]> git.mxchange.org Git - flightgear.git/blobdiff - Polygon/names.cxx
Version 0.6.0
[flightgear.git] / Polygon / names.cxx
index d01dd9b8d194d348d5bb1f1e788770e9cc51eb9a..2633d19a6b39dd66a9d88d4afef136316058b28c 100644 (file)
 #include "names.hxx"
 
 
-// return the type of the shapefile record
-AreaType get_area_type(GDBFile *dbf, int rec) {
-    GDBFieldDesc *fdesc[128];  // 128 is an arbitrary number here
-    GDBFValue *fields;         //an array of field values
-    char* dbf_rec;             //a record containing all the fields
-
-    // grab the meta-information for all the fields
-    // this applies to all the records in the DBF file.
-    // for ( int i = 0; i < dbf->numFields(); i++ ) {
-    //   fdesc[i] = dbf->getFieldDesc(i);
-    //   cout << i << ") " << fdesc[i]->name << endl;
-    // }
-
-    // this is the whole name record
-    dbf_rec = dbf->getRecord( rec );
-
-    // parse it into individual fields
-    if ( dbf_rec ) {
-       fields = dbf->recordDeform( dbf_rec );
-    }
-
-    string area = fields[4].str_v;
-    // strip leading spaces
-    while ( area[0] == ' ' ) {
-       area = area.substr(1, area.length() - 1);
-    }
-    // strip trailing spaces
-    while ( area[area.length() - 1] == ' ' ) {
-       area = area.substr(0, area.length() - 1);
-    }
-    // strip other junk encountered
-    while ( (int)area[area.length() - 1] == 9 ) {
-       area = area.substr(0, area.length() - 1);
-    }
-
-    if ( area == "AirportKeep" ) {
+// return area type from text name
+AreaType get_area_type( string area ) {
+    if ( area == "Default" ) {
+       return DefaultArea;
+    } else if ( area == "AirportKeep" ) {
        return AirportKeepArea;
     } else if ( area == "AirportIgnore" ) {
        return AirportIgnoreArea;
-    } else if ( area == "Swamp or Marsh" ) {
+    } else if ( (area == "Swamp or Marsh")
+               || (area == "Marsh") ) {
        return MarshArea;
-    } else if ( area == "Bay  Estuary or Ocean" ) {
+    } else if ( (area == "Bay  Estuary or Ocean")
+                || (area == "Ocean") ) {
        return OceanArea;
     } else if ( area == "Lake" ) {
        return LakeArea;
-    } else if ( area == "Lake   Dry" ) {
+    } else if ( (area == "Lake   Dry")
+               || (area == "DryLake") ) {
        return DryLakeArea;
-    } else if ( area == "Lake   Intermittent" ) {
+    } else if ( (area == "Lake   Intermittent")
+               || (area == "IntermittentLake") ) {
        return IntLakeArea;
     } else if ( area == "Reservoir" ) {
        return ReservoirArea;
-    } else if ( area == "Reservoir   Intermittent" ) {
+    } else if ( (area == "Reservoir   Intermittent")
+               || (area == "IntermittentReservoir") ) {
        return IntReservoirArea;
     } else if ( area == "Stream" ) {
        return StreamArea;
@@ -94,17 +68,19 @@ AreaType get_area_type(GDBFile *dbf, int rec) {
     } else {
        cout << "unknown area = '" << area << "'" << endl;
        // cout << "area = " << area << endl;
-       for ( int i = 0; i < area.length(); i++ ) {
-           cout << i << ") " << (int)area[i] << endl;
-       }
+       // for ( int i = 0; i < area.length(); i++ ) {
+       //  cout << i << ") " << (int)area[i] << endl;
+       // }
        return UnknownArea;
     }
 }
 
 
-// return text form of area name
+// return text from of area name
 string get_area_name( AreaType area ) {
-    if ( area == AirportKeepArea ) {
+    if ( area == DefaultArea ) {
+       return "Default";
+    } else if ( area == AirportKeepArea ) {
        return "AirportKeep";
     } else if ( area == AirportIgnoreArea ) {
        return "AirportIgnore";
@@ -140,6 +116,28 @@ string get_area_name( AreaType area ) {
 
 
 // $Log$
+// Revision 1.7  1999/04/01 13:52:13  curt
+// Version 0.6.0
+// Shape name tweak.
+// Removing tool: FixNode
+//
+// Revision 1.6  1999/03/27 05:31:24  curt
+// Make 0 the default area type since this corresponds well with the conventions
+//   used by the triangulator.
+//
+// Revision 1.5  1999/03/22 23:49:29  curt
+// Moved AreaType get_shapefile_type(GDBFile *dbf, int rec) to where it
+// belongs in ShapeFile/
+//
+// Revision 1.4  1999/03/13 18:47:04  curt
+// Removed an unused variable.
+//
+// Revision 1.3  1999/03/02 01:03:58  curt
+// Added more reverse lookup support.
+//
+// Revision 1.2  1999/03/01 15:35:52  curt
+// Generalized the routines a bit to make them more useful.
+//
 // Revision 1.1  1999/02/25 21:30:24  curt
 // Initial revision.
 //