From 327d8d11394a98b6bee2161c3177e7809ef91d07 Mon Sep 17 00:00:00 2001 From: Ralf Gerlich Date: Sat, 5 Jan 2008 20:47:15 +0100 Subject: [PATCH] Added --nudge option to fgfs-construct --- src/BuildTiles/Clipper/clipper.cxx | 7 ++++--- src/BuildTiles/Clipper/clipper.hxx | 2 ++ src/BuildTiles/Main/main.cxx | 7 +++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/BuildTiles/Clipper/clipper.cxx b/src/BuildTiles/Clipper/clipper.cxx index ce27d792..c252d1bb 100644 --- a/src/BuildTiles/Clipper/clipper.cxx +++ b/src/BuildTiles/Clipper/clipper.cxx @@ -45,6 +45,7 @@ SG_USING_STD(cout); // Constructor. TGClipper::TGClipper() { + nudge=0.0; } @@ -127,7 +128,7 @@ bool TGClipper::load_polys(const string& path) { } else { startz = -9999.0; } - p = Point3D(startx, starty, startz); + p = Point3D(startx+nudge, starty+nudge, startz); poly.add_node( i, p ); if ( poly3d ) { fixed_elevations.unique_add( p ); @@ -141,7 +142,7 @@ bool TGClipper::load_polys(const string& path) { } else { z = -9999.0; } - p = Point3D( x, y, z ); + p = Point3D( x+nudge, y+nudge, z ); poly.add_node( i, p ); if ( poly3d ) { fixed_elevations.unique_add( p ); @@ -161,7 +162,7 @@ bool TGClipper::load_polys(const string& path) { && (fabs(startz - lastz) < SG_EPSILON) ) { // last point same as first, discard } else { - p = Point3D( lastx, lasty, lastz ); + p = Point3D( lastx+nudge, lasty+nudge, lastz ); poly.add_node( i, p ); if ( poly3d ) { fixed_elevations.unique_add( p ); diff --git a/src/BuildTiles/Clipper/clipper.hxx b/src/BuildTiles/Clipper/clipper.hxx index 64bff506..58333a85 100644 --- a/src/BuildTiles/Clipper/clipper.hxx +++ b/src/BuildTiles/Clipper/clipper.hxx @@ -105,6 +105,8 @@ public: // Return the fixed elevation points list inline TGTriNodes get_fixed_elevations() const { return fixed_elevations; } + + double nudge; }; diff --git a/src/BuildTiles/Main/main.cxx b/src/BuildTiles/Main/main.cxx index bd2a0914..b83d40bf 100644 --- a/src/BuildTiles/Main/main.cxx +++ b/src/BuildTiles/Main/main.cxx @@ -83,6 +83,8 @@ static const double half_cover_size = cover_size * 0.5; // to gaps. If we put skirts around everything that might hide the // problem. static const double quarter_cover_size = cover_size * 0.25; + +double nudge=0.0; // Translate USGS land cover values into TerraGear area types. @@ -437,6 +439,8 @@ static int load_polys( TGConstruct& c, const TGArray &array ) { string base = c.get_bucket().gen_base_path(); string poly_path; int count = 0; + + clipper.nudge = nudge; // initialize clipper clipper.init(); @@ -1139,6 +1143,7 @@ static void usage( const string name ) { cout << " --lat=" << endl; cout << " --xdist=" << endl; cout << " --ydist=" << endl; + cout << " --nudge=" << endl; cout << " --useUKgrid" << endl; cout << " ] " << endl; exit(-1); @@ -1182,6 +1187,8 @@ int main(int argc, char **argv) { xdist = atof(arg.substr(8).c_str()); } else if (arg.find("--ydist=") == 0) { ydist = atof(arg.substr(8).c_str()); + } else if (arg.find("--nudge=") == 0) { + nudge = atof(arg.substr(8).c_str())*SG_EPSILON; } else if (arg.find("--cover=") == 0) { cover = arg.substr(8); } else if (arg.find("--useUKgrid") == 0) {