本文整理汇总了C++中GMLPropertyDefn::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ GMLPropertyDefn::GetName方法的具体用法?C++ GMLPropertyDefn::GetName怎么用?C++ GMLPropertyDefn::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMLPropertyDefn
的用法示例。
在下文中一共展示了GMLPropertyDefn::GetName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
OGRNASLayer *OGRNASDataSource::TranslateNASSchema( GMLFeatureClass *poClass )
{
OGRNASLayer *poLayer;
OGRwkbGeometryType eGType = wkbNone;
if( poClass->GetGeometryPropertyCount() != 0 )
{
eGType = (OGRwkbGeometryType) poClass->GetGeometryProperty(0)->GetType();
if( poClass->GetFeatureCount() == 0 )
eGType = wkbUnknown;
}
/* -------------------------------------------------------------------- */
/* Translate SRS. */
/* -------------------------------------------------------------------- */
const char* pszSRSName = poClass->GetSRSName();
OGRSpatialReference* poSRS = NULL;
if (pszSRSName)
{
int i;
poSRS = new OGRSpatialReference();
const char *pszHandle = strrchr( pszSRSName, ':' );
if( pszHandle != NULL )
pszHandle += 1;
for( i = 0; apszURNNames[i*2+0] != NULL; i++ )
{
const char *pszTarget = apszURNNames[i*2+0];
int nTLen = strlen(pszTarget);
// Are we just looking for a prefix match?
if( pszTarget[nTLen-1] == '*' )
{
if( EQUALN(pszTarget,pszHandle,nTLen-1) )
pszSRSName = apszURNNames[i*2+1];
}
else
{
if( EQUAL(pszTarget,pszHandle) )
pszSRSName = apszURNNames[i*2+1];
}
}
if (poSRS->SetFromUserInput(pszSRSName) != OGRERR_NONE)
{
CPLDebug( "NAS", "Failed to translate srsName='%s'",
pszSRSName );
delete poSRS;
poSRS = NULL;
}
}
/* -------------------------------------------------------------------- */
/* Create an empty layer. */
/* -------------------------------------------------------------------- */
poLayer = new OGRNASLayer( poClass->GetName(), poSRS, eGType, this );
delete poSRS;
/* -------------------------------------------------------------------- */
/* Added attributes (properties). */
/* -------------------------------------------------------------------- */
for( int iField = 0; iField < poClass->GetPropertyCount(); iField++ )
{
GMLPropertyDefn *poProperty = poClass->GetProperty( iField );
OGRFieldType eFType;
if( poProperty->GetType() == GMLPT_Untyped )
eFType = OFTString;
else if( poProperty->GetType() == GMLPT_String )
eFType = OFTString;
else if( poProperty->GetType() == GMLPT_Integer )
eFType = OFTInteger;
else if( poProperty->GetType() == GMLPT_Real )
eFType = OFTReal;
else if( poProperty->GetType() == GMLPT_StringList )
eFType = OFTStringList;
else if( poProperty->GetType() == GMLPT_IntegerList )
eFType = OFTIntegerList;
else if( poProperty->GetType() == GMLPT_RealList )
eFType = OFTRealList;
else
eFType = OFTString;
OGRFieldDefn oField( poProperty->GetName(), eFType );
if ( EQUALN(oField.GetNameRef(), "ogr:", 4) )
oField.SetName(poProperty->GetName()+4);
if( poProperty->GetWidth() > 0 )
oField.SetWidth( poProperty->GetWidth() );
poLayer->GetLayerDefn()->AddFieldDefn( &oField );
}
return poLayer;
}