1
0
Fork 0

fix the other FindIntermediateNodes error. This seems to have fixed

the hole in the runway at LIMA as well - I think it's ok for master
This commit is contained in:
Peter Sadrozinski 2012-11-14 19:55:18 -05:00 committed by Christian Schmitt
parent 79c9b17595
commit d2bc41428c
6 changed files with 62 additions and 36 deletions

View file

@ -379,13 +379,20 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
SG_LOG(SG_GENERAL, SG_INFO, "Build Runway " << i + 1 << " of " << runways.size());
slivers.clear();
if ( isDebugRunway(i) ) {
sprintf( shapefile_name, "runway_%d", i );
} else {
strcpy( shapefile_name, "" );
}
shapefile = shapefile_name;
if (boundary.size())
{
runways[i]->BuildBtg( rwy_polys, rwy_lights, slivers, make_shapefiles );
runways[i]->BuildBtg( rwy_polys, rwy_lights, slivers, shapefile );
}
else
{
runways[i]->BuildBtg( rwy_polys, rwy_lights, slivers, apt_base, apt_clearing, make_shapefiles );
runways[i]->BuildBtg( rwy_polys, rwy_lights, slivers, apt_base, apt_clearing, shapefile );
}
// Now try to merge any slivers we found

View file

@ -87,7 +87,7 @@ tgContour WaterRunway::GetBuoys()
return buoys_nodes;
}
int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, bool make_shapefiles )
int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, std::string& shapefile_name )
{
if ( rwy.surface == 1 /* Asphalt */ )
{
@ -133,7 +133,7 @@ int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights
case 1: // asphalt:
case 2: // concrete
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete " << rwy.surface);
gen_rwy( rwy_polys, slivers, make_shapefiles );
gen_rwy( rwy_polys, slivers, shapefile_name );
gen_runway_lights( rwy_lights );
break;
@ -166,11 +166,11 @@ int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights
return 0;
}
int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, tgPolygon& apt_base, tgPolygon& apt_clearing, bool make_shapefiles )
int Runway::BuildBtg( tgpolygon_list& rwy_polys, tglightcontour_list& rwy_lights, tgcontour_list& slivers, tgPolygon& apt_base, tgPolygon& apt_clearing, std::string& shapefile_name )
{
tgContour base, safe_base;
BuildBtg( rwy_polys, rwy_lights, slivers, make_shapefiles );
BuildBtg( rwy_polys, rwy_lights, slivers, shapefile_name );
// generate area around runways
base = gen_runway_area_w_extend( 20.0, -rwy.overrun[0], -rwy.overrun[1], 20.0 );

View file

@ -39,14 +39,14 @@ public:
int BuildBtg( tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
bool make_shapefiles );
std::string& shapefile_name );
int BuildBtg( tgpolygon_list& rwy_polys,
tglightcontour_list& rwy_lights,
tgcontour_list& slivers,
tgPolygon& apt_base,
tgPolygon& apt_clearing,
bool make_shapefiles );
std::string& shapefile_name );
void BuildShoulder( tgpolygon_list& rwy_polys,
tgcontour_list& slivers );
@ -108,7 +108,7 @@ private:
double &start_pct, double &end_pct,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
bool make_shapefiles );
std::string& shapefile_name );
// generate a section of runway with shoulders
void gen_runway_section( const tgPolygon& runway,
@ -120,7 +120,7 @@ private:
tgpolygon_list& rwy_polys,
tgpolygon_list& shoulder_polys,
tgcontour_list& slivers,
bool make_shapefiles );
std::string& shapefile_name );
// generate a section of runway without shoulders
void gen_runway_section( const tgPolygon& runway,
@ -131,7 +131,7 @@ private:
const string& material,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
bool make_shapefiles );
std::string& shapefile_name );
// generate a section of shoulder
tgPolygon gen_shoulder_section( SGGeod& p0, SGGeod& p1,
@ -145,7 +145,7 @@ private:
void gen_rwy( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
bool make_shapefiles );
std::string& shapefile_name );
void gen_runway_lights( tglightcontour_list& lights );

