📄 ogrgeometry.cpp
字号:
* 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().
*
* @param poCT the transformation to apply.
*
* @return OGRERR_NONE on success or an error code.
*/
/************************************************************************/
/* OGR_G_Transform() */
/************************************************************************/
/**
* Apply arbitrary coordinate transformation to geometry.
*
* This function 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 function 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 function is the same as the CPP method OGRGeometry::transform.
*
* @param hGeom handle on the geometry to apply the transform to.
* @param hTransform handle on the transformation to apply.
*
* @return OGRERR_NONE on success or an error code.
*/
OGRErr OGR_G_Transform( OGRGeometryH hGeom,
OGRCoordinateTransformationH hTransform )
{
return ((OGRGeometry *) hGeom)->transform(
(OGRCoordinateTransformation *) hTransform );
}
/**
* \fn int OGRGeometry::getDimension() const;
*
* Get the dimension of this object.
*
* This method corresponds to the SFCOM IGeometry::GetDimension() method.
* It indicates the dimension of the object, but does not indicate the
* dimension of the underlying space (as indicated by
* OGRGeometry::getCoordinateDimension()).
*
* This method is the same as the C function OGR_G_GetDimension().
*
* @return 0 for points, 1 for lines and 2 for surfaces.
*/
/************************************************************************/
/* OGR_G_GetDimension() */
/************************************************************************/
/**
*
* Get the dimension of this geometry.
*
* This function corresponds to the SFCOM IGeometry::GetDimension() method.
* It indicates the dimension of the geometry, but does not indicate the
* dimension of the underlying space (as indicated by
* OGR_G_GetCoordinateDimension() function).
*
* This function is the same as the CPP method OGRGeometry::getDimension().
*
* @param hGeom handle on the geometry to get the dimension from.
* @return 0 for points, 1 for lines and 2 for surfaces.
*/
int OGR_G_GetDimension( OGRGeometryH hGeom )
{
return ((OGRGeometry *) hGeom)->getDimension();
}
/************************************************************************/
/* getCoordinateDimension() */
/************************************************************************/
/**
* Get the dimension of the coordinates in this object.
*
* This method corresponds to the SFCOM IGeometry::GetDimension() method.
*
* This method is the same as the C function OGR_G_GetCoordinateDimension().
*
* @return in practice this always returns 2 indicating that coordinates are
* specified within a two dimensional space.
*/
int OGRGeometry::getCoordinateDimension() const
{
return nCoordDimension;
}
/************************************************************************/
/* OGR_G_GetCoordinateDimension() */
/************************************************************************/
/**
*
* Get the dimension of the coordinates in this geometry.
*
* This function corresponds to the SFCOM IGeometry::GetDimension() method.
*
* This function is the same as the CPP method
* OGRGeometry::getCoordinateDimension().
*
* @param hGeom handle on the geometry to get the dimension of the
* coordinates from.
* @return in practice this always returns 2 indicating that coordinates are
* specified within a two dimensional space.
*/
int OGR_G_GetCoordinateDimension( OGRGeometryH hGeom )
{
return ((OGRGeometry *) hGeom)->getCoordinateDimension();
}
/************************************************************************/
/* setCoordinateDimension() */
/************************************************************************/
/**
* Set the coordinate dimension.
*
* This method sets the explicit coordinate dimension. Setting the coordinate
* dimension of a geometry to 2 should zero out any existing Z values. Setting
* the dimension of a geometry collection will not necessarily affect the
* children geometries.
*
* @param nNewDimension New coordinate dimension value, either 2 or 3.
*/
void OGRGeometry::setCoordinateDimension( int nNewDimension )
{
nCoordDimension = nNewDimension;
}
/************************************************************************/
/* OGR_G_SetCoordinateDimension() */
/************************************************************************/
void OGR_G_SetCoordinateDimension( OGRGeometryH hGeom, int nNewDimension)
{
((OGRGeometry *) hGeom)->setCoordinateDimension( nNewDimension );
}
/**
* \fn OGRBoolean OGRGeometry::IsEmpty() const;
*
* Returns TRUE (non-zero) if the object has no points. Normally this
* returns FALSE except between when an object is instantiated and points
* have been assigned.
*
* This method relates to the SFCOM IGeometry::IsEmpty() method.
*
* NOTE: This method is hardcoded to return FALSE at this time.
*
* @return TRUE if object is empty, otherwise FALSE.
*/
/**
* \fn OGRBoolean OGRGeometry::IsSimple() const;
*
* Returns TRUE if the geometry is simple.
*
* Returns TRUE if the geometry has no anomalous geometric points, such
* as self intersection or self tangency. The description of each
* instantiable geometric class will include the specific conditions that
* cause an instance of that class to be classified as not simple.
*
* This method relates to the SFCOM IGeometry::IsSimple() method.
*
* NOTE: This method is hardcoded to return TRUE at this time.
*
* @return TRUE if object is simple, otherwise FALSE.
*/
/**
* \fn int OGRGeometry::Equals( OGRGeometry *poOtherGeom ) const;
*
* Returns two if two geometries are equivalent.
*
* This method is the same as the C function OGR_G_Equal().
*
* @return TRUE if equivalent or FALSE otherwise.
*/
// Backward compatibility method.
int OGRGeometry::Equal( OGRGeometry *poOtherGeom ) const
{
return Equals( poOtherGeom );
}
/************************************************************************/
/* OGR_G_Equals() */
/************************************************************************/
/**
* Returns two if two geometries are equivalent.
*
* This function is the same as the CPP method OGRGeometry::Equals() method.
*
* @param hGeom handle on the first geometry.
* @param hOther handle on the other geometry to test against.
* @return TRUE if equivalent or FALSE otherwise.
*/
int OGR_G_Equals( OGRGeometryH hGeom, OGRGeometryH hOther )
{
return ((OGRGeometry *) hGeom)->Equals( (OGRGeometry *) hOther );
}
int OGR_G_Equal( OGRGeometryH hGeom, OGRGeometryH hOther )
{
return ((OGRGeometry *) hGeom)->Equals( (OGRGeometry *) hOther );
}
/**
* \fn int OGRGeometry::WkbSize() const;
*
* 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().
*
* @return size of binary representation in bytes.
*/
/************************************************************************/
/* OGR_G_WkbSize() */
/************************************************************************/
/**
* Returns size of related binary representation.
*
* This function 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 function relates to the SFCOM IWks::WkbSize() method.
*
* This function is the same as the CPP method OGRGeometry::WkbSize().
*
* @param hGeom handle on the geometry to get the binary size from.
* @return size of binary representation in bytes.
*/
int OGR_G_WkbSize( OGRGeometryH hGeom )
{
return ((OGRGeometry *) hGeom)->WkbSize();
}
/**
* \fn void OGRGeometry::getEnvelope(OGREnvelope *psEnvelope) const;
*
* Computes and returns the bounding envelope for this geometry in the
* passed psEnvelope structure.
*
* This method is the same as the C function OGR_G_GetEnvelope().
*
* @param psEnvelope the structure in which to place the results.
*/
/************************************************************************/
/* OGR_G_GetEnvelope() */
/************************************************************************/
/**
* Computes and returns the bounding envelope for this geometry in the
* passed psEnvelope structure.
*
* This function is the same as the CPP method OGRGeometry::getEnvelope().
*
* @param hGeom handle of the geometry to get envelope from.
* @param psEnvelope the structure in which to place the results.
*/
void OGR_G_GetEnvelope( OGRGeometryH hGeom, OGREnvelope *psEnvelope )
{
((OGRGeometry *) hGeom)->getEnvelope( psEnvelope );
}
/**
* \fn OGRErr OGRGeometry::importFromWkb( unsigned char * pabyData, int nSize);
*
* 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().
*
* @param pabyData the binary input data.
* @param nSize the size of pabyData in bytes, or zero if not known.
*
* @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_ImportFromWkb() */
/************************************************************************/
/**
* 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 function relates to the SFCOM IWks::ImportFromWKB() method.
*
* This function is the same as the CPP method OGRGeometry::importFromWkb().
*
* @param hGeom handle on the geometry to assign the well know binary data to.
* @param pabyData the binary input data.
* @param nSize the size of pabyData in bytes, or zero if not known.
*
* @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_ImportFromWkb( OGRGeometryH hGeom,
unsigned char *pabyData, int nSize )
{
return ((OGRGeometry *) hGeom)->importFromWkb( pabyData, nSize );
}
/**
* \fn OGRErr OGRGeometry::exportToWkb( OGRwkbByteOrder eByteOrder,
unsigned char * pabyData ) const;
*
* 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().
*
* @param eByteOrder One of wkbXDR or wkbNDR indicating MSB or LSB byte order
* respectively.
* @param pabyData a buffer into which the binary representation is
* written. This buffer must be at least
* OGRGeometry::WkbSize() byte in size.
*
* @return Currently OGRERR_NONE is always returned.
*/
/************************************************************************/
/* OGR_G_ExportToWkb() */
/************************************************************************/
/**
* Convert a geometry into well known binary format.
*
* This function relates to the SFCOM IWks::ExportToWKB() method.
*
* This function is the same as the CPP method OGRGeometry::exportToWkb().
*
* @param hGeom handle on the geometry to convert to a well know binary
* data from.
* @param eOrder One of wkbXDR or wkbNDR indicating MSB or LSB byte order
* respectively.
* @param pabyDstBuffer a buffer into which the binary representation is
* written. This buffer must be at least
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -