SG-ified logstream.
This commit is contained in:
parent
f92570b07b
commit
9acc48acce
15 changed files with 113 additions and 113 deletions
src
Airports/GenAirports
BuildTiles
Lib/Polygon
Prep
DemChop
E00Lines
GSHHS
MergerClipper
ShapeFile
|
@ -63,7 +63,7 @@ int main( int argc, char **argv ) {
|
|||
char tmp[256];
|
||||
bool ready_to_go = true;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
// parse arguments
|
||||
string work_dir = "";
|
||||
|
@ -82,7 +82,7 @@ int main( int argc, char **argv ) {
|
|||
} else if ( arg.find("--nudge=") == 0 ) {
|
||||
nudge = atoi( arg.substr(8).c_str() );
|
||||
} else {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Usage " << argv[0] << " --input=<apt_file> "
|
||||
<< "--work=<work_dir> [ --start-id=abcd ] [ --nudge=n ]" );
|
||||
exit(-1);
|
||||
|
@ -94,13 +94,13 @@ int main( int argc, char **argv ) {
|
|||
cout << "Nudge = " << nudge << endl;
|
||||
|
||||
if ( work_dir == "" ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Error: no work directory specified." );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ( input_file == "" ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Error: no input file." );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ int main( int argc, char **argv ) {
|
|||
|
||||
fg_gzifstream in( input_file );
|
||||
if ( !in ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << input_file );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << input_file );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ int main( int argc, char **argv ) {
|
|||
// end of file
|
||||
break;
|
||||
} else {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Unknown line in file" << endl << line );
|
||||
exit(-1);
|
||||
}
|
||||
|
|
|
@ -66,12 +66,12 @@ bool FGClipper::load_polys(const string& path) {
|
|||
int hole_flag;
|
||||
double startx, starty, x, y, lastx, lasty;
|
||||
|
||||
FG_LOG( FG_CLIPPER, FG_INFO, "Loading " << path << " ..." );
|
||||
SG_LOG( SG_CLIPPER, SG_INFO, "Loading " << path << " ..." );
|
||||
|
||||
fg_gzifstream in( path );
|
||||
|
||||
if ( !in ) {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT, "Cannot open file: " << path );
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT, "Cannot open file: " << path );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ bool FGClipper::load_polys(const string& path) {
|
|||
in >> count;
|
||||
|
||||
if ( count < 3 ) {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT,
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT,
|
||||
"Polygon with less than 3 data points." );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ bool FGClipper::load_polys(const string& path) {
|
|||
p = Point3D(startx, starty, 0.0);
|
||||
// cout << "poly pt = " << p << endl;
|
||||
poly.add_node( i, p );
|
||||
FG_LOG( FG_CLIPPER, FG_BULK, "0 = "
|
||||
SG_LOG( SG_CLIPPER, SG_BULK, "0 = "
|
||||
<< startx << ", " << starty );
|
||||
|
||||
for ( j = 1; j < count - 1; ++j ) {
|
||||
|
@ -148,7 +148,7 @@ void FGClipper::add_poly( int area, const FGPolygon &poly )
|
|||
if ( area < FG_MAX_AREA_TYPES ) {
|
||||
polys_in.polys[area].push_back(poly);
|
||||
} else {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT, "Polygon type out of range = "
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT, "Polygon type out of range = "
|
||||
<< area);
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -291,7 +291,7 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
|||
|
||||
// gpcpoly_iterator current, last;
|
||||
|
||||
FG_LOG( FG_CLIPPER, FG_INFO, "Running master clipper" );
|
||||
SG_LOG( SG_CLIPPER, SG_INFO, "Running master clipper" );
|
||||
|
||||
accum.erase();
|
||||
|
||||
|
@ -344,7 +344,7 @@ bool FGClipper::clip_all(const point2d& min, const point2d& max) {
|
|||
// for ( ; current != last; ++current ) {
|
||||
for( j = 0; j < (int)polys_in.polys[i].size(); ++j ) {
|
||||
FGPolygon current = polys_in.polys[i][j];
|
||||
FG_LOG( FG_CLIPPER, FG_DEBUG, get_area_name( (AreaType)i )
|
||||
SG_LOG( SG_CLIPPER, SG_DEBUG, get_area_name( (AreaType)i )
|
||||
<< " = " << current.contours() );
|
||||
|
||||
// if not a hole, clip the area to the land_mask
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
int main( int argc, char **argv ) {
|
||||
point2d global_min, global_max;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
global_min.x = global_min.y = 200;
|
||||
global_max.y = global_max.x = -200;
|
||||
|
@ -40,7 +40,7 @@ int main( int argc, char **argv ) {
|
|||
clipper.init();
|
||||
|
||||
if ( argc < 2 ) {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT, "Usage: " << argv[0]
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT, "Usage: " << argv[0]
|
||||
<< " file1 file2 ..." );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ int main( int argc, char **argv ) {
|
|||
min.y = -180.0;
|
||||
max.y = 180.0;
|
||||
} else {
|
||||
FG_LOG ( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG ( SG_GENERAL, SG_ALERT,
|
||||
"Out of range latitude in clip_and_write_poly() = "
|
||||
<< c.y );
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ int main( int argc, char **argv ) {
|
|||
// do the clipping
|
||||
clipper.clip_all(global_min, global_max);
|
||||
|
||||
FG_LOG( FG_CLIPPER, FG_INFO, "finished main" );
|
||||
SG_LOG( SG_CLIPPER, SG_INFO, "finished main" );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -986,7 +986,7 @@ int main(int argc, char **argv) {
|
|||
double ydist = -1;
|
||||
long tile_id = -1;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
//
|
||||
// Parse the command-line arguments.
|
||||
|
|
|
@ -65,11 +65,11 @@ static void clip_and_write_poly( string root, long int p_index, AreaType area,
|
|||
min.sety( -180.0 );
|
||||
max.sety( 180.0 );
|
||||
} else {
|
||||
FG_LOG ( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG ( SG_GENERAL, SG_ALERT,
|
||||
"Out of range latitude in clip_and_write_poly() = " << c.y() );
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, " (" << min << ") (" << max << ")" );
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, " (" << min << ") (" << max << ")" );
|
||||
|
||||
// set up clipping tile
|
||||
base.add_node( 0, Point3D(min.x(), min.y(), 0) );
|
||||
|
@ -77,7 +77,7 @@ static void clip_and_write_poly( string root, long int p_index, AreaType area,
|
|||
base.add_node( 0, Point3D(max.x(), max.y(), 0) );
|
||||
base.add_node( 0, Point3D(min.x(), max.y(), 0) );
|
||||
|
||||
// FG_LOG( FG_GENERAL, FG_DEBUG, "base = 4 vertices" );
|
||||
// SG_LOG( SG_GENERAL, SG_DEBUG, "base = 4 vertices" );
|
||||
|
||||
/*
|
||||
FILE *bfp= fopen("base", "w");
|
||||
|
@ -158,15 +158,15 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
// get next polygon index
|
||||
index = poly_index_next();
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " min = " << min << " max = " << max );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " min = " << min << " max = " << max );
|
||||
|
||||
// find buckets for min, and max points of convex hull.
|
||||
// note to self: self, you should think about checking for
|
||||
// polygons that span the date line
|
||||
SGBucket b_min( min.x(), min.y() );
|
||||
SGBucket b_max( max.x(), max.y() );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " Bucket min = " << b_min );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " Bucket max = " << b_max );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " Bucket min = " << b_min );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " Bucket max = " << b_max );
|
||||
|
||||
if ( b_min == b_max ) {
|
||||
// shape entirely contained in a single bucket, write and bail
|
||||
|
@ -178,13 +178,13 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
int dx, dy;
|
||||
|
||||
sgBucketDiff(b_min, b_max, &dx, &dy);
|
||||
FG_LOG( FG_GENERAL, FG_INFO,
|
||||
SG_LOG( SG_GENERAL, SG_INFO,
|
||||
" polygon spans tile boundaries" );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " dx = " << dx
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " dx = " << dx
|
||||
<< " dy = " << dy );
|
||||
|
||||
if ( (dx > 2880) || (dy > 1440) ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"something is really wrong in split_polygon()!!!!" );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -217,7 +217,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
} else if ( clip_line >= 89.0 ) {
|
||||
clip_line = 90.0;
|
||||
} else {
|
||||
FG_LOG ( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG ( SG_GENERAL, SG_ALERT,
|
||||
"Out of range latitude in clip_and_write_poly() = "
|
||||
<< clip_line );
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
// structures to reduce memory use)
|
||||
//
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO,
|
||||
SG_LOG ( SG_GENERAL, SG_INFO,
|
||||
"Generating bottom half (" << min.y() << "-" <<
|
||||
clip_line << ")" );
|
||||
|
||||
|
@ -258,7 +258,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
// structures to reduce memory use)
|
||||
//
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO,
|
||||
SG_LOG ( SG_GENERAL, SG_INFO,
|
||||
"Generating top half (" << clip_line << "-" <<
|
||||
max.y() << ")" );
|
||||
|
||||
|
|
|
@ -64,11 +64,11 @@ static void clip_and_write_poly( string root, long int p_index, AreaType area,
|
|||
min.sety( -180.0 );
|
||||
max.sety( 180.0 );
|
||||
} else {
|
||||
FG_LOG ( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG ( SG_GENERAL, SG_ALERT,
|
||||
"Out of range latitude in clip_and_write_poly() = " << c.y() );
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, " (" << min << ") (" << max << ")" );
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, " (" << min << ") (" << max << ")" );
|
||||
|
||||
// set up clipping tile
|
||||
base.add_node( 0, Point3D(min.x(), min.y(), 0) );
|
||||
|
@ -76,7 +76,7 @@ static void clip_and_write_poly( string root, long int p_index, AreaType area,
|
|||
base.add_node( 0, Point3D(max.x(), max.y(), 0) );
|
||||
base.add_node( 0, Point3D(min.x(), max.y(), 0) );
|
||||
|
||||
// FG_LOG( FG_GENERAL, FG_DEBUG, "base = 4 vertices" );
|
||||
// SG_LOG( SG_GENERAL, SG_DEBUG, "base = 4 vertices" );
|
||||
|
||||
/*
|
||||
FILE *bfp= fopen("base", "w");
|
||||
|
@ -157,15 +157,15 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
// get next polygon index
|
||||
index = poly_index_next();
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " min = " << min << " max = " << max );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " min = " << min << " max = " << max );
|
||||
|
||||
// find buckets for min, and max points of convex hull.
|
||||
// note to self: self, you should think about checking for
|
||||
// polygons that span the date line
|
||||
FGBucket b_min( min.x(), min.y() );
|
||||
FGBucket b_max( max.x(), max.y() );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " Bucket min = " << b_min );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " Bucket max = " << b_max );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " Bucket min = " << b_min );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " Bucket max = " << b_max );
|
||||
|
||||
if ( b_min == b_max ) {
|
||||
clip_and_write_poly( path, index, area, b_min, shape );
|
||||
|
@ -174,13 +174,13 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
int dx, dy, i, j;
|
||||
|
||||
fgBucketDiff(b_min, b_max, &dx, &dy);
|
||||
FG_LOG( FG_GENERAL, FG_INFO,
|
||||
SG_LOG( SG_GENERAL, SG_INFO,
|
||||
" polygon spans tile boundaries" );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " dx = " << dx
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " dx = " << dx
|
||||
<< " dy = " << dy );
|
||||
|
||||
if ( (dx > 2880) || (dy > 1440) ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"something is really wrong in split_polygon()!!!!" );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
// horizontal row, and clip all the tiles in this row
|
||||
// against the smaller shape
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO,
|
||||
SG_LOG ( SG_GENERAL, SG_INFO,
|
||||
"Generating clip row " << j << " of " << dy );
|
||||
|
||||
FGBucket b_clip = fgBucketOffset(min.x(), min.y(), 0, j);
|
||||
|
@ -212,7 +212,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
|
|||
clip_min.sety( 89.0 );
|
||||
clip_max.sety( 90.0 );
|
||||
} else {
|
||||
FG_LOG ( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG ( SG_GENERAL, SG_ALERT,
|
||||
"Out of range latitude in clip_and_write_poly() = "
|
||||
<< c.y() );
|
||||
}
|
||||
|
|
|
@ -51,10 +51,10 @@ int main(int argc, char **argv) {
|
|||
int i, j;
|
||||
*/
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
if ( argc != 3 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Usage " << argv[0] << " <dem_file> <work_dir>" );
|
||||
exit(-1);
|
||||
}
|
||||
|
|
|
@ -422,7 +422,7 @@ main (int argc, const char **argv)
|
|||
vector<Attribute> pat_list;
|
||||
|
||||
// Enable logging.
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
|
||||
// Default values
|
||||
|
@ -605,7 +605,7 @@ main (int argc, const char **argv)
|
|||
// Grab command-line arguments.
|
||||
fg_gzifstream input(argv[argPos]);
|
||||
if ( !input.good() ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << argv[argPos]);
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << argv[argPos]);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ main (int argc, const char **argv)
|
|||
try {
|
||||
data.readE00(input);
|
||||
} catch (E00Exception &e) {
|
||||
FG_LOG(FG_GENERAL, FG_ALERT, "Reading " << argv[argPos]
|
||||
SG_LOG(SG_GENERAL, SG_ALERT, "Reading " << argv[argPos]
|
||||
<< " failed with exception " << e.getMessage());
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
@ -113,19 +113,19 @@ void gen_clipped_polygon( const FGPolygon& shape, const FGPolygon& clip ) {
|
|||
center_shape.erase();
|
||||
upper_shape.erase();
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Clipping lower shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Clipping lower shape" );
|
||||
lower_shape = polygon_int( lower_mask, shape );
|
||||
lower_shape.shift( 360, 0 );
|
||||
result = polygon_int( lower_shape, clip );
|
||||
write_result( result );
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Clipping center shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Clipping center shape" );
|
||||
center_shape = polygon_int( center_mask, shape );
|
||||
result = polygon_int( center_shape, clip );
|
||||
write_result( result );
|
||||
|
||||
upper_shape = polygon_int( upper_mask, shape );
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Clipping upper shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Clipping upper shape" );
|
||||
upper_shape.shift( -360, 0 );
|
||||
result = polygon_int( upper_shape, clip );
|
||||
write_result( result );
|
||||
|
@ -140,21 +140,21 @@ int main( int argc, char **argv ) {
|
|||
int k, max_east = 270000000;
|
||||
char source;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
if ( argc < 2 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Usage: " << argv[0]
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Usage: " << argv[0]
|
||||
<< " <gshhs_file>" );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
gzFile fp;
|
||||
if ( (fp = gzopen (argv[1], "rb")) == NULL ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << argv[1] );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << argv[1] );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
|
||||
while ( gzread(fp, (void *)&h, (unsigned)sizeof(struct GSHHS)) ==
|
||||
(unsigned)sizeof(struct GSHHS) )
|
||||
|
@ -189,7 +189,7 @@ int main( int argc, char **argv ) {
|
|||
if ( gzread(fp, (void *)&p, (unsigned)sizeof(struct POINT)) !=
|
||||
(unsigned)sizeof(struct POINT) )
|
||||
{
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Error reading file for polygon "
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Error reading file for polygon "
|
||||
<< h.id << " point " << k );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ int main( int argc, char **argv ) {
|
|||
}
|
||||
max_east = 180000000; /* Only Eurasiafrica needs 270 */
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " record = " << h.id << " size = " <<
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " record = " << h.id << " size = " <<
|
||||
shape.contour_size( 0 ) );
|
||||
|
||||
if ( h.id > -1 ) {
|
||||
|
|
|
@ -71,24 +71,24 @@ void split_and_shift_chunk( const string& path, AreaType area,
|
|||
center_shape.erase();
|
||||
upper_shape.erase();
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Clipping lower shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Clipping lower shape" );
|
||||
lower_shape = polygon_int( lower_mask, shape );
|
||||
lower_shape.shift( 360, 0 );
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Clipping center shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Clipping center shape" );
|
||||
center_shape = polygon_int( center_mask, shape );
|
||||
|
||||
upper_shape = polygon_int( upper_mask, shape );
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Clipping upper shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Clipping upper shape" );
|
||||
upper_shape.shift( -360, 0 );
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Processing lower shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Processing lower shape" );
|
||||
split_polygon(path, area, lower_shape);
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Processing center shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Processing center shape" );
|
||||
split_polygon(path, area, center_shape);
|
||||
|
||||
FG_LOG ( FG_GENERAL, FG_INFO, "Processing upper shape" );
|
||||
SG_LOG ( SG_GENERAL, SG_INFO, "Processing upper shape" );
|
||||
split_polygon(path, area, upper_shape);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,10 +59,10 @@ int main( int argc, char **argv ) {
|
|||
int k, max_east = 270000000;
|
||||
char source;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
if ( argc < 4 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Usage: " << argv[0]
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Usage: " << argv[0]
|
||||
<< " <gshhs_file> <work_dir> <level> [ area_type ]" );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ int main( int argc, char **argv ) {
|
|||
// get the specified data level
|
||||
int target_level = atoi(argv[3]);
|
||||
if ( target_level < 1 || target_level > 4) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, argv[0] <<
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, argv[0] <<
|
||||
": level must be 1 (land), 2 (lake), 3 (island), or 4 (pond)");
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -101,11 +101,11 @@ int main( int argc, char **argv ) {
|
|||
|
||||
gzFile fp;
|
||||
if ( (fp = gzopen (argv[1], "rb")) == NULL ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << argv[1] );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Cannot open file: " << argv[1] );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
|
||||
while ( gzread(fp, (void *)&h, (unsigned)sizeof(struct GSHHS)) ==
|
||||
(unsigned)sizeof(struct GSHHS) )
|
||||
|
@ -144,7 +144,7 @@ int main( int argc, char **argv ) {
|
|||
if ( gzread(fp, (void *)&p, (unsigned)sizeof(struct POINT)) !=
|
||||
(unsigned)sizeof(struct POINT) )
|
||||
{
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Error reading file for polygon "
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Error reading file for polygon "
|
||||
<< h.id << " point " << k );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ int main( int argc, char **argv ) {
|
|||
// continue;
|
||||
// }
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " record = " << h.id << " size = " <<
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " record = " << h.id << " size = " <<
|
||||
shape.contour_size( 0 ) );
|
||||
|
||||
FILE *fp = fopen("junk", "w");
|
||||
|
|
|
@ -58,12 +58,12 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
int hole_flag;
|
||||
double startx, starty, x, y, lastx, lasty;
|
||||
|
||||
FG_LOG( FG_CLIPPER, FG_INFO, "Loading " << path << " ..." );
|
||||
SG_LOG( SG_CLIPPER, SG_INFO, "Loading " << path << " ..." );
|
||||
|
||||
fg_gzifstream in( path );
|
||||
|
||||
if ( !in ) {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT, "Cannot open file: " << path );
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT, "Cannot open file: " << path );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
in >> count;
|
||||
|
||||
if ( count < 3 ) {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT,
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT,
|
||||
"Polygon with less than 3 data points." );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
in >> starty;
|
||||
p = Point3D(startx, starty, 0.0);
|
||||
poly.add_node( i, p );
|
||||
/* FG_LOG( FG_CLIPPER, FG_BULK, "0 = "
|
||||
/* SG_LOG( SG_CLIPPER, SG_BULK, "0 = "
|
||||
<< startx << ", " << starty );
|
||||
*/
|
||||
for ( j = 1; j < count - 1; ++j ) {
|
||||
|
@ -104,7 +104,7 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
in >> y;
|
||||
p = Point3D( x, y, 0.0 );
|
||||
poly.add_node( i, p );
|
||||
FG_LOG( FG_CLIPPER, FG_BULK, j << " = " << x << ", " << y );
|
||||
SG_LOG( SG_CLIPPER, SG_BULK, j << " = " << x << ", " << y );
|
||||
}
|
||||
|
||||
in >> lastx;
|
||||
|
@ -116,7 +116,7 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
} else {
|
||||
p = Point3D( lastx, lasty, 0.0 );
|
||||
poly.add_node( i, p );
|
||||
FG_LOG( FG_CLIPPER, FG_BULK, count - 1 << " = "
|
||||
SG_LOG( SG_CLIPPER, SG_BULK, count - 1 << " = "
|
||||
<< lastx << ", " << lasty );
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,7 @@ bool FGMerger::load_polys(const string& path, FGPolyList& subject) {
|
|||
if ( area < FG_MAX_AREA_TYPES ) {
|
||||
subject.polys[area].push_back(poly);
|
||||
} else {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT, "Polygon type out of range = "
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT, "Polygon type out of range = "
|
||||
<< (int)poly_type);
|
||||
exit(-1);
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
int main( int argc, char **argv ) {
|
||||
point2d global_min, global_max;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
global_min.x = global_min.y = 200;
|
||||
global_max.y = global_max.x = -200;
|
||||
|
@ -42,7 +42,7 @@ int main( int argc, char **argv ) {
|
|||
FGPolyList subject;
|
||||
|
||||
if ( argc < 2 ) {
|
||||
FG_LOG( FG_CLIPPER, FG_ALERT, "Usage: " << argv[0]
|
||||
SG_LOG( SG_CLIPPER, SG_ALERT, "Usage: " << argv[0]
|
||||
<< " file1 file2 ... dir_to_put" );
|
||||
exit(-1);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ int main( int argc, char **argv ) {
|
|||
min.y = -180.0;
|
||||
max.y = 180.0;
|
||||
} else {
|
||||
FG_LOG ( FG_GENERAL, FG_ALERT,
|
||||
SG_LOG ( SG_GENERAL, SG_ALERT,
|
||||
"Out of range latitude in clip_and_write_poly() = "
|
||||
<< c.y );
|
||||
}
|
||||
|
|
|
@ -145,8 +145,8 @@ AreaType get_shapefile_type(DBFHandle& hDBF, int rec) {
|
|||
area = area.substr(0, area.length() - 1);
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " raw area = " << area );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " code = " << code );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " raw area = " << area );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " code = " << code );
|
||||
|
||||
// there may be a better way to handle various area types, but
|
||||
// this is what we are trying for starters
|
||||
|
@ -257,15 +257,15 @@ int main( int argc, char **argv ) {
|
|||
FGPolygon shape;
|
||||
int i, j;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
if ( argc < 3 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Usage: " << argv[0]
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Usage: " << argv[0]
|
||||
<< " <shape_file> <work_dir> [ area_string ]" );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
|
||||
// make work directory
|
||||
string work_dir = argv[2];
|
||||
|
@ -293,7 +293,7 @@ int main( int argc, char **argv ) {
|
|||
dbffile += ".dbf";
|
||||
DBFHandle hDBF = DBFOpen( dbffile.c_str(), "rb" );
|
||||
if( hDBF == NULL ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "DBFOpen(" << dbffile
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "DBFOpen(" << dbffile
|
||||
<< ",\"rb\") failed." );
|
||||
exit( -1 );
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ int main( int argc, char **argv ) {
|
|||
shpfile += ".shp";
|
||||
SHPHandle hSHP = SHPOpen( shpfile.c_str(), "rb" );
|
||||
if( hSHP == NULL ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "SHPOpen(" << shpfile
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "SHPOpen(" << shpfile
|
||||
<< ",\"rb\") failed." );
|
||||
exit( -1 );
|
||||
}
|
||||
|
@ -311,12 +311,12 @@ int main( int argc, char **argv ) {
|
|||
double adfMinBound[4], adfMaxBound[4];
|
||||
SHPGetInfo( hSHP, &nEntities, &nShapeType, adfMinBound, adfMaxBound );
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, "shape file records = " << nEntities << endl );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "shape file records = " << nEntities << endl );
|
||||
|
||||
string shapetype = SHPTypeName( nShapeType );
|
||||
|
||||
if ( shapetype != "Polygon" ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Can't handle non-polygon shape files" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Can't handle non-polygon shape files" );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -330,7 +330,7 @@ int main( int argc, char **argv ) {
|
|||
|
||||
psShape = SHPReadObject( hSHP, i );
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, "Processing record = " << i
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Processing record = " << i
|
||||
<< " of " << nEntities
|
||||
<< " rings = " << psShape->nParts
|
||||
<< " total vertices = " << psShape->nVertices );
|
||||
|
@ -338,15 +338,15 @@ int main( int argc, char **argv ) {
|
|||
AreaType area = DefaultArea;
|
||||
if ( force_area_type.length() == 0 ) {
|
||||
area = get_shapefile_type(hDBF, i);
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, " area type = "
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, " area type = "
|
||||
<< get_area_name(area) << " (" << (int)area << ")" );
|
||||
} else {
|
||||
area = get_area_type( force_area_type );
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " record type = "
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " record type = "
|
||||
<< SHPTypeName(psShape->nSHPType) );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " bounds = ("
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " bounds = ("
|
||||
<< psShape->dfXMin << "," << psShape->dfYMin << ") "
|
||||
<< psShape->dfZMin << "," << psShape->dfMMin
|
||||
<< " to (" << psShape->dfXMax << "," << psShape->dfYMax << ") "
|
||||
|
@ -421,7 +421,7 @@ int main( int argc, char **argv ) {
|
|||
} else if ( area == OceanArea ) {
|
||||
// interior of polygon is ocean, holes are islands
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Ocean area ... SKIPPING!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Ocean area ... SKIPPING!" );
|
||||
|
||||
// Ocean data now comes from GSHHS so we want to ignore
|
||||
// all other ocean data
|
||||
|
@ -430,10 +430,10 @@ int main( int argc, char **argv ) {
|
|||
// interior is ????
|
||||
|
||||
// skip for now
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Void area ... SKIPPING!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Void area ... SKIPPING!" );
|
||||
|
||||
if ( shape.contours() > 1 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, " Void area with holes!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, " Void area with holes!" );
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
|
@ -442,10 +442,10 @@ int main( int argc, char **argv ) {
|
|||
// interior is ????
|
||||
|
||||
// skip for now
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Null area ... SKIPPING!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Null area ... SKIPPING!" );
|
||||
|
||||
if ( shape.contours() > 1 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, " Null area with holes!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, " Null area with holes!" );
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ AreaType get_shapefile_type(DBFHandle& hDBF, int rec) {
|
|||
area = area.substr(0, area.length() - 1);
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " raw area = " << area );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " raw area = " << area );
|
||||
|
||||
return get_area_type( area );
|
||||
}
|
||||
|
@ -154,15 +154,15 @@ int main( int argc, char **argv ) {
|
|||
FGPolygon shape;
|
||||
int i, j;
|
||||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
sglog().setLogLevels( SG_ALL, SG_DEBUG );
|
||||
|
||||
if ( argc < 3 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Usage: " << argv[0]
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Usage: " << argv[0]
|
||||
<< " <shape_file> <work_dir> [ area_string ]" );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Opening " << argv[1] << " for reading." );
|
||||
|
||||
// make work directory
|
||||
string work_dir = argv[2];
|
||||
|
@ -190,7 +190,7 @@ int main( int argc, char **argv ) {
|
|||
dbffile += ".dbf";
|
||||
DBFHandle hDBF = DBFOpen( dbffile.c_str(), "rb" );
|
||||
if( hDBF == NULL ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "DBFOpen(" << dbffile
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "DBFOpen(" << dbffile
|
||||
<< ",\"rb\") failed." );
|
||||
exit( -1 );
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ int main( int argc, char **argv ) {
|
|||
shpfile += ".shp";
|
||||
SHPHandle hSHP = SHPOpen( shpfile.c_str(), "rb" );
|
||||
if( hSHP == NULL ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "SHPOpen(" << shpfile
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "SHPOpen(" << shpfile
|
||||
<< ",\"rb\") failed." );
|
||||
exit( -1 );
|
||||
}
|
||||
|
@ -208,12 +208,12 @@ int main( int argc, char **argv ) {
|
|||
double adfMinBound[4], adfMaxBound[4];
|
||||
SHPGetInfo( hSHP, &nEntities, &nShapeType, adfMinBound, adfMaxBound );
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, "shape file records = " << nEntities << endl );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "shape file records = " << nEntities << endl );
|
||||
|
||||
string shapetype = SHPTypeName( nShapeType );
|
||||
|
||||
if ( shapetype != "Polygon" ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Can't handle non-polygon shape files" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Can't handle non-polygon shape files" );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -227,22 +227,22 @@ int main( int argc, char **argv ) {
|
|||
|
||||
psShape = SHPReadObject( hSHP, i );
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, "Processing record = " << i
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Processing record = " << i
|
||||
<< " rings = " << psShape->nParts
|
||||
<< " total vertices = " << psShape->nVertices );
|
||||
|
||||
AreaType area = DefaultArea;
|
||||
if ( force_area_type.length() == 0 ) {
|
||||
area = get_shapefile_type(hDBF, i);
|
||||
FG_LOG( FG_GENERAL, FG_DEBUG, " area type = "
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, " area type = "
|
||||
<< get_area_name(area) << " (" << (int)area << ")" );
|
||||
} else {
|
||||
area = get_area_type( force_area_type );
|
||||
}
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " record type = "
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " record type = "
|
||||
<< SHPTypeName(psShape->nSHPType) );
|
||||
FG_LOG( FG_GENERAL, FG_INFO, " bounds = ("
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " bounds = ("
|
||||
<< psShape->dfXMin << "," << psShape->dfYMin << ") "
|
||||
<< psShape->dfZMin << "," << psShape->dfMMin
|
||||
<< " to (" << psShape->dfXMax << "," << psShape->dfYMax << ") "
|
||||
|
@ -303,7 +303,7 @@ int main( int argc, char **argv ) {
|
|||
} else if ( area == OceanArea ) {
|
||||
// interior of polygon is ocean, holes are islands
|
||||
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Ocean area ... SKIPPING!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Ocean area ... SKIPPING!" );
|
||||
|
||||
// Ocean data now comes from GSHHS so we want to ignore
|
||||
// all other ocean data
|
||||
|
@ -312,10 +312,10 @@ int main( int argc, char **argv ) {
|
|||
// interior is ????
|
||||
|
||||
// skip for now
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Void area ... SKIPPING!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Void area ... SKIPPING!" );
|
||||
|
||||
if ( shape.contours() > 1 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, " Void area with holes!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, " Void area with holes!" );
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
|
@ -324,10 +324,10 @@ int main( int argc, char **argv ) {
|
|||
// interior is ????
|
||||
|
||||
// skip for now
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Null area ... SKIPPING!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Null area ... SKIPPING!" );
|
||||
|
||||
if ( shape.contours() > 1 ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, " Null area with holes!" );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, " Null area with holes!" );
|
||||
// exit(-1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue