1
0
Fork 0

Use the Accumulator in the Polygon Library, instead of passing one around.

The accumulator in the polygon library has the bounding box hit test, so it's faster
My test run decreased 16 seconds from 71 to 54.
This commit is contained in:
Peter Sadrozinski 2012-10-21 15:40:34 -04:00
parent 68640c4479
commit fc304804ab
13 changed files with 71 additions and 129 deletions

View file

@ -517,15 +517,11 @@ void Airport::merge_slivers( superpoly_list& polys, poly_list& slivers_list ) {
void Airport::BuildBtg(const string& root, const string_list& elev_src ) void Airport::BuildBtg(const string& root, const string_list& elev_src )
{ {
ClipPolyType accum; poly_list slivers;
poly_list slivers; poly_list line_slivers;
// try to keep line accumulator in clipper format for speed... TGPolygon apt_base;
ClipPolyType lines; TGPolygon apt_clearing;
poly_list line_slivers;
TGPolygon apt_base;
TGPolygon apt_clearing;
// runways // runways
superpoly_list rwy_polys; superpoly_list rwy_polys;
@ -539,7 +535,6 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
superpoly_list line_polys; superpoly_list line_polys;
texparams_list line_tps; texparams_list line_tps;
// int i, j, k;
Point3D p; Point3D p;
bool verbose_triangulation = false; bool verbose_triangulation = false;
@ -594,6 +589,10 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
build_start.stamp(); build_start.stamp();
// Add the linear features // Add the linear features
tgPolygonInitClipperAccumulator();
if (features.size()) if (features.size())
{ {
for ( unsigned int i=0; i<features.size(); i++ ) for ( unsigned int i=0; i<features.size(); i++ )
@ -608,7 +607,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
make_shapefiles = false; make_shapefiles = false;
} }
features[i]->BuildBtg( &line_polys, &line_tps, &lines, &rwy_lights, make_shapefiles ); features[i]->BuildBtg( &line_polys, &line_tps, &rwy_lights, make_shapefiles );
} }
} }
else else
@ -616,9 +615,15 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
SG_LOG(SG_GENERAL, SG_DEBUG, "no markings"); SG_LOG(SG_GENERAL, SG_DEBUG, "no markings");
} }
/* DOne with the linear features accumulator */
tgPolygonFreeClipperAccumulator();
log_time = time(0); log_time = time(0);
SG_LOG( SG_GENERAL, SG_ALERT, "Finished building Linear Features for " << icao << " at " << ctime(&log_time) ); SG_LOG( SG_GENERAL, SG_ALERT, "Finished building Linear Features for " << icao << " at " << ctime(&log_time) );
// Initialize a new accumulator for the other objects
tgPolygonInitClipperAccumulator();
// Build runways next // Build runways next
for ( unsigned int i=0; i<runways.size(); i++ ) for ( unsigned int i=0; i<runways.size(); i++ )
{ {
@ -635,11 +640,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary.size()) if (boundary.size())
{ {
runways[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, NULL, NULL, make_shapefiles ); runways[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, slivers, NULL, NULL, make_shapefiles );
} }
else else
{ {
runways[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, &apt_base, &apt_clearing, make_shapefiles ); runways[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, slivers, &apt_base, &apt_clearing, make_shapefiles );
} }
// Now try to merge any slivers we found // Now try to merge any slivers we found
@ -668,11 +673,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary.size()) if (boundary.size())
{ {
helipads[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, NULL, NULL ); helipads[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, slivers, NULL, NULL );
} }
else else
{ {
helipads[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, &apt_base, &apt_clearing ); helipads[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, slivers, &apt_base, &apt_clearing );
} }
// Now try to merge any slivers we found // Now try to merge any slivers we found
@ -698,11 +703,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary.size()) if (boundary.size())
{ {
pavements[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &accum, slivers, NULL, NULL, make_shapefiles ); pavements[i]->BuildBtg( &pvmt_polys, &pvmt_tps, slivers, NULL, NULL, make_shapefiles );
} }
else else
{ {
pavements[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &accum, slivers, &apt_base, &apt_clearing, make_shapefiles ); pavements[i]->BuildBtg( &pvmt_polys, &pvmt_tps, slivers, &apt_base, &apt_clearing, make_shapefiles );
} }
// Now try to merge any slivers we found // Now try to merge any slivers we found
@ -736,11 +741,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary.size()) if (boundary.size())
{ {
taxiways[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &rwy_lights, &accum, slivers, NULL, NULL, make_shapefiles ); taxiways[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &rwy_lights, slivers, NULL, NULL, make_shapefiles );
} }
else else
{ {
taxiways[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &rwy_lights, &accum, slivers, &apt_base, &apt_clearing, make_shapefiles ); taxiways[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &rwy_lights, slivers, &apt_base, &apt_clearing, make_shapefiles );
} }
// Now try to merge any slivers we found // Now try to merge any slivers we found
@ -765,11 +770,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary.size()) if (boundary.size())
{ {
runways[i]->BuildShoulder( &rwy_polys, &rwy_tps, &accum, slivers, NULL, NULL ); runways[i]->BuildShoulder( &rwy_polys, &rwy_tps, slivers, NULL, NULL );
} }
else else
{ {
runways[i]->BuildShoulder( &rwy_polys, &rwy_tps, &accum, slivers, &apt_base, &apt_clearing ); runways[i]->BuildShoulder( &rwy_polys, &rwy_tps, slivers, &apt_base, &apt_clearing );
} }
// Now try to merge any slivers we found // Now try to merge any slivers we found
@ -789,11 +794,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary.size()) if (boundary.size())
{ {
helipads[i]->BuildShoulder( &rwy_polys, &rwy_tps, &accum, slivers, NULL, NULL ); helipads[i]->BuildShoulder( &rwy_polys, &rwy_tps, slivers, NULL, NULL );
} }
else else
{ {
helipads[i]->BuildShoulder( &rwy_polys, &rwy_tps, &accum, slivers, &apt_base, &apt_clearing ); helipads[i]->BuildShoulder( &rwy_polys, &rwy_tps, slivers, &apt_base, &apt_clearing );
} }
// Now try to merge any slivers we found // Now try to merge any slivers we found
@ -821,7 +826,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
TGPolygon filled_base = tgPolygonStripHoles( apt_base ); TGPolygon filled_base = tgPolygonStripHoles( apt_base );
TGPolygon divided_base = tgPolygonSplitLongEdges( filled_base, 200.0 ); TGPolygon divided_base = tgPolygonSplitLongEdges( filled_base, 200.0 );
TGPolygon base_poly = tgPolygonDiffClipper( divided_base, accum ); TGPolygon base_poly = tgPolygonDiffClipperWithAccumulator( divided_base );
build_end.stamp(); build_end.stamp();
build_time = build_end - build_start; build_time = build_end - build_start;

View file

@ -380,10 +380,9 @@ void ClosedPoly::Finish()
holes.clear(); holes.clear();
} }
int ClosedPoly::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles ) int ClosedPoly::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles )
{ {
TGPolygon base, safe_base; TGPolygon base, safe_base;
TGPolygon pre_accum;
string material; string material;
void* ds_id = NULL; // If we are going to build shapefiles void* ds_id = NULL; // If we are going to build shapefiles
@ -446,11 +445,9 @@ int ClosedPoly::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams,
l_id = tgShapefileOpenLayer( ds_id, layer_name ); l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "original" ); sprintf( feature_name, "original" );
tgShapefileCreateFeature( ds_id, l_id, pre_tess, feature_name ); tgShapefileCreateFeature( ds_id, l_id, pre_tess, feature_name );
pre_accum = *accum;
} }
TGPolygon clipped = tgPolygonDiffClipper( pre_tess, *accum ); TGPolygon clipped = tgPolygonDiffClipperWithAccumulator( pre_tess );
tgPolygonFindSlivers( clipped, slivers ); tgPolygonFindSlivers( clipped, slivers );
SG_LOG(SG_GENERAL, SG_DEBUG, "clipped = " << clipped.contours()); SG_LOG(SG_GENERAL, SG_DEBUG, "clipped = " << clipped.contours());
@ -462,7 +459,7 @@ int ClosedPoly::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams,
rwy_polys->push_back( sp ); rwy_polys->push_back( sp );
*accum = tgPolygonUnionClipper( pre_tess, *accum ); tgPolygonAddToClipperAccumulator( pre_tess, false );
/* If debugging this poly, write the poly, and clipped poly and the accum buffer into their own layers */ /* If debugging this poly, write the poly, and clipped poly and the accum buffer into their own layers */
if ( make_shapefiles ) { if ( make_shapefiles ) {
@ -473,16 +470,6 @@ int ClosedPoly::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams,
l_id = tgShapefileOpenLayer( ds_id, layer_name ); l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "clipped" ); sprintf( feature_name, "clipped" );
tgShapefileCreateFeature( ds_id, l_id, clipped, feature_name ); tgShapefileCreateFeature( ds_id, l_id, clipped, feature_name );
sprintf( layer_name, "pre_accum" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "pre_accum" );
tgShapefileCreateFeature( ds_id, l_id, pre_accum, feature_name );
sprintf( layer_name, "post_accum" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "post_accum" );
tgShapefileCreateFeature( ds_id, l_id, *accum, feature_name );
} }
SG_LOG(SG_GENERAL, SG_DEBUG, "tp construct"); SG_LOG(SG_GENERAL, SG_DEBUG, "tp construct");

