本文整理汇总了C++中GMLFeature::SetPropertyDirectly方法的典型用法代码示例。如果您正苦于以下问题:C++ GMLFeature::SetPropertyDirectly方法的具体用法?C++ GMLFeature::SetPropertyDirectly怎么用?C++ GMLFeature::SetPropertyDirectly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMLFeature
的用法示例。
在下文中一共展示了GMLFeature::SetPropertyDirectly方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetFeaturePropertyDirectly
void NASReader::SetFeaturePropertyDirectly( const char *pszElement,
char *pszValue )
{
GMLFeature *poFeature = GetState()->m_poFeature;
CPLAssert( poFeature != NULL );
/* -------------------------------------------------------------------- */
/* Does this property exist in the feature class? If not, add */
/* it. */
/* -------------------------------------------------------------------- */
GMLFeatureClass *poClass = poFeature->GetClass();
int iProperty;
for( iProperty=0; iProperty < poClass->GetPropertyCount(); iProperty++ )
{
if( EQUAL(poClass->GetProperty( iProperty )->GetSrcElement(),
pszElement ) )
break;
}
if( iProperty == poClass->GetPropertyCount() )
{
if( poClass->IsSchemaLocked() )
{
CPLDebug("NAS","Encountered property missing from class schema.");
CPLFree(pszValue);
return;
}
CPLString osFieldName;
if( strchr(pszElement,'|') == NULL )
osFieldName = pszElement;
else
{
osFieldName = strrchr(pszElement,'|') + 1;
if( poClass->GetPropertyIndex(osFieldName) != -1 )
osFieldName = pszElement;
}
// Does this conflict with an existing property name?
while( poClass->GetProperty(osFieldName) != NULL )
{
osFieldName += "_";
}
GMLPropertyDefn *poPDefn = new GMLPropertyDefn(osFieldName,pszElement);
if( EQUAL(CPLGetConfigOption( "GML_FIELDTYPES", ""), "ALWAYS_STRING") )
poPDefn->SetType( GMLPT_String );
poClass->AddProperty( poPDefn );
}
/* -------------------------------------------------------------------- */
/* We want to handle <lage> specially to ensure it is zero */
/* filled, and treated as a string depspite the numeric */
/* content. https://trac.wheregroup.com/PostNAS/ticket/9 */
/* -------------------------------------------------------------------- */
if( strcmp(poClass->GetProperty(iProperty)->GetName(),"lage") == 0 )
{
if( strlen(pszValue) < 5 )
{
CPLString osValue = "00000";
osValue += pszValue;
poFeature->SetPropertyDirectly( iProperty, CPLStrdup(osValue + osValue.size() - 5) );
CPLFree(pszValue);
}
else
poFeature->SetPropertyDirectly( iProperty, pszValue );
if( !poClass->IsSchemaLocked() )
{
poClass->GetProperty(iProperty)->SetWidth( 5 );
poClass->GetProperty(iProperty)->SetType( GMLPT_String );
}
return;
}
/* -------------------------------------------------------------------- */
/* Set the property */
/* -------------------------------------------------------------------- */
poFeature->SetPropertyDirectly( iProperty, pszValue );
/* -------------------------------------------------------------------- */
/* Do we need to update the property type? */
/* -------------------------------------------------------------------- */
if( !poClass->IsSchemaLocked() )
{
// Special handling for punktkennung per NAS #12
if( strcmp(poClass->GetProperty(iProperty)->GetName(),
"punktkennung") == 0)
{
poClass->GetProperty(iProperty)->SetWidth( 15 );
poClass->GetProperty(iProperty)->SetType( GMLPT_String );
}
// Special handling for artDerFlurstuecksgrenze per http://trac.osgeo.org/gdal/ticket/4255
//.........这里部分代码省略.........