openModeller  Version 1.4.0
Raster.hh
Go to the documentation of this file.
00001 
00030 #ifndef _RASTERHH_
00031 #define _RASTERHH_
00032 
00033 #include <openmodeller/om_defs.hh>
00034 #include <openmodeller/env_io/Header.hh>
00035 
00036 #include <string>
00037 
00038 class MapFormat;
00039 class Map;
00040 
00041 /****************************************************************/
00042 /**************************** Raster ****************************/
00044 class dllexp Raster
00045 {
00046 public:
00047 
00048     virtual ~Raster();
00049     
00054     virtual void createRaster( const std::string& source, int categ = 0 ) = 0;
00055 
00056  #ifdef MPI_FOUND
00057 
00063     virtual void createRaster( const std::string& output_file_source, const std::string& file, const MapFormat& format ) = 0;
00064  #else
00065 
00069     virtual void createRaster( const std::string& source, const MapFormat& format )= 0;
00070 #endif
00071 
00072     //virtual static Raster* CreateRasterCallback() { return 0; };
00073 
00075     Header& header() { return f_hdr; }
00076 
00078     int isCategorical() const { return f_hdr.categ; }
00079 
00081     Coord xMin() const { return f_hdr.xmin; }
00082 
00084     Coord yMin() const { return f_hdr.ymin; }
00085 
00087     Coord xMax() const { return f_hdr.xmax; }
00088 
00090     Coord yMax() const { return f_hdr.ymax; }
00091 
00093     int dimX() const { return f_hdr.xdim; }
00094 
00096     int dimY() const { return f_hdr.ydim; }
00097 
00099     Coord celX() const { return f_hdr.xcel; }
00100 
00102     Coord celY() const { return f_hdr.ycel; }
00103 
00105     Scalar noVal() const { return f_hdr.noval; }
00106 
00108     int numBand() const { return f_hdr.nband; }
00109 
00116     virtual int get( Coord px, Coord py, Scalar *val ) = 0;
00117 
00125     virtual int put( Coord px, Coord py, Scalar val ) = 0;
00126 
00133     virtual int put( Coord px, Coord py ) = 0;
00134 
00140     virtual int getMinMax( Scalar *min, Scalar *max ) = 0;
00141 
00143     bool hasMinMax() { return f_hdr.minmax > 0 ? true : false ; }
00144 
00149     void setMinMax( Scalar min, Scalar max );
00150 
00154     virtual void finish() {};
00155 
00159     virtual int deleteRaster()= 0;
00160 
00165     virtual bool hasCustomGeotransform() { return false; }
00166 
00180     virtual int getExtentInStandardCs( Coord *xmin, Coord *ymin, Coord *xmax, Coord *ymax ) { return 0; }
00181 
00182 protected:
00183 
00184     Scalar f_scalefactor;  // used in projection put.
00185 
00186     std::string f_file;
00187     #ifdef MPI_FOUND
00188     std::string f_output_file;
00189     #endif
00190 
00191     // Raster header
00192     Header f_hdr;
00193 
00194     Raster() {}; // Abstract class.
00195 
00196     // Disable copying.
00197     //Raster( const Raster& );
00198     //Raster& operator=( const Raster& );
00199 };
00200 
00201 #endif
00202