1
0
Fork 0

Removing alt_m from all the BuildBTG functions. It isn't used byt SimGear

int the geo_direct_wgs_84() calls.
This commit is contained in:
Peter Sadrozinski 2012-03-04 11:05:27 -05:00 committed by Christian Schmitt
parent f0a7f39e7b
commit 051e73da6a
12 changed files with 362 additions and 379 deletions

View file

@ -546,11 +546,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
{
if (boundary)
{
runways[i]->BuildBtg( altitude, &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, NULL, NULL );
runways[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, NULL, NULL );
}
else
{
runways[i]->BuildBtg( altitude, &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, &apt_base, &apt_clearing );
runways[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, &apt_base, &apt_clearing );
}
}
@ -580,11 +580,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary)
{
helipads[i]->BuildBtg( altitude, &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, NULL, NULL );
helipads[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, NULL, NULL );
}
else
{
helipads[i]->BuildBtg( altitude, &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, &apt_base, &apt_clearing );
helipads[i]->BuildBtg( &rwy_polys, &rwy_tps, &rwy_lights, &accum, slivers, &apt_base, &apt_clearing );
}
// Now try to merge any slivers we found
@ -610,11 +610,11 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary)
{
pavements[i]->BuildBtg( altitude, &pvmt_polys, &pvmt_tps, &accum, slivers, NULL, NULL, make_shapefiles );
pavements[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &accum, slivers, NULL, NULL, make_shapefiles );
}
else
{
pavements[i]->BuildBtg( altitude, &pvmt_polys, &pvmt_tps, &accum, slivers, &apt_base, &apt_clearing, make_shapefiles );
pavements[i]->BuildBtg( &pvmt_polys, &pvmt_tps, &accum, slivers, &apt_base, &apt_clearing, make_shapefiles );
}
// Now try to merge any slivers we found
@ -639,7 +639,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if ( runways[i]->GetsShoulder() )
{
slivers.clear();
runways[i]->BuildShoulder( altitude, &rwy_polys, &rwy_tps, &accum, slivers, &apt_base, &apt_clearing );
runways[i]->BuildShoulder( &rwy_polys, &rwy_tps, &accum, slivers, &apt_base, &apt_clearing );
// Now try to merge any slivers we found
merge_slivers( rwy_polys, slivers );
@ -652,7 +652,7 @@ void Airport::BuildBtg(const string& root, const string_list& elev_src )
if (boundary)
{
SG_LOG(SG_GENERAL, SG_INFO, "Build user defined boundary " );
boundary->BuildBtg( altitude, &apt_base, &apt_clearing, false );
boundary->BuildBtg( &apt_base, &apt_clearing, false );
}
if ( apt_base.total_size() == 0 )

View file

@ -32,7 +32,6 @@ TGPolygon gen_wgs84_area( Point3D origin,
double displ1, double displ2,
double width_m,
double heading_deg,
double alt_m,
bool add_mid )
{
TGPolygon result_list;
@ -43,18 +42,18 @@ TGPolygon gen_wgs84_area( Point3D origin,
// move to the +l end/center of the runway
Point3D ref = origin;
double lon = 0, lat = 0, r = 0;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), length_hdg,
length_m / 2.0 - displ2, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
// move to the l,-w corner (then we add points in a clockwise direction)
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
-width_m / 2.0, &lat, &lon, &r );
Point3D p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
// move to the l,w corner
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
@ -63,7 +62,7 @@ TGPolygon gen_wgs84_area( Point3D origin,
// move to the 0,w point (then we add points in a clockwise direction)
ref = origin;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
@ -71,18 +70,18 @@ TGPolygon gen_wgs84_area( Point3D origin,
// move to the -l end/center of the runway
ref = origin;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), length_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), length_hdg,
displ1 - length_m/2.0, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
// move to the -l,w corner (then we add points in a clockwise direction)
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
// move to the -l,-w corner
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
-width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
@ -91,7 +90,7 @@ TGPolygon gen_wgs84_area( Point3D origin,
// move to the 0,-w point (then we add points in a clockwise direction)
ref = origin;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
-width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
@ -105,7 +104,6 @@ TGPolygon gen_wgs84_area( Point3D end1, Point3D end2,
double displ1, double displ2,
double width_m,
double heading_deg,
double alt_m,
bool add_mid )
{
TGPolygon result_list;
@ -115,18 +113,18 @@ TGPolygon gen_wgs84_area( Point3D end1, Point3D end2,
// move from end2 to the displaced threshold
Point3D ref = end2;
double lon = 0, lat = 0, r = 0;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), heading_deg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), heading_deg,
length_m / 2.0 - displ2, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
// move to the l,-w corner (then we add points in a clockwise direction)
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
-width_m / 2.0, &lat, &lon, &r );
Point3D p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
// move to the l,w corner
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
@ -135,7 +133,7 @@ TGPolygon gen_wgs84_area( Point3D end1, Point3D end2,
// move to the 0,w point (then we add points in a clockwise direction)
ref = Point3D( (end1.lon()+end2.lon())/2.0f, (end1.lat()+end2.lat())/2.0f, 0.0f);
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
@ -143,18 +141,18 @@ TGPolygon gen_wgs84_area( Point3D end1, Point3D end2,
// move to the end1 center to the displ. threshold
ref = end1;
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), heading_deg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), heading_deg,
displ1 - length_m / 2.0, &lat, &lon, &r );
ref = Point3D( lon, lat, 0.0 );
// move to the -l,w corner (then we add points in a clockwise direction)
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
// move to the -l,-w corner
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
-width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );
@ -163,7 +161,7 @@ TGPolygon gen_wgs84_area( Point3D end1, Point3D end2,
// move to the 0,-w point (then we add points in a clockwise direction)
ref = Point3D( (end1.lon()+end2.lon())/2.0f, (end1.lat()+end2.lat())/2.0f, 0.0f);
geo_direct_wgs_84 ( alt_m, ref.lat(), ref.lon(), left_hdg,
geo_direct_wgs_84 ( ref.lat(), ref.lon(), left_hdg,
-width_m / 2.0, &lat, &lon, &r );
p = Point3D( lon, lat, 0.0 );
result_list.add_node( 0, p );

View file

@ -13,7 +13,13 @@
using std::string;
TGPolygon gen_wgs84_area( Point3D origin, double length_m, double displ1, double displ2, double width_m, double heading_deg, double alt_m, bool add_mid );
TGPolygon gen_wgs84_area( Point3D origin,
double length_m,
double displ1,
double displ2,
double width_m,
double heading_deg,
bool add_mid );
// This function uses the 2 runway end points for calculation, which
// yields a higher precision
@ -22,7 +28,6 @@ TGPolygon gen_wgs84_area( Point3D end1, Point3D end2,
double displ1, double displ2,
double width_m,
double heading_deg,
double alt_m,
bool add_mid );
TGPolygon gen_wgs84_rect( double lat, double lon, double heading, double length, double width );

View file

@ -385,7 +385,7 @@ void ClosedPoly::Finish()
holes.clear();
}
int ClosedPoly::BuildBtg( float alt_m, 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, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles )
{
TGPolygon base, safe_base;
string material;
@ -501,7 +501,7 @@ int ClosedPoly::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list
// Just used for user defined border - add a little bit, as some modelers made the border exactly on the edges
// - resulting in no base, which we can't handle
int ClosedPoly::BuildBtg( float alt_m, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles )
int ClosedPoly::BuildBtg( TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles )
{
TGPolygon base, safe_base;

View file

@ -25,10 +25,10 @@ public:
void Finish();
// Build BTG for airport base for airports with boundary
int BuildBtg( float alt_m, 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
int BuildBtg( float alt_m, 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, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing, bool make_shapefiles );
FeatureList* GetFeatures()
{

View file

@ -75,11 +75,13 @@ superpoly_list Helipad::gen_helipad_lights(void){
return result;
}
void Helipad::BuildBtg( float alt_m,
superpoly_list *rwy_polys,
texparams_list *texparams,
void Helipad::BuildBtg( superpoly_list *rwy_polys,
texparams_list *texparams,
superpoly_list *rwy_lights,
ClipPolyType *accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing )
ClipPolyType *accum,
poly_list& slivers,
TGPolygon* apt_base,
TGPolygon* apt_clearing )
{
SG_LOG( SG_GENERAL, SG_INFO, "Building helipad = " << heli.designator );
@ -89,7 +91,7 @@ void Helipad::BuildBtg( float alt_m,
Point3D helicenter = Point3D( heli.lon, heli.lat, 0.0);
TGPolygon helipad = gen_wgs84_area( helicenter, heli.length, 0, 0, heli.width, heli.heading, alt_m, false);
TGPolygon helipad = gen_wgs84_area( helicenter, heli.length, 0, 0, heli.width, heli.heading, false);
double start1_pct = 0.0;
double end1_pct = 0.0;

View file

@ -27,7 +27,7 @@ class Helipad
{
public:
Helipad(char* def);
void BuildBtg( float alt_m, 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, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing );
Point3D GetLoc()
{
@ -60,7 +60,7 @@ private:
// (return result points in degrees)
TGPolygon gen_runway_area_w_extend( double alt_m, double length_extend, double displ1, double displ2, double width_extend )
{
return ( gen_wgs84_area(Point3D(heli.lon, heli.lat, 0.0f), heli.length + 2.0*length_extend, displ1, displ2, heli.width + 2.0*width_extend, heli.heading, alt_m, false) );
return ( gen_wgs84_area(Point3D(heli.lon, heli.lat, 0.0f), heli.length + 2.0*length_extend, displ1, displ2, heli.width + 2.0*width_extend, heli.heading, false) );
}
superpoly_list gen_helipad_lights(void);

File diff suppressed because it is too large Load diff

View file

@ -73,13 +73,13 @@ TGPolygon WaterRunway::GetNodes()
// create a polygon for the 4 buoy points
// TODO: The amount of points can be increased if needed (more buoys)
buoy_nodes = gen_wgs84_area(Point3D( (lon[0] + lon[1]) / 2 , (lat[0] + lat[1]) / 2, 0), length, 0, 0, width, heading, 0, false);
buoy_nodes = gen_wgs84_area(Point3D( (lon[0] + lon[1]) / 2 , (lat[0] + lat[1]) / 2, 0), length, 0, 0, width, heading, false);
}
return buoy_nodes;
}
int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing )
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 )
{
TGPolygon base, safe_base;
string material;
@ -128,16 +128,16 @@ int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* te
case 1: // asphalt:
case 2: // concrete
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete" << rwy.surface);
gen_rwy( alt_m, material, rwy_polys, texparams, accum, slivers );
gen_runway_lights( alt_m, rwy_lights );
gen_rwy( material, rwy_polys, texparams, accum, slivers );
gen_runway_lights( rwy_lights );
break;
case 3: // Grass
case 4: // Dirt
case 5: // Gravel
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Turf, Dirt or Gravel" << rwy.surface );
gen_simple_rwy( alt_m, material, rwy_polys, texparams, accum, slivers );
gen_runway_lights( alt_m, rwy_lights );
gen_simple_rwy( material, rwy_polys, texparams, accum, slivers );
gen_runway_lights( rwy_lights );
break;
case 12: // dry lakebed
@ -166,10 +166,10 @@ int Runway::BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* te
// If we have shoulders, we need to grow even further...
// generate area around runways
base = gen_runway_area_w_extend( 0.0, 20.0, -rwy.overrun[0], -rwy.overrun[1], 20.0);
base = gen_runway_area_w_extend( 20.0, -rwy.overrun[0], -rwy.overrun[1], 20.0);
// also clear a safe area around the runway
safe_base = gen_runway_area_w_extend( 0.0, 180.0, -rwy.overrun[0], -rwy.overrun[1], 50.0 );
safe_base = gen_runway_area_w_extend( 180.0, -rwy.overrun[0], -rwy.overrun[1], 50.0 );
// add this to the airport clearing
*apt_clearing = tgPolygonUnionClipper(safe_base, *apt_clearing);

View file

@ -46,14 +46,20 @@ public:
else return false;
}
int BuildBtg( float alt_m, superpoly_list* rwy_polys, texparams_list* texparams, superpoly_list* rwy_lights, ClipPolyType* accum, poly_list& slivers, TGPolygon* apt_base, TGPolygon* apt_clearing );
void BuildShoulder( float alt_m,
superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers,
TGPolygon* apt_base,
TGPolygon* apt_clearing );
int BuildBtg( superpoly_list* rwy_polys,
texparams_list* texparams,
superpoly_list* rwy_lights,
ClipPolyType* accum,
poly_list& slivers,
TGPolygon* apt_base,
TGPolygon* apt_clearing );
void BuildShoulder( superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers,
TGPolygon* apt_base,
TGPolygon* apt_clearing );
private:
struct TGRunway {
@ -86,16 +92,16 @@ private:
// Build Helpers:
// generate an area for a runway and include midpoints
TGPolygon gen_runway_w_mid( double alt_m, double length_extend_m, double width_extend_m )
TGPolygon gen_runway_w_mid( double length_extend_m, double width_extend_m )
{
return ( gen_wgs84_area( Point3D(GetStart()), Point3D(GetEnd()), 2.0*length_extend_m, 0.0, 0.0, rwy.width + 2.0 * width_extend_m, rwy.heading, alt_m, true) );
return ( gen_wgs84_area( Point3D(GetStart()), Point3D(GetEnd()), 2.0*length_extend_m, 0.0, 0.0, rwy.width + 2.0 * width_extend_m, rwy.heading, true) );
}
// generate an area for a runway with expansion specified in meters
// (return result points in degrees)
TGPolygon gen_runway_area_w_extend( double alt_m, double length_extend, double displ1, double displ2, double width_extend )
TGPolygon gen_runway_area_w_extend( double length_extend, double displ1, double displ2, double width_extend )
{
return ( gen_wgs84_area( Point3D(GetStart()), Point3D(GetEnd()), 2.0*length_extend, displ1, displ2, rwy.width + 2.0*width_extend, rwy.heading, alt_m, false) );
return ( gen_wgs84_area( Point3D(GetStart()), Point3D(GetEnd()), 2.0*length_extend, displ1, displ2, rwy.width + 2.0*width_extend, rwy.heading, false) );
}
void gen_rw_designation( const std::string& material,
@ -128,9 +134,8 @@ private:
ClipPolyType* accum,
poly_list& slivers );
void gen_simple_rwy( double alt_m, const string& material, superpoly_list *rwy_polys, texparams_list *texparams, ClipPolyType *accum, poly_list& slivers );
void gen_rwy( double alt_m,
const std::string& material,
void gen_simple_rwy( const string& material, superpoly_list *rwy_polys, texparams_list *texparams, ClipPolyType *accum, poly_list& slivers );
void gen_rwy( const std::string& material,
superpoly_list* rwy_polys,
texparams_list* texparams,
ClipPolyType* accum,
@ -146,20 +151,20 @@ private:
poly_list& slivers,
int marking );
void gen_runway_lights( float alt_m, superpoly_list* lights );
void gen_runway_lights( superpoly_list* lights );
Point3D gen_runway_light_vector( double angle, bool recip );
superpoly_list gen_runway_edge_lights( bool recip );
superpoly_list gen_taxiway_edge_lights( const int kind, bool recip );
superpoly_list gen_runway_threshold_lights( const int kind, float alt_m, bool recip );
superpoly_list gen_runway_threshold_lights( const int kind, bool recip );
superpoly_list gen_runway_center_line_lights( bool recip );
TGSuperPoly gen_touchdown_zone_lights( float alt_m, bool recip );
TGSuperPoly gen_reil( float alt_m, bool recip );
superpoly_list gen_calvert( float alt_m, const string &kind, bool recip );
superpoly_list gen_alsf( float alt_m, const string &kind, bool recip );
TGSuperPoly gen_odals( float alt_m, bool recip );
superpoly_list gen_ssalx( float alt_m, const string& kind, bool recip );
superpoly_list gen_malsx( float alt_m, const string& kind, bool recip );
TGSuperPoly gen_touchdown_zone_lights( bool recip );
TGSuperPoly gen_reil( bool recip );
superpoly_list gen_calvert( const string &kind, bool recip );
superpoly_list gen_alsf( const string &kind, bool recip );
TGSuperPoly gen_odals( bool recip );
superpoly_list gen_ssalx( const string& kind, bool recip );
superpoly_list gen_malsx( const string& kind, bool recip );
};
typedef std::vector <Runway *> RunwayList;

View file

@ -140,12 +140,11 @@ void Runway::gen_rw_marking( const TGPolygon& runway,
// dimensions of precision runway markings, please refer to FAA
// document AC 150/5340-1H
void Runway::gen_rwy( double alt_m,
const string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers )
void Runway::gen_rwy( const string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers )
{
SG_LOG( SG_GENERAL, SG_DEBUG, "Building runway = " << rwy.rwnum[0] << " / " << rwy.rwnum[1]);
@ -155,7 +154,7 @@ void Runway::gen_rwy( double alt_m,
int i;
TGPolygon runway = gen_runway_w_mid( alt_m, 0, 0 );
TGPolygon runway = gen_runway_w_mid( 0, 0 );
TGPolygon runway_half;
for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
@ -333,8 +332,7 @@ void Runway::gen_rwy( double alt_m,
}
}
void Runway::BuildShoulder( float alt_m,
superpoly_list *rwy_polys,
void Runway::BuildShoulder( superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers,
@ -460,12 +458,7 @@ void Runway::BuildShoulder( float alt_m,
poly.add_node( 0, curInnerLoc );
}
#if 0
TGPolygon clipped = tgPolygonDiff( poly, *accum );
#else
TGPolygon clipped = tgPolygonDiffClipper( poly, *accum );
#endif
tgPolygonFindSlivers( clipped, slivers );
sp.erase();
@ -473,11 +466,7 @@ void Runway::BuildShoulder( float alt_m,
sp.set_material( shoulder_surface );
rwy_polys->push_back( sp );
#if 0
*accum = tgPolygonUnion( poly, *accum );
#else
*accum = tgPolygonUnionClipper( poly, *accum );
#endif
tp = TGTexParams( poly.get_pt(0,0), shoulder_width, dist, rwy.heading );
tp.set_maxv(dist);

View file

@ -32,76 +32,77 @@ using std::string;
// generate a simple runway. The routine modifies rwy_polys,
// texparams, and accum
void Runway::gen_simple_rwy( double alt_m,
const string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers )
void Runway::gen_simple_rwy( const string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers )
{
TGPolygon runway = gen_runway_w_mid( alt_m, 0.0, 0.0 );
TGPolygon runway = gen_runway_w_mid( 0.0, 0.0 );
TGPolygon runway_half;
for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
for ( int rwhalf=0; rwhalf<2; ++rwhalf ) {
if (rwhalf == 0) {
if (rwhalf == 0) {
//Create the first half of the runway (first entry in apt.dat)
runway_half.erase();
runway_half.add_node( 0, runway.get_pt(0, 3) );
runway_half.add_node( 0, runway.get_pt(0, 4) );
runway_half.add_node( 0, runway.get_pt(0, 5) );
runway_half.add_node( 0, runway.get_pt(0, 2) );
}
//Create the first half of the runway (first entry in apt.dat)
runway_half.erase();
runway_half.add_node( 0, runway.get_pt(0, 3) );
runway_half.add_node( 0, runway.get_pt(0, 4) );
runway_half.add_node( 0, runway.get_pt(0, 5) );
runway_half.add_node( 0, runway.get_pt(0, 2) );
}
else if (rwhalf == 1) {
else if (rwhalf == 1) {
//Create the second runway half from apt.dat
runway_half.erase();
runway_half.add_node( 0, runway.get_pt(0, 0) );
runway_half.add_node( 0, runway.get_pt(0, 1) );
runway_half.add_node( 0, runway.get_pt(0, 2) );
runway_half.add_node( 0, runway.get_pt(0, 5) );
}
//Create the second runway half from apt.dat
runway_half.erase();
runway_half.add_node( 0, runway.get_pt(0, 0) );
runway_half.add_node( 0, runway.get_pt(0, 1) );
runway_half.add_node( 0, runway.get_pt(0, 2) );
runway_half.add_node( 0, runway.get_pt(0, 5) );
}
double length = rwy.length / 2.0;
double start1_pct = 0.0;
double end1_pct = 0.0;
double heading = 0.0;
double length = rwy.length / 2.0;
double start1_pct = 0.0;
double end1_pct = 0.0;
double heading = 0.0;
if (rwhalf == 0) {
if (rwhalf == 0) {
heading = rwy.heading + 180.0;
}
else if (rwhalf == 1) {
}
else if (rwhalf == 1) {
heading = rwy.heading;
}
SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] );
}
SG_LOG( SG_GENERAL, SG_DEBUG, "runway marking = " << rwy.marking[rwhalf] );
// 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] );
// 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] );
start1_pct = end1_pct;
end1_pct = start1_pct + ( rwy.threshold[rwhalf] / length );
Runway::gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "",
rwy_polys, texparams, accum, slivers );
}
start1_pct = end1_pct;
end1_pct = start1_pct + ( rwy.threshold[rwhalf] / length );
Runway::gen_runway_section( runway_half,
start1_pct, end1_pct,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "",
rwy_polys, texparams,
accum, slivers );
}
// Generate runway
Runway::gen_runway_section( runway_half,
0, 1,
0.0, 1.0,
0.0, 0.28, 0.0, 1.0,
heading,
material, "",
rwy_polys, texparams, accum, slivers );
}
0, 1,
0.0, 1.0,
0.0, 0.28, 0.0, 1.0,
heading,
material, "",
rwy_polys, texparams,
accum, slivers );
}
}