📄 ogrgeometry.cpp
字号:
* OGR_G_WkbSize() byte in size.
*
* @return Currently OGRERR_NONE is always returned.
*/
OGRErr OGR_G_ExportToWkb( OGRGeometryH hGeom, OGRwkbByteOrder eOrder,
unsigned char *pabyDstBuffer )
{
return ((OGRGeometry *) hGeom)->exportToWkb( eOrder, pabyDstBuffer );
}
/**
* \fn OGRErr OGRGeometry::importFromWkt( char ** ppszInput );
*
* 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().
*
* @param ppszInput pointer to a pointer to the source text. The pointer is
* updated to pointer after the consumed text.
*
* @return OGRERR_NONE if all goes well, otherwise any of
* OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or
* OGRERR_CORRUPT_DATA may be returned.
*/
/************************************************************************/
/* OGR_G_ImportFromWkt() */
/************************************************************************/
/**
* 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 function relates to the SFCOM IWks::ImportFromWKT() method.
*
* This function is the same as the CPP method OGRGeometry::importFromWkt().
*
* @param hGeom handle on the geometry to assign well know text data to.
* @param ppszSrcText pointer to a pointer to the source text. The pointer is
* updated to pointer after the consumed text.
*
* @return OGRERR_NONE if all goes well, otherwise any of
* OGRERR_NOT_ENOUGH_DATA, OGRERR_UNSUPPORTED_GEOMETRY_TYPE, or
* OGRERR_CORRUPT_DATA may be returned.
*/
OGRErr OGR_G_ImportFromWkt( OGRGeometryH hGeom, char ** ppszSrcText )
{
return ((OGRGeometry *) hGeom)->importFromWkt( ppszSrcText );
}
/**
* \fn OGRErr OGRGeometry::exportToWkt( char ** ppszDstText ) const;
*
* 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().
*
* @param ppszDstText a text buffer is allocated by the program, and assigned
* to the passed pointer.
*
* @return Currently OGRERR_NONE is always returned.
*/
/************************************************************************/
/* OGR_G_ExportToWkt() */
/************************************************************************/
/**
* Convert a geometry into well known text format.
*
* This function relates to the SFCOM IWks::ExportToWKT() method.
*
* This function is the same as the CPP method OGRGeometry::exportToWkt().
*
* @param hGeom handle on the geometry to convert to a text format from.
* @param ppszSrcText a text buffer is allocated by the program, and assigned
to the passed pointer.
*
* @return Currently OGRERR_NONE is always returned.
*/
OGRErr OGR_G_ExportToWkt( OGRGeometryH hGeom, char **ppszSrcText )
{
return ((OGRGeometry *) hGeom)->exportToWkt( ppszSrcText );
}
/**
* \fn OGRwkbGeometryType OGRGeometry::getGeometryType() const;
*
* 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().
*
* @return the geometry type code.
*/
/************************************************************************/
/* OGR_G_GetGeometryType() */
/************************************************************************/
/**
* 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 function is the same as the CPP method OGRGeometry::getGeometryType().
*
* @param hGeom handle on the geometry to get type from.
* @return the geometry type code.
*/
OGRwkbGeometryType OGR_G_GetGeometryType( OGRGeometryH hGeom )
{
return ((OGRGeometry *) hGeom)->getGeometryType();
}
/**
* \fn const char * OGRGeometry::getGeometryName() const;
*
* 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().
*
* @return 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.
*/
/************************************************************************/
/* OGR_G_GetGeometryName() */
/************************************************************************/
/**
* Fetch WKT name for geometry type.
*
* There is no SFCOM analog to this function.
*
* This function is the same as the CPP method OGRGeometry::getGeometryName().
*
* @param hGeom handle on the geometry to get name from.
* @return name used for this geometry type in well known text format.
*/
const char *OGR_G_GetGeometryName( OGRGeometryH hGeom )
{
return ((OGRGeometry *) hGeom)->getGeometryName();
}
/**
* \fn OGRGeometry *OGRGeometry::clone() const;
*
* 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().
*
* @return a new object instance with the same geometry, and spatial
* reference system as the original.
*/
/************************************************************************/
/* OGR_G_Clone() */
/************************************************************************/
/**
* Make a copy of this object.
*
* This function relates to the SFCOM IGeometry::clone() method.
*
* This function is the same as the CPP method OGRGeometry::clone().
*
* @param hGeom handle on the geometry to clone from.
* @return an handle on the copy of the geometry with the spatial
* reference system as the original.
*/
OGRGeometryH OGR_G_Clone( OGRGeometryH hGeom )
{
return (OGRGeometryH) ((OGRGeometry *) hGeom)->clone();
}
/**
* \fn OGRSpatialReference *OGRGeometry::getSpatialReference();
*
* Returns spatial reference system for object.
*
* This method relates to the SFCOM IGeometry::get_SpatialReference() method.
*
* This method is the same as the C function OGR_G_GetSpatialReference().
*
* @return a reference to the spatial reference object. The object may be
* shared with many geometry objects, and should not be modified.
*/
/************************************************************************/
/* OGR_G_GetSpatialReference() */
/************************************************************************/
/**
* Returns spatial reference system for geometry.
*
* This function relates to the SFCOM IGeometry::get_SpatialReference() method.
*
* This function is the same as the CPP method
* OGRGeometry::getSpatialReference().
*
* @param hGeom handle on the geometry to get spatial reference from.
* @return a reference to the spatial reference geometry.
*/
OGRSpatialReferenceH OGR_G_GetSpatialReference( OGRGeometryH hGeom )
{
return (OGRSpatialReferenceH)
((OGRGeometry *) hGeom)->getSpatialReference();
}
/**
* \fn void OGRGeometry::empty();
*
* Clear geometry information. This restores the geometry to it's initial
* state after construction, and before assignment of actual geometry.
*
* This method relates to the SFCOM IGeometry::Empty() method.
*
* This method is the same as the C function OGR_G_Empty().
*/
/************************************************************************/
/* OGR_G_Empty() */
/************************************************************************/
/**
* Clear geometry information. This restores the geometry to it's initial
* state after construction, and before assignment of actual geometry.
*
* This function relates to the SFCOM IGeometry::Empty() method.
*
* This function is the same as the CPP method OGRGeometry::empty().
*
* @param hGeom handle on the geometry to empty.
*/
void OGR_G_Empty( OGRGeometryH hGeom )
{
((OGRGeometry *) hGeom)->empty();
}
/************************************************************************/
/* OGRGeometryTypeToName() */
/************************************************************************/
/**
* Fetch a human readable name corresponding to an OGRwkBGeometryType value.
* The returned value should not be modified, or freed by the application.
*
* This function is C callable.
*
* @param eType the geometry type.
*
* @return internal human readable string, or NULL on failure.
*/
const char *OGRGeometryTypeToName( OGRwkbGeometryType eType )
{
switch( eType )
{
case wkbUnknown:
return "Unknown (any)";
case wkbPoint:
return "Point";
case wkbPoint25D:
return "3D Point";
case wkbLineString:
return "Line String";
case wkbLineString25D:
return "3D Line String";
case wkbPolygon:
return "Polygon";
case wkbPolygon25D:
return "3D Polygon";
case wkbMultiPoint:
return "Multi Point";
case wkbMultiPoint25D:
return "3D Multi Point";
case wkbMultiLineString:
return "Multi Line String";
case wkbMultiLineString25D:
return "3D Multi Line String";
case wkbMultiPolygon:
return "Multi Polygon";
case wkbMultiPolygon25D:
return "3D Multi Polygon";
case wkbGeometryCollection:
return "Geometry Collection";
case wkbGeometryCollection25D:
return "3D Geometry Collection";
case wkbNone:
return "None";
default:
{
static char szWorkName[33];
sprintf( szWorkName, "Unrecognised: %d", (int) eType );
return szWorkName;
}
}
}
/**
* \fn void OGRGeometry::flattenTo2D();
*
* Convert geometry to strictly 2D. In a sense this converts all Z coordinates
* to 0.0.
*
* This method is the same as the C function OGR_G_FlattenTo2D().
*/
/************************************************************************/
/* OGR_G_FlattenTo2D() */
/************************************************************************/
/**
* Convert geometry to strictly 2D. In a sense this converts all Z coordinates
* to 0.0.
*
* This function is the same as the CPP method OGRGeometry::flattenTo2D().
*
* @param hGeom handle on the geometry to convert.
*/
void OGR_G_FlattenTo2D( OGRGeometryH hGeom )
{
((OGRGeometry *) hGeom)->flattenTo2D();
}
/************************************************************************/
/* exportToGML() */
/************************************************************************/
/**
* \fn char *OGRGeometry::exportToGML() const;
*
* Convert a geometry into GML format.
*
* The GML geometry is expressed directly in terms of GML basic data
* types assuming the this is available in the gml namespace. The returned
* string should be freed with CPLFree() when no longer required.
*
* This method is the same as the C function OGR_G_ExportToGML().
*
* @return A GML fragment or NULL in case of error.
*/
char *OGRGeometry::exportToGML() const
{
return OGR_G_ExportToGML( (OGRGeometryH) this );
}
/************************************************************************/
/* OGRSetGenerate_DB2_V72_BYTE_ORDER() */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -