]> git.mxchange.org Git - flightgear.git/commitdiff
Generalized the routines a bit to make them more useful.
authorcurt <curt>
Mon, 1 Mar 1999 15:35:52 +0000 (15:35 +0000)
committercurt <curt>
Mon, 1 Mar 1999 15:35:52 +0000 (15:35 +0000)
Polygon/names.cxx
Polygon/names.hxx

index d01dd9b8d194d348d5bb1f1e788770e9cc51eb9a..6d94f88c1b5b0842961e33a15d3f325fdb107a34 100644 (file)
@@ -29,7 +29,7 @@
 
 
 // return the type of the shapefile record
-AreaType get_area_type(GDBFile *dbf, int rec) {
+AreaType get_shapefile_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
@@ -47,6 +47,8 @@ AreaType get_area_type(GDBFile *dbf, int rec) {
     // parse it into individual fields
     if ( dbf_rec ) {
        fields = dbf->recordDeform( dbf_rec );
+    } else {
+       return UnknownArea;
     }
 
     string area = fields[4].str_v;
@@ -63,11 +65,18 @@ AreaType get_area_type(GDBFile *dbf, int rec) {
        area = area.substr(0, area.length() - 1);
     }
 
+    return get_area_type( area );
+}
+
+
+// return area type from text name
+AreaType get_area_type( string area ) {
     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" ) {
        return OceanArea;
@@ -75,7 +84,8 @@ AreaType get_area_type(GDBFile *dbf, int rec) {
        return LakeArea;
     } else if ( area == "Lake   Dry" ) {
        return DryLakeArea;
-    } else if ( area == "Lake   Intermittent" ) {
+    } else if ( (area == "Lake   Intermittent")
+               || (area == "IntermittentLake") ) {
        return IntLakeArea;
     } else if ( area == "Reservoir" ) {
        return ReservoirArea;
@@ -94,15 +104,15 @@ 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 ) {
        return "AirportKeep";
@@ -140,6 +150,9 @@ string get_area_name( AreaType area ) {
 
 
 // $Log$
+// 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.
 //
index ce6236ee3529031d6bb322ab06f08d78d0b9fda8..168df64d86c9a1b066d1337503a30020a4943b85 100644 (file)
@@ -60,7 +60,10 @@ enum AreaType {
 
 
 // return the type of the shapefile record
-AreaType get_area_type(GDBFile *dbf, int rec);
+AreaType get_shapefile_type(GDBFile *dbf, int rec);
+
+// return area type from text name
+AreaType get_area_type( string area );
 
 // return text form of area name
 string get_area_name( AreaType area );
@@ -70,6 +73,9 @@ string get_area_name( AreaType area );
 
 
 // $Log$
+// Revision 1.3  1999/03/01 15:35:53  curt
+// Generalized the routines a bit to make them more useful.
+//
 // Revision 1.2  1999/02/26 22:10:42  curt
 // Updated names and priorities of area types.
 //