openModeller  Version 1.4.0
MapIterator.hh
Go to the documentation of this file.
00001 
00029 #ifndef MAP_ITER_HH
00030 #define MAP_ITER_HH
00031 
00032 #include <openmodeller/om_defs.hh>
00033 
00034 // For pair
00035 #include <utility>
00036 
00037 #include <openmodeller/env_io/Header.hh>
00038 class GeoTransform;
00039 
00040 class dllexp MapIterator {
00041 
00042   friend dllexp bool operator == ( const MapIterator&, const MapIterator& );
00043   friend dllexp bool operator != ( const MapIterator&, const MapIterator& );
00044 
00045 public:
00046   // Default constructor create a Terminal object which can be used in
00047   // while (miter != MapIterator() {} loops.
00048   MapIterator();
00049 
00050   MapIterator( const Header& h, GeoTransform* gt );
00051 
00052   // Compiler generated copy constructor, assignment operator and destructor
00053   // are ok.
00054   
00055   // returns the current position in geo coordinates.
00056   // first is x, second is y.
00057   std::pair<Coord,Coord> operator*() const;
00058 
00059   // prefix operator++
00060   MapIterator& operator++();
00061 
00062   // prefix operator--
00063   MapIterator& operator--();
00064 
00065   // postfix operator++
00066   MapIterator operator++( int );
00067 
00068   // postfix operator--
00069   MapIterator operator--( int );
00070 
00071   #ifdef MPI_FOUND
00072   //method added for the parallel version
00073   void nextblock(int init);
00074   #endif
00075 
00076 private:
00077   bool isPastBounds() const;
00078   // If isTerminal is true, then this MapIterator object
00079   // represents the terminal condition.
00080   bool isTerminal;
00081 
00082   GeoTransform *gt;
00083   Header h;
00084   int xcur;
00085   int ycur;
00086 };
00087 
00088 #endif