Public Member Functions | Friends

# OGRLinearRing Class Reference

`#include <ogr_geometry.h>`

Inheritance diagram for OGRLinearRing:

List of all members.

## Public Member Functions
virtual const char * | getGeometryName () const
| Fetch WKT name for geometry type.
virtual OGRGeometry * | clone () const
| Make a copy of this object.
virtual int | isClockwise () const
| Returns TRUE if the ring has clockwise winding (or less than 2 points).
virtual void | closeRings ()
| Force rings to be closed.
virtual double | get_Area () const
| Compute area of ring.
virtual int | WkbSize () const
| Returns size of related binary representation.
virtual OGRErr | importFromWkb (unsigned char *, int=-1)
| Assign geometry from well known binary data.
virtual OGRErr | exportToWkb (OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOgc) const
| Convert a geometry into well known binary format.
## Friends
class | OGRPolygon

## Detailed Description

Concrete representation of a closed ring.

This class is functionally equivelent to an OGRLineString, but has a separate identity to maintain alignment with the OpenGIS simple feature data model. It exists to serve as a component of an OGRPolygon.

The OGRLinearRing has no corresponding free standing well known binary representation, so importFromWkb() and exportToWkb() will not actually work. There is a non-standard GDAL WKT representation though.

Because OGRLinearRing is not a "proper" free standing simple features object, it cannot be directly used on a feature via SetGeometry(), and cannot genearally be used with GEOS for operations like Intersects(). Instead the polygon should be used, or the OGRLinearRing should be converted to an OGRLineString for such operations.

## Member Function Documentation

OGRGeometry * OGRLinearRing::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 OGRLineString.

References OGRGeometry::assignSpatialReference(), OGRGeometry::getSpatialReference(), and OGRLineString::setPoints().

void OGRLinearRing::closeRings | ( |  | ) | `[virtual]`

Force rings to be closed.

If this geometry, or any contained geometries has polygon rings that are not closed, they will be closed by adding the starting point at the end.

Reimplemented from OGRGeometry.

References OGRLineString::addPoint(), OGRLineString::getPoint(), OGRLineString::getX(), OGRLineString::getY(), and OGRLineString::getZ().

OGRErr OGRLinearRing::exportToWkb | ( | OGRwkbByteOrder | eByteOrder,
|  | unsigned char * | pabyData,
|  | OGRwkbVariant | eWkbVariant = `wkbVariantOgc` |
| ) |  |  | const`[virtual]`

Convert a geometry into well known binary format.

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

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

Parameters:

  | eByteOrder | One of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
  | pabyData | a buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
  | eWkbVariant | What standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOgc is the historical OGR variant. wkbVariantIso is the variant defined in ISO SQL/MM and adopted by OGC for SFSQL 1.2.

Returns:
  Currently OGRERR_NONE is always returned.

Reimplemented from OGRLineString.

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

Compute area of ring.

The area is computed according to Green's Theorem:

Area is "Sum(x(i)*(y(i+1) - y(i-1)))/2" for i = 0 to pointCount-1, assuming the last point is a duplicate of the first.

Returns:
  computed area.

Referenced by OGRPolygon::get_Area().

const char * OGRLinearRing::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 OGRLineString.

OGRErr OGRLinearRing::importFromWkb | ( | unsigned char * | pabyData,
|  | int | nSize = `-1` |
| ) |  |  | `[virtual]`

Assign geometry from well known binary data.

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

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

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

Parameters:

  | pabyData | the binary input data.
  | nSize | the size of pabyData in bytes, or zero if not known.

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 OGRLineString.

int OGRLinearRing::isClockwise | ( |  | ) | const`[virtual]`

Returns TRUE if the ring has clockwise winding (or less than 2 points).

Returns:
  TRUE if clockwise otherwise FALSE.

Referenced by OGRGeometryFactory::organizePolygons().

int OGRLinearRing::WkbSize | ( |  | ) | const`[virtual]`

Returns size of related binary representation.

This method returns the exact number of bytes required to hold the well known binary representation of this geometry object. Its computation may be slightly expensive for complex geometries.

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

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

Returns:
  size of binary representation in bytes.

Reimplemented from OGRLineString.

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

- ogr_geometry.h
- ogrlinearring.cpp

Generated for GDAL by 1.7.1.