View file

@ -24,6 +24,8 @@
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
#include <boost/lexical_cast.hpp>
#include <Geometry/poly_support.hxx>
#include "global.hxx"
@ -142,13 +144,14 @@ void Runway::gen_runway_section( const tgPolygon& runway,
tgpolygon_list& rwy_polys,
tgpolygon_list& shoulder_polys,
tgcontour_list& slivers,
bool make_shapefiles )
std::string& shapefile_name )
{
double width = rwy.width;
double length = rwy.length;
double lshoulder_width = 0.0f;
double rshoulder_width = 0.0f;
std::string shoulder_surface = "";
#if 0
static int runway_idx = 0;
static int section_idx = 0;
@ -298,9 +301,17 @@ void Runway::gen_runway_section( const tgPolygon& runway,
SG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << material_prefix << material);
SG_LOG(SG_GENERAL, SG_DEBUG, section );
if( shapefile_name.size() ) {
tgPolygon::ToShapefile( section, "./airport_dbg", std::string("preclip"), shapefile_name );
}
// Clip the new polygon against what ever has already been created.
tgPolygon clipped = tgPolygon::DiffWithAccumulator( section );
if( shapefile_name.size() ) {
tgPolygon::ToShapefile( clipped, "./airport_dbg", std::string("postclip"), shapefile_name );
}
tgPolygon::RemoveSlivers( clipped, slivers );
// Split long edges to create an object that can better flow with
@ -339,7 +350,7 @@ void Runway::gen_runway_section( const tgPolygon& runway,
const string& material,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
bool make_shapefiles )
std::string& shapefile_name )
{
double width = rwy.width;
double length = rwy.length;
@ -471,7 +482,7 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname,
double &start_pct, double &end_pct,
tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
bool make_shapefiles )
std::string& shapefile_name )
{
if (rwname != "XX") { /* Do not create a designation block if the runway name is set to none */
string letter = "";
@ -498,7 +509,7 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
shapefile_name );
}
@ -528,7 +539,7 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
shapefile_name );
gen_runway_section( poly,
start_pct, end_pct,
0.5, 1.0,
@ -538,7 +549,7 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
shapefile_name );
} else if (rwname.length() == 1) {
sprintf( tex1, "%c%c", rwname[0], 'c');
@ -552,7 +563,7 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
shapefile_name );
}
}
}
@ -563,9 +574,11 @@ void Runway::gen_rw_designation( tgPolygon poly, double heading, string rwname,
// document AC 150/5340-1H
void Runway::gen_rwy( tgpolygon_list& rwy_polys,
tgcontour_list& slivers,
bool make_shapefiles )
std::string& shapefile_name )
{
SG_LOG( SG_GENERAL, SG_DEBUG, "Building runway = " << rwy.rwnum[0] << " / " << rwy.rwnum[1]);
std::string section_name = "";
bool debug = shapefile_name.size() != 0;
//
// Generate the basic runway outlines
@ -644,6 +657,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
// starting (possibly partial chunk)
start1_pct = end1_pct;
end1_pct = start1_pct + ( part_len / length );
if ( debug ) { section_name = shapefile_name + "_disp_start"; }
gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
@ -653,12 +667,13 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
section_name );
// main chunks
for ( int i = 0; i < count; ++i ) {
start1_pct = end1_pct;
end1_pct = start1_pct + ( 60.0 / length );
if ( debug ) { section_name = shapefile_name + "_disp_" + boost::lexical_cast<std::string>(i); }
gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
@ -668,13 +683,14 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
section_name );
}
}
// final arrows
start1_pct = end1_pct;
end1_pct = start1_pct + ( final_arrow / length );
if ( debug ) { section_name = shapefile_name + "_disp_end"; }
gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
@ -684,13 +700,14 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
section_name );
}
if (rwy.marking[rwhalf] == 0) {
// No marking
start1_pct = end1_pct;
end1_pct = start1_pct + ( 10 / length );
if ( debug ) { section_name = shapefile_name + "_nothresh"; }
gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
@ -700,11 +717,12 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
section_name );
} else {
// Thresholds for all others
start1_pct = end1_pct;
end1_pct = start1_pct + ( 202.0 * SG_FEET_TO_METER / length );
if ( debug ) { section_name = shapefile_name + "thresh"; }
gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
@ -714,14 +732,14 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
shapefile_name );
}
// Runway designation block
gen_rw_designation( runway_half, heading,
rwy.rwnum[rwhalf], start1_pct, end1_pct,
rwy_polys, slivers,
make_shapefiles );
shapefile_name );
// Generate remaining markings depending on type of runway
if (rwy.marking[rwhalf] > 1) {
@ -753,6 +771,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
if ( end1_pct < 1.0 ) {
start1_pct = end1_pct;
end1_pct = start1_pct + ( rw_marking_list[i].size / length );
if ( debug ) { section_name = shapefile_name + "_" + rw_marking_list[i].tex; }
gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
@ -762,7 +781,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
section_name );
}
}
}
@ -781,7 +800,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
while ( end1_pct < 1.0 ) {
start1_pct = end1_pct;
end1_pct = start1_pct + rest1_inc;
if ( debug ) { section_name = shapefile_name + "rest_" + boost::lexical_cast<std::string>(end1_pct); }
gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
@ -791,7 +810,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
section_name );
}
start1_pct = 0.0;
@ -811,7 +830,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
for(int i=0; i<count; i++) {
start1_pct=end1_pct;
end1_pct = start1_pct + ( part_len / length );
if ( debug ) { section_name = shapefile_name + "stopway"; }
gen_runway_section( runway_half,
-end1_pct, -start1_pct,
0.0, 1.0,
@ -821,7 +840,7 @@ void Runway::gen_rwy( tgpolygon_list& rwy_polys,
rwy_polys,
shoulder_polys,
slivers,
make_shapefiles );
section_name );
}
}
}

View file

@ -32,6 +32,7 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
{
tgContour runway = gen_runway_w_mid( 0.0, 0.0 );
tgPolygon runway_half;
std::string empty = "";
for ( int rwhalf=0; rwhalf<2; ++rwhalf ) {
@ -66,8 +67,7 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
// Displaced threshold if it exists
if ( rwy.threshold[rwhalf] > 0.0 ) {
SG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is "
<< rwy.threshold[rwhalf] );
SG_LOG( SG_GENERAL, SG_DEBUG, "Displaced threshold for RW side " << rwhalf << " is " << rwy.threshold[rwhalf] );
start_pct = end_pct;
end_pct = start_pct + ( rwy.threshold[rwhalf] / length );
@ -79,7 +79,7 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
"",
rwy_polys,
slivers,
false );
empty );
}
// Generate runway
@ -91,6 +91,6 @@ void Runway::gen_simple_rwy( tgpolygon_list& rwy_polys,
"",
rwy_polys,
slivers,
false );
empty );
}
}

View file

@ -1160,7 +1160,7 @@ bool FindIntermediateNode( const SGGeod& start, const SGGeod& end,
if ( (current.getLatitudeDeg() > (p_min.getLatitudeDeg() + (bbEpsilon))) && (current.getLatitudeDeg() < (p_max.getLatitudeDeg() - (bbEpsilon))) ) {
x_err = fabs(current.getLongitudeDeg() - (m1 * current.getLongitudeDeg() + b1));
x_err = fabs(current.getLongitudeDeg() - (m1 * current.getLatitudeDeg() + b1));
if ( x_err < errEpsilon ) {
found_node = true;