GDAL
Public Member Functions | Static Protected Member Functions
OGRLinearRing Class Reference

Concrete representation of a closed ring. More...

#include <ogr_geometry.h>

Inheritance diagram for OGRLinearRing:
OGRLineString OGRSimpleCurve OGRCurve OGRGeometry

List of all members.

Public Member Functions

 OGRLinearRing ()
 Constructor.
 OGRLinearRing (const OGRLinearRing &other)
 Copy constructor.
 OGRLinearRing (OGRLinearRing *)
 Constructor.
OGRLinearRingoperator= (const OGRLinearRing &other)
 Assignment operator.
virtual const char * getGeometryName () const CPL_OVERRIDE
 Fetch WKT name for geometry type.
virtual OGRGeometryclone () const CPL_OVERRIDE
 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 reverseWindingOrder ()
 Reverse order of points.
virtual void closeRings () CPL_OVERRIDE
 Force rings to be closed.
OGRBoolean isPointInRing (const OGRPoint *pt, int bTestEnvelope=TRUE) const
 Returns whether the point is inside the ring.
OGRBoolean isPointOnRingBoundary (const OGRPoint *pt, int bTestEnvelope=TRUE) const
 Returns whether the point is on the ring boundary.
virtual OGRErr transform (OGRCoordinateTransformation *poCT) CPL_OVERRIDE
 Apply arbitrary coordinate transformation to geometry.
virtual int WkbSize () const CPL_OVERRIDE
 Returns size of related binary representation.
virtual OGRErr importFromWkb (unsigned char *, int=-1, OGRwkbVariant=wkbVariantOldOgc) CPL_OVERRIDE
 Assign geometry from well known binary data.
virtual OGRErr exportToWkb (OGRwkbByteOrder, unsigned char *, OGRwkbVariant=wkbVariantOldOgc) const CPL_OVERRIDE
 Convert a geometry into well known binary format.

Static Protected Member Functions

static OGRLineStringCastToLineString (OGRLinearRing *poLR)
 Cast to line string.

Detailed Description

Concrete representation of a closed ring.

This class is functionally equivalent 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 generally 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.

Note: this class exists in SFSQL 1.2, but not in ISO SQL/MM Part 3.


Constructor & Destructor Documentation

Copy constructor.

Note: before GDAL 2.1, only the default implementation of the constructor existed, which could be unsafe to use.

Since:
GDAL 2.1
OGRLinearRing::OGRLinearRing ( OGRLinearRing poSrcRing) [explicit]

Constructor.

Parameters:
poSrcRingsource ring.

Member Function Documentation

OGRLineString * OGRLinearRing::CastToLineString ( OGRLinearRing poLR) [static, protected]

Cast to line string.

The passed in geometry is consumed and a new one returned .

Parameters:
poLRthe input geometry - ownership is passed to the method.
Returns:
new geometry.
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 OGRSimpleCurve.

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.

OGRErr OGRLinearRing::exportToWkb ( OGRwkbByteOrder  eByteOrder,
unsigned char *  pabyData,
OGRwkbVariant  eWkbVariant = wkbVariantOldOgc 
) 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() or OGR_G_ExportToIsoWkb(), depending on the value of eWkbVariant.

Parameters:
eByteOrderOne of wkbXDR or wkbNDR indicating MSB or LSB byte order respectively.
pabyDataa buffer into which the binary representation is written. This buffer must be at least OGRGeometry::WkbSize() byte in size.
eWkbVariantWhat standard to use when exporting geometries with three dimensions (or more). The default wkbVariantOldOgc 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 OGRSimpleCurve.

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,
OGRwkbVariant  eWkbVariant = wkbVariantOldOgc 
) [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:
pabyDatathe binary input data.
nSizethe size of pabyData in bytes, or zero if not known.
eWkbVariantif wkbVariantPostGIS1, special interpretation is done for curve geometries code
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 OGRSimpleCurve.

int OGRLinearRing::isClockwise ( ) const [virtual]

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

Returns:
TRUE if clockwise otherwise FALSE.
OGRBoolean OGRLinearRing::isPointInRing ( const OGRPoint poPoint,
int  bTestEnvelope = TRUE 
) const

Returns whether the point is inside the ring.

Parameters:
poPointpoint
bTestEnvelopeset to TRUE if the presence of the point inside the ring envelope must be checked first.
Returns:
TRUE or FALSE.
OGRBoolean OGRLinearRing::isPointOnRingBoundary ( const OGRPoint poPoint,
int  bTestEnvelope = TRUE 
) const

Returns whether the point is on the ring boundary.

Parameters:
poPointpoint
bTestEnvelopeset to TRUE if the presence of the point inside the ring envelope must be checked first.
Returns:
TRUE or FALSE.
OGRLinearRing & OGRLinearRing::operator= ( const OGRLinearRing other)

Assignment operator.

Note: before GDAL 2.1, only the default implementation of the operator existed, which could be unsafe to use.

Since:
GDAL 2.1

Apply arbitrary coordinate transformation to geometry.

This method will transform the coordinates of a geometry from their current spatial reference system to a new target spatial reference system. Normally this means reprojecting the vectors, but it could include datum shifts, and changes of units.

Note that this method does not require that the geometry already have a spatial reference system. It will be assumed that they can be treated as having the source spatial reference system of the OGRCoordinateTransformation object, and the actual SRS of the geometry will be ignored. On successful completion the output OGRSpatialReference of the OGRCoordinateTransformation will be assigned to the geometry.

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

Parameters:
poCTthe transformation to apply.
Returns:
OGRERR_NONE on success or an error code.

Reimplemented from OGRSimpleCurve.

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


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

Generated for GDAL by doxygen 1.7.6.1.