openModeller  Version 1.4.0
Map.hh
Go to the documentation of this file.
00001 
00028 #ifndef _MAPHH_
00029 #define _MAPHH_
00030 
00031 #include <openmodeller/om_defs.hh>
00032 #include <openmodeller/env_io/Raster.hh>
00033 #include <openmodeller/env_io/MapIterator.hh>
00034 
00035 #include <string>
00036 
00037 class GeoTransform;
00038 
00039 /****************************************************************/
00040 /****************************** Map *****************************/
00041 
00048 /*******/
00049 class Map
00050 {
00051 public:
00052 
00060   Map( Raster *rst );
00061   ~Map();
00062 
00063   MapIterator begin() const
00064   {
00065     return MapIterator( _rst->header(), _gt );
00066   }
00067 
00068   const Header& getHeader() const { return _rst->header(); }
00069 
00070   int isCategorical() const { return _rst->isCategorical(); }
00071 
00073   void setMinMax( Scalar min, Scalar max )
00074   {
00075     _rst->setMinMax( min, max );
00076   }
00077 
00078   bool hasMinMax() const
00079   {
00080     return _rst->hasMinMax();
00081   }
00082 
00084   int getMinMax( Scalar *min, Scalar *max ) const
00085   {
00086     return _rst->getMinMax( min, max );
00087   }
00088 
00090   int numBand() const  { return _rst->numBand(); }
00091 
00093   int getExtent( Coord *xmin, Coord *ymin, Coord *xmax, Coord *ymax) const;
00094 
00096   int getDim( int *xdim, int *ydim ) const
00097   {
00098     *xdim = _rst->dimX(); *ydim = _rst->dimY(); return 1;
00099   } 
00100 
00102   int getCell( Coord *xcel, Coord *ycel ) const
00103   {
00104     *xcel = _rst->celX(); *ycel = _rst->celY(); return 1;
00105   } 
00106 
00111   int get( Coord x, Coord y, Scalar *val ) const;
00112 
00118   int put( Coord x, Coord y, Scalar val );
00119 
00125   int put( Coord x, Coord y );
00126 
00127   GeoTransform *getGT() const { return _gt; }
00128 
00133   int getRowColumn( Coord x, Coord y, int *row, int *col );
00134 
00138   void finish();
00139 
00144   int deleteRaster();
00145 
00146 private:
00147 
00148   Raster      *_rst;
00149   GeoTransform  *_gt;
00150 
00151   // Disable copying.
00152   Map( const Map& );
00153   Map& operator=( const Map& );
00154 
00155 };
00156 
00157 
00158 #endif
00159