diff --git a/src/Airports/GenAirports850/airport.cxx b/src/Airports/GenAirports850/airport.cxx index adf25ec2..3a0ae337 100644 --- a/src/Airports/GenAirports850/airport.cxx +++ b/src/Airports/GenAirports850/airport.cxx @@ -285,8 +285,8 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) tgcontour_list slivers; tgcontour_list line_slivers; - tgPolygon apt_base; - tgPolygon apt_clearing; + tgpolygon_list apt_base_polys; + tgpolygon_list apt_clearing_polys; // runways tgpolygon_list rwy_polys; @@ -397,7 +397,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } else { - runways[i]->BuildBtg( rwy_polys, rwy_lights, slivers, apt_base, apt_clearing, shapefile ); + runways[i]->BuildBtg( rwy_polys, rwy_lights, slivers, apt_base_polys, apt_clearing_polys, shapefile ); } // Now try to merge any slivers we found @@ -433,7 +433,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } else { - helipads[i]->BuildBtg( rwy_polys, rwy_lights, slivers, apt_base, apt_clearing ); + helipads[i]->BuildBtg( rwy_polys, rwy_lights, slivers, apt_base_polys, apt_clearing_polys ); } // Now try to merge any slivers we found @@ -463,7 +463,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } else { - pavements[i]->BuildBtg( pvmt_polys, slivers, apt_base, apt_clearing, shapefile ); + pavements[i]->BuildBtg( pvmt_polys, slivers, apt_base_polys, apt_clearing_polys, shapefile ); } // Now try to merge any slivers we found @@ -497,7 +497,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } else { - taxiways[i]->BuildBtg( pvmt_polys, rwy_lights, slivers, apt_base, apt_clearing, shapefile ); + taxiways[i]->BuildBtg( pvmt_polys, rwy_lights, slivers, apt_base_polys, apt_clearing_polys, shapefile ); } // Now try to merge any slivers we found @@ -517,15 +517,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) if ( runways[i]->GetsShoulder() ) { slivers.clear(); - - if (boundary.size()) - { - runways[i]->BuildShoulder( rwy_polys, slivers ); - } - else - { - runways[i]->BuildShoulder( rwy_polys, slivers, apt_base, apt_clearing ); - } + runways[i]->BuildShoulder( rwy_polys, slivers ); // Now try to merge any slivers we found tgPolygon::MergeSlivers( rwy_polys, slivers ); @@ -545,15 +537,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) if ( helipads[i]->GetsShoulder() ) { slivers.clear(); - - if (boundary.size()) - { - helipads[i]->BuildShoulder( rwy_polys, slivers ); - } - else - { - helipads[i]->BuildShoulder( rwy_polys, slivers, apt_base, apt_clearing ); - } + helipads[i]->BuildShoulder( rwy_polys, slivers ); // Now try to merge any slivers we found tgPolygon::MergeSlivers( rwy_polys, slivers ); @@ -563,6 +547,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) } // build the base and clearing if there's a boundary + tgPolygon apt_base, apt_clearing; if (boundary.size()) { SG_LOG(SG_GENERAL, SG_INFO, "Build " << boundary.size() << " Boundary Polys "); @@ -573,6 +558,9 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) SG_LOG(SG_GENERAL, SG_DEBUG, "Build Userdefined boundary " << i + 1 << " of " << boundary.size()); boundary[i]->BuildBtg( apt_base, apt_clearing, shapefile ); } + } else { + apt_base = tgPolygon::Union( apt_base_polys ); + apt_clearing = tgPolygon::Union( apt_clearing_polys ); } if ( apt_base.TotalNodes() == 0 ) @@ -592,9 +580,6 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) // add segments to polygons to remove any possible "T" // intersections - //TGTriNodes tmp_pvmt_nodes; - //TGTriNodes tmp_feat_nodes; - UniqueSGGeodSet tmp_pvmt_nodes; UniqueSGGeodSet tmp_feat_nodes; @@ -791,7 +776,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src ) intersecting contours */ base_poly = tgPolygon::Simplify( base_poly ); - SG_LOG(SG_GENERAL, SG_INFO, "Tesselating base poly "); + SG_LOG(SG_GENERAL, SG_INFO, "Tesselating base poly : " << base_poly.Contours() << " contours " ); base_poly.Tesselate(); SG_LOG(SG_GENERAL, SG_INFO, "Tesselating base poly - done : Triangles = " << base_poly.Triangles()); // should we texture base here? diff --git a/src/Airports/GenAirports850/closedpoly.cxx b/src/Airports/GenAirports850/closedpoly.cxx index 5c48c9a3..5c49d49c 100644 --- a/src/Airports/GenAirports850/closedpoly.cxx +++ b/src/Airports/GenAirports850/closedpoly.cxx @@ -415,7 +415,7 @@ std::string ClosedPoly::GetMaterial( int surface ) return material; } -int ClosedPoly::BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, tgPolygon& apt_base, tgPolygon& apt_clearing, std::string& shapefile_name ) +int ClosedPoly::BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, tgpolygon_list& apt_base_polys, tgpolygon_list& apt_clearing_polys, std::string& shapefile_name ) { if (is_pavement && pre_tess.Contours() ) { @@ -427,10 +427,10 @@ int ClosedPoly::BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, tg safe_base = tgPolygon::Expand( pre_tess, 50.0); // add this to the airport clearing - apt_clearing = tgPolygon::Union( safe_base, apt_clearing); + apt_clearing_polys.push_back( safe_base ); // and add the clearing to the base - apt_base = tgPolygon::Union( base, apt_base ); + apt_base_polys.push_back( base ); } // clean up to save ram : we're done here... diff --git a/src/Airports/GenAirports850/closedpoly.hxx b/src/Airports/GenAirports850/closedpoly.hxx index 968895a5..d529beb4 100644 --- a/src/Airports/GenAirports850/closedpoly.hxx +++ b/src/Airports/GenAirports850/closedpoly.hxx @@ -30,8 +30,8 @@ public: int BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, - tgPolygon& apt_base, - tgPolygon& apt_clearing, + tgpolygon_list& apt_base_polys, + tgpolygon_list& apt_clearing_polys, std::string& shapefile_name ); FeatureList* GetFeatures() @@ -63,11 +63,14 @@ private: BezContour* cur_contour; // outer boundary as convex hull - point_list hull; + // point_list hull; // Converted polygon after parsing complete tgPolygon pre_tess; + // shoulders after BTG built + tgpolygon_list shoulder_polys; + // pavement definitions have multiple linear features (markings and lights for each contour) LinearFeature* cur_feature; FeatureList features; diff --git a/src/Airports/GenAirports850/helipad.cxx b/src/Airports/GenAirports850/helipad.cxx index 3868c0a4..ff77b103 100644 --- a/src/Airports/GenAirports850/helipad.cxx +++ b/src/Airports/GenAirports850/helipad.cxx @@ -200,14 +200,15 @@ void Helipad::BuildBtg( tgpolygon_list& rwy_polys, void Helipad::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, - tgPolygon& apt_base, - tgPolygon& apt_clearing ) + tgpolygon_list& apt_base_polys, + tgpolygon_list& apt_clearing_polys ) { BuildBtg( rwy_polys, rwy_lights, slivers ); // generate area around helipad double length, width; - tgContour base, safe_base; + tgContour base_contour, safe_base_contour; + tgPolygon base, safe_base; length = heli.length; width = heli.width; @@ -219,45 +220,20 @@ void Helipad::BuildBtg( tgpolygon_list& rwy_polys, width += 2.0; } - base = gen_helipad_area_w_extend(length * 0.25 , width * 0.25 ); - base = tgContour::Snap( base, gSnap ); + base_contour = gen_helipad_area_w_extend(length * 0.25 , width * 0.25 ); + base_contour = tgContour::Snap( base_contour, gSnap ); + base.AddContour( base_contour ); // also clear a safe area around the pad - safe_base = gen_helipad_area_w_extend( length * 0.5, width * 0.5 ); - safe_base = tgContour::Snap( safe_base, gSnap ); + safe_base_contour = gen_helipad_area_w_extend( length * 0.5, width * 0.5 ); + safe_base_contour = tgContour::Snap( safe_base_contour, gSnap ); + safe_base.AddContour( safe_base_contour ); // add this to the airport clearing - apt_clearing = tgPolygon::Union(safe_base, apt_clearing); + apt_clearing_polys.push_back( safe_base ); // and add the clearing to the base - apt_base = tgPolygon::Union( base, apt_base ); -} - -void Helipad::BuildShoulder( tgpolygon_list& rwy_polys, - tgcontour_list& slivers, - tgPolygon& apt_base, - tgPolygon& apt_clearing ) -{ - tgPolygon shoulder; - - for (unsigned int i=0; i 0) && (rwy.surface < 3) ) { + shoulder_width += 22.0; + } else if ( (rwy.surface == 1) || (rwy.surface == 2) ) { + shoulder_width += 2.0; + } + + base_contour = gen_runway_area_w_extend( 20.0, -rwy.overrun[0], -rwy.overrun[1], shoulder_width + 20.0 ); + base_contour = tgContour::Snap( base_contour, gSnap ); + base.AddContour( base_contour ); // also clear a safe area around the runway - safe_base = gen_runway_area_w_extend( 180.0, -rwy.overrun[0], -rwy.overrun[1], 50.0 ); - safe_base = tgContour::Snap( safe_base, gSnap ); + safe_base_contour = gen_runway_area_w_extend( 180.0, -rwy.overrun[0], -rwy.overrun[1], shoulder_width + 50.0 ); + safe_base_contour = tgContour::Snap( safe_base_contour, gSnap ); + safe_base.AddContour( safe_base_contour ); // add this to the airport clearing - apt_clearing = tgPolygon::Union( safe_base, apt_clearing ); + apt_clearing_polys.push_back( safe_base ); // and add the clearing to the base - apt_base = tgPolygon::Union( base, apt_base ); + apt_base_polys.push_back( base ); return 0; } \ No newline at end of file diff --git a/src/Airports/GenAirports850/runway.hxx b/src/Airports/GenAirports850/runway.hxx index 7e9c0022..1f1b90e7 100644 --- a/src/Airports/GenAirports850/runway.hxx +++ b/src/Airports/GenAirports850/runway.hxx @@ -39,18 +39,13 @@ public: int BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, - tgPolygon& apt_base, - tgPolygon& apt_clearing, + tgpolygon_list& apt_base_polys, + tgpolygon_list& apt_clearing_polys, std::string& shapefile_name ); void BuildShoulder( tgpolygon_list& rwy_polys, tgcontour_list& slivers ); - void BuildShoulder( tgpolygon_list& rwy_polys, - tgcontour_list& slivers, - tgPolygon& apt_base, - tgPolygon& apt_clearing ); - private: struct TGRunway { // data for whole runway diff --git a/src/Airports/GenAirports850/rwy_gen.cxx b/src/Airports/GenAirports850/rwy_gen.cxx index 72ee2f6c..5e5ba171 100644 --- a/src/Airports/GenAirports850/rwy_gen.cxx +++ b/src/Airports/GenAirports850/rwy_gen.cxx @@ -847,9 +847,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys, } void Runway::BuildShoulder( tgpolygon_list& rwy_polys, - tgcontour_list& slivers, - tgPolygon& apt_base, - tgPolygon& apt_clearing ) + tgcontour_list& slivers ) { tgPolygon base, safe_base; tgPolygon shoulder; @@ -867,40 +865,6 @@ void Runway::BuildShoulder( tgpolygon_list& rwy_polys, shoulder_polys[i] = split; rwy_polys.push_back( shoulder_polys[i] ); - - tgPolygon::AddToAccumulator( shoulder ); - - // also clear a safe area around the runway - base = tgPolygon::Expand( shoulder, 20.0); - safe_base = tgPolygon::Expand( shoulder, 50.0); - - // add this to the airport clearing - apt_clearing = tgPolygon::Union( safe_base, apt_clearing ); - - // and add the clearing to the base - apt_base = tgPolygon::Union( base, apt_base ); - } -} - -void Runway::BuildShoulder( tgpolygon_list& rwy_polys, - tgcontour_list& slivers ) -{ - tgPolygon shoulder; - - for (unsigned int i=0; i 5 && strcasecmp(argv[5], "EVENODD") == 0) clip_pft = pftEvenOdd; - cout << "\nclipping ... "; + cout << "\nclipping ... \n"; Clipper c; c.AddPolygons(subject, ptSubject); @@ -302,6 +302,15 @@ int main(int argc, char* argv[]) // cout << "\nEllapsed: " << elapsed; // } + for ( int i=0; i