- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

# Polygon.h

    00001 /**********************************************************************
    00002  * $Id: Polygon.h 2556 2009-06-06 22:22:28Z strk $
    00003  *
    00004  * GEOS - Geometry Engine Open Source
    00005  * http://geos.refractions.net
    00006  *
    00007  * Copyright (C) 2005 2006 Refractions Research Inc.
    00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
    00009  *
    00010  * This is free software; you can redistribute and/or modify it under
    00011  * the terms of the GNU Lesser General Public Licence as published
    00012  * by the Free Software Foundation.
    00013  * See the COPYING file for more information.
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: geom/Polygon.java rev. 1.50
    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> // for proper use of auto_ptr<>
    00030 #include <geos/geom/Dimension.h> // for Dimension::DimensionType
    00031
    00032 #include <geos/inline.h>
    00033
    00034 #include <memory> // for auto_ptr
    00035
    00036 // Forward declarations
    00037 namespace geos {
    00038         namespace geom { // geos::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 { // geos::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; //was protected
    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; //Actually vector<LinearRing *>
    00179
    00180         Envelope::AutoPtr computeEnvelopeInternal() const;
    00181
    00182 private:
    00183
    00184         void normalize(LinearRing *ring, bool clockwise);
    00185 };
    00186
    00187 } // namespace geos::geom
    00188 } // namespace geos
    00189
    00190 //#ifdef GEOS_INLINE
    00191 //# include "geos/geom/Polygon.inl"
    00192 //#endif
    00193
    00194 #endif // ndef GEOS_GEOM_POLYGON_H
    00195
    00196 /**********************************************************************
    00197  * $Log$
    00198  * Revision 1.7  2006/06/08 17:58:57  strk
    00199  * Polygon::getNumInteriorRing() return size_t, Polygon::interiorRingN() takes size_t.
    00200  *
    00201  * Revision 1.6  2006/05/04 15:49:39  strk
    00202  * updated all Geometry::getDimension() methods to return Dimension::DimensionType (closes bug#93)
    00203  *
    00204  * Revision 1.5  2006/04/28 10:55:39  strk
    00205  * Geometry constructors made protected, to ensure all constructions use GeometryFactory,
    00206  * which has been made friend of all Geometry derivates. getNumPoints() changed to return
    00207  * size_t.
    00208  *
    00209  * Revision 1.4  2006/04/10 18:15:09  strk
    00210  * Changed Geometry::envelope member to be of type auto_ptr<Envelope>.
    00211  * Changed computeEnvelopeInternal() signater to return auto_ptr<Envelope>
    00212  *
    00213  * Revision 1.3  2006/03/24 09:52:41  strk
    00214  * USE_INLINE => GEOS_INLINE
    00215  *
    00216  * Revision 1.2  2006/03/15 09:12:45  strk
    00217  * isSimple doc
    00218  *
    00219  * Revision 1.1  2006/03/09 16:46:49  strk
    00220  * geos::geom namespace definition, first pass at headers split
    00221  *
    00222  **********************************************************************/