1
0
Fork 0

Moved AreaType get_shapefile_type(GDBFile *dbf, int rec) to where it

belongs in ShapeFile/
This commit is contained in:
curt 1999-03-22 23:49:29 +00:00
parent 4c1565c869
commit 4525fcbd55
3 changed files with 53 additions and 55 deletions

View file

@ -28,47 +28,6 @@
#include "names.hxx" #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 // return area type from text name
AreaType get_area_type( string area ) { AreaType get_area_type( string area ) {
if ( area == "AirportKeep" ) { if ( area == "AirportKeep" ) {
@ -151,6 +110,10 @@ string get_area_name( AreaType area ) {
// $Log$ // $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 // Revision 1.4 1999/03/13 18:47:04 curt
// Removed an unused variable. // Removed an unused variable.
// //

View file

@ -26,17 +26,6 @@
#define _NAMES_HXX #define _NAMES_HXX
// libgfc.a includes need this bit o' strangeness
#if defined ( linux )
# define _LINUX_
#endif
#include <gfc/gadt_polygon.h>
#include <gfc/gdbf.h>
#undef E
#undef DEG_TO_RAD
#undef RAD_TO_DEG
// Posible shape file types. Note the order of these is important and // Posible shape file types. Note the order of these is important and
// defines the priority of these shapes if they should intersect. The // defines the priority of these shapes if they should intersect. The
// smaller the number, the higher the priority. // 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 // return area type from text name
AreaType get_area_type( string area ); AreaType get_area_type( string area );
@ -73,6 +59,10 @@ string get_area_name( AreaType area );
// $Log$ // $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 // Revision 1.3 1999/03/01 15:35:53 curt
// Generalized the routines a bit to make them more useful. // Generalized the routines a bit to make them more useful.
// //

View file

@ -53,6 +53,47 @@ extern "C" {
#include "shape.hxx" #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 ) { int main( int argc, char **argv ) {
gpc_polygon gpc_shape; gpc_polygon gpc_shape;
int i, j; int i, j;
@ -265,6 +306,10 @@ int main( int argc, char **argv ) {
// $Log$ // $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 // Revision 1.7 1999/03/17 23:51:29 curt
// Changed polygon index counter file. // Changed polygon index counter file.
// //