本文整理汇总了C++中GMLFeature::SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ GMLFeature::SetProperty方法的具体用法?C++ GMLFeature::SetProperty怎么用?C++ GMLFeature::SetProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMLFeature
的用法示例。
在下文中一共展示了GMLFeature::SetProperty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetFeatureProperty
void GMLReader::SetFeatureProperty( const char *pszElement,
const 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("GML","Encountered property missing from class schema.");
return;
}
GMLPropertyDefn *poPDefn = new GMLPropertyDefn(pszElement,pszElement);
if( EQUAL(CPLGetConfigOption( "GML_FIELDTYPES", ""), "ALWAYS_STRING") )
poPDefn->SetType( GMLPT_String );
poClass->AddProperty( poPDefn );
}
/* -------------------------------------------------------------------- */
/* Set the property */
/* -------------------------------------------------------------------- */
poFeature->SetProperty( iProperty, pszValue );
/* -------------------------------------------------------------------- */
/* Do we need to update the property type? */
/* -------------------------------------------------------------------- */
if( !poClass->IsSchemaLocked() )
poClass->GetProperty( iProperty )->AnalysePropertyValue(pszValue);
}
示例2: SetFeatureProperty
void NASReader::SetFeatureProperty( const char *pszElement,
const 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("GML","Encountered property missing from class schema.");
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 );
}
/* -------------------------------------------------------------------- */
/* Set the property */
/* -------------------------------------------------------------------- */
poFeature->SetProperty( iProperty, pszValue );
/* -------------------------------------------------------------------- */
/* Do we need to update the property type? */
/* -------------------------------------------------------------------- */
if( !poClass->IsSchemaLocked() )
{
poClass->GetProperty(iProperty)->AnalysePropertyValue(
poFeature->GetProperty(iProperty));
}
}