1
0
Fork 0

Compare commits

...

4 commits

Author SHA1 Message Date
fly
155a5d240f Fix missing v1300 surface codes for rwy and twy
Signed-off-by: fly <merspieler@alwaysdata.com>
2023-12-23 03:32:05 +01:00
scttgs0
9d9c6033c2 Surround 'cp' arguments with quotes.
patch provided by thefgfseagle@gmail.com.
2023-12-10 01:27:49 -06:00
scttgs0
ce412c5bf1 Fix: an implicit old-style integer conversion that sometimes results in a division by zero.
Patch submitted by: David Megginson
2023-10-30 09:53:06 -05:00
fly
3afc4578da tgAccumulator: fix accumulator reduction
Signed-off-by: fly <merspieler@alwaysdata.com>
2023-09-25 11:25:10 +01:00
5 changed files with 43 additions and 15 deletions

View file

@ -135,9 +135,9 @@ tgContour WaterRunway::GetBuoys()
int Runway::BuildBtg(tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, tgAccumulator& accum, std::string& shapefile_name)
{
if (rwy.surface == 1 /* Asphalt */) {
if (rwy.surface == 1 || (rwy.surface >= 20 && rwy.surface <= 38)/* Asphalt */) {
material_prefix = "pa_";
} else if (rwy.surface == 2 /* Concrete */) {
} else if (rwy.surface == 2 || (rwy.surface >= 50 && rwy.surface <= 57) /* Concrete */) {
material_prefix = "pc_";
} else if (rwy.surface == 3 /* Turf/Grass */) {
material_prefix = "grass_rwy";
@ -158,8 +158,35 @@ int Runway::BuildBtg(tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights,
// first, check the surface type - anything but concrete and asphalt are easy
switch (rwy.surface) {
case 1: // asphalt:
case 2: // concrete
case 1: // asphalt:
case 2: // concrete
case 20: // Light colored asphalt
case 21:
case 22:
case 23:
case 24: // Asphalt
case 25:
case 26:
case 27: // Darker colored asphalt
case 28:
case 29:
case 30:
case 31: // Very dark colored asphalt
case 32:
case 33:
case 34:
case 35: // Near black, new looking asphalt
case 36:
case 37:
case 38:
case 50: // Light “new” looking concrete
case 51:
case 52:
case 53: // Concrete
case 54:
case 55: // Dark concrete
case 56:
case 57:
TG_LOG(SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete " << rwy.surface);
gen_rwy(rwy_polys, slivers, accum, shapefile_name);
gen_runway_lights(rwy_lights);

View file

@ -103,7 +103,7 @@ int Taxiway::BuildBtg(tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights
std::string material;
if (surface == 1 /* Asphalt */) {
if (surface == 1 || (surface >= 20 && surface <= 38)/* Asphalt */) {
if ((width <= 50) && (lighting[1] == '6')) {
material = "pa_taxiway"s;
GenLights(rwy_lights);
@ -111,7 +111,7 @@ int Taxiway::BuildBtg(tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights
material = "pa_tiedown"s;
}
} else if (surface == 2 /* Concrete */) {
} else if (surface == 2 || (surface >= 50 && surface <= 57)/* Concrete */) {
if ((width <= 50) && (lighting[1] == '6')) {
material = "pc_taxiway"s;
GenLights(rwy_lights);

View file

@ -102,7 +102,7 @@ void TGConstruct::AddCustomObjects( void ) {
string command = "copy /Y " + basecom + " " + dest_dir;
#else
string basecom = srcbase.utf8Str();
string command = "cp " + basecom + " " + dest_dir;
string command = "cp \"" + basecom + "\" \"" + dest_dir + "\"";
#endif
SG_LOG( SG_GENERAL, SG_DEBUG, "running " << command );

View file

@ -90,13 +90,13 @@ tgPolygon tgAccumulator::Diff( const tgPolygon& subject )
all_nodes.add( nodes[i] );
}
unsigned int num_hits = 0;
tgRectangle box1 = subject.GetBoundingBox();
ClipperLib::Paths clipper_subject = tgPolygon::ToClipper( subject );
ClipperLib::Paths clipper_result;
while ( !done && max_hits > 0 ) {
unsigned int num_hits = 0;
ClipperLib::Clipper c;
c.Clear();
@ -104,6 +104,10 @@ tgPolygon tgAccumulator::Diff( const tgPolygon& subject )
// clip result against all polygons in the accum that intersect our bb
for (unsigned int i=0; i < accum.size(); i++) {
if (num_hits >= max_hits)
{
break;
}
tgRectangle box2 = BoundingBox_FromClipper( accum[i] );
if ( box2.intersects(box1) )
@ -117,10 +121,7 @@ tgPolygon tgAccumulator::Diff( const tgPolygon& subject )
if ( !c.Execute(ClipperLib::ClipType::Difference, clipper_result, ClipperLib::PolyFillType::NonZero, ClipperLib::PolyFillType::NonZero) ) {
SG_LOG(SG_GENERAL, SG_ALERT, "Diff With Accumulator returned FALSE - reducing accumulator" );
max_hits = num_hits-1;
FILE* fp = fopen( "./accumulator_fail.log", "a" );
fprintf( fp, "%s : reduce from %u to %u\n", debugstr.c_str(), num_hits, max_hits );
fclose(fp);
SG_LOG(SG_GENERAL, SG_DEBUG, debugstr << ": reduce from " << num_hits << " to " << max_hits );
} else {
result = tgPolygon::FromClipper( clipper_result );
result = tgPolygon::AddColinearNodes( result, all_nodes );
@ -236,4 +237,4 @@ void tgAccumulator::ToClipperfiles( const std::string& path, const std::string&
}
}
}
}
}

View file

@ -125,11 +125,11 @@ public:
}
int GetColStepArcsec() {
return pxSizeX * 3600;
return std::round(pxSizeX * 3600.0);
}
int GetRowStepArcsec() {
return pxSizeY * 3600;
return std::round(pxSizeY * 3600.0);
}
void GetDataChunk(int *buffer,