Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

omgmodel.h

Go to the documentation of this file.
00001  /*   Copyright (C) 2005 by Tim Sutton   *
00002  *   tim@linfiniti.com   *
00003  *                                                                         *
00004  *   This program is free software; you can redistribute it and/or modify  *
00005  *   it under the terms of the GNU General Public License as published by  *
00006  *   the Free Software Foundation; either version 2 of the License, or     *
00007  *   (at your option) any later version.                                   *
00008  *                                                                         *
00009  *   This program is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00012  *   GNU General Public License for more details.                          *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU General Public License     *
00015  *   along with this program; if not, write to the                         *
00016  *   Free Software Foundation, Inc.,                                       *
00017  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00018  ***************************************************************************/
00019 #ifndef OMGMODEL_H
00020 #define OMGMODEL_H
00021 
00022 #include <QString>
00023 #include <QStringList>
00024 #include <QDateTime>
00025 #include <QFile>
00026 #include <QVector>
00027 #include <QList>
00028 #include <QPair>
00029 #include "omgalgorithm.h"
00030 #include "omglocality.h"
00031 #include "omgserialisable.h"
00032 #include "omglayerset.h"
00033 #include "omglayer.h"
00034 #include "omgguid.h"
00035 #include "omgdataseries.h"
00036 
00041 class OMG_LIB_EXPORT OmgModel : public QObject, public OmgSerialisable, public OmgGuid
00042 {
00043 
00044   Q_OBJECT; //needed for QPointer guarded pointer support
00045 public:
00046 
00047   OmgModel();
00048   ~OmgModel();
00050   enum LocalitiesFilterType {NO_FILTER,SPATIALLY_UNIQUE,ENVIRONMENTALLY_UNIQUE};
00051   bool isValid() const;
00066   QString toString() const;
00072   QString toHtml(bool theForceFlag=false) const;
00082   QString toPrintHtml(bool theForceFlag=false) const ;
00083   void createRocGraph(bool theForceFlag=false) const;
00084   QString projectionLayersXml() ;
00086   void reset();
00092   bool  parseModelResult(QString theModelXml);
00093 
00094   //mutators
00095   void setCoordinateSystem(QString theCoordinateSystem);
00096   void setCoordinateSystemName (QString theName);
00097   void setOccurrencesFile(QString theSpeciesFile);
00103   void setSpeciesFile(QString theFileName );
00104   void setShapefileName(QString theFileName);
00105   void setCsvFileName(QString theFileName);
00106   void setTaxonName(QString theName);
00107   void setLocalities(OmgLocalities theLocalities);
00108   void setOutputFormatLayerName(QString theName);
00109  
00112   void setModelRasterFormat(QString theFormat);
00116   void setCreationLayerSet(OmgLayerSet theLayerSet);
00120   void setProjectionLayerSet(OmgLayerSet theLayerSet);
00121   
00122   //
00123   // The following four mutators will be deprecated in favour of the above
00124   //
00125   
00126   void setCreationLayerNames(QStringList theNames);
00127   void setcreationMaskLayerName(QString theName);
00128   void setProjectionLayerNames(QStringList theNames);
00129   void setProjectionMaskLayerName(QString theName);
00130   
00131   void setAlgorithm(OmgAlgorithm theAlgorithm);
00132   void setCompleted(bool theFlag);
00133   void setError(bool theFlag);
00134   void setStartDateTimeStamp(QDateTime theDateTimeStamp);
00135   void setEndDateTimeStamp(QDateTime theDateTimeStamp);
00136   void setThumbnailFileName(QString theFileName);
00137   void setPreviewFileName(QString theFileName);
00138   void setLegendFileName(QString theFileName);
00139   void setRawImageFileName(QString theFileName);
00140   void setColouredImageFileName(QString theFileName);
00141   void setWorkDir(QString theDir);
00146   void setModelDefinition(QString theDefinition);
00149   void setNormalizationDefinition(QString theDefinition);
00151   void setRocScore(double theRocScore);
00153   void setAccuracy(double theAccuracy);
00155   void setOmission(double theOmission);
00157   void setCommission(double theCommission);
00159   void setPercentCellsPresent(double thePercent );
00161   void setTotalCells(double theTotal);
00166   void setLocalitiesFilterType(LocalitiesFilterType theFilterType=NO_FILTER);
00167   
00168   //accessors
00169  
00171   QString coordinateSystem() const;
00172   QString coordinateSystemName() const;
00173   QString speciesFile() const;
00174   QString shapefileName() const;
00175   QString csvFileName() const;
00176   QString taxonName() const;
00177   OmgLayerSet creationLayerSet() const;
00178   OmgLayerSet projectionLayerSet() const;
00179   QString creationMaskLayerName() const;
00180   QString projectionMaskLayerName() const;
00181   QString outputFormatLayerName() const;
00182   QStringList creationLayerNames() const;
00183   QStringList projectionLayerNames() const;
00184   OmgAlgorithm algorithm() const;
00185   bool isCompleted() const;
00186   bool hasError() const;
00187   QDateTime startDateTimeStamp() const;
00188   QDateTime endDateTimeStamp() const;
00189   QString thumbnailFileName() const;
00190   QString previewFileName() const;
00191   QString legendFileName() const;
00192   QString rawImageFileName() const;
00193   QString colouredImageFileName() const;
00196   QString modelRasterFormat() const;
00197 
00200   QString workDir() const;
00202   double rocScore() const;
00204   double accuracy() const;
00206   double omission() const;
00211   double commission() const;
00213   double percentCellsPresent() const;
00215   double totalCells() const;
00216   QString modelDefinition() const;
00217   QString normalizationDefinition() const;
00222   LocalitiesFilterType localitiesFilterType() const;
00223   OmgLocalities localities() const;
00224   QString modelLog() const;
00225   //
00226   // General helper functions
00227   //
00231   unsigned int loadLocalities();
00232 
00235   void createThumbnail();
00236   //
00237   // implement the serialisable interface:
00238   //
00239 
00245   QString toXml() const;
00250   bool fromXml(const QString theXml);
00251 
00260   QString toModelCreationXml() const;
00261   
00270   QString toModelProjectionXml() const;
00271 
00276   QString localitiesToCsv(QString theDelimiter="\t") const;
00277 
00282   bool toShapefile(QString theShapefileName) const;
00283 
00288   void addRocPoint( QPair <double,double> thePair );
00290   void clearRocPoints();
00292   OmgDataSeries getRocPoints() const;
00299   bool postProcess();
00300 
00301  public slots:
00303   void appendToLog(QString theMessage);
00306   void setLog(QString theLog);
00307 private:
00308 
00310   QString mCoordinateSystem;
00311   QString mCoordinateSystemName;
00312   QString mSpeciesFile;
00313   QString mTaxonName;
00314   OmgLayer mOutputFormatLayer;
00315   OmgLayerSet mProjectionLayerSet;
00316   OmgLayerSet mCreationLayerSet;
00317   OmgAlgorithm mAlgorithm;
00318   bool mCompletedFlag;
00319   bool mErrorFlag;
00320   //this type is defined at the bottom of omglocality.h
00321   OmgLocalities mLocalities;
00322   QDateTime mStartDateTimeStamp;
00323   QDateTime mEndDateTimeStamp;
00324   QString mThumbnailFileName;
00325   QString mPreviewFileName;
00326   QString mLegendFileName;
00327   QString mRawImageFileName;
00328   QString mShapefileName;
00329   QString mCsvFileName;
00330   QString mColouredImageFileName;
00331   QString mWorkDir;
00332   QString mModelDefinition;
00333   QString mNormalizationDefinition;
00334   double mRocScore;
00335   double mAccuracy;
00336   double mOmission;
00339   double mCommission;
00340   double mPercentCellsPresent;
00341   double mTotalCells;
00342   QString mModelLog;
00343   QList < QPair <double,double> > mRocPoints;
00344   QString mModelRasterFormat;
00345   LocalitiesFilterType  mLocalitiesFilterType;
00346 };
00347 
00348 #endif //OMGMODEL_H

Generated on Mon Apr 28 15:08:54 2008 for openModellerDesktop by  doxygen 1.4.1-20050210