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/export.h>
00020 #include <geos/platform.h>
00021 #include <geos/inline.h>
00022 #include <set>
00023 #include <stack>
00024 #include <vector>
00025 #include <string>
00026 #include <limits>
00027
00028 namespace geos {
00029 namespace geom {
00030
00031 struct CoordinateLessThen;
00032
00053
00054
00055
00056 class GEOS_DLL Coordinate {
00057
00058 private:
00059
00060 static Coordinate nullCoord;
00061
00062 public:
00064 typedef std::set<const Coordinate *, CoordinateLessThen> ConstSet;
00065
00067 typedef std::vector<const Coordinate *> ConstVect;
00068
00070 typedef std::stack<const Coordinate *> ConstStack;
00071
00073 typedef std::vector<Coordinate> Vect;
00074
00076 double x;
00077
00079 double y;
00080
00082 double z;
00083
00084 void setNull();
00085
00086 static Coordinate& getNull();
00087
00088 bool isNull() const;
00089
00090 ~Coordinate();
00091
00092 Coordinate(double xNew=0.0, double yNew=0.0, double zNew=DoubleNotANumber);
00093
00094
00095 #if 0
00096 Coordinate(const Coordinate& c);
00097
00098 Coordinate &operator=(const Coordinate &c);
00099 #endif
00100
00101 bool equals2D(const Coordinate& other) const;
00102
00104 bool equals(const Coordinate& other) const;
00105
00107 int compareTo(const Coordinate& other) const;
00108
00110 bool equals3D(const Coordinate& other) const;
00111
00113 std::string toString() const;
00114
00117
00118
00119 double distance(const Coordinate& p) const;
00120
00121 int hashCode() const;
00122
00127 static int hashCode(double d);
00128
00129 };
00130
00132 struct GEOS_DLL CoordinateLessThen {
00133
00134 bool operator()(const Coordinate* a, const Coordinate* b) const;
00135 bool operator()(const Coordinate& a, const Coordinate& b) const;
00136
00137 };
00138
00140 GEOS_DLL std::ostream& operator<< (std::ostream& os, const Coordinate& c);
00141
00143 GEOS_DLL bool operator==(const Coordinate& a, const Coordinate& b);
00144
00146 GEOS_DLL bool operator!=(const Coordinate& a, const Coordinate& b);
00147
00148
00149
00150 }
00151 }
00152
00153 #ifdef GEOS_INLINE
00154 # include "geos/geom/Coordinate.inl"
00155 #endif
00156
00157 #endif // ndef GEOS_GEOM_COORDINATE_H
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179