1
0
Fork 0

Introduce 2nd variable for other runway end designation.

Some cleanup, too.
This commit is contained in:
Christian Schmitt 2011-09-13 11:35:01 +02:00
parent 83144f66a3
commit 0e83e180fc
4 changed files with 51 additions and 61 deletions

View file

@ -216,19 +216,6 @@ static TGPolygon calc_elevations( TGAptSurface &surf,
}
#if 0 // DEAD CODE 10/15/2004 CLO
// strip trailing spaces
static void my_chomp( string& str ) {
SG_LOG(SG_GENERAL, SG_DEBUG, "my_chomp()");
SG_LOG(SG_GENERAL, SG_DEBUG, "'" << str.substr( str.length() - 1, 1 ) << "'");
while ( str.substr( str.length() - 1, 1 ) == " " ) {
str = str.substr( 0, str.length() - 1 );
SG_LOG(SG_GENERAL, SG_DEBUG, "'" << str.substr( str.length() - 1, 1 ) << "'");
}
}
#endif
// build a runway
static void build_runway( const TGRunway& rwy_info,
double alt_m,
@ -378,7 +365,7 @@ void build_airport( string airport_id, float alt_m,
SG_LOG( SG_GENERAL, SG_INFO, "Building " << airport_id );
// parse runways/taxiways and generate the vertex list
// parse runways and generate the vertex list
runway_list runways; runways.clear();
runway_list taxiways; taxiways.clear();
@ -391,8 +378,9 @@ void build_airport( string airport_id, float alt_m,
TGRunway rwy;
SG_LOG(SG_GENERAL, SG_DEBUG, rwy_str);
rwy.rwy_no = token[8];
rwy.really_taxiway = (rwy.rwy_no == "xxx");
rwy.rwy_no1 = token[8];
rwy.rwy_no2 = token[17];
rwy.really_taxiway = (rwy.rwy_no1 == "xxx");
rwy.generated = false;
//first runway end coordinates
@ -411,6 +399,7 @@ void build_airport( string airport_id, float alt_m,
//calculate runway length
double rwlength((SGGeodesy::distanceM(pos_1, pos_2)) * SG_METER_TO_FEET);
//calculate runway centerpoint
double rwcenter_lat = (lat_1 + lat_2) / 2;
double rwcenter_lon = (lon_1 + lon_2) / 2;
SG_LOG( SG_GENERAL, SG_INFO, "pos1 is " << lat_1 << lon_1 );
@ -430,11 +419,11 @@ void build_airport( string airport_id, float alt_m,
rwy.length = rwlength;
rwy.width = atoi( token[1].c_str() ) * SG_METER_TO_FEET;
rwy.disp_thresh1 = atoi( token[11].c_str() );
rwy.disp_thresh2 = atoi( token[20].c_str() );
rwy.disp_thresh1 = atoi( token[11].c_str() ) * SG_METER_TO_FEET;
rwy.disp_thresh2 = atoi( token[20].c_str() ) * SG_METER_TO_FEET;
rwy.stopway1 = atoi( token[12].c_str() );
rwy.stopway2 = atoi( token[21].c_str() );
rwy.stopway1 = atoi( token[12].c_str() ) * SG_METER_TO_FEET;
rwy.stopway2 = atoi( token[21].c_str() ) * SG_METER_TO_FEET;
rwy.lighting_flags = token[9];
rwy.surface_code = atoi( token[2].c_str() );
@ -452,7 +441,7 @@ void build_airport( string airport_id, float alt_m,
rwy.gs_angle1 = rwy.gs_angle2 = 3.0;
}
SG_LOG( SG_GENERAL, SG_DEBUG, " no = " << rwy.rwy_no);
SG_LOG( SG_GENERAL, SG_DEBUG, " no1/2 = " << rwy.rwy_no1 << " " << rwy.rwy_no2);
SG_LOG( SG_GENERAL, SG_DEBUG, " lat = " << rwy.lat);
SG_LOG( SG_GENERAL, SG_DEBUG, " lon = " << rwy.lon);
SG_LOG( SG_GENERAL, SG_DEBUG, " hdg = " << rwy.heading);

View file

@ -291,7 +291,7 @@ static superpoly_list gen_runway_threshold_lights( const TGRunway& rwy_info,
point_list r_normals; r_normals.clear();
int i;
cout << "gen threshold " << rwy_info.rwy_no << endl;
cout << "gen threshold " << rwy_info.rwy_no1 << endl;
// using TGPolygon is a bit innefficient, but that's what the
// routine returns.
@ -585,7 +585,7 @@ static TGSuperPoly gen_touchdown_zone_lights( const TGRunway& rwy_info,
point_list normals; normals.clear();
int i;
cout << "gen touchdown zone lights " << rwy_info.rwy_no << endl;
cout << "gen touchdown zone lights " << rwy_info.rwy_no1 << endl;
Point3D normal;
@ -694,7 +694,7 @@ static TGSuperPoly gen_vasi( const TGRunway& rwy_info, float alt_m,
string flag;
double gs_angle = 3.0;
cout << "gen vasi " << rwy_info.rwy_no << endl;
cout << "gen vasi " << rwy_info.rwy_no1 << endl;
Point3D normal;
@ -719,12 +719,12 @@ static TGSuperPoly gen_vasi( const TGRunway& rwy_info, float alt_m,
ref = corner[0];
length_hdg = rwy_info.heading + 180.0;
if ( length_hdg > 360.0 ) { length_hdg -= 360.0; }
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
gs_angle = rwy_info.gs_angle1;
} else {
ref = corner[2];
length_hdg = rwy_info.heading;
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
gs_angle = rwy_info.gs_angle2;
}
@ -860,7 +860,7 @@ static TGSuperPoly gen_papi( const TGRunway& rwy_info, float alt_m,
string flag;
double gs_angle = 3.0;
cout << "gen papi " << rwy_info.rwy_no << endl;
cout << "gen papi " << rwy_info.rwy_no1 << endl;
Point3D normal;
@ -885,12 +885,12 @@ static TGSuperPoly gen_papi( const TGRunway& rwy_info, float alt_m,
ref = corner[0];
length_hdg = rwy_info.heading + 180.0;
if ( length_hdg > 360.0 ) { length_hdg -= 360.0; }
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
gs_angle = rwy_info.gs_angle1;
} else {
ref = corner[2];
length_hdg = rwy_info.heading;
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
gs_angle = rwy_info.gs_angle2;
}
@ -973,7 +973,7 @@ static TGSuperPoly gen_reil( const TGRunway& rwy_info, float alt_m,
int i;
string flag;
cout << "gen reil " << rwy_info.rwy_no << endl;
cout << "gen reil " << rwy_info.rwy_no1 << endl;
Point3D normal;
@ -999,12 +999,12 @@ static TGSuperPoly gen_reil( const TGRunway& rwy_info, float alt_m,
ref2 = corner[1];
length_hdg = rwy_info.heading + 180.0;
if ( length_hdg > 360.0 ) { length_hdg -= 360.0; }
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
} else {
ref1 = corner[2];
ref2 = corner[3];
length_hdg = rwy_info.heading;
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
}
left_hdg = length_hdg - 90.0;
if ( left_hdg < 0 ) { left_hdg += 360.0; }
@ -1068,11 +1068,11 @@ static superpoly_list gen_calvert( const TGRunway& rwy_info,
int i, j;
string flag;
if ( kind == "1" ) {
cout << "gen Calvert lights " << rwy_info.rwy_no << endl;
cout << "gen Calvert lights " << rwy_info.rwy_no1 << endl;
} else if ( kind == "2" ) {
cout << "gen Calvert/II lights " << rwy_info.rwy_no << endl;
cout << "gen Calvert/II lights " << rwy_info.rwy_no1 << endl;
} else {
cout << "gen unknown Calvert lights " << rwy_info.rwy_no << endl;
cout << "gen unknown Calvert lights " << rwy_info.rwy_no1 << endl;
}
Point3D normal1 = gen_runway_light_vector( rwy_info, 3.0, recip );
@ -1102,11 +1102,11 @@ static superpoly_list gen_calvert( const TGRunway& rwy_info,
if ( recip ) {
inc = (corner[0] - corner[1]) / divs;
pt = corner[1];
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
} else {
inc = (corner[2] - corner[3]) / divs;
pt = corner[3];
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
}
double dist = rwy_info.length;
@ -1459,7 +1459,7 @@ static superpoly_list gen_alsf( const TGRunway& rwy_info,
int i, j;
string flag;
cout << "gen ALSF/SALS lights " << rwy_info.rwy_no << endl;
cout << "gen ALSF/SALS lights " << rwy_info.rwy_no1 << endl;
Point3D normal1 = gen_runway_light_vector( rwy_info, 3.0, recip );
Point3D normal2 = gen_runway_light_vector( rwy_info, 3.0, !recip );
@ -1488,11 +1488,11 @@ static superpoly_list gen_alsf( const TGRunway& rwy_info,
if ( recip ) {
inc = (corner[0] - corner[1]) / divs;
pt = corner[1];
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
} else {
inc = (corner[2] - corner[3]) / divs;
pt = corner[3];
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
}
double dist = rwy_info.length;
@ -1970,7 +1970,7 @@ static TGSuperPoly gen_odals( const TGRunway& rwy_info, float alt_m,
int i;
string flag;
cout << "gen odals " << rwy_info.rwy_no << endl;
cout << "gen odals " << rwy_info.rwy_no1 << endl;
// ODALS lighting is omni-directional, but we generate a normal as
// a placeholder to keep everything happy.
@ -1998,12 +1998,12 @@ static TGSuperPoly gen_odals( const TGRunway& rwy_info, float alt_m,
ref2 = corner[1];
length_hdg = rwy_info.heading + 180.0;
if ( length_hdg > 360.0 ) { length_hdg -= 360.0; }
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
} else {
ref1 = corner[2];
ref2 = corner[3];
length_hdg = rwy_info.heading;
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
}
left_hdg = length_hdg - 90.0;
if ( left_hdg < 0 ) { left_hdg += 360.0; }
@ -2077,7 +2077,7 @@ static superpoly_list gen_ssalx( const TGRunway& rwy_info,
int i, j;
string flag;
cout << "gen SSALx lights " << rwy_info.rwy_no << endl;
cout << "gen SSALx lights " << rwy_info.rwy_no1 << endl;
Point3D normal1 = gen_runway_light_vector( rwy_info, 3.0, recip );
Point3D normal2 = gen_runway_light_vector( rwy_info, 3.0, !recip );
@ -2106,11 +2106,11 @@ static superpoly_list gen_ssalx( const TGRunway& rwy_info,
if ( recip ) {
inc = (corner[0] - corner[1]) / divs;
pt = corner[1];
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
} else {
inc = (corner[2] - corner[3]) / divs;
pt = corner[3];
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
}
double dist = rwy_info.length;
@ -2347,7 +2347,7 @@ static superpoly_list gen_malsx( const TGRunway& rwy_info,
int i, j;
string flag;
cout << "gen SSALx lights " << rwy_info.rwy_no << endl;
cout << "gen SSALx lights " << rwy_info.rwy_no1 << endl;
Point3D normal1 = gen_runway_light_vector( rwy_info, 3.0, recip );
Point3D normal2 = gen_runway_light_vector( rwy_info, 3.0, !recip );
@ -2376,11 +2376,11 @@ static superpoly_list gen_malsx( const TGRunway& rwy_info,
if ( recip ) {
inc = (corner[0] - corner[1]) / divs;
pt = corner[1];
flag = rwy_info.rwy_no + "-i";
flag = rwy_info.rwy_no1 + "-i";
} else {
inc = (corner[2] - corner[3]) / divs;
pt = corner[3];
flag = rwy_info.rwy_no;
flag = rwy_info.rwy_no1;
}
double dist = rwy_info.length;
@ -2606,7 +2606,7 @@ void gen_runway_lights( const TGRunway& rwy_info, float alt_m,
superpoly_list &lights, TGPolygon *apt_base ) {
string lighting_flags = rwy_info.lighting_flags;
SG_LOG( SG_GENERAL, SG_DEBUG, "gen runway lights " << rwy_info.rwy_no << " "
SG_LOG( SG_GENERAL, SG_DEBUG, "gen runway lights " << rwy_info.rwy_no1 << " "
<< rwy_info.lighting_flags );
int vasi1 = atoi( lighting_flags.substr(0,1).c_str() );
@ -2931,7 +2931,7 @@ void gen_taxiway_lights( const TGRunway& taxiway_info, float alt_m,
superpoly_list &lights )
{
SG_LOG( SG_GENERAL, SG_DEBUG, "gen taxiway lights "
<< taxiway_info.rwy_no << " "
<< taxiway_info.rwy_no1 << " "
<< taxiway_info.lighting_flags );
string lighting_flags = taxiway_info.lighting_flags;

View file

@ -35,7 +35,8 @@
struct TGRunway {
std::string rwy_no;
std::string rwy_no1;
std::string rwy_no2;
double lon;
double lat;

View file

@ -45,7 +45,7 @@ void gen_precision_rwy( const TGRunway& rwy_info,
texparams_list *texparams,
TGPolygon *accum )
{
SG_LOG( SG_GENERAL, SG_INFO, "Building runway = " << rwy_info.rwy_no );
SG_LOG( SG_GENERAL, SG_INFO, "Building runway = " << rwy_info.rwy_no1 << rwy_info.rwy_no2);
//
// Generate the basic runway outlines
@ -100,7 +100,7 @@ void gen_precision_rwy( const TGRunway& rwy_info,
double length = rwy_info.length / 2.0 + 2.0;
if ( length < 3075 ) {
SG_LOG( SG_GENERAL, SG_ALERT,
"Runway " << rwy_info.rwy_no << " is not long enough ("
"Runway " << rwy_info.rwy_no1 << " is not long enough ("
<< rwy_info.length << ") for precision markings!");
}
@ -241,11 +241,11 @@ void gen_precision_rwy( const TGRunway& rwy_info,
// Runway designation letter
//
int len = rwy_info.rwy_no.length();
int len = rwy_info.rwy_no1.length();
string letter = "";
string rev_letter = "";
for ( i = 0; i < len; ++i ) {
string tmp = rwy_info.rwy_no.substr(i, 1);
string tmp = rwy_info.rwy_no1.substr(i, 1);
if ( tmp == "L" ) {
letter = "L";
rev_letter = "R";
@ -258,7 +258,7 @@ void gen_precision_rwy( const TGRunway& rwy_info,
}
}
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation = " << rwy_info.rwy_no);
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation = " << rwy_info.rwy_no1);
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter = " << letter);
if ( !letter.empty() ) {
@ -287,12 +287,12 @@ void gen_precision_rwy( const TGRunway& rwy_info,
// Runway designation number(s)
//
len = rwy_info.rwy_no.length();
string snum = rwy_info.rwy_no;
len = rwy_info.rwy_no1.length();
string snum = rwy_info.rwy_no1;
for ( i = 0; i < len; ++i ) {
string tmp = rwy_info.rwy_no.substr(i, 1);
string tmp = rwy_info.rwy_no1.substr(i, 1);
if ( tmp == "L" || tmp == "R" || tmp == "C" || tmp == " " ) {
snum = rwy_info.rwy_no.substr(0, i);
snum = rwy_info.rwy_no1.substr(0, i);
}
}
SG_LOG(SG_GENERAL, SG_INFO, "Runway num = '" << snum << "'");