- return in >> a.id >> a.latitude >> a.longitude >> a.elevation;
-}
-
-
-FGAirports::FGAirports( const string& file ) {
- // open the specified database readonly
- storage = new c4_Storage( file.c_str(), false );
-
- if ( !storage->Strategy().IsValid() ) {
- SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << file );
- exit(-1);
- }
-
- vAirport = new c4_View;
- *vAirport =
- storage->GetAs("airport[ID:S,Longitude:F,Latitude:F,Elevation:F]");
-}
-
-
-// search for the specified id
-bool
-FGAirports::search( const string& id, FGAirport* a ) const
-{
- c4_StringProp pID ("ID");
- c4_FloatProp pLon ("Longitude");
- c4_FloatProp pLat ("Latitude");
- c4_FloatProp pElev ("Elevation");
-
- int idx = vAirport->Find(pID[id.c_str()]);
- cout << "idx = " << idx << endl;
-
- if ( idx == -1 ) {
- return false;
- }
-
- c4_RowRef r = vAirport->GetAt(idx);
- a->id = (const char *) pID(r); /// NHV fix wrong case crash
- a->longitude = (double) pLon(r);
- a->latitude = (double) pLat(r);
- a->elevation = (double) pElev(r);
-
- return true;
-}
-
-
-FGAirport
-FGAirports::search( const string& id ) const
-{
- FGAirport a;
- search( id, &a );
- return a;
-}
-
-
-// Destructor
-FGAirports::~FGAirports( void ) {
- delete storage;
-}