00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GEOS_GEOM_POLYGON_H
00022 #define GEOS_GEOM_POLYGON_H
00023
00024 #include <geos/export.h>
00025 #include <string>
00026 #include <vector>
00027 #include <geos/platform.h>
00028 #include <geos/geom/Geometry.h>
00029 #include <geos/geom/Envelope.h>
00030 #include <geos/geom/Dimension.h>
00031
00032 #include <geos/inline.h>
00033
00034 #include <memory>
00035
00036
00037 namespace geos {
00038 namespace geom {
00039 class Coordinate;
00040 class CoordinateArraySequence;
00041 class CoordinateSequenceFilter;
00042 class LinearRing;
00043 class LineString;
00044 }
00045 }
00046
00047 namespace geos {
00048 namespace geom {
00049
00065 class GEOS_DLL Polygon: public Geometry{
00066
00067 public:
00068
00069 friend class GeometryFactory;
00070
00072 typedef std::vector<const Polygon *> ConstVect;
00073
00074 virtual ~Polygon();
00075
00082 virtual Geometry *clone() const { return new Polygon(*this); }
00083
00084 CoordinateSequence* getCoordinates() const;
00085
00086 size_t getNumPoints() const;
00087
00089 Dimension::DimensionType getDimension() const;
00090
00092 int getBoundaryDimension() const;
00093
00100 Geometry* getBoundary() const;
00101
00102 bool isEmpty() const;
00103
00110 bool isSimple() const;
00111
00113 const LineString* getExteriorRing() const;
00114
00116 size_t getNumInteriorRing() const;
00117
00119 const LineString* getInteriorRingN(size_t n) const;
00120
00121 std::string getGeometryType() const;
00122 virtual GeometryTypeId getGeometryTypeId() const;
00123 bool equalsExact(const Geometry *other, double tolerance=0) const;
00124 void apply_rw(const CoordinateFilter *filter);
00125 void apply_ro(CoordinateFilter *filter) const;
00126 void apply_rw(GeometryFilter *filter);
00127 void apply_ro(GeometryFilter *filter) const;
00128 void apply_rw(CoordinateSequenceFilter& filter);
00129 void apply_ro(CoordinateSequenceFilter& filter) const;
00130
00131 Geometry* convexHull() const;
00132
00133 void normalize();
00134
00135 int compareToSameClass(const Geometry *p) const;
00136
00137 const Coordinate* getCoordinate() const;
00138
00139 double getArea() const;
00140
00142 double getLength() const;
00143
00144 void apply_rw(GeometryComponentFilter *filter);
00145
00146 void apply_ro(GeometryComponentFilter *filter) const;
00147
00148 bool isRectangle() const;
00149
00150 protected:
00151
00152
00153 Polygon(const Polygon &p);
00154
00173 Polygon(LinearRing *newShell, std::vector<Geometry *> *newHoles,
00174 const GeometryFactory *newFactory);
00175
00176 LinearRing *shell;
00177
00178 std::vector<Geometry *> *holes;
00179
00180 Envelope::AutoPtr computeEnvelopeInternal() const;
00181
00182 private:
00183
00184 void normalize(LinearRing *ring, bool clockwise);
00185 };
00186
00187 }
00188 }
00189
00190
00191
00192
00193
00194 #endif // ndef GEOS_GEOM_POLYGON_H
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222