Region.h

00001 
00006 #ifndef _Region_h
00007 #define _Region_h
00008 
00009 // SYSTEM INCLUDES
00010 //
00011 
00012 // PROJECT INCLUDES
00013 //
00014 
00015 // LOCAL INCLUDES
00016 //
00017 
00018 // FORWARD REFERENCES
00019 //
00020 
00021 
00022 class Region
00023 {
00024 public:
00025 // LIFECYCLE
00026 
00029     Region(void);
00030 
00033     Region(double x1, double y1, double x2, double y2);
00034 
00039     Region(const Region& from);
00040 
00041 
00044     ~Region(void);
00045 
00046 
00047 // OPERATORS
00048 
00055     Region&        operator=(const Region& from);
00056 
00064     Region&         operator+=(const Region& from);
00065 
00071     Region          operator+(const Region& from) const;
00072 
00073 // OPERATIONS
00074 
00077     void            Extend(double x, double y);
00078 
00079 // ACCESS
00080 
00082     inline double   X1() const;
00083 
00085     inline double   Y1() const;
00086 
00088     inline double   X2() const;
00089 
00091     inline double   Y2() const;
00092 
00093 // INQUIRY
00094 
00097     inline bool     IsValid() const;
00098 
00101     inline bool     IsSmaller(const Region& other_region) const;
00102 
00108     inline bool     IsInside(const Region& other_region) const;
00109 
00110 protected:
00111 private:
00112     double  mX1;
00113     double  mX2;
00114     double  mY1;
00115     double  mY2;
00116 
00117     bool    mValid;
00118 };
00119 
00120 // INLINE METHODS
00121 //
00122 inline double
00123 Region::X1() const
00124 {
00125     return mX1;
00126 }// X1
00127 
00128 inline double
00129 Region::X2() const
00130 {
00131     return mX2;
00132 }// X2
00133 
00134 inline double
00135 Region::Y1() const
00136 {
00137     return mY1;
00138 }// Y1
00139 
00140 inline double
00141 Region::Y2() const
00142 {
00143     return mY2;
00144 }// Y2
00145 
00146 inline bool
00147 Region::IsValid() const
00148 {
00149     return mValid;
00150 }// IsValid
00151 
00152 inline bool
00153 Region::IsSmaller(const Region& other_region) const
00154 {
00155     return (mX2 - mX1 < other_region.mX2 - other_region.mX1)
00156           && (mY2 - mY1 < other_region.mY2 - other_region.mY1);
00157 }// IsSmaller
00158 
00159 inline bool
00160 Region::IsInside(const Region& other_region) const
00161 {
00162     return (mX1 >= other_region.mX1) && (mX2 <= other_region.mX2)
00163         && (mY1 >= other_region.mY1) && (mY2 <= other_region.mY2);
00164 }// IsInside
00165 
00166 
00167 // EXTERNAL REFERENCES
00168 //
00169 
00170 #endif  // _Region_h

Wygenerowano Fri Sep 29 21:04:48 2006 dla EduOptim2 programem  doxygen 1.4.6