#include <ogr_geometry.h>
Static Public Member Functions | |
static OGRErr | createFromWkb (unsigned char *, OGRSpatialReference *, OGRGeometry **, int=-1) |
static OGRErr | createFromWkt (char **, OGRSpatialReference *, OGRGeometry **) |
static OGRGeometry * | createFromGML (const char *) |
static void | destroyGeometry (OGRGeometry *) |
static OGRGeometry * | createGeometry (OGRwkbGeometryType) |
static OGRGeometry * | forceToPolygon (OGRGeometry *) |
static OGRGeometry * | forceToMultiPolygon (OGRGeometry *) |
static OGRGeometry * | forceToMultiPoint (OGRGeometry *) |
static OGRGeometry * | forceToMultiLineString (OGRGeometry *) |
static int | haveGEOS () |
OGRGeometry * OGRGeometryFactory::createFromGML | ( | const char * | pszData | ) | [static] |
Create geometry from GML.
This method translates a fragment of GML containing only the geometry portion into a corresponding OGRGeometry. There are many limitations on the forms of GML geometries supported by this parser, but they are too numerous to list here.
The C function OGR_G_CreateFromGML() is the same as this method.
pszData | The GML fragment for the geometry. |
OGRErr OGRGeometryFactory::createFromWkb | ( | unsigned char * | pabyData, | |
OGRSpatialReference * | poSR, | |||
OGRGeometry ** | ppoReturn, | |||
int | nBytes = -1 | |||
) | [static] |
Create a geometry object of the appropriate type from it's well known binary representation.
Note that if nBytes is passed as zero, no checking can be done on whether the pabyData is sufficient. This can result in a crash if the input data is corrupt. This function returns no indication of the number of bytes from the data source actually used to represent the returned geometry object. Use OGRGeometry::WkbSize() on the returned geometry to establish the number of bytes it required in WKB format.
Also note that this is a static method, and that there is no need to instantiate an OGRGeometryFactory object.
The C function OGR_G_CreateFromWkb() is the same as this method.
pabyData | pointer to the input BLOB data. | |
poSR | pointer to the spatial reference to be assigned to the created geometry object. This may be NULL. | |
ppoReturn | the newly created geometry object will be assigned to the indicated pointer on return. This will be NULL in case of failure. | |
nBytes | the number of bytes available in pabyData, or -1 if it isn't known. |
References OGRGeometry::assignSpatialReference(), createGeometry(), and OGRGeometry::importFromWkb().
Referenced by OGRGeometryCollection::importFromWkb(), and OGR_G_CreateFromWkb().
OGRErr OGRGeometryFactory::createFromWkt | ( | char ** | ppszData, | |
OGRSpatialReference * | poSR, | |||
OGRGeometry ** | ppoReturn | |||
) | [static] |
Create a geometry object of the appropriate type from it's well known text representation.
The C function OGR_G_CreateFromWkt() is the same as this method.
ppszData | input zero terminated string containing well known text representation of the geometry to be created. The pointer is updated to point just beyond that last character consumed. | |
poSR | pointer to the spatial reference to be assigned to the created geometry object. This may be NULL. | |
ppoReturn | the newly created geometry object will be assigned to the indicated pointer on return. This will be NULL if the method fails. |
const char* wkt= "POINT(0 0)";
// cast because OGR_G_CreateFromWkt will move the pointer char* pszWkt = (char*) wkt.c_str(); OGRSpatialReferenceH ref = OSRNewSpatialReference(NULL); OGRGeometryH new_geom; OGRErr err = OGR_G_CreateFromWkt(&pszWkt, ref, &new_geom);
References OGRGeometry::assignSpatialReference(), and OGRGeometry::importFromWkt().
Referenced by OGRGeometryCollection::importFromWkt(), and OGR_G_CreateFromWkt().
OGRGeometry * OGRGeometryFactory::createGeometry | ( | OGRwkbGeometryType | eGeometryType | ) | [static] |
Create an empty geometry of desired type.
This is equivelent to allocating the desired geometry with new, but the allocation is guaranteed to take place in the context of the GDAL/OGR heap.
This method is the same as the C function OGR_G_CreateGeometry().
eGeometryType | the type code of the geometry class to be instantiated. |
References wkbGeometryCollection, wkbLinearRing, wkbLineString, wkbMultiLineString, wkbMultiPoint, wkbMultiPolygon, wkbPoint, and wkbPolygon.
Referenced by createFromWkb(), and OGR_G_CreateGeometry().
void OGRGeometryFactory::destroyGeometry | ( | OGRGeometry * | poGeom | ) | [static] |
Destroy geometry object.
Equivalent to invoking delete on a geometry, but it guaranteed to take place within the context of the GDAL/OGR heap.
This method is the same as the C function OGR_G_DestroyGeometry().
poGeom | the geometry to deallocate. |
Referenced by OGR_G_DestroyGeometry().
OGRGeometry * OGRGeometryFactory::forceToMultiLineString | ( | OGRGeometry * | poGeom | ) | [static] |
Convert to multilinestring.
Tries to force the provided geometry to be a multilinestring. Currently this just effects a change on linestrings. The passed in geometry is consumed and a new one returned (or potentially the same one).
References OGRMultiLineString::addGeometryDirectly(), OGRGeometryCollection::getGeometryRef(), OGRGeometry::getGeometryType(), OGRGeometryCollection::getNumGeometries(), OGRGeometryCollection::removeGeometry(), wkbGeometryCollection, and wkbLineString.
OGRGeometry * OGRGeometryFactory::forceToMultiPoint | ( | OGRGeometry * | poGeom | ) | [static] |
Convert to multipoint.
Tries to force the provided geometry to be a multipoint. Currently this just effects a change on points. The passed in geometry is consumed and a new one returned (or potentially the same one).
References OGRMultiPoint::addGeometryDirectly(), OGRGeometryCollection::getGeometryRef(), OGRGeometry::getGeometryType(), OGRGeometryCollection::getNumGeometries(), OGRGeometryCollection::removeGeometry(), wkbGeometryCollection, and wkbPoint.
OGRGeometry * OGRGeometryFactory::forceToMultiPolygon | ( | OGRGeometry * | poGeom | ) | [static] |
Convert to multipolygon.
Tries to force the provided geometry to be a multipolygon. Currently this just effects a change on polygons. The passed in geometry is consumed and a new one returned (or potentially the same one).
References OGRMultiPolygon::addGeometryDirectly(), OGRGeometryCollection::getGeometryRef(), OGRGeometry::getGeometryType(), OGRGeometryCollection::getNumGeometries(), OGRGeometryCollection::removeGeometry(), wkbGeometryCollection, and wkbPolygon.
OGRGeometry * OGRGeometryFactory::forceToPolygon | ( | OGRGeometry * | poGeom | ) | [static] |
Convert to polygon.
Tries to force the provided geometry to be a polygon. Currently this just effects a change on multipolygons. The passed in geometry is consumed and a new one returned (or potentially the same one).
References OGRPolygon::addRing(), OGRPolygon::getExteriorRing(), OGRGeometryCollection::getGeometryRef(), OGRGeometry::getGeometryType(), OGRPolygon::getInteriorRing(), OGRGeometryCollection::getNumGeometries(), OGRPolygon::getNumInteriorRings(), wkbGeometryCollection, wkbMultiPolygon, and wkbPolygon.
int OGRGeometryFactory::haveGEOS | ( | ) | [static] |
Test if GEOS enabled.
This static method returns TRUE if GEOS support is built into OGR, otherwise it returns FALSE.