00001 #ifndef POINT_H 00002 #define POINT_H 00003 #include "value.h" 00004 00011 class PointValue: public Value 00012 { 00013 public: 00014 double x; 00015 double y; 00016 virtual QString toString(); 00017 00021 PointValue() 00022 { 00023 x = 0; 00024 y = 0; 00025 }; 00026 00031 PointValue(Token data) 00032 { 00033 x = (Float8)data["x"]; 00034 y = (Float8)data["y"]; 00035 } 00036 00040 PointValue(double a, double b) 00041 { 00042 x = a; 00043 y = b; 00044 } 00045 00050 virtual Data getSaveDescription(QString) 00051 { 00052 Token r; 00053 r["type"]=Symbol("point"); 00054 r["x"]=Float8(x); 00055 r["y"]=Float8(y); 00056 return r; 00057 }; 00058 00064 PointValue operator *(const PointValue& other) const; 00065 00066 PointValue & operator /=(const PointValue& other) 00067 { 00068 x/=other.x; 00069 y/=other.y; 00070 return *this; 00071 } 00072 00073 PointValue & operator *=(const PointValue& other) 00074 { 00075 x*=other.x; 00076 y*=other.y; 00077 return *this; 00078 } 00079 protected: 00080 virtual bool equals_same_type(Value * other); 00081 }; 00082 00083 PointValue max(const PointValue &a, const PointValue &b); 00084 PointValue min(const PointValue &a, const PointValue &b); 00085 00086 #endif 00087