1
0
Fork 0

handle closed poly case where clip results in no contours

when dumping accumylator, dump each stage in its own layer
This commit is contained in:
Peter Sadrozinski 2012-11-07 19:25:42 -05:00 committed by Christian Schmitt
parent 76ee23a294
commit f6a08f3095
2 changed files with 18 additions and 16 deletions

View file

@ -453,25 +453,24 @@ int ClosedPoly::BuildBtg( tgpolygon_list& rwy_polys, tgcontour_list& slivers, st
tgPolygon clipped = tgPolygon::DiffWithAccumulator( pre_tess );
SG_LOG(SG_GENERAL, SG_INFO, "BuildBtg: clipped poly has " << clipped.Contours() << " contours" << " and " << clipped.TotalNodes() << " points : shapefile_name is " << shapefile_name );
if ( clipped.Contours() ) {
if( shapefile_name.size() ) {
tgPolygon::ToShapefile( clipped, "./airport_dbg", std::string("postclip"), shapefile_name );
}
if( shapefile_name.size() ) {
tgPolygon::ToShapefile( pre_tess, "./airport_dbg", std::string("postclip"), shapefile_name );
tgPolygon::RemoveSlivers( clipped, slivers );
clipped.SetMaterial( GetMaterial( surface_type ) );
clipped.SetTexParams( clipped.GetNode(0,0), 5.0, 5.0, texture_heading );
clipped.SetTexLimits( 0.0, 0.0, 1.0, 1.0 );
clipped.SetTexMethod( TG_TEX_BY_TPS_NOCLIP );
rwy_polys.push_back( clipped );
tgPolygon::AddToAccumulator( pre_tess );
}
tgPolygon::RemoveSlivers( clipped, slivers );
clipped.SetMaterial( GetMaterial( surface_type ) );
clipped.SetTexParams( clipped.GetNode(0,0), 5.0, 5.0, texture_heading );
clipped.SetTexLimits( 0.0, 0.0, 1.0, 1.0 );
clipped.SetTexMethod( TG_TEX_BY_TPS_NOCLIP );
rwy_polys.push_back( clipped );
tgPolygon::AddToAccumulator( pre_tess );
}
// clean up to save ram : we're done here...
return 1;
}

View file

@ -2093,10 +2093,13 @@ void clipperToShapefile( ClipperLib::Polygons polys, const std::string& path, co
tgPolygon::ToShapefile( poly, path, layer, name);
}
void tgPolygon::AccumulatorToShapefiles( const std::string& path, const std::string& layer )
void tgPolygon::AccumulatorToShapefiles( const std::string& path, const std::string& layer_prefix )
{
char shapefile[16];
char layer[16];
for (unsigned int i=0; i < clipper_accumulator.size(); i++) {
sprintf( layer, "%s_%d", layer_prefix.c_str(), i );
sprintf( shapefile, "accum_%d", i );
clipperToShapefile( clipper_accumulator[i], path, layer, std::string(shapefile) );
}