00001 #ifndef __CPoint__ 00002 #define __CPoint__ 00003 00004 #include "../Basics/CCountedObject.hpp" 00005 using Exponent::Basics::CCountedObject; 00006 00007 // =========================================================================== 00008 00009 namespace Exponent 00010 { 00011 namespace MathTools 00012 { 00032 class CPoint : public CCountedObject 00033 { 00035 EXPONENT_CLASS_DECLARATION; 00038 // =========================================================================== 00039 00040 public: 00041 00042 // =========================================================================== 00043 00049 CPoint(const long x = 0, const long y = 0); 00050 00055 CPoint(const CPoint &point); 00056 00060 virtual ~CPoint(); 00061 00062 // =========================================================================== 00063 00069 CPoint &operator = (const CPoint &point); 00070 00076 bool operator == (const CPoint &point); 00077 00083 bool operator == (const CPoint &point) const; 00084 00089 CPoint &operator += (const CPoint &point); 00090 00095 CPoint &operator -= (const CPoint &point); 00096 00097 // =========================================================================== 00098 00104 void setPoint(const long x, const long y) 00105 { 00106 this->setXPosition(x); 00107 this->setYPosition(y); 00108 } 00109 00114 void setXPosition(const long x) { m_x = x; } 00115 00120 void setYPosition(const long y) { m_y = y; } 00121 00122 // =========================================================================== 00123 00128 long getXPosition() const { return m_x; } 00129 00134 long getYPosition() const { return m_y; } 00135 00136 // =========================================================================== 00137 00142 void offset(const CPoint &point); 00143 00149 void offset(const long x, const long y); 00150 00151 // =========================================================================== 00152 00159 static bool isStraightLine(const CPoint &point1, const CPoint &point2); 00160 00161 // =========================================================================== 00162 00168 virtual void getObjectDescription(char *string, const long size) const; 00169 00170 // =========================================================================== 00171 00172 protected: 00173 00174 // =========================================================================== 00175 00176 long m_x; 00177 long m_y; 00178 }; 00179 } 00180 } 00181 #endif // End of CRect.hpp