From 225e3e149175cac0fb7fe32daf61e2fb7e17f77e Mon Sep 17 00:00:00 2001 From: Peter Sadrozinski Date: Tue, 13 Mar 2012 18:51:40 -0400 Subject: [PATCH] - modified grid size from 1 cm to 1 mm - snap runway and pavement polys to grid after adding slivers. --- src/Airports/GenAirports850/airport.cxx | 31 +++++++++++++------------ src/Airports/GenAirports850/helipad.cxx | 4 ---- src/Airports/GenAirports850/main.cxx | 4 ++-- src/Airports/GenAirports850/rwy_gen.cxx | 4 ---- 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index f763bf28..25f7694e 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -770,21 +770,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src ) gettimeofday(&log_time, NULL); SG_LOG( SG_GENERAL, SG_ALERT, "Finished adding intermediate nodes for " << icao << " at " << ctime(&log_time.tv_sec) ); - // One more pass to try to get rid of other yukky stuff - for ( unsigned int k = 0; k < rwy_polys.size(); ++k ) - { - TGPolygon poly = rwy_polys[k].get_poly(); - poly = snap(poly, gSnap); - rwy_polys[k].set_poly( poly ); - } - - for ( unsigned int k = 0; k < pvmt_polys.size(); ++k ) - { - TGPolygon poly = pvmt_polys[k].get_poly(); - poly = snap(poly, gSnap); - pvmt_polys[k].set_poly( poly ); - } - for ( unsigned int k = 0; k < line_polys.size(); ++k ) { TGPolygon poly = line_polys[k].get_poly(); @@ -819,6 +804,22 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src ) merge_slivers( rwy_polys, slivers ); merge_slivers( pvmt_polys, slivers ); + // Then snap rwy and pavement to grid (was done right after adding intermediate nodes...) + for ( unsigned int k = 0; k < rwy_polys.size(); ++k ) + { + TGPolygon poly = rwy_polys[k].get_poly(); + poly = snap(poly, gSnap); + poly = remove_dups( poly ); + rwy_polys[k].set_poly( poly ); + } + for ( unsigned int k = 0; k < pvmt_polys.size(); ++k ) + { + TGPolygon poly = pvmt_polys[k].get_poly(); + poly = snap(poly, gSnap); + poly = remove_dups( poly ); + pvmt_polys[k].set_poly( poly ); + } + gettimeofday(&cleanup_end, NULL); timersub(&cleanup_end, &cleanup_start, &cleanup_time); diff --git a/src/Airports/GenAirports850/helipad.cxx b/src/Airports/GenAirports850/helipad.cxx index 119b6987..4040f931 100644 --- a/src/Airports/GenAirports850/helipad.cxx +++ b/src/Airports/GenAirports850/helipad.cxx @@ -63,14 +63,12 @@ void Helipad::gen_helipad( const TGPolygon& runway, Point3D a2 = runway.get_pt(0, 0); Point3D a3 = runway.get_pt(0, 3); -#if 0 if ( startl_pct > 0.0 ) { startl_pct -= nudge * SG_EPSILON; } if ( endl_pct < 1.0 ) { endl_pct += nudge * SG_EPSILON; } -#endif if ( startl_pct < 0.0 ) { startl_pct = 0.0; @@ -85,7 +83,6 @@ void Helipad::gen_helipad( const TGPolygon& runway, // with our polygon clipping code. This attempts to compensate // for that by nudging the areas a bit bigger so we don't end up // with polygon slivers. -#if 0 if ( startw_pct > 0.0 || endw_pct < 1.0 ) { if ( startw_pct > 0.0 ) { startw_pct -= nudge * SG_EPSILON; @@ -94,7 +91,6 @@ void Helipad::gen_helipad( const TGPolygon& runway, endw_pct += nudge * SG_EPSILON; } } -#endif SG_LOG(SG_GENERAL, SG_DEBUG, "start len % = " << startl_pct << " end len % = " << endl_pct); diff --git a/src/Airports/GenAirports850/main.cxx b/src/Airports/GenAirports850/main.cxx index 2d863479..11f435c9 100644 --- a/src/Airports/GenAirports850/main.cxx +++ b/src/Airports/GenAirports850/main.cxx @@ -112,9 +112,9 @@ static void help( int argc, char **argv, const string_list& elev_src ) { } // TODO: where do these belong -int nudge = 0; +int nudge = 10; double slope_max = 0.2; -double gSnap = 0.0000001; +double gSnap = 0.00000001; // approx 1 mm int main(int argc, char **argv) { diff --git a/src/Airports/GenAirports850/rwy_gen.cxx b/src/Airports/GenAirports850/rwy_gen.cxx index 7a24db02..d5b2b0d3 100644 --- a/src/Airports/GenAirports850/rwy_gen.cxx +++ b/src/Airports/GenAirports850/rwy_gen.cxx @@ -109,14 +109,12 @@ void Runway::gen_runway_section( const TGPolygon& runway, Point3D a2 = runway.get_pt(0, 0); Point3D a3 = runway.get_pt(0, 3); -#if 0 if ( startl_pct > 0.0 ) { startl_pct -= nudge * SG_EPSILON; } if ( endl_pct < 1.0 ) { endl_pct += nudge * SG_EPSILON; } -#endif if ( startl_pct < 0.0 ) { startl_pct = 0.0; @@ -131,7 +129,6 @@ void Runway::gen_runway_section( const TGPolygon& runway, // with our polygon clipping code. This attempts to compensate // for that by nudging the areas a bit bigger so we don't end up // with polygon slivers. -#if 0 if ( startw_pct > 0.0 || endw_pct < 1.0 ) { if ( startw_pct > 0.0 ) { startw_pct -= nudge * SG_EPSILON; @@ -140,7 +137,6 @@ void Runway::gen_runway_section( const TGPolygon& runway, endw_pct += nudge * SG_EPSILON; } } -#endif SG_LOG(SG_GENERAL, SG_DEBUG, "start len % = " << startl_pct << " end len % = " << endl_pct);