void OGRNASDataSource::PopulateRelations()

{
    GMLFeature  *poFeature;

    poReader->ResetReading();
    while( (poFeature = poReader->NextFeature()) != NULL )
    {
        char **papszOBProperties = poFeature->GetOBProperties();
        int i;

        for( i = 0; papszOBProperties != NULL && papszOBProperties[i] != NULL;
             i++ )
        {
            const GMLProperty *psGMLId = poFeature->GetProperty( "gml_id" );
            char *pszName = NULL;
            const char *pszValue = CPLParseNameValue( papszOBProperties[i], 
                                                      &pszName );

            if( EQUALN(pszValue,"urn:adv:oid:",12) 
                && psGMLId != NULL && psGMLId->nSubProperties == 1 )
            {
                poRelationLayer->AddRelation( psGMLId->papszSubProperties[0],
                                              pszName, 
                                              pszValue + 12 );
            }
            CPLFree( pszName );
        }
        
        delete poFeature;
    }

    poRelationLayer->MarkRelationsPopulated();
}
示例#2
0
void OGRNASDataSource::PopulateRelations()

{
    poReader->ResetReading();

    GMLFeature  *poFeature = NULL;
    while( (poFeature = poReader->NextFeature()) != NULL )
    {
        char **papszOBProperties = poFeature->GetOBProperties();

        for( int i = 0;
             papszOBProperties != NULL && papszOBProperties[i] != NULL;
             i++ )
        {
            const int nGMLIdIndex =
                poFeature->GetClass()->GetPropertyIndex( "gml_id" );
            const GMLProperty *psGMLId =
              (nGMLIdIndex >= 0) ? poFeature->GetProperty(nGMLIdIndex ) : NULL;
            char *l_pszName = NULL;
            const char *pszValue = CPLParseNameValue( papszOBProperties[i],
                                                      &l_pszName );

            if( STARTS_WITH_CI(pszValue, "urn:adv:oid:")
                && psGMLId != NULL && psGMLId->nSubProperties == 1 )
            {
                poRelationLayer->AddRelation( psGMLId->papszSubProperties[0],
                                              l_pszName,
                                              pszValue + 12 );
            }
            CPLFree( l_pszName );
        }

        delete poFeature;
    }

    poRelationLayer->MarkRelationsPopulated();
}