1
0
Fork 0

Add material_prefix to runway class, so we don't have to pass it around so much

This commit is contained in:
Peter Sadrozinski 2012-03-04 16:19:02 -05:00 committed by Christian Schmitt
parent d0d30fbd52
commit 97aac36c39
4 changed files with 58 additions and 74 deletions

View file

@ -82,27 +82,26 @@ TGPolygon 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 )
{
TGPolygon base, safe_base;
string material;
if ( rwy.surface == 1 /* Asphalt */ )
{
material = "pa_";
material_prefix = "pa_";
}
else if ( rwy.surface == 2 /* Concrete */ )
{
material = "pc_";
material_prefix = "pc_";
}
else if ( rwy.surface == 3 /* Turf/Grass */ )
{
material = "grass_rwy";
material_prefix = "grass_rwy";
}
else if ( rwy.surface == 4 /* Dirt */ || rwy.surface == 5 /* Gravel */ )
{
material = "dirt_rwy";
material_prefix = "dirt_rwy";
}
else if ( rwy.surface == 12 /* Dry Lakebed */ )
{
material = "dirt_rwy";
material_prefix = "dirt_rwy";
}
else if ( rwy.surface == 13 /* Water runway (buoy's?) */ )
{
@ -128,7 +127,7 @@ int Runway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, supe
case 1: // asphalt:
case 2: // concrete
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: asphalt or concrete" << rwy.surface);
gen_rwy( material, rwy_polys, texparams, accum, slivers );
gen_rwy( rwy_polys, texparams, accum, slivers );
gen_runway_lights( rwy_lights );
break;
@ -136,7 +135,7 @@ int Runway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, supe
case 4: // Dirt
case 5: // Gravel
SG_LOG( SG_GENERAL, SG_DEBUG, "Build Runway: Turf, Dirt or Gravel" << rwy.surface );
gen_simple_rwy( material, rwy_polys, texparams, accum, slivers );
gen_simple_rwy( rwy_polys, texparams, accum, slivers );
gen_runway_lights( rwy_lights );
break;
@ -166,13 +165,13 @@ int Runway::BuildBtg( superpoly_list* rwy_polys, texparams_list* texparams, supe
// If we have shoulders, we need to grow even further...
// generate area around runways
base = gen_runway_area_w_extend( 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( 180.0, -rwy.overrun[0], -rwy.overrun[1], 50.0 );
// add this to the airport clearing
*apt_clearing = tgPolygonUnionClipper(safe_base, *apt_clearing);
*apt_clearing = tgPolygonUnionClipper( safe_base, *apt_clearing );
// and add the clearing to the base
*apt_base = tgPolygonUnionClipper( base, *apt_base );

View file

@ -64,48 +64,48 @@ public:
private:
struct TGRunway {
// data for whole runway
int surface;
int shoulder;
int centerline_lights;
int edge_lights;
int dist_remain_signs;
int surface;
int shoulder;
int centerline_lights;
int edge_lights;
int dist_remain_signs;
double width;
double length;
double heading;
double smoothness;
double width;
double length;
double heading;
double smoothness;
// data for each end
char rwnum[2][16];
double lat[2];
double lon[2];
double threshold[2];
double overrun[2];
// data for each end
char rwnum[2][16];
double lat[2];
double lon[2];
double threshold[2];
double overrun[2];
int marking[2];
int approach_lights[2];
int tz_lights[2];
int reil[2];
int marking[2];
int approach_lights[2];
int tz_lights[2];
int reil[2];
};
TGRunway rwy;
TGRunway rwy;
std::string material_prefix;
// Build Helpers:
// generate an area for a runway and include midpoints
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, true) );
return ( gen_wgs84_area( GetStart(), 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 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, false) );
return ( gen_wgs84_area( GetStart(), GetEnd(), 2.0*length_extend, displ1, displ2, rwy.width + 2.0*width_extend, rwy.heading, false) );
}
void gen_rw_designation( const std::string& material,
TGPolygon poly, double heading, string rwname,
void gen_rw_designation( TGPolygon poly, double heading, string rwname,
double &start_pct, double &end_pct,
superpoly_list* rwy_polys,
texparams_list* texparams,
@ -118,17 +118,15 @@ private:
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const string& prefix,
const string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers );
void gen_simple_rwy( const string& material, superpoly_list *rwy_polys, texparams_list *texparams, ClipPolyType *accum, poly_list& slivers );
void gen_simple_rwy( superpoly_list *rwy_polys, texparams_list *texparams, ClipPolyType *accum, poly_list& slivers );
void gen_rwy( const std::string& material,
superpoly_list* rwy_polys,
void gen_rwy( superpoly_list* rwy_polys,
texparams_list* texparams,
ClipPolyType* accum,
poly_list& slivers );

View file

@ -92,7 +92,6 @@ void Runway::gen_runway_section( const TGPolygon& runway,
double startw_pct, double endw_pct,
double minu, double maxu, double minv, double maxv,
double heading,
const string& prefix,
const string& material,
superpoly_list *rwy_polys,
texparams_list *texparams,
@ -187,7 +186,7 @@ void Runway::gen_runway_section( const TGPolygon& runway,
section.add_node( 0, p3 );
// print runway points
SG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << prefix << material);
SG_LOG(SG_GENERAL, SG_DEBUG, "pre clipped runway pts " << material_prefix << material);
for ( j = 0; j < section.contours(); ++j ) {
for ( k = 0; k < section.contour_size( j ); ++k ) {
Point3D p = section.get_pt(j, k);
@ -196,12 +195,7 @@ void Runway::gen_runway_section( const TGPolygon& runway,
}
// Clip the new polygon against what ever has already been created.
#if 0
TGPolygon clipped = tgPolygonDiff( section, *accum );
#else
TGPolygon clipped = tgPolygonDiffClipper( section, *accum );
#endif
tgPolygonFindSlivers( clipped, slivers );
// Split long edges to create an object that can better flow with
@ -213,15 +207,11 @@ void Runway::gen_runway_section( const TGPolygon& runway,
TGSuperPoly sp;
sp.erase();
sp.set_poly( split );
sp.set_material( prefix + material );
sp.set_material( material_prefix + material );
rwy_polys->push_back( sp );
SG_LOG(SG_GENERAL, SG_DEBUG, "section = " << clipped.contours());
#if 0
*accum = tgPolygonUnion( section, *accum );
#else
*accum = tgPolygonUnionClipper( section, *accum );
#endif
// Store away what we need to know for texture coordinate
// calculation. (CLO 10/20/02: why can't we calculate texture
@ -232,7 +222,6 @@ void Runway::gen_runway_section( const TGPolygon& runway,
double len = length / 2.0;
double sect_len = len * ( endl_pct - startl_pct );
double sect_wid = width * ( endw_pct - startw_pct );
TGTexParams tp;
@ -247,7 +236,7 @@ void Runway::gen_runway_section( const TGPolygon& runway,
texparams->push_back( tp );
// print runway points
SG_LOG(SG_GENERAL, SG_DEBUG, "clipped runway pts " << prefix + material);
SG_LOG(SG_GENERAL, SG_DEBUG, "clipped runway pts " << material_prefix + material);
for ( j = 0; j < clipped.contours(); ++j ) {
for ( k = 0; k < clipped.contour_size( j ); ++k ) {
Point3D p = clipped.get_pt(j, k);
@ -256,8 +245,7 @@ void Runway::gen_runway_section( const TGPolygon& runway,
}
}
void Runway::gen_rw_designation( const string& material,
TGPolygon poly, double heading, string rwname,
void Runway::gen_rw_designation( TGPolygon poly, double heading, string rwname,
double &start_pct, double &end_pct,
superpoly_list *rwy_polys,
texparams_list *texparams,
@ -285,14 +273,16 @@ void Runway::gen_rw_designation( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, letter,
letter,
rwy_polys, texparams, accum, slivers );
}
// create runway designation number(s)
if (rwname == "0")
if (rwname == "0") {
rwname = "36";
}
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation = " << rwname);
char tex1[32]; tex1[0] = '\0';
@ -310,14 +300,14 @@ void Runway::gen_rw_designation( const string& material,
0.0, 0.5,
0.0, 1.0, 0.0, 1.0,
heading,
material, tex1,
tex1,
rwy_polys, texparams, accum, slivers );
gen_runway_section( poly,
start_pct, end_pct,
0.5, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, tex2,
tex2,
rwy_polys, texparams, accum, slivers );
} else if (rwname.length() == 1) {
@ -328,7 +318,7 @@ void Runway::gen_rw_designation( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, tex1,
tex1,
rwy_polys, texparams, accum, slivers );
}
}
@ -338,8 +328,7 @@ void Runway::gen_rw_designation( const string& material,
// rwy_polys, texparams, and accum. For specific details and
// dimensions of precision runway markings, please refer to FAA
// document AC 150/5340-1H
void Runway::gen_rwy( const string& material,
superpoly_list *rwy_polys,
void Runway::gen_rwy( superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers )
@ -427,7 +416,7 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, tex_pct, 1.0,
heading,
material, "dspl_thresh",
"dspl_thresh",
rwy_polys, texparams, accum, slivers );
// main chunks
@ -439,7 +428,7 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "dspl_thresh",
"dspl_thresh",
rwy_polys, texparams, accum, slivers );
}
@ -451,7 +440,7 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "dspl_arrows",
"dspl_arrows",
rwy_polys, texparams, accum, slivers );
}
@ -464,7 +453,7 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "no_threshold",
"no_threshold",
rwy_polys, texparams, accum, slivers );
} else {
// Thresholds for all others
@ -475,12 +464,12 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "threshold",
"threshold",
rwy_polys, texparams, accum, slivers );
}
// Runway designation block
gen_rw_designation( material, runway_half, heading,
gen_rw_designation( runway_half, heading,
rwname, start1_pct, end1_pct,
rwy_polys, texparams, accum, slivers );
@ -519,7 +508,7 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, rw_marking_list[i].tex,
rw_marking_list[i].tex,
rwy_polys, texparams, accum, slivers );
}
}
@ -545,7 +534,7 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "rest",
"rest",
rwy_polys, texparams, accum, slivers );
}
@ -573,7 +562,6 @@ void Runway::gen_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0, //last number is lengthwise
heading,
material,
"stopway",
rwy_polys,
texparams,

View file

@ -32,8 +32,7 @@ using std::string;
// generate a simple runway. The routine modifies rwy_polys,
// texparams, and accum
void Runway::gen_simple_rwy( const string& material,
superpoly_list *rwy_polys,
void Runway::gen_simple_rwy( superpoly_list *rwy_polys,
texparams_list *texparams,
ClipPolyType *accum,
poly_list& slivers )
@ -89,7 +88,7 @@ void Runway::gen_simple_rwy( const string& material,
0.0, 1.0,
0.0, 1.0, 0.0, 1.0,
heading,
material, "",
"",
rwy_polys, texparams,
accum, slivers );
}
@ -100,7 +99,7 @@ void Runway::gen_simple_rwy( const string& material,
0.0, 1.0,
0.0, 0.28, 0.0, 1.0,
heading,
material, "",
"",
rwy_polys, texparams,
accum, slivers );