OGRNTFRasterLayer::OGRNTFRasterLayer( OGRNTFDataSource *poDSIn, NTFFileReader * poReaderIn ) { char szLayerName[128]; sprintf( szLayerName, "DTM_%s", poReaderIn->GetTileName() ); poFeatureDefn = new OGRFeatureDefn( szLayerName ); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( wkbPoint25D ); OGRFieldDefn oHeight( "HEIGHT", OFTReal ); poFeatureDefn->AddFieldDefn( &oHeight ); poReader = poReaderIn; poDS = poDSIn; poFilterGeom = NULL; pafColumn = (float *) CPLCalloc(sizeof(float), poReader->GetRasterYSize()); iColumnOffset = -1; iCurrentFC = 0; /* -------------------------------------------------------------------- */ /* Check for DEM subsampling, and compute total feature count */ /* accordingly. */ /* -------------------------------------------------------------------- */ if( poDS->GetOption( "DEM_SAMPLE" ) == NULL ) nDEMSample = 1; else nDEMSample = MAX(1,atoi(poDS->GetOption("DEM_SAMPLE"))); nFeatureCount = (poReader->GetRasterXSize() / nDEMSample) * (poReader->GetRasterYSize() / nDEMSample); }
int OGRAVCLayer::SetupFeatureDefinition( const char *pszName ) { bool bRet = false; switch( eSectionType ) { case AVCFileARC: { poFeatureDefn = new OGRFeatureDefn( pszName ); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( wkbLineString ); OGRFieldDefn oUserId( "UserId", OFTInteger ); OGRFieldDefn oFNode( "FNODE_", OFTInteger ); OGRFieldDefn oTNode( "TNODE_", OFTInteger ); OGRFieldDefn oLPoly( "LPOLY_", OFTInteger ); OGRFieldDefn oRPoly( "RPOLY_", OFTInteger ); poFeatureDefn->AddFieldDefn( &oUserId ); poFeatureDefn->AddFieldDefn( &oFNode ); poFeatureDefn->AddFieldDefn( &oTNode ); poFeatureDefn->AddFieldDefn( &oLPoly ); poFeatureDefn->AddFieldDefn( &oRPoly ); bRet = true; break; } case AVCFilePAL: case AVCFileRPL: { poFeatureDefn = new OGRFeatureDefn( pszName ); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( wkbPolygon ); OGRFieldDefn oArcIds( "ArcIds", OFTIntegerList ); poFeatureDefn->AddFieldDefn( &oArcIds ); bRet = true; break; } case AVCFileCNT: { poFeatureDefn = new OGRFeatureDefn( pszName ); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( wkbPoint ); OGRFieldDefn oLabelIds( "LabelIds", OFTIntegerList ); poFeatureDefn->AddFieldDefn( &oLabelIds ); bRet = true; break; } case AVCFileLAB: { poFeatureDefn = new OGRFeatureDefn( pszName ); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( wkbPoint ); OGRFieldDefn oValueId( "ValueId", OFTInteger ); poFeatureDefn->AddFieldDefn( &oValueId ); OGRFieldDefn oPolyId( "PolyId", OFTInteger ); poFeatureDefn->AddFieldDefn( &oPolyId ); bRet = true; break; } case AVCFileTXT: case AVCFileTX6: { poFeatureDefn = new OGRFeatureDefn( pszName ); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( wkbPoint ); OGRFieldDefn oUserId( "UserId", OFTInteger ); poFeatureDefn->AddFieldDefn( &oUserId ); OGRFieldDefn oText( "Text", OFTString ); poFeatureDefn->AddFieldDefn( &oText ); OGRFieldDefn oHeight( "Height", OFTReal ); poFeatureDefn->AddFieldDefn( &oHeight ); OGRFieldDefn oLevel( "Level", OFTInteger ); poFeatureDefn->AddFieldDefn( &oLevel ); bRet = true; break; } default: poFeatureDefn = NULL; break; } SetDescription( pszName ); return bRet; }