OGRXPlaneNDBLayer::OGRXPlaneNDBLayer() : OGRXPlaneLayer("NDB") { poFeatureDefn->SetGeomType( wkbPoint ); OGRFieldDefn oFieldID("navaid_id", OFTString ); oFieldID.SetWidth( 4 ); poFeatureDefn->AddFieldDefn( &oFieldID ); OGRFieldDefn oFieldName("navaid_name", OFTString ); poFeatureDefn->AddFieldDefn( &oFieldName ); OGRFieldDefn oFieldSubType("subtype", OFTString ); oFieldSubType.SetWidth( 10 ); poFeatureDefn->AddFieldDefn( &oFieldSubType ); OGRFieldDefn oFieldElev("elevation_m", OFTReal ); oFieldElev.SetWidth( 8 ); oFieldElev.SetPrecision( 2 ); poFeatureDefn->AddFieldDefn( &oFieldElev ); OGRFieldDefn oFieldFreq("freq_khz", OFTReal ); oFieldFreq.SetWidth( 7 ); oFieldFreq.SetPrecision( 3 ); poFeatureDefn->AddFieldDefn( &oFieldFreq ); OGRFieldDefn oFieldRange("range_km", OFTReal ); oFieldRange.SetWidth( 7 ); oFieldRange.SetPrecision( 3 ); poFeatureDefn->AddFieldDefn( &oFieldRange ); }
OGRXPlaneGSLayer::OGRXPlaneGSLayer() : OGRXPlaneLayer("GS") { poFeatureDefn->SetGeomType( wkbPoint ); OGRFieldDefn oFieldID("navaid_id", OFTString ); oFieldID.SetWidth( 4 ); poFeatureDefn->AddFieldDefn( &oFieldID ); OGRFieldDefn oFieldAptICAO("apt_icao", OFTString ); oFieldAptICAO.SetWidth( 5 ); poFeatureDefn->AddFieldDefn( &oFieldAptICAO ); OGRFieldDefn oFieldRwyNum("rwy_num", OFTString ); oFieldRwyNum.SetWidth( 3 ); poFeatureDefn->AddFieldDefn( &oFieldRwyNum ); OGRFieldDefn oFieldElev("elevation_m", OFTReal ); oFieldElev.SetWidth( 8 ); oFieldElev.SetPrecision( 2 ); poFeatureDefn->AddFieldDefn( &oFieldElev ); OGRFieldDefn oFieldFreq("freq_mhz", OFTReal ); oFieldFreq.SetWidth( 7 ); oFieldFreq.SetPrecision( 3 ); poFeatureDefn->AddFieldDefn( &oFieldFreq ); OGRFieldDefn oFieldRange("range_km", OFTReal ); oFieldRange.SetWidth( 7 ); oFieldRange.SetPrecision( 3 ); poFeatureDefn->AddFieldDefn( &oFieldRange ); OGRFieldDefn oFieldTrueHeading("true_heading_deg", OFTReal ); oFieldTrueHeading.SetWidth( 6 ); oFieldTrueHeading.SetPrecision( 2 ); poFeatureDefn->AddFieldDefn( &oFieldTrueHeading ); OGRFieldDefn oFieldGlideSlope("glide_slope", OFTReal ); oFieldGlideSlope.SetWidth( 6 ); oFieldGlideSlope.SetPrecision( 2 ); poFeatureDefn->AddFieldDefn( &oFieldGlideSlope ); }
OGRXPlaneDMEILSLayer::OGRXPlaneDMEILSLayer() : OGRXPlaneLayer("DMEILS") { poFeatureDefn->SetGeomType( wkbPoint ); OGRFieldDefn oFieldID("navaid_id", OFTString ); oFieldID.SetWidth( 4 ); poFeatureDefn->AddFieldDefn( &oFieldID ); OGRFieldDefn oFieldAptICAO("apt_icao", OFTString ); oFieldAptICAO.SetWidth( 5 ); poFeatureDefn->AddFieldDefn( &oFieldAptICAO ); OGRFieldDefn oFieldRwyNum("rwy_num", OFTString ); oFieldRwyNum.SetWidth( 3 ); poFeatureDefn->AddFieldDefn( &oFieldRwyNum ); OGRFieldDefn oFieldElev("elevation_m", OFTReal ); oFieldElev.SetWidth( 8 ); oFieldElev.SetPrecision( 2 ); poFeatureDefn->AddFieldDefn( &oFieldElev ); OGRFieldDefn oFieldFreq("freq_mhz", OFTReal ); oFieldFreq.SetWidth( 7 ); oFieldFreq.SetPrecision( 3 ); poFeatureDefn->AddFieldDefn( &oFieldFreq ); OGRFieldDefn oFieldRange("range_km", OFTReal ); oFieldRange.SetWidth( 7 ); oFieldRange.SetPrecision( 3 ); poFeatureDefn->AddFieldDefn( &oFieldRange ); OGRFieldDefn oFieldBias("bias_km", OFTReal ); oFieldBias.SetWidth( 6 ); oFieldBias.SetPrecision( 2 ); poFeatureDefn->AddFieldDefn( &oFieldBias ); }
OGRBNALayer::OGRBNALayer( const char *pszFilename, const char* layerName, BNAFeatureType bnaFeatureType, OGRwkbGeometryType eLayerGeomType, int bWriter, OGRBNADataSource* poDS, int nIDs) { eof = FALSE; failed = FALSE; curLine = 0; nNextFID = 0; this->bWriter = bWriter; this->poDS = poDS; this->nIDs = nIDs; nFeatures = 0; partialIndexTable = TRUE; offsetAndLineFeaturesTable = NULL; const char* iKnowHowToCount[] = { "Primary", "Secondary", "Third", "Fourth", "Fifth" }; char tmp[32]; poFeatureDefn = new OGRFeatureDefn( CPLSPrintf("%s_%s", CPLGetBasename( pszFilename ) , layerName )); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( eLayerGeomType ); this->bnaFeatureType = bnaFeatureType; if (! bWriter ) { int i; for(i=0;i<nIDs;i++) { if (i < (int) (sizeof(iKnowHowToCount)/sizeof(iKnowHowToCount[0])) ) { sprintf(tmp, "%s ID", iKnowHowToCount[i]); OGRFieldDefn oFieldID(tmp, OFTString ); poFeatureDefn->AddFieldDefn( &oFieldID ); } else { sprintf(tmp, "%dth ID", i+1); OGRFieldDefn oFieldID(tmp, OFTString ); poFeatureDefn->AddFieldDefn( &oFieldID ); } } if (bnaFeatureType == BNA_ELLIPSE) { OGRFieldDefn oFieldMajorRadius( "Major radius", OFTReal ); poFeatureDefn->AddFieldDefn( &oFieldMajorRadius ); OGRFieldDefn oFieldMinorRadius( "Minor radius", OFTReal ); poFeatureDefn->AddFieldDefn( &oFieldMinorRadius ); } fpBNA = VSIFOpenL( pszFilename, "rb" ); if( fpBNA == NULL ) return; } else { fpBNA = NULL; } }
OGRBNALayer::OGRBNALayer( const char *pszFilename, const char* layerName, BNAFeatureType bnaFeatureTypeIn, OGRwkbGeometryType eLayerGeomType, int bWriterIn, OGRBNADataSource* poDSIn, int nIDsIn) : poDS(poDSIn), bWriter(bWriterIn), nIDs(nIDsIn), eof(FALSE), failed(FALSE), curLine(0), nNextFID(0), nFeatures(0), partialIndexTable(TRUE), offsetAndLineFeaturesTable(NULL) { static const char* const iKnowHowToCount[] = { "Primary", "Secondary", "Third", "Fourth", "Fifth" }; char tmp[32]; poFeatureDefn = new OGRFeatureDefn( CPLSPrintf( "%s_%s", CPLGetBasename( pszFilename ), layerName )); poFeatureDefn->Reference(); poFeatureDefn->SetGeomType( eLayerGeomType ); SetDescription( poFeatureDefn->GetName() ); this->bnaFeatureType = bnaFeatureTypeIn; if (! bWriter ) { for(int i=0;i<nIDs;i++) { if (i < static_cast<int>( sizeof(iKnowHowToCount)/sizeof(iKnowHowToCount[0]) ) ) { snprintf(tmp, sizeof(tmp), "%s ID", iKnowHowToCount[i]); OGRFieldDefn oFieldID(tmp, OFTString ); poFeatureDefn->AddFieldDefn( &oFieldID ); } else { snprintf(tmp, sizeof(tmp), "%dth ID", i+1); OGRFieldDefn oFieldID(tmp, OFTString ); poFeatureDefn->AddFieldDefn( &oFieldID ); } } if (bnaFeatureType == BNA_ELLIPSE) { OGRFieldDefn oFieldMajorRadius( "Major radius", OFTReal ); poFeatureDefn->AddFieldDefn( &oFieldMajorRadius ); OGRFieldDefn oFieldMinorRadius( "Minor radius", OFTReal ); poFeatureDefn->AddFieldDefn( &oFieldMinorRadius ); } fpBNA = VSIFOpenL( pszFilename, "rb" ); if( fpBNA == NULL ) return; } else { fpBNA = NULL; } }