GEOS: geos::Polygon Class Reference

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

- Class List
- Class Hierarchy
- Class Members

# geos::Polygon Class Reference

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

`#include <geos.h>`

Inheritance diagram for geos::Polygon:

List of all members.

## Public Member Functions
| Polygon (LinearRing *newShell, vector< Geometry * > *newHoles, const GeometryFactory *newFactory)
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.
int | getNumPoints () const
| Returns the count of this Geometrys vertices.
int | 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
| Returns false if the Geometry not simple.
const LineString * | getExteriorRing () const
| Returns the exterior ring (shell).
int | getNumInteriorRing () const
| Returns number of interior rings (hole).
const LineString * | getInteriorRingN (int n) const
| Get nth interior ring (hole).
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) const
| Returns true if the two Geometrys are exactly equal, up to a specified tolerance.
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).
const Coordinate * | getCoordinate () const
| Returns a vertex of this Geometry.
double | getArea () const
| Returns the area of this Geometry.
double | getLength () const
| Returns the perimeter of this `Polygon`.

## 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::Polygon::Polygon | ( | LinearRing * | newShell,
|  | vector< Geometry * > * | newHoles,
|  | const GeometryFactory * | newFactory |
| ) |  |  |

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

double geos::Polygon::getArea | ( |  | ) | const`[virtual]`

Returns the area of this Geometry.

Returns the area of this `Geometry`. Areal Geometries have a non-zero area. They override this function to compute the area. Others return 0.0

Returns:
  the area of the Geometry

Reimplemented from geos::Geometry.

double geos::Polygon::getLength | ( |  | ) | const`[virtual]`

Returns the perimeter of this `Polygon`.

Returns the perimeter of this `Polygon`

Returns:
  the perimeter of the polygon

Reimplemented from geos::Geometry.

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

- geom.h
- Polygon.cpp