本文整理汇总了C++中OGRPoint::getGeometryType方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRPoint::getGeometryType方法的具体用法?C++ OGRPoint::getGeometryType怎么用?C++ OGRPoint::getGeometryType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRPoint
的用法示例。
在下文中一共展示了OGRPoint::getGeometryType方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateFeature
OGRErr TigerPoint::CreateFeature( OGRFeature *poFeature,
int pointIndex)
{
char szRecord[OGR_TIGER_RECBUF_LEN];
OGRPoint *poPoint = poFeature->GetGeometryRef()->toPoint();
if( !SetWriteModule( m_pszFileCode, psRTInfo->nRecordLength+2, poFeature ) )
return OGRERR_FAILURE;
memset( szRecord, ' ', psRTInfo->nRecordLength );
WriteFields( psRTInfo, poFeature, szRecord );
if( poPoint != nullptr
&& (poPoint->getGeometryType() == wkbPoint
|| poPoint->getGeometryType() == wkbPoint25D) ) {
WritePoint( szRecord, pointIndex, poPoint->getX(), poPoint->getY() );
} else {
if (bRequireGeom) {
return OGRERR_FAILURE;
}
}
WriteRecord( szRecord, psRTInfo->nRecordLength, m_pszFileCode );
return OGRERR_NONE;
}
示例2: WriteINSERT
OGRErr OGRDXFWriterLayer::WriteINSERT( OGRFeature *poFeature )
{
WriteValue( 0, "INSERT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbBlockReference" );
WriteValue( 2, poFeature->GetFieldAsString("BlockName") );
/* -------------------------------------------------------------------- */
/* Write location. */
/* -------------------------------------------------------------------- */
OGRPoint *poPoint = (OGRPoint *) poFeature->GetGeometryRef();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
/* -------------------------------------------------------------------- */
/* Write scaling. */
/* -------------------------------------------------------------------- */
int nScaleCount;
const double *padfScale =
poFeature->GetFieldAsDoubleList( "BlockScale", &nScaleCount );
if( nScaleCount == 3 )
{
WriteValue( 41, padfScale[0] );
WriteValue( 42, padfScale[1] );
WriteValue( 43, padfScale[2] );
}
/* -------------------------------------------------------------------- */
/* Write rotation. */
/* -------------------------------------------------------------------- */
double dfAngle = poFeature->GetFieldAsDouble( "BlockAngle" );
if( dfAngle != 0.0 )
{
WriteValue( 50, dfAngle ); // degrees
}
return OGRERR_NONE;
}
示例3: WritePOINT
OGRErr OGRDXFWriterLayer::WritePOINT( OGRFeature *poFeature )
{
WriteValue( 0, "POINT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbPoint" );
// Write style pen color
OGRStyleTool *poTool = nullptr;
OGRStyleMgr oSM;
if( poFeature->GetStyleString() != nullptr )
{
oSM.InitFromFeature( poFeature );
if( oSM.GetPartCount() > 0 )
poTool = oSM.GetPart(0);
}
if( poTool && poTool->GetType() == OGRSTCPen )
{
OGRStylePen *poPen = (OGRStylePen *) poTool;
GBool bDefault;
if( poPen->Color(bDefault) != nullptr && !bDefault )
WriteValue( 62, ColorStringToDXFColor( poPen->Color(bDefault) ) );
}
delete poTool;
OGRPoint *poPoint = poFeature->GetGeometryRef()->toPoint();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
return OGRERR_NONE;
}
示例4: WritePOINT
OGRErr OGRDXFWriterLayer::WritePOINT( OGRFeature *poFeature )
{
WriteValue( 0, "POINT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbPoint" );
OGRPoint *poPoint = (OGRPoint *) poFeature->GetGeometryRef();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
return OGRERR_NONE;
}
示例5: BareGMLElement
//.........这里部分代码省略.........
delete poPolygon;
delete poMPoly;
return NULL;
}
poMPoly->addGeometryDirectly( poPolygon );
}
}
return poMPoly;
}
/* -------------------------------------------------------------------- */
/* MultiPoint */
/* -------------------------------------------------------------------- */
if( EQUAL(pszBaseGeometry,"MultiPoint") )
{
CPLXMLNode *psChild;
OGRMultiPoint *poMP = new OGRMultiPoint();
// collect points.
for( psChild = psNode->psChild;
psChild != NULL;
psChild = psChild->psNext )
{
if( psChild->eType == CXT_Element
&& EQUAL(BareGMLElement(psChild->pszValue),"pointMember") )
{
OGRPoint *poPoint;
poPoint = (OGRPoint *)
GML2OGRGeometry_XMLNode( psChild->psChild );
if( poPoint == NULL
|| wkbFlatten(poPoint->getGeometryType()) != wkbPoint )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Got %.500s geometry as pointMember instead of MULTIPOINT",
poPoint ? poPoint->getGeometryName() : "NULL" );
delete poPoint;
delete poMP;
return NULL;
}
poMP->addGeometryDirectly( poPoint );
}
}
return poMP;
}
/* -------------------------------------------------------------------- */
/* MultiLineString */
/* -------------------------------------------------------------------- */
if( EQUAL(pszBaseGeometry,"MultiLineString") )
{
CPLXMLNode *psChild;
OGRMultiLineString *poMP = new OGRMultiLineString();
// collect lines
for( psChild = psNode->psChild;
psChild != NULL;
psChild = psChild->psNext )
{
if( psChild->eType == CXT_Element
&& EQUAL(BareGMLElement(psChild->pszValue),"lineStringMember") )
{
示例6: WriteTEXT
//.........这里部分代码省略.........
if( !bDefault )
WriteValue( 50, dfAngle );
/* -------------------------------------------------------------------- */
/* Height - We need to fetch this in georeferenced units - I'm */
/* doubt the default translation mechanism will be much good. */
/* -------------------------------------------------------------------- */
poTool->SetUnit( OGRSTUGround );
const double dfHeight = poLabel->Size(bDefault);
if( !bDefault )
WriteValue( 40, dfHeight );
/* -------------------------------------------------------------------- */
/* Anchor / Attachment Point */
/* -------------------------------------------------------------------- */
const int nAnchor = poLabel->Anchor(bDefault);
if( !bDefault )
{
const static int anAnchorMap[] =
{ -1, 7, 8, 9, 4, 5, 6, 1, 2, 3, 7, 8, 9 };
if( nAnchor > 0 && nAnchor < 13 )
WriteValue( 71, anAnchorMap[nAnchor] );
}
/* -------------------------------------------------------------------- */
/* Offset */
/* -------------------------------------------------------------------- */
dfDx = poLabel->SpacingX(bDefault);
dfDy = poLabel->SpacingY(bDefault);
/* -------------------------------------------------------------------- */
/* Escape the text, and convert to ISO8859. */
/* -------------------------------------------------------------------- */
const char *pszText = poLabel->TextString( bDefault );
if( pszText != nullptr && !bDefault )
{
CPLString osEscaped = TextEscape( pszText );
while( osEscaped.size() > 250 )
{
WriteValue( 3, osEscaped.substr( 0, 250 ).c_str() );
osEscaped.erase( 0, 250 );
}
WriteValue( 1, osEscaped );
}
/* -------------------------------------------------------------------- */
/* Store the text style in the map. */
/* -------------------------------------------------------------------- */
std::map<CPLString, CPLString> oTextStyleDef =
PrepareTextStyleDefinition( poLabel );
CPLString osStyleName;
for( const auto& oPair: oNewTextStyles )
{
if( oPair.second == oTextStyleDef )
{
osStyleName = oPair.first;
break;
}
}
if( osStyleName == "" )
{
do
{
osStyleName.Printf( "AutoTextStyle-%d", nNextAutoID++ );
}
while( poDS->oHeaderDS.TextStyleExists( osStyleName ) );
oNewTextStyles[osStyleName] = oTextStyleDef;
}
WriteValue( 7, osStyleName );
}
delete poTool;
/* -------------------------------------------------------------------- */
/* Write the location. */
/* -------------------------------------------------------------------- */
OGRPoint *poPoint = poFeature->GetGeometryRef()->toPoint();
WriteValue( 10, poPoint->getX() + dfDx );
if( !WriteValue( 20, poPoint->getY() + dfDy ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
return OGRERR_NONE;
}
示例7: WriteINSERT
OGRErr OGRDXFWriterLayer::WriteINSERT( OGRFeature *poFeature )
{
WriteValue( 0, "INSERT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbBlockReference" );
WriteValue( 2, poFeature->GetFieldAsString("BlockName") );
// Write style symbol color
OGRStyleTool *poTool = nullptr;
OGRStyleMgr oSM;
if( poFeature->GetStyleString() != nullptr )
{
oSM.InitFromFeature( poFeature );
if( oSM.GetPartCount() > 0 )
poTool = oSM.GetPart(0);
}
if( poTool && poTool->GetType() == OGRSTCSymbol )
{
OGRStyleSymbol *poSymbol = (OGRStyleSymbol *) poTool;
GBool bDefault;
if( poSymbol->Color(bDefault) != nullptr && !bDefault )
WriteValue( 62, ColorStringToDXFColor( poSymbol->Color(bDefault) ) );
}
delete poTool;
/* -------------------------------------------------------------------- */
/* Write location in OCS. */
/* -------------------------------------------------------------------- */
int nCoordCount = 0;
const double *padfCoords =
poFeature->GetFieldAsDoubleList( "BlockOCSCoords", &nCoordCount );
if( nCoordCount == 3 )
{
WriteValue( 10, padfCoords[0] );
WriteValue( 20, padfCoords[1] );
if( !WriteValue( 30, padfCoords[2] ) )
return OGRERR_FAILURE;
}
else
{
// We don't have an OCS; we will just assume that the location of
// the geometry (in WCS) is the correct insertion point.
OGRPoint *poPoint = poFeature->GetGeometryRef()->toPoint();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
}
/* -------------------------------------------------------------------- */
/* Write scaling. */
/* -------------------------------------------------------------------- */
int nScaleCount = 0;
const double *padfScale =
poFeature->GetFieldAsDoubleList( "BlockScale", &nScaleCount );
if( nScaleCount == 3 )
{
WriteValue( 41, padfScale[0] );
WriteValue( 42, padfScale[1] );
WriteValue( 43, padfScale[2] );
}
/* -------------------------------------------------------------------- */
/* Write rotation. */
/* -------------------------------------------------------------------- */
const double dfAngle = poFeature->GetFieldAsDouble( "BlockAngle" );
if( dfAngle != 0.0 )
{
WriteValue( 50, dfAngle ); // degrees
}
/* -------------------------------------------------------------------- */
/* Write OCS normal vector. */
/* -------------------------------------------------------------------- */
int nOCSCount = 0;
const double *padfOCS =
poFeature->GetFieldAsDoubleList( "BlockOCSNormal", &nOCSCount );
if( nOCSCount == 3 )
{
WriteValue( 210, padfOCS[0] );
WriteValue( 220, padfOCS[1] );
WriteValue( 230, padfOCS[2] );
}
return OGRERR_NONE;
}
示例8: GDALParseGMLCoverage
CPLErr GDALParseGMLCoverage( CPLXMLNode *psXML,
int *pnXSize, int *pnYSize,
double *padfGeoTransform,
char **ppszProjection )
{
CPLStripXMLNamespace( psXML, NULL, TRUE );
/* -------------------------------------------------------------------- */
/* Isolate RectifiedGrid. Eventually we will need to support */
/* other georeferencing objects. */
/* -------------------------------------------------------------------- */
CPLXMLNode *psRG = CPLSearchXMLNode( psXML, "=RectifiedGrid" );
CPLXMLNode *psOriginPoint = NULL;
const char *pszOffset1=NULL, *pszOffset2=NULL;
if( psRG != NULL )
{
psOriginPoint = CPLGetXMLNode( psRG, "origin.Point" );
if( psOriginPoint == NULL )
psOriginPoint = CPLGetXMLNode( psRG, "origin" );
CPLXMLNode *psOffset1 = CPLGetXMLNode( psRG, "offsetVector" );
if( psOffset1 != NULL )
{
pszOffset1 = CPLGetXMLValue( psOffset1, "", NULL );
pszOffset2 = CPLGetXMLValue( psOffset1->psNext, "=offsetVector",
NULL );
}
}
/* -------------------------------------------------------------------- */
/* If we are missing any of the origin or 2 offsets then give up. */
/* -------------------------------------------------------------------- */
if( psRG == NULL || psOriginPoint == NULL
|| pszOffset1 == NULL || pszOffset2 == NULL )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Unable to find GML RectifiedGrid, origin or offset vectors");
return CE_Failure;
}
/* -------------------------------------------------------------------- */
/* Search for the GridEnvelope and derive the raster size. */
/* -------------------------------------------------------------------- */
char **papszLow = CSLTokenizeString(
CPLGetXMLValue( psRG, "limits.GridEnvelope.low", ""));
char **papszHigh = CSLTokenizeString(
CPLGetXMLValue( psRG, "limits.GridEnvelope.high",""));
if( CSLCount(papszLow) < 2 || CSLCount(papszHigh) < 2 )
{
CPLError( CE_Failure, CPLE_AppDefined,
"Unable to find or parse GridEnvelope.low/high." );
return CE_Failure;
}
if( pnXSize != NULL )
*pnXSize = atoi(papszHigh[0]) - atoi(papszLow[0]) + 1;
if( pnYSize != NULL )
*pnYSize = atoi(papszHigh[1]) - atoi(papszLow[1]) + 1;
CSLDestroy( papszLow );
CSLDestroy( papszHigh );
/* -------------------------------------------------------------------- */
/* Extract origin location. */
/* -------------------------------------------------------------------- */
OGRPoint *poOriginGeometry = NULL;
const char *pszSRSName = NULL;
if( psOriginPoint != NULL )
{
int bOldWrap = FALSE;
// old coverages (ie. WCS) just have <pos> under <origin> so we
// may need to temporarily force <origin> to <Point>
if( psOriginPoint->eType == CXT_Element
&& EQUAL(psOriginPoint->pszValue,"origin") )
{
strcpy( psOriginPoint->pszValue, "Point");
bOldWrap = TRUE;
}
poOriginGeometry = (OGRPoint *)
OGR_G_CreateFromGMLTree( psOriginPoint );
if( poOriginGeometry != NULL
&& wkbFlatten(poOriginGeometry->getGeometryType()) != wkbPoint )
{
delete poOriginGeometry;
poOriginGeometry = NULL;
}
if( bOldWrap )
strcpy( psOriginPoint->pszValue, "origin");
// SRS?
pszSRSName = CPLGetXMLValue( psOriginPoint, "srsName", NULL );
}
//.........这里部分代码省略.........
示例9: WriteTEXT
OGRErr OGRDXFWriterLayer::WriteTEXT( OGRFeature *poFeature )
{
WriteValue( 0, "MTEXT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbMText" );
/* -------------------------------------------------------------------- */
/* Do we have styling information? */
/* -------------------------------------------------------------------- */
OGRStyleTool *poTool = NULL;
OGRStyleMgr oSM;
if( poFeature->GetStyleString() != NULL )
{
oSM.InitFromFeature( poFeature );
if( oSM.GetPartCount() > 0 )
poTool = oSM.GetPart(0);
}
/* ==================================================================== */
/* Process the LABEL tool. */
/* ==================================================================== */
if( poTool && poTool->GetType() == OGRSTCLabel )
{
OGRStyleLabel *poLabel = (OGRStyleLabel *) poTool;
GBool bDefault;
/* -------------------------------------------------------------------- */
/* Color */
/* -------------------------------------------------------------------- */
if( poLabel->ForeColor(bDefault) != NULL && !bDefault )
WriteValue( 62, ColorStringToDXFColor(
poLabel->ForeColor(bDefault) ) );
/* -------------------------------------------------------------------- */
/* Angle */
/* -------------------------------------------------------------------- */
double dfAngle = poLabel->Angle(bDefault);
// The DXF2000 reference says this is in radians, but in files
// I see it seems to be in degrees. Perhaps this is version dependent?
if( !bDefault )
WriteValue( 50, dfAngle );
/* -------------------------------------------------------------------- */
/* Height - We need to fetch this in georeferenced units - I'm */
/* doubt the default translation mechanism will be much good. */
/* -------------------------------------------------------------------- */
poTool->SetUnit( OGRSTUGround );
double dfHeight = poLabel->Size(bDefault);
if( !bDefault )
WriteValue( 40, dfHeight );
/* -------------------------------------------------------------------- */
/* Anchor / Attachment Point */
/* -------------------------------------------------------------------- */
int nAnchor = poLabel->Anchor(bDefault);
if( !bDefault )
{
const static int anAnchorMap[] =
{ -1, 7, 8, 9, 4, 5, 6, 1, 2, 3, 7, 8, 9 };
if( nAnchor > 0 && nAnchor < 13 )
WriteValue( 71, anAnchorMap[nAnchor] );
}
/* -------------------------------------------------------------------- */
/* Escape the text, and convert to ISO8859. */
/* -------------------------------------------------------------------- */
const char *pszText = poLabel->TextString( bDefault );
if( pszText != NULL && !bDefault )
{
CPLString osEscaped = TextEscape( pszText );
WriteValue( 1, osEscaped );
}
}
delete poTool;
/* -------------------------------------------------------------------- */
/* Write the location. */
/* -------------------------------------------------------------------- */
OGRPoint *poPoint = (OGRPoint *) poFeature->GetGeometryRef();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
//.........这里部分代码省略.........
示例10: WriteINSERT
OGRErr OGRDXFWriterLayer::WriteINSERT( OGRFeature *poFeature )
{
WriteValue( 0, "INSERT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbBlockReference" );
WriteValue( 2, poFeature->GetFieldAsString("BlockName") );
// Write style symbol color
OGRStyleTool *poTool = NULL;
OGRStyleMgr oSM;
if( poFeature->GetStyleString() != NULL )
{
oSM.InitFromFeature( poFeature );
if( oSM.GetPartCount() > 0 )
poTool = oSM.GetPart(0);
}
if( poTool && poTool->GetType() == OGRSTCSymbol )
{
OGRStyleSymbol *poSymbol = (OGRStyleSymbol *) poTool;
GBool bDefault;
if( poSymbol->Color(bDefault) != NULL && !bDefault )
WriteValue( 62, ColorStringToDXFColor( poSymbol->Color(bDefault) ) );
}
delete poTool;
/* -------------------------------------------------------------------- */
/* Write location. */
/* -------------------------------------------------------------------- */
OGRPoint *poPoint = (OGRPoint *) poFeature->GetGeometryRef();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
/* -------------------------------------------------------------------- */
/* Write scaling. */
/* -------------------------------------------------------------------- */
int nScaleCount;
const double *padfScale =
poFeature->GetFieldAsDoubleList( "BlockScale", &nScaleCount );
if( nScaleCount == 3 )
{
WriteValue( 41, padfScale[0] );
WriteValue( 42, padfScale[1] );
WriteValue( 43, padfScale[2] );
}
/* -------------------------------------------------------------------- */
/* Write rotation. */
/* -------------------------------------------------------------------- */
double dfAngle = poFeature->GetFieldAsDouble( "BlockAngle" );
if( dfAngle != 0.0 )
{
WriteValue( 50, dfAngle ); // degrees
}
return OGRERR_NONE;
}