View file

@ -28,7 +28,7 @@ public:
int BuildBtg( TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles ); int BuildBtg( TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles );
// Build BTG for pavements for airports with no boundary // Build BTG for pavements for airports with no boundary
int BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles ); int BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles );
FeatureList* GetFeatures() FeatureList* GetFeatures()
{ {

View file

@ -88,11 +88,10 @@ superpoly_list Helipad::gen_helipad_lights(double maxsize){
void Helipad::WriteGeom( TGPolygon polygon, string material, void Helipad::WriteGeom( TGPolygon polygon, string material,
superpoly_list *rwy_polys, superpoly_list *rwy_polys,
ClipPolyType *accum,
poly_list& slivers ) poly_list& slivers )
{ {
// Clip the new polygon against what ever has already been created. // Clip the new polygon against what ever has already been created.
TGPolygon clipped = tgPolygonDiffClipper( polygon, *accum ); TGPolygon clipped = tgPolygonDiffClipperWithAccumulator( polygon );
tgPolygonFindSlivers( clipped, slivers ); tgPolygonFindSlivers( clipped, slivers );
// Split long edges to create an object that can better flow with // Split long edges to create an object that can better flow with
@ -107,13 +106,12 @@ void Helipad::WriteGeom( TGPolygon polygon, string material,
sp.set_material( material ); sp.set_material( material );
rwy_polys->push_back( sp ); rwy_polys->push_back( sp );
*accum = tgPolygonUnionClipper( polygon, *accum ); tgPolygonAddToClipperAccumulator( polygon, false );
} }
void Helipad::BuildBtg( superpoly_list *rwy_polys, void Helipad::BuildBtg( superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
superpoly_list *rwy_lights, superpoly_list *rwy_lights,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
TGPolygon* apt_base, TGPolygon* apt_base,
TGPolygon* apt_clearing ) TGPolygon* apt_clearing )
@ -143,7 +141,7 @@ void Helipad::BuildBtg( superpoly_list *rwy_polys,
else else
material = "pc_"; material = "pc_";
// write out // write out
WriteGeom( helipad, material + "heli", rwy_polys, accum, slivers); WriteGeom( helipad, material + "heli", rwy_polys, slivers);
TGTexParams tp; TGTexParams tp;
tp = TGTexParams( helipad.get_pt(0,0).toSGGeod(), maxsize, maxsize, heli.heading ); tp = TGTexParams( helipad.get_pt(0,0).toSGGeod(), maxsize, maxsize, heli.heading );
@ -185,7 +183,7 @@ void Helipad::BuildBtg( superpoly_list *rwy_polys,
TGPolygon area_geom; TGPolygon area_geom;
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
area_geom.add_contour(area_poly.get_contour(i), false); area_geom.add_contour(area_poly.get_contour(i), false);
WriteGeom( area_geom, material + "tiedown", rwy_polys, accum, slivers); WriteGeom( area_geom, material + "tiedown", rwy_polys, slivers);
tp = TGTexParams( area_poly.get_pt(i,0).toSGGeod(), maxsize, areahight, heading ); tp = TGTexParams( area_poly.get_pt(i,0).toSGGeod(), maxsize, areahight, heading );
tp.set_minu( 1 ); tp.set_minu( 1 );
@ -277,7 +275,6 @@ void Helipad::BuildBtg( superpoly_list *rwy_polys,
void Helipad::BuildShoulder( superpoly_list *rwy_polys, void Helipad::BuildShoulder( superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
TGPolygon* apt_base, TGPolygon* apt_base,
TGPolygon* apt_clearing ) TGPolygon* apt_clearing )
@ -289,7 +286,7 @@ void Helipad::BuildShoulder( superpoly_list *rwy_polys,
shoulder = shoulder_polys[i].get_poly(); shoulder = shoulder_polys[i].get_poly();
// Clip the new polygon against what ever has already been created. // Clip the new polygon against what ever has already been created.
TGPolygon clipped = tgPolygonDiffClipper( shoulder, *accum ); TGPolygon clipped = tgPolygonDiffClipperWithAccumulator( shoulder );
tgPolygonFindSlivers( clipped, slivers ); tgPolygonFindSlivers( clipped, slivers );
// Split long edges to create an object that can better flow with // Split long edges to create an object that can better flow with
@ -300,7 +297,7 @@ void Helipad::BuildShoulder( superpoly_list *rwy_polys,
rwy_polys->push_back( shoulder_polys[i] ); rwy_polys->push_back( shoulder_polys[i] );
texparams->push_back( shoulder_tps[i] ); texparams->push_back( shoulder_tps[i] );
*accum = tgPolygonUnionClipper( shoulder, *accum ); tgPolygonAddToClipperAccumulator( shoulder, false );
if (apt_base) if (apt_base)
{ {

View file

@ -24,7 +24,7 @@ class Helipad
{ {
public: public:
Helipad(char* def); Helipad(char* def);
void BuildBtg( superpoly_list* heli_polys, texparams_list* texparams, superpoly_list* heli_lights, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing ); void BuildBtg( superpoly_list* heli_polys, texparams_list* texparams, superpoly_list* heli_lights, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing );
SGGeod GetLoc() SGGeod GetLoc()
{ {
@ -38,7 +38,6 @@ public:
void BuildShoulder( superpoly_list *rwy_polys, void BuildShoulder( superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
TGPolygon* apt_base, TGPolygon* apt_base,
TGPolygon* apt_clearing ); TGPolygon* apt_clearing );
@ -78,7 +77,6 @@ private:
void WriteGeom( TGPolygon polygon, string material, void WriteGeom( TGPolygon polygon, string material,
superpoly_list *rwy_polys, superpoly_list *rwy_polys,
ClipPolyType *accum,
poly_list& slivers ); poly_list& slivers );
}; };

View file

@ -844,7 +844,7 @@ int LinearFeature::Finish( bool closed, unsigned int idx )
return 1; return 1;
} }
int LinearFeature::BuildBtg(superpoly_list* line_polys, texparams_list* line_tps, ClipPolyType* lines, superpoly_list* lights, bool make_shapefiles ) int LinearFeature::BuildBtg(superpoly_list* line_polys, texparams_list* line_tps, superpoly_list* lights, bool make_shapefiles )
{ {
TGPolygon poly, tmp; TGPolygon poly, tmp;
void* ds_id = NULL; // If we are going to build shapefiles void* ds_id = NULL; // If we are going to build shapefiles
@ -860,27 +860,12 @@ int LinearFeature::BuildBtg(superpoly_list* line_polys, texparams_list* line_tps
SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::BuildBtg: " << description); SG_LOG(SG_GENERAL, SG_DEBUG, "\nLinearFeature::BuildBtg: " << description);
for ( unsigned int i = 0; i < marking_polys.size(); i++) for ( unsigned int i = 0; i < marking_polys.size(); i++)
{ {
poly = marking_polys[i].get_poly(); poly = tgPolygonDiffClipperWithAccumulator( marking_polys[i].get_poly() );
poly.get_bounding_box(minp, maxp);
tg::Rectangle box1(minp, maxp);
for (int j= 0; j < lines->contours(); ++j)
{
tmp.erase();
tmp.add_contour(lines->get_contour(j), 0);
tmp.get_bounding_box(min, max);
tg::Rectangle box2(min, max);
if ( box2.intersects(box1) )
{
poly = tgPolygonDiffClipper( poly, tmp );
}
}
marking_polys[i].set_poly( poly ); marking_polys[i].set_poly( poly );
line_polys->push_back( marking_polys[i] ); line_polys->push_back( marking_polys[i] );
/* If debugging this lf, write the poly, and the accum buffer at each step into their own layers */ /* If debugging this lf, write the polys into their own layers */
if (ds_id) { if (ds_id) {
char layer_name[128]; char layer_name[128];
sprintf( layer_name, "poly_%d", i ); sprintf( layer_name, "poly_%d", i );
@ -889,15 +874,9 @@ int LinearFeature::BuildBtg(superpoly_list* line_polys, texparams_list* line_tps
char feature_name[128]; char feature_name[128];
sprintf( feature_name, "poly_%d", i); sprintf( feature_name, "poly_%d", i);
tgShapefileCreateFeature( ds_id, l_id, poly, feature_name ); tgShapefileCreateFeature( ds_id, l_id, poly, feature_name );
sprintf( layer_name, "accum_%d", i );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "accum_%d", i );
tgShapefileCreateFeature( ds_id, l_id, *lines, feature_name );
} }
lines->add_contour(poly.get_contour(0), 0); tgPolygonAddToClipperAccumulator(poly, false);
line_tps->push_back( marking_tps[i] ); line_tps->push_back( marking_tps[i] );
} }

View file

@ -97,7 +97,7 @@ public:
} }
int Finish( bool closed, unsigned int idx ); int Finish( bool closed, unsigned int idx );
int BuildBtg( superpoly_list* line_polys, texparams_list* line_tps, ClipPolyType* lines, superpoly_list* lights, bool debug ); int BuildBtg( superpoly_list* line_polys, texparams_list* line_tps, superpoly_list* lights, bool debug );
// int BuildBtg( float alt_m, superpoly_list* line_polys, texparams_list* line_tps, ClipPolyType* line_accum, superpoly_list* lights ); // int BuildBtg( float alt_m, superpoly_list* line_polys, texparams_list* line_tps, ClipPolyType* line_accum, superpoly_list* lights );
private: private:

View file

@ -89,7 +89,7 @@ point_list WaterRunway::GetNodes()
} }
int Runway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles ) int Runway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles )
{ {
TGPolygon base, safe_base; TGPolygon base, safe_base;
@ -137,7 +137,7 @@ int Runway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, supe
case 1: // asphalt: case 1: // asphalt:
case 2: // concrete case 2: // concrete
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete " << rwy.surface); SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete " << rwy.surface);
gen_rwy( rwy_polys, texparams, accum, slivers, make_shapefiles ); gen_rwy( rwy_polys, texparams, slivers, make_shapefiles );
gen_runway_lights( rwy_lights ); gen_runway_lights( rwy_lights );
break; break;
@ -146,7 +146,7 @@ int Runway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, supe
case 5: // Gravel case 5: // Gravel
case 12: // dry lakebed case 12: // dry lakebed
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Grass, Dirt, Gravel or Dry Lakebed " << rwy.surface ); SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Grass, Dirt, Gravel or Dry Lakebed " << rwy.surface );
gen_simple_rwy( rwy_polys, texparams, accum, slivers ); gen_simple_rwy( rwy_polys, texparams, slivers );
gen_runway_lights( rwy_lights ); gen_runway_lights( rwy_lights );
break; break;

View file

@ -42,7 +42,6 @@ public:
int BuildBtg( superpoly_list* rwy_polys, int BuildBtg( superpoly_list* rwy_polys,
texparams_list* texparams, texparams_list* texparams,
superpoly_list* rwy_lights, superpoly_list* rwy_lights,
ClipPolyType* accum,
poly_list& slivers, poly_list& slivers,
TGPolygon* apt_base, TGPolygon* apt_base,
TGPolygon* apt_clearing, TGPolygon* apt_clearing,
@ -50,7 +49,6 @@ public:
void BuildShoulder( superpoly_list *rwy_polys, void BuildShoulder( superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
TGPolygon* apt_base, TGPolygon* apt_base,
TGPolygon* apt_clearing ); TGPolygon* apt_clearing );
@ -108,7 +106,6 @@ private:
double &start_pct, double &end_pct, double &start_pct, double &end_pct,
superpoly_list* rwy_polys, superpoly_list* rwy_polys,
texparams_list* texparams, texparams_list* texparams,
ClipPolyType* accum,
poly_list& slivers, poly_list& slivers,
bool make_shapefiles ); bool make_shapefiles );
@ -123,7 +120,6 @@ private:
texparams_list *texparams, texparams_list *texparams,
superpoly_list *shoulder_polys, superpoly_list *shoulder_polys,
texparams_list *shoulder_tps, texparams_list *shoulder_tps,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
bool make_shapefiles ); bool make_shapefiles );
@ -136,11 +132,10 @@ private:
std::string surface, std::string surface,
TGSuperPoly& sp, TGTexParams& tp ); TGSuperPoly& sp, TGTexParams& tp );
void gen_simple_rwy( superpoly_list *rwy_polys, texparams_list *texparams, ClipPolyType *accum, poly_list& slivers ); void gen_simple_rwy( superpoly_list *rwy_polys, texparams_list *texparams, poly_list& slivers );
void gen_rwy( superpoly_list* rwy_polys, void gen_rwy( superpoly_list* rwy_polys,
texparams_list* texparams, texparams_list* texparams,
ClipPolyType* accum,
poly_list& slivers, poly_list& slivers,
bool make_shapefiles ); bool make_shapefiles );

View file

@ -156,7 +156,6 @@ void Runway::gen_runway_section( const TGPolygon& runway,
texparams_list *texparams, texparams_list *texparams,
superpoly_list *shoulder_polys, superpoly_list *shoulder_polys,
texparams_list *shoulder_tps, texparams_list *shoulder_tps,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
bool make_shapefiles ) bool make_shapefiles )
{ {
@ -360,7 +359,7 @@ void Runway::gen_runway_section( const TGPolygon& runway,
} }
// Clip the new polygon against what ever has already been created. // Clip the new polygon against what ever has already been created.
TGPolygon clipped = tgPolygonDiffClipper( section, *accum ); TGPolygon clipped = tgPolygonDiffClipperWithAccumulator( section );
tgPolygonFindSlivers( clipped, slivers ); tgPolygonFindSlivers( clipped, slivers );
// Split long edges to create an object that can better flow with // Split long edges to create an object that can better flow with
@ -377,7 +376,7 @@ void Runway::gen_runway_section( const TGPolygon& runway,
SG_LOG(SG_GENERAL, SG_DEBUG, "section = " << clipped.contours()); SG_LOG(SG_GENERAL, SG_DEBUG, "section = " << clipped.contours());
*accum = tgPolygonUnionClipper( section, *accum ); tgPolygonAddToClipperAccumulator( section, false );
// Store away what we need to know for texture coordinate // Store away what we need to know for texture coordinate
// calculation. (CLO 10/20/02: why can't we calculate texture // calculation. (CLO 10/20/02: why can't we calculate texture
@ -419,7 +418,6 @@ void Runway::gen_rw_designation( TGPolygon poly, double heading, string rwname,
double &start_pct, double &end_pct, double &start_pct, double &end_pct,
superpoly_list *rwy_polys, superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
bool make_shapefiles ) bool make_shapefiles )
{ {
@ -447,7 +445,7 @@ void Runway::gen_rw_designation( TGPolygon poly, double heading, string rwname,
letter, letter,
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
@ -477,7 +475,7 @@ void Runway::gen_rw_designation( TGPolygon poly, double heading, string rwname,
tex1, tex1,
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
gen_runway_section( poly, gen_runway_section( poly,
start_pct, end_pct, start_pct, end_pct,
@ -487,7 +485,7 @@ void Runway::gen_rw_designation( TGPolygon poly, double heading, string rwname,
tex2, tex2,
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} else if (rwname.length() == 1) { } else if (rwname.length() == 1) {
@ -501,7 +499,7 @@ void Runway::gen_rw_designation( TGPolygon poly, double heading, string rwname,
tex1, tex1,
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
} }
@ -513,7 +511,6 @@ void Runway::gen_rw_designation( TGPolygon poly, double heading, string rwname,
// document AC 150/5340-1H // document AC 150/5340-1H
void Runway::gen_rwy( superpoly_list *rwy_polys, void Runway::gen_rwy( superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
bool make_shapefiles ) bool make_shapefiles )
{ {
@ -619,7 +616,7 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
"dspl_thresh", "dspl_thresh",
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
// main chunks // main chunks
@ -634,7 +631,7 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
"dspl_thresh", "dspl_thresh",
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
} }
@ -650,7 +647,7 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
"dspl_arrows", "dspl_arrows",
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
@ -666,7 +663,7 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
"no_threshold", "no_threshold",
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} else { } else {
// Thresholds for all others // Thresholds for all others
@ -680,14 +677,14 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
"threshold", "threshold",
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
// Runway designation block // Runway designation block
gen_rw_designation( runway_half, heading, gen_rw_designation( runway_half, heading,
rwname, start1_pct, end1_pct, rwname, start1_pct, end1_pct,
rwy_polys, texparams, accum, slivers, rwy_polys, texparams, slivers,
make_shapefiles ); make_shapefiles );
// Generate remaining markings depending on type of runway // Generate remaining markings depending on type of runway
@ -728,7 +725,7 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
rw_marking_list[i].tex, rw_marking_list[i].tex,
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
} }
@ -757,7 +754,7 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
"rest", "rest",
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
@ -787,7 +784,7 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
"stopway", "stopway",
rwy_polys, texparams, rwy_polys, texparams,
&shoulder_polys, &shoulder_tps, &shoulder_polys, &shoulder_tps,
accum, slivers, slivers,
make_shapefiles ); make_shapefiles );
} }
} }
@ -796,7 +793,6 @@ void Runway::gen_rwy( superpoly_list *rwy_polys,
void Runway::BuildShoulder( superpoly_list *rwy_polys, void Runway::BuildShoulder( superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers, poly_list& slivers,
TGPolygon* apt_base, TGPolygon* apt_base,
TGPolygon* apt_clearing ) TGPolygon* apt_clearing )
@ -808,7 +804,7 @@ void Runway::BuildShoulder( superpoly_list *rwy_polys,
shoulder = shoulder_polys[i].get_poly(); shoulder = shoulder_polys[i].get_poly();
// Clip the new polygon against what ever has already been created. // Clip the new polygon against what ever has already been created.
TGPolygon clipped = tgPolygonDiffClipper( shoulder, *accum ); TGPolygon clipped = tgPolygonDiffClipperWithAccumulator( shoulder );
tgPolygonFindSlivers( clipped, slivers ); tgPolygonFindSlivers( clipped, slivers );
// Split long edges to create an object that can better flow with // Split long edges to create an object that can better flow with
@ -819,7 +815,7 @@ void Runway::BuildShoulder( superpoly_list *rwy_polys,
rwy_polys->push_back( shoulder_polys[i] ); rwy_polys->push_back( shoulder_polys[i] );
texparams->push_back( shoulder_tps[i] ); texparams->push_back( shoulder_tps[i] );
*accum = tgPolygonUnionClipper( shoulder, *accum ); tgPolygonAddToClipperAccumulator( shoulder, false );
if (apt_base) if (apt_base)
{ {

View file

@ -34,7 +34,6 @@ using std::string;
// texparams, and accum // texparams, and accum
void Runway::gen_simple_rwy( superpoly_list *rwy_polys, void Runway::gen_simple_rwy( superpoly_list *rwy_polys,
texparams_list *texparams, texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers ) poly_list& slivers )
{ {
TGPolygon runway = gen_runway_w_mid( 0.0, 0.0 ); TGPolygon runway = gen_runway_w_mid( 0.0, 0.0 );
@ -91,7 +90,7 @@ void Runway::gen_simple_rwy( superpoly_list *rwy_polys,
"", "",
rwy_polys, texparams, rwy_polys, texparams,
NULL, NULL, NULL, NULL,
accum, slivers, slivers,
false ); false );
} }
@ -104,7 +103,7 @@ void Runway::gen_simple_rwy( superpoly_list *rwy_polys,
"", "",
rwy_polys, texparams, rwy_polys, texparams,
NULL, NULL, NULL, NULL,
accum, slivers, slivers,
false ); false );
} }
} }

View file

@ -58,11 +58,10 @@ Taxiway::Taxiway(char* definition)
lon = pt_x; lon = pt_x;
} }
int Taxiway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles ) int Taxiway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles )
{ {
TGPolygon taxi; TGPolygon taxi;
TGPolygon base, safe_base; TGPolygon base, safe_base;
TGPolygon pre_accum;
std::string material; std::string material;
void* ds_id = NULL; // If we are going to build shapefiles void* ds_id = NULL; // If we are going to build shapefiles
void* l_id = NULL; // datasource and layer IDs void* l_id = NULL; // datasource and layer IDs
@ -133,11 +132,9 @@ int Taxiway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, sup
l_id = tgShapefileOpenLayer( ds_id, layer_name ); l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "original" ); sprintf( feature_name, "original" );
tgShapefileCreateFeature( ds_id, l_id, taxi, feature_name ); tgShapefileCreateFeature( ds_id, l_id, taxi, feature_name );
pre_accum = *accum;
} }
TGPolygon clipped = tgPolygonDiffClipper( taxi, *accum ); TGPolygon clipped = tgPolygonDiffClipperWithAccumulator( taxi );
tgPolygonFindSlivers( clipped, slivers ); tgPolygonFindSlivers( clipped, slivers );
SG_LOG(SG_GENERAL, SG_DEBUG, "clipped = " << clipped.contours()); SG_LOG(SG_GENERAL, SG_DEBUG, "clipped = " << clipped.contours());
@ -149,7 +146,7 @@ int Taxiway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, sup
rwy_polys->push_back( sp ); rwy_polys->push_back( sp );
*accum = tgPolygonUnionClipper( taxi, *accum ); tgPolygonAddToClipperAccumulator( taxi, false );
/* If debugging this poly, write the poly, and clipped poly and the accum buffer into their own layers */ /* If debugging this poly, write the poly, and clipped poly and the accum buffer into their own layers */
if ( make_shapefiles ) { if ( make_shapefiles ) {
@ -160,16 +157,6 @@ int Taxiway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, sup
l_id = tgShapefileOpenLayer( ds_id, layer_name ); l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "clipped" ); sprintf( feature_name, "clipped" );
tgShapefileCreateFeature( ds_id, l_id, clipped, feature_name ); tgShapefileCreateFeature( ds_id, l_id, clipped, feature_name );
sprintf( layer_name, "pre_accum" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "pre_accum" );
tgShapefileCreateFeature( ds_id, l_id, pre_accum, feature_name );
sprintf( layer_name, "post_accum" );
l_id = tgShapefileOpenLayer( ds_id, layer_name );
sprintf( feature_name, "post_accum" );
tgShapefileCreateFeature( ds_id, l_id, *accum, feature_name );
} }
SG_LOG(SG_GENERAL, SG_DEBUG, "tp construct"); SG_LOG(SG_GENERAL, SG_DEBUG, "tp construct");

View file

@ -22,7 +22,6 @@ public:
int BuildBtg( superpoly_list* taxi_polys, int BuildBtg( superpoly_list* taxi_polys,
texparams_list* texparams, texparams_list* texparams,
superpoly_list* taxi_lights, superpoly_list* taxi_lights,
ClipPolyType* accum,
poly_list& slivers, poly_list& slivers,
TGPolygon* apt_base, TGPolygon* apt_base,
TGPolygon* apt_clearing, TGPolygon* apt_clearing,