From 4525fcbd5584a5e1baa54a92c859b83a17c046e8 Mon Sep 17 00:00:00 2001 From: curt Date: Mon, 22 Mar 1999 23:49:29 +0000 Subject: [PATCH] Moved AreaType get_shapefile_type(GDBFile *dbf, int rec) to where it belongs in ShapeFile/ --- Polygon/names.cxx | 45 ++++----------------------------------------- Polygon/names.hxx | 18 ++++-------------- ShapeFile/main.cxx | 45 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 55 deletions(-) diff --git a/Polygon/names.cxx b/Polygon/names.cxx index 7e6d2a320..eabd8697e 100644 --- a/Polygon/names.cxx +++ b/Polygon/names.cxx @@ -28,47 +28,6 @@ #include "names.hxx" -// return the type of the shapefile record -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 - - // 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 ); - } else { - return UnknownArea; - } - - 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); - } - - return get_area_type( area ); -} - - // return area type from text name AreaType get_area_type( string area ) { if ( area == "AirportKeep" ) { @@ -151,6 +110,10 @@ string get_area_name( AreaType area ) { // $Log$ +// 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. // diff --git a/Polygon/names.hxx b/Polygon/names.hxx index 168df64d8..78c85d339 100644 --- a/Polygon/names.hxx +++ b/Polygon/names.hxx @@ -26,17 +26,6 @@ #define _NAMES_HXX -// libgfc.a includes need this bit o' strangeness -#if defined ( linux ) -# define _LINUX_ -#endif -#include -#include -#undef E -#undef DEG_TO_RAD -#undef RAD_TO_DEG - - // Posible shape file types. Note the order of these is important and // defines the priority of these shapes if they should intersect. The // smaller the number, the higher the priority. @@ -59,9 +48,6 @@ enum AreaType { }; -// return the type of the shapefile record -AreaType get_shapefile_type(GDBFile *dbf, int rec); - // return area type from text name AreaType get_area_type( string area ); @@ -73,6 +59,10 @@ string get_area_name( AreaType area ); // $Log$ +// Revision 1.4 1999/03/22 23:49:30 curt +// Moved AreaType get_shapefile_type(GDBFile *dbf, int rec) to where it +// belongs in ShapeFile/ +// // Revision 1.3 1999/03/01 15:35:53 curt // Generalized the routines a bit to make them more useful. // diff --git a/ShapeFile/main.cxx b/ShapeFile/main.cxx index f85ec18b4..b0e629575 100644 --- a/ShapeFile/main.cxx +++ b/ShapeFile/main.cxx @@ -53,6 +53,47 @@ extern "C" { #include "shape.hxx" +// return the type of the shapefile record +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 + + // 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 ); + } else { + return UnknownArea; + } + + 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); + } + + return get_area_type( area ); +} + + int main( int argc, char **argv ) { gpc_polygon gpc_shape; int i, j; @@ -265,6 +306,10 @@ int main( int argc, char **argv ) { // $Log$ +// Revision 1.8 1999/03/22 23:49:36 curt +// Moved AreaType get_shapefile_type(GDBFile *dbf, int rec) to where it +// belongs in ShapeFile/ +// // Revision 1.7 1999/03/17 23:51:29 curt // Changed polygon index counter file. // -- 2.39.5