1
0
Fork 0

Added --nudge option to fgfs-construct

This commit is contained in:
Ralf Gerlich 2008-01-05 20:47:15 +01:00
parent a8f76d3efc
commit 327d8d1139
3 changed files with 13 additions and 3 deletions

View file

@ -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 );

View file

@ -105,6 +105,8 @@ public:
// Return the fixed elevation points list
inline TGTriNodes get_fixed_elevations() const { return fixed_elevations; }
double nudge;
};

View file

@ -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=<degrees>" << endl;
cout << " --xdist=<degrees>" << endl;
cout << " --ydist=<degrees>" << endl;
cout << " --nudge=<float>" << endl;
cout << " --useUKgrid" << endl;
cout << " ] <load directory...>" << 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) {