OGR: OGRMultiPolygon Class Reference

# OGRMultiPolygon Class Reference

`#include <ogr_geometry.h>`

Inheritance diagram for OGRMultiPolygon:

List of all members.

## Public Member Functions
virtual const char * | getGeometryName () const
virtual OGRwkbGeometryType | getGeometryType () const
virtual OGRGeometry * | clone () const
virtual OGRErr | importFromWkt (char **)
virtual OGRErr | exportToWkt (char **) const
virtual OGRErr | addGeometryDirectly (OGRGeometry *)
virtual double | get_Area () const

## Detailed Description

A collection of non-overlapping OGRPolygons.

Note that the IMultiSurface class hasn't been modelled, nor have any of it's methods.

## Member Function Documentation

OGRErr OGRMultiPolygon::addGeometryDirectly | ( | OGRGeometry * | poNewGeom | ) | `[virtual]`

Add a geometry directly to the container.

Some subclasses of OGRGeometryCollection restrict the types of geometry that can be added, and may return an error. Ownership of the passed geometry is taken by the container rather than cloning as addGeometry() does.

This method is the same as the C function OGR_G_AddGeometryDirectly().

There is no SFCOM analog to this method.

Parameters:

  | poNewGeom | geometry to add to the container.

Returns:
  OGRERR_NONE if successful, or OGRERR_UNSUPPORTED_GEOMETRY_TYPE if the geometry type is illegal for the type of geometry container.

Reimplemented from OGRGeometryCollection.

References OGRGeometry::getGeometryType(), wkbPolygon, and wkbPolygon25D.

Referenced by OGRGeometryFactory::forceToMultiPolygon(), and importFromWkt().

OGRGeometry * OGRMultiPolygon::clone | ( |  | ) | const`[virtual]`

Make a copy of this object.

This method relates to the SFCOM IGeometry::clone() method.

This method is the same as the C function OGR_G_Clone().

Returns:
  a new object instance with the same geometry, and spatial reference system as the original.

Reimplemented from OGRGeometryCollection.

References OGRGeometryCollection::addGeometry(), OGRGeometry::assignSpatialReference(), OGRGeometryCollection::getGeometryRef(), OGRGeometryCollection::getNumGeometries(), and OGRGeometry::getSpatialReference().

OGRErr OGRMultiPolygon::exportToWkt | ( | char ** | ppszDstText | ) | const`[virtual]`

Convert a geometry into well known text format.

This method relates to the SFCOM IWks::ExportToWKT() method.

This method is the same as the C function OGR_G_ExportToWkt().

Parameters:

  | ppszDstText | a text buffer is allocated by the program, and assigned to the passed pointer.

Returns:
  Currently OGRERR_NONE is always returned.

Reimplemented from OGRGeometryCollection.

References OGRGeometry::exportToWkt(), OGRGeometryCollection::getGeometryRef(), and OGRGeometryCollection::getNumGeometries().

double OGRMultiPolygon::get_Area | ( |  | ) | const`[virtual]`

Compute area of multipolygon.

The area is computed as the sum of the areas of all polygon members in this collection.

Returns:
  computed area.

Reimplemented from OGRGeometryCollection.

References OGRPolygon::get_Area(), OGRGeometryCollection::getGeometryRef(), and OGRGeometryCollection::getNumGeometries().

const char * OGRMultiPolygon::getGeometryName | ( |  | ) | const`[virtual]`

Fetch WKT name for geometry type.

There is no SFCOM analog to this method.

This method is the same as the C function OGR_G_GetGeometryName().

Returns:
  name used for this geometry type in well known text format. The returned pointer is to a static internal string and should not be modified or freed.

Reimplemented from OGRGeometryCollection.

Referenced by importFromWkt().

OGRwkbGeometryType OGRMultiPolygon::getGeometryType | ( |  | ) | const`[virtual]`

Fetch geometry type.

Note that the geometry type may include the 2.5D flag. To get a 2D flattened version of the geometry type apply the wkbFlatten() macro to the return result.

This method is the same as the C function OGR_G_GetGeometryType().

Returns:
  the geometry type code.

Reimplemented from OGRGeometryCollection.

References OGRGeometry::getCoordinateDimension(), wkbMultiPolygon, and wkbMultiPolygon25D.

OGRErr OGRMultiPolygon::importFromWkt | ( | char ** | ppszInput | ) | `[virtual]`

Assign geometry from well known text data.

The object must have already been instantiated as the correct derived type of geometry object to match the text type. This method is used by the OGRGeometryFactory class, but not normally called by application code.

This method relates to the SFCOM IWks::ImportFromWKT() method.

This method is the same as the C function OGR_G_ImportFromWkt().

Parameters:

  | ppszInput | pointer to a pointer to the source text. The pointer is updated to pointer after the consumed text.

Returns:
  OGRERR_NONE if all goes well, otherwise any of OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or OGRERR_CORRUPT_DATA may be returned.

Reimplemented from OGRGeometryCollection.

References addGeometryDirectly(), OGRPolygon::addRingDirectly(), OGRGeometryCollection::empty(), getGeometryName(), and OGRLineString::setPoints().

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

- ogr_geometry.h
- ogrmultipolygon.cpp

Generated for GDAL by 1.5.9.