Added support for generating displaced thresholds (finally) :-)
This commit is contained in:
parent
9a7173d85e
commit
2538ac773f
10 changed files with 366 additions and 464 deletions
|
@ -95,6 +95,10 @@ static TGPolygon rwy_section_tex_coords( const TGPolygon& in_poly,
|
|||
double width = tp.get_width();
|
||||
double length = tp.get_length();
|
||||
double heading = tp.get_heading();
|
||||
double minu = tp.get_minu();
|
||||
double maxu = tp.get_maxu();
|
||||
double minv = tp.get_minv();
|
||||
double maxv = tp.get_maxv();
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "section ref = " << ref );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " width = " << width );
|
||||
SG_LOG( SG_GENERAL, SG_INFO, " length = " << length );
|
||||
|
@ -142,18 +146,22 @@ static TGPolygon rwy_section_tex_coords( const TGPolygon& in_poly,
|
|||
//
|
||||
// 4. Map x, y point into texture coordinates
|
||||
//
|
||||
|
||||
tx = x / width;
|
||||
double tmp;
|
||||
|
||||
tmp = x / width;
|
||||
tx = tmp * (maxu - minu) + minu;
|
||||
// tx = ((int)(tx * 100)) / 100.0;
|
||||
SG_LOG(SG_GENERAL, SG_INFO, " (" << tx << ")");
|
||||
|
||||
if ( clip_result ) {
|
||||
if ( clip_result) {
|
||||
if ( tx < 0.0 ) { tx = 0.0; }
|
||||
if ( tx > 1.0 ) { tx = 1.0; }
|
||||
}
|
||||
|
||||
// ty = (y - min.y()) / (max.y() - min.y());
|
||||
ty = y / length;
|
||||
tmp = y / length;
|
||||
ty = tmp * (maxv - minv) + minv;
|
||||
// ty = ((int)(ty * 100)) / 100.0;
|
||||
SG_LOG(SG_GENERAL, SG_INFO, " (" << ty << ")");
|
||||
|
||||
|
@ -493,22 +501,30 @@ void build_airport( string airport_id, float alt_m,
|
|||
// 2nd pass: generate the non-precision and visual runways
|
||||
for ( i = 0; i < (int)runways.size(); ++i ) {
|
||||
string type_flag = runways[i].surface_flags.substr(2, 1);
|
||||
string surface_flag = runways[i].surface_flags.substr(1, 1);
|
||||
if ( type_flag == "R" || type_flag == "V" ) {
|
||||
build_runway( runways[i], alt_m,
|
||||
&rwy_polys, &texparams, &accum,
|
||||
&apt_base, &apt_clearing );
|
||||
}
|
||||
if ( surface_flag != "W" ) {
|
||||
// only build non-water runways
|
||||
build_runway( runways[i], alt_m,
|
||||
&rwy_polys, &texparams, &accum,
|
||||
&apt_base, &apt_clearing );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 3rd pass: generate all remaining runways not covered in the first pass
|
||||
for ( i = 0; i < (int)runways.size(); ++i ) {
|
||||
string type_flag = runways[i].surface_flags.substr(2, 1);
|
||||
string surface_flag = runways[i].surface_flags.substr(1, 1);
|
||||
if ( type_flag != string("P") && type_flag != string("R")
|
||||
&& type_flag != string("V") ) {
|
||||
build_runway( runways[i], alt_m,
|
||||
&rwy_polys, &texparams, &accum,
|
||||
&apt_base, &apt_clearing );
|
||||
}
|
||||
if ( surface_flag != "W" ) {
|
||||
// only build non-water runways
|
||||
build_runway( runways[i], alt_m,
|
||||
&rwy_polys, &texparams, &accum,
|
||||
&apt_base, &apt_clearing );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4th pass: generate all taxiways
|
||||
|
|
|
@ -261,58 +261,51 @@ int main( int argc, char **argv ) {
|
|||
}
|
||||
}
|
||||
|
||||
if ( last_apt_id.length() ) {
|
||||
// extract some airport runway info
|
||||
cout << "last_apt_id.length() = " << last_apt_id.length() << endl;
|
||||
|
||||
if ( !last_apt_id.empty()) {
|
||||
char ctmp, tmpid[32], rwy[32];
|
||||
string id;
|
||||
float lat, lon;
|
||||
int elev = 0;
|
||||
|
||||
sscanf( line.c_str(), "%c %s %d",
|
||||
&ctmp, tmpid, &elev );
|
||||
id = tmpid;
|
||||
SG_LOG( SG_GENERAL, SG_INFO, "Airport = " << id << " "
|
||||
<< elev );
|
||||
if ( runways_list.size() ) {
|
||||
sscanf( runways_list[0].c_str(), "%c %s %s %f %f",
|
||||
&ctmp, tmpid, rwy, &lat, &lon );
|
||||
}
|
||||
|
||||
if ( !last_apt_id.empty()) {
|
||||
if ( runways_list.size() ) {
|
||||
sscanf( runways_list[0].c_str(), "%c %s %s %s %f %f",
|
||||
&ctmp, tmpid, rwy, &lat, &lon );
|
||||
if ( lon >= min_lon && lon <= max_lon &&
|
||||
lat >= min_lat && lat <= max_lat )
|
||||
{
|
||||
if ( start_id.length() && start_id == last_apt_id ) {
|
||||
ready_to_go = true;
|
||||
}
|
||||
|
||||
if ( lon >= min_lon && lon <= max_lon &&
|
||||
lat >= min_lat && lat <= max_lat )
|
||||
{
|
||||
if ( start_id.length() && start_id == last_apt_id ) {
|
||||
ready_to_go = true;
|
||||
}
|
||||
if ( ready_to_go ) {
|
||||
// check point our location
|
||||
char command[256];
|
||||
sprintf( command,
|
||||
"echo before building %s >> last_apt",
|
||||
last_apt_id.c_str() );
|
||||
system( command );
|
||||
|
||||
if ( ready_to_go ) {
|
||||
// check point our location
|
||||
char command[256];
|
||||
sprintf( command,
|
||||
"echo before building %s >> last_apt",
|
||||
last_apt_id.c_str() );
|
||||
system( command );
|
||||
|
||||
// process previous record
|
||||
// process_airport(last_apt_id, runways_list, argv[2]);
|
||||
try {
|
||||
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
||||
runways_list, taxiways_list,
|
||||
work_dir, elev_src );
|
||||
} catch (sg_exception &e) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Failed to build airport = "
|
||||
<< last_apt_id );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Exception: "
|
||||
<< e.getMessage() );
|
||||
exit(-1);
|
||||
}
|
||||
// process previous record
|
||||
// process_airport(last_apt_id, runways_list, argv[2]);
|
||||
try {
|
||||
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
||||
runways_list, taxiways_list,
|
||||
work_dir, elev_src );
|
||||
} catch (sg_exception &e) {
|
||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||
"Failed to build airport = "
|
||||
<< last_apt_id );
|
||||
SG_LOG( SG_GENERAL, SG_ALERT, "Exception: "
|
||||
<< e.getMessage() );
|
||||
exit(-1);
|
||||
}
|
||||
} else {
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Skipping airport " << id);
|
||||
}
|
||||
} else {
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Skipping airport " << id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ void gen_number_block( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, poly,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
heading,
|
||||
material, tex1,
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -71,22 +72,25 @@ void gen_number_block( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, poly,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
heading,
|
||||
material, tex1,
|
||||
rwy_polys, texparams, accum );
|
||||
} else {
|
||||
gen_runway_section( rwy_info, poly,
|
||||
start_pct, end_pct,
|
||||
0.0, 0.5,
|
||||
heading,
|
||||
material, tex1,
|
||||
rwy_polys, texparams, accum );
|
||||
gen_runway_section( rwy_info, poly,
|
||||
start_pct, end_pct,
|
||||
0.5, 1.0,
|
||||
heading,
|
||||
material, tex2,
|
||||
rwy_polys, texparams, accum );
|
||||
gen_runway_section( rwy_info, poly,
|
||||
start_pct, end_pct,
|
||||
0.0, 0.5,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
heading,
|
||||
material, tex1,
|
||||
rwy_polys, texparams, accum );
|
||||
gen_runway_section( rwy_info, poly,
|
||||
start_pct, end_pct,
|
||||
0.5, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
heading,
|
||||
material, tex2,
|
||||
rwy_polys, texparams, accum );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -96,6 +100,7 @@ void gen_runway_section( const TGRunway& rwy_info,
|
|||
const TGPolygon& runway,
|
||||
double startl_pct, double endl_pct,
|
||||
double startw_pct, double endw_pct,
|
||||
double minu, double maxu, double minv, double maxv,
|
||||
double heading,
|
||||
const string& prefix,
|
||||
const string& material,
|
||||
|
@ -238,6 +243,10 @@ void gen_runway_section( const TGRunway& rwy_info,
|
|||
sect_wid * SG_FEET_TO_METER,
|
||||
sect_len * SG_FEET_TO_METER,
|
||||
heading );
|
||||
tp.set_minu( minu );
|
||||
tp.set_maxu( maxu );
|
||||
tp.set_minv( minv );
|
||||
tp.set_maxv( maxv );
|
||||
texparams->push_back( tp );
|
||||
|
||||
// print runway points
|
||||
|
|
|
@ -46,6 +46,7 @@ void gen_runway_section( const TGRunway& rwy_info,
|
|||
const TGPolygon& runway,
|
||||
double startl_pct, double endl_pct,
|
||||
double startw_pct, double endw_pct,
|
||||
double minu, double maxu, double minv, double maxv,
|
||||
double heading,
|
||||
const string& prefix,
|
||||
const string& material,
|
||||
|
|
|
@ -107,6 +107,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "threshold",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -114,6 +115,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "threshold",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -148,6 +150,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, rev_letter,
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -155,6 +158,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, letter,
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -202,6 +206,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -209,6 +214,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -218,6 +224,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -226,6 +233,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
|
@ -242,6 +250,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "aim",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -249,6 +258,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "aim",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -272,6 +282,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -279,6 +290,7 @@ void gen_non_precision_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
|
|
@ -46,7 +46,7 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// Generate the basic runway outlines
|
||||
//
|
||||
|
||||
int i, j;
|
||||
int i;
|
||||
|
||||
TGPolygon runway = gen_runway_w_mid( rwy_info, alt_m,
|
||||
2 * SG_FEET_TO_METER,
|
||||
|
@ -71,13 +71,13 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
|
||||
Point3D p;
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "raw runway pts (a half)");
|
||||
for ( j = 0; j < runway_a.contour_size( 0 ); ++j ) {
|
||||
p = runway_a.get_pt(0, j);
|
||||
for ( i = 0; i < runway_a.contour_size( 0 ); ++i ) {
|
||||
p = runway_a.get_pt(0, i);
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " point = " << p);
|
||||
}
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "raw runway pts (b half)");
|
||||
for ( j = 0; j < runway_b.contour_size( 0 ); ++j ) {
|
||||
p = runway_b.get_pt(0, j);
|
||||
for ( i = 0; i < runway_b.contour_size( 0 ); ++i ) {
|
||||
p = runway_b.get_pt(0, i);
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, " point = " << p);
|
||||
}
|
||||
|
||||
|
@ -99,24 +99,129 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
<< rwy_info.length << ") for precision markings!");
|
||||
}
|
||||
|
||||
double start_pct = 0;
|
||||
double end_pct = 0;
|
||||
double start1_pct = 0.0;
|
||||
double start2_pct = 0.0;
|
||||
double end1_pct = 0.0;
|
||||
double end2_pct = 0.0;
|
||||
|
||||
//
|
||||
// Displaced threshold if it exists
|
||||
//
|
||||
|
||||
if ( rwy_info.disp_thresh1 > 0.0 ) {
|
||||
// reserve 100' for final arrows
|
||||
double thresh = rwy_info.disp_thresh1 - 100.0;
|
||||
|
||||
// number of full center arrows
|
||||
int count = (int)(thresh / 200.0);
|
||||
|
||||
// length of starting partial arrow
|
||||
double part_len = thresh - ( count * 200.0 );
|
||||
double tex_pct = (200.0 - part_len) / 200.0;
|
||||
|
||||
// starting (possibly partial chunk)
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( part_len / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, tex_pct, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "dspl_thresh",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
// main chunks
|
||||
for ( i = 0; i < count; ++i ) {
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 200.0 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "dspl_thresh",
|
||||
rwy_polys, texparams, accum );
|
||||
}
|
||||
|
||||
// final arrows
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 100.0 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "dspl_arrows",
|
||||
rwy_polys, texparams, accum );
|
||||
}
|
||||
|
||||
if ( rwy_info.disp_thresh2 > 0.0 ) {
|
||||
// reserve 100' for final arrows
|
||||
double thresh = rwy_info.disp_thresh2 - 100.0;
|
||||
|
||||
// number of full center arrows
|
||||
int count = (int)(thresh / 200.0);
|
||||
|
||||
// length of starting partial arrow
|
||||
double part_len = thresh - ( count * 200.0 );
|
||||
double tex_pct = (200.0 - part_len) / 200.0;
|
||||
|
||||
// starting (possibly partial chunk)
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( part_len / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, tex_pct, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "dspl_thresh",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
// main chunks
|
||||
for ( i = 0; i < count; ++i ) {
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 200.0 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "dspl_thresh",
|
||||
rwy_polys, texparams, accum );
|
||||
}
|
||||
|
||||
// final arrows
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 100.0 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "dspl_arrows",
|
||||
rwy_polys, texparams, accum );
|
||||
}
|
||||
|
||||
//
|
||||
// Threshold
|
||||
//
|
||||
|
||||
end_pct = start_pct + ( 192.0 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 192.0 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "threshold",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 192.0 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "threshold",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -146,18 +251,22 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter = " << letter);
|
||||
|
||||
if ( !letter.empty() ) {
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 90.0 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 90.0 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, rev_letter,
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 90.0 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, letter,
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -167,9 +276,6 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// Runway designation number(s)
|
||||
//
|
||||
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 90.0 / length );
|
||||
|
||||
len = rwy_info.rwy_no.length();
|
||||
string snum = rwy_info.rwy_no;
|
||||
for ( i = 0; i < len; ++i ) {
|
||||
|
@ -184,50 +290,62 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
num += 36;
|
||||
}
|
||||
|
||||
gen_number_block( rwy_info, material, runway_b, rwy_info.heading + 180.0,
|
||||
num, start_pct, end_pct, rwy_polys, texparams, accum );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 90.0 / length );
|
||||
gen_number_block( rwy_info, material, runway_a, rwy_info.heading,
|
||||
num, start1_pct, end1_pct, rwy_polys, texparams, accum );
|
||||
|
||||
num += 18;
|
||||
while ( num > 36 ) {
|
||||
num -= 36;
|
||||
}
|
||||
|
||||
gen_number_block( rwy_info, material, runway_a, rwy_info.heading,
|
||||
num, start_pct, end_pct, rwy_polys, texparams, accum );
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 90.0 / length );
|
||||
gen_number_block( rwy_info, material, runway_b, rwy_info.heading + 180.0,
|
||||
num, start2_pct, end2_pct, rwy_polys, texparams, accum );
|
||||
|
||||
//
|
||||
// Touch down zone x3
|
||||
//
|
||||
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 380 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 380 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "tz_three",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 380 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "tz_three",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
// add a section of center stripe
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 200 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -236,18 +354,22 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// Aiming point
|
||||
//
|
||||
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 400 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 400 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "aim",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 400 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "aim",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -256,39 +378,49 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// Touch down zone x2 (first)
|
||||
//
|
||||
|
||||
if ( end_pct >= 1.0 ) {
|
||||
if ( end1_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 400 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 400 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "tz_two_a",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
if ( end2_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 400 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "tz_two_a",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
// add a section of center stripe
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 200 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -297,39 +429,49 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// Touch down zone x2 (second)
|
||||
//
|
||||
|
||||
if ( end_pct >= 1.0 ) {
|
||||
if ( end1_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 200 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "tz_two_b",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
if ( end2_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "tz_two_b",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
// add a section of center stripe
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 200 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -338,39 +480,49 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// Touch down zone x1 (first)
|
||||
//
|
||||
|
||||
if ( end_pct >= 1.0 ) {
|
||||
if ( end1_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 400 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 400 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "tz_one_a",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
if ( end2_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 400 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "tz_one_a",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
// add a section of center stripe
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 200 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -379,22 +531,28 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// Touch down zone x1 (second)
|
||||
//
|
||||
|
||||
if ( end_pct >= 1.0 ) {
|
||||
if ( end1_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + ( 200 / length );
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "tz_one_b",
|
||||
rwy_polys, texparams, accum );
|
||||
|
||||
if ( end2_pct >= 1.0 ) {
|
||||
return;
|
||||
}
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + ( 200 / length );
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "tz_one_b",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -407,23 +565,30 @@ void gen_precision_rwy( const TGRunway& rwy_info,
|
|||
// the remaining distance so we don't end up with a super short
|
||||
// section at the end.
|
||||
double ideal_rest_inc = ( 200.0 / length );
|
||||
int divs = (int)((1.0 - end_pct) / ideal_rest_inc) + 1;
|
||||
double rest_inc = (1.0 - end_pct) / divs;
|
||||
int divs = (int)((1.0 - end1_pct) / ideal_rest_inc) + 1;
|
||||
double rest_inc = (1.0 - end1_pct) / divs;
|
||||
|
||||
while ( end_pct < 1.0 ) {
|
||||
start_pct = end_pct;
|
||||
end_pct = start_pct + rest_inc;
|
||||
while ( end1_pct < 1.0 ) {
|
||||
start1_pct = end1_pct;
|
||||
end1_pct = start1_pct + rest_inc;
|
||||
|
||||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
start1_pct, end1_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
}
|
||||
|
||||
while ( end2_pct < 1.0 ) {
|
||||
start2_pct = end2_pct;
|
||||
end2_pct = start2_pct + rest_inc;
|
||||
|
||||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
start2_pct, end2_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
|
|
@ -137,6 +137,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, rev_letter,
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -144,6 +145,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, letter,
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -195,6 +197,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -202,6 +205,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -215,6 +219,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -222,6 +227,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -240,6 +246,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "aim",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -247,6 +254,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "aim",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -270,6 +278,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_a,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
@ -277,6 +286,7 @@ void gen_visual_rwy( const TGRunway& rwy_info,
|
|||
gen_runway_section( rwy_info, runway_b,
|
||||
start_pct, end_pct,
|
||||
0.0, 1.0,
|
||||
0.0, 1.0, 0.0, 1.0,
|
||||
rwy_info.heading + 180.0,
|
||||
material, "rest",
|
||||
rwy_polys, texparams, accum );
|
||||
|
|
|
@ -48,6 +48,11 @@ private:
|
|||
double length;
|
||||
double heading;
|
||||
|
||||
double minu;
|
||||
double maxu;
|
||||
double minv;
|
||||
double maxv;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor and destructor
|
||||
|
@ -58,6 +63,9 @@ public:
|
|||
width = w;
|
||||
length = l;
|
||||
heading = h;
|
||||
|
||||
minu = minv = 0.0;
|
||||
maxu = maxv = 1.0;
|
||||
}
|
||||
inline ~TGTexParams( void ) { }
|
||||
|
||||
|
@ -72,6 +80,18 @@ public:
|
|||
|
||||
inline double get_heading() const { return heading; }
|
||||
inline void set_heading( const double h ) { heading = h; }
|
||||
|
||||
inline double get_minu() const { return minu; }
|
||||
inline void set_minu( const double x ) { minu = x; }
|
||||
|
||||
inline double get_maxu() const { return maxu; }
|
||||
inline void set_maxu( const double x ) { maxu = x; }
|
||||
|
||||
inline double get_minv() const { return minv; }
|
||||
inline void set_minv( const double x ) { minv = x; }
|
||||
|
||||
inline double get_maxv() const { return maxv; }
|
||||
inline void set_maxv( const double x ) { maxv = x; }
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,234 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Convert the XP apt.dat format to FlightGear's default.rwy format
|
||||
#
|
||||
# Data source is:
|
||||
#
|
||||
# http://www.x-plane.org/users/robinp/
|
||||
#
|
||||
# Written by Curt Olson <curt@flightgear.org> Started Aug 2003
|
||||
|
||||
use strict;
|
||||
|
||||
my( $line );
|
||||
my( @F );
|
||||
my( $apt_id ) = "";
|
||||
|
||||
# strip the first line
|
||||
$line = <>;
|
||||
|
||||
# copy the license / source / credits line
|
||||
$line = <>;
|
||||
print "// " . $line;
|
||||
|
||||
while ( <> ) {
|
||||
@F = split( /\s+/, $_ );
|
||||
if ( $F[0] == 1 ) {
|
||||
# print "airport = " . $_;
|
||||
|
||||
# current airport definition
|
||||
$apt_id = $F[4];
|
||||
} elsif ( $F[0] == 10 ) {
|
||||
# runway/taxiway definition
|
||||
# print "runway = " . $_;
|
||||
my( $rwy_no ) = $F[3];
|
||||
$rwy_no =~ s/x+$//;
|
||||
my( $xpvasi1, $xprwy1, $xpappr1,
|
||||
$xpvasi2, $xprwy2, $xpappr2 )
|
||||
= $F[9] =~ m/(\d)(\d)(\d)(\d)(\d)(\d)/;
|
||||
|
||||
my( $cll );
|
||||
if ( $xprwy1 >= 4 || $xprwy2 >= 4 ) {
|
||||
$cll = "Y";
|
||||
} else {
|
||||
$cll = "N";
|
||||
}
|
||||
|
||||
my( $xpsurf ) = $F[10];
|
||||
my( $surface );
|
||||
if ( $xpsurf eq "01" ) {
|
||||
$surface = "A";
|
||||
} elsif ( $xpsurf eq "02" ) {
|
||||
$surface = "C";
|
||||
} elsif ( $xpsurf eq "03" ) {
|
||||
$surface = "T";
|
||||
} elsif ( $xpsurf eq "04" ) {
|
||||
$surface = "D";
|
||||
} elsif ( $xpsurf eq "05" ) {
|
||||
$surface = "G";
|
||||
} elsif ( $xpsurf eq "06" ) {
|
||||
$surface = "A";
|
||||
} elsif ( $xpsurf eq "07" ) {
|
||||
$surface = "C";
|
||||
} elsif ( $xpsurf eq "08" ) {
|
||||
$surface = "T";
|
||||
} elsif ( $xpsurf eq "09" ) {
|
||||
$surface = "D";
|
||||
} elsif ( $xpsurf eq "10" ) {
|
||||
$surface = "A";
|
||||
} elsif ( $xpsurf eq "11" ) {
|
||||
$surface = "C";
|
||||
} elsif ( $xpsurf eq "12" ) {
|
||||
$surface = "L";
|
||||
} elsif ( $xpsurf eq "13" ) {
|
||||
$surface = "W";
|
||||
} else {
|
||||
die "unknown surface code = $xpsurf\n";
|
||||
}
|
||||
|
||||
my( $xpmarkings ) = $F[12];
|
||||
my( $markings );
|
||||
if ( $xpmarkings == 0 ) {
|
||||
$markings = "V";
|
||||
} elsif ( $xpmarkings == 1 ) {
|
||||
$markings = "V";
|
||||
} elsif ( $xpmarkings == 2 ) {
|
||||
$markings = "R";
|
||||
} elsif ( $xpmarkings == 3 ) {
|
||||
$markings = "P";
|
||||
} elsif ( $xpmarkings == 4 ) {
|
||||
$markings = "H";
|
||||
} else {
|
||||
die "unknown markings code = $xpmarkings\n";
|
||||
}
|
||||
|
||||
my( $edgelights );
|
||||
if ( $xprwy1 >= 2 || $xprwy2 >= 2 ) {
|
||||
$edgelights = "H";
|
||||
} else {
|
||||
$edgelights = "N";
|
||||
}
|
||||
|
||||
my( $rwy_codes ) = "$cll$surface$markings$edgelights" . "N";
|
||||
|
||||
my( $tdz1 );
|
||||
if ( $xprwy1 >= 5 ) {
|
||||
$tdz1 = "Y";
|
||||
} else {
|
||||
$tdz1 = "N";
|
||||
}
|
||||
|
||||
my( $tdz2 );
|
||||
if ( $xprwy2 >= 5 ) {
|
||||
$tdz2 = "Y";
|
||||
} else {
|
||||
$tdz2 = "N";
|
||||
}
|
||||
|
||||
my( $reil1 );
|
||||
if ( $xprwy1 >= 3 ) {
|
||||
$reil1 = "Y";
|
||||
} else {
|
||||
$reil1 = "N";
|
||||
}
|
||||
|
||||
my( $reil2 );
|
||||
if ( $xprwy2 >= 3 ) {
|
||||
$reil2 = "Y";
|
||||
} else {
|
||||
$reil2 = "N";
|
||||
}
|
||||
|
||||
my( $vasi1 );
|
||||
if ( $xpvasi1 == 1 ) {
|
||||
$vasi1 = "N";
|
||||
} elsif ( $xpvasi1 == 2 ) {
|
||||
$vasi1 = "V";
|
||||
} elsif ( $xpvasi1 == 3 ) {
|
||||
$vasi1 = "P";
|
||||
} elsif ( $xpvasi1 == 4 ) {
|
||||
$vasi1 = "P";
|
||||
}
|
||||
|
||||
my( $vasi2 );
|
||||
if ( $xpvasi2 == 1 ) {
|
||||
$vasi2 = "N";
|
||||
} elsif ( $xpvasi2 == 2 ) {
|
||||
$vasi2 = "V";
|
||||
} elsif ( $xpvasi2 == 3 ) {
|
||||
$vasi2 = "P";
|
||||
} elsif ( $xpvasi2 == 4 ) {
|
||||
$vasi2 = "P";
|
||||
}
|
||||
|
||||
my( $appr1 );
|
||||
if ( $xpappr1 == 0 ) {
|
||||
$appr1 = "N";
|
||||
} elsif ( $xpappr1 == 1 ) {
|
||||
$appr1 = "N";
|
||||
} elsif ( $xpappr1 == 2 ) {
|
||||
$appr1 = "S";
|
||||
} elsif ( $xpappr1 == 3 ) {
|
||||
$appr1 = "P";
|
||||
} elsif ( $xpappr1 == 4 ) {
|
||||
$appr1 = "B";
|
||||
} elsif ( $xpappr1 == 5 ) {
|
||||
$appr1 = "C";
|
||||
} elsif ( $xpappr1 == 6 ) {
|
||||
$appr1 = "L";
|
||||
} elsif ( $xpappr1 == 7 ) {
|
||||
$appr1 = "D";
|
||||
} elsif ( $xpappr1 == 8 ) {
|
||||
$appr1 = "E";
|
||||
} else {
|
||||
die "unknown approach lighting code = $xpappr1\n";
|
||||
}
|
||||
|
||||
my( $appr2 );
|
||||
if ( $xpappr2 == 0 ) {
|
||||
$appr2 = "N";
|
||||
} elsif ( $xpappr2 == 1 ) {
|
||||
$appr2 = "N";
|
||||
} elsif ( $xpappr2 == 2 ) {
|
||||
$appr2 = "S";
|
||||
} elsif ( $xpappr2 == 3 ) {
|
||||
$appr2 = "P";
|
||||
} elsif ( $xpappr2 == 4 ) {
|
||||
$appr2 = "B";
|
||||
} elsif ( $xpappr2 == 5 ) {
|
||||
$appr2 = "C";
|
||||
} elsif ( $xpappr2 == 6 ) {
|
||||
$appr2 = "L";
|
||||
} elsif ( $xpappr2 == 7 ) {
|
||||
$appr2 = "D";
|
||||
} elsif ( $xpappr2 == 8 ) {
|
||||
$appr2 = "E";
|
||||
} else {
|
||||
die "unknown approach lighting code = $xpappr2\n";
|
||||
}
|
||||
|
||||
my( $end1_codes, $end2_codes );
|
||||
|
||||
$end1_codes = "$tdz1$reil1$vasi1$appr1";
|
||||
$end2_codes = "$tdz2$reil2$vasi2$appr2";
|
||||
|
||||
my( $end1_thresh, $end2_thresh ) = split( /\./, $F[6] );
|
||||
my( $end1_stopway, $end2_stopway ) = split( /\./, $F[7] );
|
||||
|
||||
my( $taxi_edge );
|
||||
if ( $xprwy1 >= 6 || $xprwy2 >= 6 ) {
|
||||
$taxi_edge = "B";
|
||||
} else {
|
||||
$taxi_edge = "N";
|
||||
}
|
||||
|
||||
my( $taxi_codes );
|
||||
$taxi_codes = "$cll$surface$taxi_edge";
|
||||
|
||||
if ( $F[3] ne "xxx" ) {
|
||||
# runway definition
|
||||
printf("R %-4s %-3s %10.6f %11.6f %6.2f %5d %3d %s %s %4d %4d %s %4d %4d\n",
|
||||
$apt_id, $rwy_no, $F[1], $F[2], $F[4], $F[5], $F[8],
|
||||
$rwy_codes,
|
||||
$end1_codes, $end1_thresh, $end1_stopway,
|
||||
$end2_codes, $end2_thresh, $end2_stopway );
|
||||
} else {
|
||||
# taxiway definition
|
||||
printf("T %-4s xxx %10.6f %11.6f %6.2f %5d %3d %s\n",
|
||||
$apt_id, $F[1], $F[2], $F[4], $F[5], $F[8],
|
||||
$taxi_codes );
|
||||
}
|
||||
} else {
|
||||
# something we don't know how to handle right now
|
||||
}
|
||||
}
|
|
@ -1,90 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# Convert the XP apt.dat format to FlightGear's "simple.apt" format
|
||||
#
|
||||
# Data source is:
|
||||
#
|
||||
# http://www.x-plane.org/users/robinp/
|
||||
#
|
||||
# Written by Curt Olson <curt@flightgear.org> Started Aug 2003
|
||||
|
||||
use strict;
|
||||
|
||||
my( $line );
|
||||
my( @F );
|
||||
my( $last_apt ) = "";
|
||||
my( $last_elev ) = "";
|
||||
my( $last_name ) = "";
|
||||
my( $apt_type ) = "C";
|
||||
my( $rwy_lon ) = 0.0;
|
||||
my( $rwy_lat ) = 0.0;
|
||||
my( $has_tower ) = 0;
|
||||
my( $default_bldgs ) = 0;
|
||||
my( $count ) = 0;
|
||||
|
||||
# strip the first line
|
||||
$line = <>;
|
||||
|
||||
# copy the license / source / credits line
|
||||
$line = <>;
|
||||
print "// " . $line;
|
||||
|
||||
while ( <> ) {
|
||||
@F = split( /\s+/, $_ );
|
||||
if ( $F[0] == 1 ) {
|
||||
# print "airport = " . $_;
|
||||
|
||||
if ( $last_apt ne "" ) {
|
||||
# print out airport definition line
|
||||
my( $lon ) = $rwy_lon / $count;
|
||||
my( $lat ) = $rwy_lat / $count;
|
||||
printf( "A %-4s %10.6f %11.6f %5d %s%s%s %s\n",
|
||||
$last_apt, $lat, $lon, $last_elev,
|
||||
$apt_type, $has_tower, $default_bldgs, $last_name );
|
||||
}
|
||||
|
||||
# current airport definition
|
||||
$last_elev = $F[1];
|
||||
$apt_type = "C";
|
||||
if( $F[2] ) {
|
||||
$has_tower = "Y";
|
||||
} else {
|
||||
$has_tower = "N";
|
||||
}
|
||||
if ( $F[3] ) {
|
||||
$default_bldgs = "Y";
|
||||
} else {
|
||||
$default_bldgs = "N";
|
||||
}
|
||||
$last_apt = $F[4];
|
||||
$last_name = $F[5];
|
||||
for( my($i) = 6; $i <= $#F; ++$i ) {
|
||||
$last_name .= " " . $F[$i];
|
||||
}
|
||||
$count = 0;
|
||||
$rwy_lon = 0.0;
|
||||
$rwy_lat = 0.0;
|
||||
} elsif ( $F[0] == 10 ) {
|
||||
if ( $F[3] ne "xxx" ) {
|
||||
# runway definition
|
||||
# print "runway = " . $_;
|
||||
$rwy_lon += $F[2];
|
||||
$rwy_lat += $F[1];
|
||||
$count++;
|
||||
} else {
|
||||
# taxiway definition
|
||||
}
|
||||
} else {
|
||||
# something we don't know how to handle right now
|
||||
}
|
||||
}
|
||||
|
||||
# grab that last data point
|
||||
if ( $last_apt ne "" ) {
|
||||
# print out airport definition line
|
||||
my( $lon ) = $rwy_lon / $count;
|
||||
my( $lat ) = $rwy_lat / $count;
|
||||
printf( "A %-4s %10.6f %11.6f %5d %s%s%s %s\n",
|
||||
$last_apt, $lat, $lon, $last_elev,
|
||||
$apt_type, $has_tower, $default_bldgs, $last_name );
|
||||
}
|
Loading…
Add table
Reference in a new issue