00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_GEOM_COORDINATE_H
00017 #define GEOS_GEOM_COORDINATE_H
00018
00019 #include <geos/platform.h>
00020 #include <geos/inline.h>
00021
00022 #include <set>
00023 #include <stack>
00024 #include <vector>
00025 #include <string>
00026
00027 namespace geos {
00028 namespace geom {
00029
00030 struct CoordinateLessThen;
00031
00052
00053
00054
00055 class Coordinate {
00056
00057 private:
00058
00059 static Coordinate nullCoord;
00060
00061 public:
00063 typedef std::set<const Coordinate *, CoordinateLessThen> ConstSet;
00064
00066 typedef std::vector<const Coordinate *> ConstVect;
00067
00069 typedef std::stack<const Coordinate *> ConstStack;
00070
00072 typedef std::vector<Coordinate> Vect;
00073
00075 double x;
00076
00078 double y;
00079
00081 double z;
00082
00083 void setNull();
00084
00085 static Coordinate& getNull();
00086
00087 ~Coordinate();
00088
00089 Coordinate(double xNew=0.0, double yNew=0.0, double zNew=DoubleNotANumber);
00090
00091
00092 #if 0
00093 Coordinate(const Coordinate& c);
00094
00095 Coordinate &operator=(const Coordinate &c);
00096 #endif
00097
00098 bool equals2D(const Coordinate& other) const;
00099
00101 bool equals(const Coordinate& other) const;
00102
00104 int compareTo(const Coordinate& other) const;
00105
00107 bool equals3D(const Coordinate& other) const;
00108
00110 std::string toString() const;
00111
00114
00115
00116 double distance(const Coordinate& p) const;
00117
00118 int hashCode() const;
00119
00124 static int hashCode(double d);
00125
00126 };
00127
00129 struct CoordinateLessThen {
00130
00131 bool operator()(const Coordinate* a, const Coordinate* b) const;
00132 bool operator()(const Coordinate& a, const Coordinate& b) const;
00133
00134 };
00135
00137 std::ostream& operator<< (std::ostream& os, const Coordinate& c);
00138
00140 bool operator==(const Coordinate& a, const Coordinate& b);
00141
00143 bool operator!=(const Coordinate& a, const Coordinate& b);
00144
00145
00146
00147 }
00148 }
00149
00150 #ifdef GEOS_INLINE
00151 # include "geos/geom/Coordinate.inl"
00152 #endif
00153
00154 #endif // ndef GEOS_GEOM_COORDINATE_H
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176