00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GEOS_GEOM_POLYGON_H
00023 #define GEOS_GEOM_POLYGON_H
00024
00025 #include <geos/export.h>
00026 #include <string>
00027 #include <vector>
00028 #include <geos/platform.h>
00029 #include <geos/geom/Geometry.h>
00030 #include <geos/geom/Polygonal.h>
00031 #include <geos/geom/Envelope.h>
00032 #include <geos/geom/Dimension.h>
00033
00034 #include <geos/inline.h>
00035
00036 #include <memory>
00037
00038
00039 namespace geos {
00040 namespace geom {
00041 class Coordinate;
00042 class CoordinateArraySequence;
00043 class CoordinateSequenceFilter;
00044 class LinearRing;
00045 class LineString;
00046 }
00047 }
00048
00049 namespace geos {
00050 namespace geom {
00051
00067 class GEOS_DLL Polygon: public virtual Geometry, public Polygonal
00068 {
00069
00070 public:
00071
00072 friend class GeometryFactory;
00073
00075 typedef std::vector<const Polygon *> ConstVect;
00076
00077 virtual ~Polygon();
00078
00085 virtual Geometry *clone() const { return new Polygon(*this); }
00086
00087 CoordinateSequence* getCoordinates() const;
00088
00089 size_t getNumPoints() const;
00090
00092 Dimension::DimensionType getDimension() const;
00093
00095 virtual int getCoordinateDimension() const;
00096
00098 int getBoundaryDimension() const;
00099
00106 Geometry* getBoundary() const;
00107
00108 bool isEmpty() const;
00109
00116 bool isSimple() const;
00117
00119 const LineString* getExteriorRing() const;
00120
00122 size_t getNumInteriorRing() const;
00123
00125 const LineString* getInteriorRingN(std::size_t n) const;
00126
00127 std::string getGeometryType() const;
00128 virtual GeometryTypeId getGeometryTypeId() const;
00129 bool equalsExact(const Geometry *other, double tolerance=0) const;
00130 void apply_rw(const CoordinateFilter *filter);
00131 void apply_ro(CoordinateFilter *filter) const;
00132 void apply_rw(GeometryFilter *filter);
00133 void apply_ro(GeometryFilter *filter) const;
00134 void apply_rw(CoordinateSequenceFilter& filter);
00135 void apply_ro(CoordinateSequenceFilter& filter) const;
00136
00137 Geometry* convexHull() const;
00138
00139 void normalize();
00140
00141 int compareToSameClass(const Geometry *p) const;
00142
00143 const Coordinate* getCoordinate() const;
00144
00145 double getArea() const;
00146
00148 double getLength() const;
00149
00150 void apply_rw(GeometryComponentFilter *filter);
00151
00152 void apply_ro(GeometryComponentFilter *filter) const;
00153
00154 bool isRectangle() const;
00155
00156 protected:
00157
00158
00159 Polygon(const Polygon &p);
00160
00179 Polygon(LinearRing *newShell, std::vector<Geometry *> *newHoles,
00180 const GeometryFactory *newFactory);
00181
00182 LinearRing *shell;
00183
00184 std::vector<Geometry *> *holes;
00185
00186 Envelope::AutoPtr computeEnvelopeInternal() const;
00187
00188 private:
00189
00190 void normalize(LinearRing *ring, bool clockwise);
00191 };
00192
00193 }
00194 }
00195
00196 #endif // ndef GEOS_GEOM_POLYGON_H
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
00223
00224