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

- Class List
- Class Hierarchy
- Class Members

# geos::geom::Polygon Class Reference

Represents a linear polygon, which may include holes. More...

`#include <geos.h>`

Inheritance diagram for geos::geom::Polygon:

List of all members.

## Public Types
typedef std::vector< const Polygon * > | ConstVect
| A vector of const Polygon pointers.
## Public Member Functions
virtual Geometry * | clone () const
| Make a deep-copy of this Geometry.
CoordinateSequence * | getCoordinates () const
| Returns this Geometry vertices. Caller takes ownership of the returned object.
size_t | getNumPoints () const
| Returns the count of this Geometrys vertices.
Dimension::DimensionType | getDimension () const
| Returns surface dimension (2).
int | getBoundaryDimension () const
| Returns 1 (Polygon boundary is a MultiLineString).
Geometry * | getBoundary () const
| Returns a MultiLineString. One LineString for the shell and one for each hole. Empty for an empty Polygon.
bool | isEmpty () const
| Returns whether or not the set of points in this Geometry is empty.
bool | isSimple () const
| Tests if a valid polygon is simple. This method always returns true, since a valid polygon is always simple.
const LineString * | getExteriorRing () const
| Returns the exterior ring (shell).
size_t | getNumInteriorRing () const
| Returns number of interior rings (hole).
const LineString * | getInteriorRingN (size_t n) const
| Get nth interior ring (hole).
std::string | getGeometryType () const
| Return a string representation of this Geometry type.
virtual GeometryTypeId | getGeometryTypeId () const
| Return an integer representation of this Geometry type.
bool | equalsExact (const Geometry *other, double tolerance=0) const
| Returns true if the two Geometrys are exactly equal, up to a specified tolerance.
void | apply_rw (const CoordinateFilter *filter)
void | apply_ro (CoordinateFilter *filter) const
void | apply_rw (GeometryFilter *filter)
void | apply_ro (GeometryFilter *filter) const
Geometry * | convexHull () const
| Returns the smallest convex Polygon that contains all the points in the Geometry.
void | normalize ()
| Converts this Geometry to normal form (or canonical form).
int | compareToSameClass (const Geometry *p) const
const Coordinate * | getCoordinate () const
| Returns a vertex of this Geometry, or NULL if this is the empty geometry.
double | getArea () const
| Returns the area of this Geometry.
double | getLength () const
| Returns the perimeter of this `Polygon`.
void | apply_rw (GeometryComponentFilter *filter)
void | apply_ro (GeometryComponentFilter *filter) const
bool | isRectangle () const
## Protected Member Functions
| Polygon (const Polygon &p)
| Polygon (LinearRing *newShell, std::vector< Geometry * > *newHoles, const GeometryFactory *newFactory)
Envelope::AutoPtr | computeEnvelopeInternal () const
## Protected Attributes
LinearRing * | shell
std::vector< Geometry * > * | holes
## Friends
class | GeometryFactory

## Detailed Description

Represents a linear polygon, which may include holes.

The shell and holes of the polygon are represented by LinearRings. In a valid polygon, holes may touch the shell or other holes at a single point. However, no sequence of touching holes may split the polygon into two pieces. The orientation of the rings in the polygon does not matter.

The shell and holes must conform to the assertions specified in the OpenGIS Simple Features Specification for SQL .

## Constructor & Destructor Documentation

geos::geom::Polygon::Polygon | ( | LinearRing * | newShell,
|  | std::vector< Geometry * > * | newHoles,
|  | const GeometryFactory * | newFactory |
| ) |  |  | `[protected]`

Constructs a `Polygon` with the given exterior and interior boundaries.

Parameters:

  | newShell | the outer boundary of the new Polygon, or `null` or an empty LinearRing if the empty geometry is to be created.
  | newHoles | the LinearRings defining the inner boundaries of the new Polygon, or null or empty LinearRing if the empty geometry is to be created.
  | newFactory | the GeometryFactory used to create this geometry

Polygon will take ownership of Shell and Holes LinearRings

## Member Function Documentation

bool geos::geom::Polygon::isSimple | ( |  | ) | const`[virtual]`

Tests if a valid polygon is simple. This method always returns true, since a valid polygon is always simple.

Returns:
  `true`

Implements geos::geom::Geometry.

bool geos::geom::Polygon::isRectangle | ( |  | ) | const`[virtual]`

Deprecated:

Deprecated:

Polygon overrides to check for actual rectangle

Reimplemented from geos::geom::Geometry.

The documentation for this class was generated from the following file:

- Polygon.h