Ejemplo n.º 1
0
int OGRFeatureDefn::IsSame( OGRFeatureDefn * poOtherFeatureDefn )
{
    if (strcmp(GetName(), poOtherFeatureDefn->GetName()) == 0 &&
        GetFieldCount() == poOtherFeatureDefn->GetFieldCount() &&
        GetGeomFieldCount() == poOtherFeatureDefn->GetGeomFieldCount())
    {
        int i;
        for(i=0;i<nFieldCount;i++)
        {
            const OGRFieldDefn* poFldDefn = GetFieldDefn(i);
            const OGRFieldDefn* poOtherFldDefn = poOtherFeatureDefn->GetFieldDefn(i);
            if (!poFldDefn->IsSame(poOtherFldDefn))
            {
                return FALSE;
            }
        }
        for(i=0;i<nGeomFieldCount;i++)
        {
            OGRGeomFieldDefn* poGFldDefn = GetGeomFieldDefn(i);
            OGRGeomFieldDefn* poOtherGFldDefn =
                poOtherFeatureDefn->GetGeomFieldDefn(i);
            if (!poGFldDefn->IsSame(poOtherGFldDefn))
            {
                return FALSE;
            }
        }
        return TRUE;
    }
    return FALSE;
}
Ejemplo n.º 2
0
/**
 * \fn OGRwkbGeometryType OGRFeatureDefn::GetGeomType();
 *
 * \brief Fetch the geometry base type.
 *
 * Note that some drivers are unable to determine a specific geometry
 * type for a layer, in which case wkbUnknown is returned.  A value of
 * wkbNone indicates no geometry is available for the layer at all.
 * Many drivers do not properly mark the geometry
 * type as 25D even if some or all geometries are in fact 25D.  A few (broken)
 * drivers return wkbPolygon for layers that also include wkbMultiPolygon.  
 *
 * Starting with GDAL 1.11, this method returns GetGeomFieldDefn(0)->GetType().
 *
 * This method is the same as the C function OGR_FD_GetGeomType().
 *
 * @return the base type for all geometry related to this definition.
 */
OGRwkbGeometryType OGRFeatureDefn::GetGeomType()
{
    if( GetGeomFieldCount() == 0 )
        return wkbNone;
    OGRwkbGeometryType eType = GetGeomFieldDefn(0)->GetType();
    if( eType == (wkbUnknown | wkb25DBitInternalUse) && CSLTestBoolean(CPLGetConfigOption("QGIS_HACK", "NO")) )
        eType = wkbUnknown;
    return eType;
}
Ejemplo n.º 3
0
int OGRFeatureDefn::GetGeomFieldIndex( const char * pszGeomFieldName )

{
    GetGeomFieldCount();
    for( int i = 0; i < nGeomFieldCount; i++ )
    {
        if( EQUAL(pszGeomFieldName, GetGeomFieldDefn(i)->GetNameRef() ) )
            return i;
    }

    return -1;
}
Ejemplo n.º 4
0
void OGRFeatureDefn::SetGeomType( OGRwkbGeometryType eNewType )

{
    if( GetGeomFieldCount() > 0 )
    {
        if( GetGeomFieldCount() == 1 && eNewType == wkbNone )
            DeleteGeomFieldDefn(0);
        else
            GetGeomFieldDefn(0)->SetType(eNewType);
    }
    else if( eNewType != wkbNone )
    {
        OGRGeomFieldDefn oGeomFieldDefn( "", eNewType );
        AddGeomFieldDefn(&oGeomFieldDefn);
    }
}
Ejemplo n.º 5
0
OGRFeatureDefn *OGRFeatureDefn::Clone()

{
    int i;
    OGRFeatureDefn *poCopy;

    poCopy = new OGRFeatureDefn( GetName() );

    GetFieldCount();
    for( i = 0; i < nFieldCount; i++ )
        poCopy->AddFieldDefn( GetFieldDefn( i ) );

    /* There is a default geometry field created at OGRFeatureDefn instanciation */
    poCopy->DeleteGeomFieldDefn(0);
    GetGeomFieldCount();
    for( i = 0; i < nGeomFieldCount; i++ )
        poCopy->AddGeomFieldDefn( GetGeomFieldDefn( i ) );

    return poCopy;
}
Ejemplo n.º 6
0
void OGRFeatureDefn::SetGeometryIgnored( int bIgnore )
{
    if( GetGeomFieldCount() > 0 )
        GetGeomFieldDefn(0)->SetIgnored(bIgnore);
}
Ejemplo n.º 7
0
int OGRFeatureDefn::IsGeometryIgnored()
{
    if( GetGeomFieldCount() == 0 )
        return FALSE;
    return GetGeomFieldDefn(0)->IsIgnored();
}
Ejemplo n.º 8
0
/**
 * \fn OGRwkbGeometryType OGRFeatureDefn::GetGeomType();
 *
 * \brief Fetch the geometry base type.
 *
 * Note that some drivers are unable to determine a specific geometry
 * type for a layer, in which case wkbUnknown is returned.  A value of
 * wkbNone indicates no geometry is available for the layer at all.
 * Many drivers do not properly mark the geometry
 * type as 25D even if some or all geometries are in fact 25D.  A few (broken)
 * drivers return wkbPolygon for layers that also include wkbMultiPolygon.  
 *
 * Starting with GDAL 1.11, this method returns GetGeomFieldDefn(0)->GetType().
 *
 * This method is the same as the C function OGR_FD_GetGeomType().
 *
 * @return the base type for all geometry related to this definition.
 */
OGRwkbGeometryType OGRFeatureDefn::GetGeomType()
{
    if( GetGeomFieldCount() == 0 )
        return wkbNone;
    return GetGeomFieldDefn(0)->GetType();
}