00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 #ifndef GEOS_UTIL_H
00112 #define GEOS_UTIL_H
00113
00114 #include <memory>
00115 #include <string>
00116 #include <geos/platform.h>
00117 #include <geos/geom.h>
00118
00119 using namespace std;
00120
00121 namespace geos {
00122
00131 class GEOSException {
00132 public:
00133 GEOSException();
00134
00135 GEOSException(string msg);
00136
00138 GEOSException(string nname,string msg);
00139
00140 virtual ~GEOSException();
00141
00143 virtual string toString();
00144
00145 virtual void setName(string nname);
00146 virtual void setMessage(string msg);
00147 protected:
00148 string txt;
00149 string name;
00150 };
00151
00155 class AssertionFailedException: public GEOSException {
00156 public:
00157 AssertionFailedException();
00158 AssertionFailedException(string msg);
00159 ~AssertionFailedException();
00160 };
00161
00169 class IllegalArgumentException: public GEOSException {
00170 public:
00171 IllegalArgumentException();
00172 IllegalArgumentException(string msg);
00173 ~IllegalArgumentException();
00174 };
00175
00183 class TopologyException: public GEOSException {
00184 public:
00185 TopologyException(string msg);
00186 TopologyException(string msg,const Coordinate *newPt);
00187 ~TopologyException();
00188 Coordinate* getCoordinate();
00189 private:
00190 Coordinate *pt;
00191 };
00192
00201 class UnsupportedOperationException: public GEOSException {
00202 public:
00203 UnsupportedOperationException();
00204 UnsupportedOperationException(string msg);
00205 ~UnsupportedOperationException();
00206 };
00207
00208 class Coordinate;
00209 class Assert {
00210 public:
00211 static void isTrue(bool assertion);
00212 static void isTrue(bool assertion, string message);
00213
00214 static void equals(const Coordinate& expectedValue, const Coordinate& actualValue);
00215 static void equals(const Coordinate& expectedValue, const Coordinate& actualValue, string message);
00216
00217 static void shouldNeverReachHere();
00218 static void shouldNeverReachHere(string message);
00219 };
00220
00221 class CoordinateArrayFilter:public CoordinateFilter {
00222 public:
00223 CoordinateSequence* pts;
00224 int n;
00225 CoordinateArrayFilter(int size);
00226 virtual ~CoordinateArrayFilter();
00227 virtual const CoordinateSequence* getCoordinates() const;
00228 virtual void filter_ro(const Coordinate &coord);
00229 virtual void filter_rw(Coordinate &coord);
00230 };
00231
00232 class UniqueCoordinateArrayFilter:public CoordinateFilter {
00233 public:
00234 CoordinateSequence *list;
00235 UniqueCoordinateArrayFilter();
00236 virtual ~UniqueCoordinateArrayFilter();
00237 virtual const CoordinateSequence* getCoordinates() const;
00238 virtual void filter_ro(const Coordinate *coord);
00239 virtual void filter_rw(Coordinate *coord);
00240 };
00241
00242
00252 class GeometricShapeFactory {
00253 private:
00254 class Dimensions {
00255 public:
00256 Dimensions();
00257 Coordinate base;
00258 Coordinate centre;
00259 double width;
00260 double height;
00261 void setBase(const Coordinate& newBase);
00262 void setCentre(const Coordinate& newCentre);
00263 void setSize(double size);
00264 void setWidth(double nWidth);
00265 void setHeight(double nHeight);
00266 Envelope* getEnvelope();
00267 };
00268 const GeometryFactory* geomFact;
00269 Dimensions dim;
00270 int nPts;
00271 public:
00282 GeometricShapeFactory(const GeometryFactory *factory);
00283
00284 ~GeometricShapeFactory();
00285
00291 LineString* createArc(double startAng,double endAng);
00292
00298 Polygon* createCircle();
00299
00305 Polygon* createRectangle();
00306
00315 void setBase(const Coordinate& base);
00316
00324 void setCentre(const Coordinate& centre);
00325
00331 void setHeight(double height);
00332
00336 void setNumPoints(int nNPts);
00337
00344 void setSize(double size);
00345
00351 void setWidth(double width);
00352
00353 };
00354
00355 }
00356 #endif