Simplify runway code a bit.
This commit is contained in:
parent
6f7df8da5e
commit
d573b38430
2 changed files with 25 additions and 48 deletions
|
@ -155,9 +155,9 @@ void Runway::gen_rwy( double alt_m,
|
||||||
|
|
||||||
TGPolygon runway_half;
|
TGPolygon runway_half;
|
||||||
|
|
||||||
for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
|
||||||
|
|
||||||
if (rwhalf == 1) {
|
if (rwhalf == 0) {
|
||||||
|
|
||||||
//Create the first half of the runway (first entry in apt.dat)
|
//Create the first half of the runway (first entry in apt.dat)
|
||||||
runway_half.erase();
|
runway_half.erase();
|
||||||
|
@ -167,7 +167,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
||||||
runway_half.add_node( 0, runway.get_pt(0, 2) );
|
runway_half.add_node( 0, runway.get_pt(0, 2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (rwhalf == 2) {
|
else if (rwhalf == 1) {
|
||||||
|
|
||||||
//Create the second runway half from apt.dat
|
//Create the second runway half from apt.dat
|
||||||
runway_half.erase();
|
runway_half.erase();
|
||||||
|
@ -194,12 +194,9 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
||||||
<< rwy.length << ") for precision markings!");
|
<< rwy.length << ") for precision markings!");
|
||||||
}
|
}
|
||||||
|
|
||||||
int marking = 0;
|
|
||||||
double start1_pct = 0.0;
|
double start1_pct = 0.0;
|
||||||
double end1_pct = 0.0;
|
double end1_pct = 0.0;
|
||||||
double disp_thresh = 0.0;
|
|
||||||
double heading = 0.0;
|
double heading = 0.0;
|
||||||
double stopway = 0.0;
|
|
||||||
string rwname;
|
string rwname;
|
||||||
|
|
||||||
|
|
||||||
|
@ -207,27 +204,21 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
||||||
// Displaced threshold if it exists
|
// Displaced threshold if it exists
|
||||||
//
|
//
|
||||||
|
|
||||||
if (rwhalf == 1) {
|
if (rwhalf == 0) {
|
||||||
marking = rwy.marking[0];
|
|
||||||
disp_thresh = rwy.threshold[0];
|
|
||||||
heading = rwy.heading + 180.0;
|
heading = rwy.heading + 180.0;
|
||||||
rwname = rwy.rwnum[0];
|
rwname = rwy.rwnum[0];
|
||||||
stopway = rwy.overrun[0];
|
|
||||||
}
|
}
|
||||||
else if (rwhalf == 2) {
|
else if (rwhalf == 1) {
|
||||||
marking = rwy.marking[1];
|
|
||||||
disp_thresh = rwy.threshold[1];
|
|
||||||
heading = rwy.heading;
|
heading = rwy.heading;
|
||||||
rwname = rwy.rwnum[1];
|
rwname = rwy.rwnum[1];
|
||||||
stopway = rwy.overrun[1];
|
|
||||||
}
|
}
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << marking );
|
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << rwy.marking[rwhalf] );
|
||||||
if ( disp_thresh > 0.0 ) {
|
if ( rwy.threshold[rwhalf] > 0.0 ) {
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Displaced threshold for RW side " << rwhalf << " is "
|
SG_LOG( SG_GENERAL, SG_INFO, "Displaced threshold for RW side " << rwhalf << " is "
|
||||||
<< disp_thresh );
|
<< rwy.threshold[rwhalf] );
|
||||||
|
|
||||||
// reserve 90' for final arrows
|
// reserve 90' for final arrows
|
||||||
double thresh = disp_thresh - 90.0 * SG_FEET_TO_METER;
|
double thresh = rwy.threshold[rwhalf] - 90.0 * SG_FEET_TO_METER;
|
||||||
|
|
||||||
// number of full center arrows
|
// number of full center arrows
|
||||||
int count = (int)(thresh / 200.0 * SG_FEET_TO_METER);
|
int count = (int)(thresh / 200.0 * SG_FEET_TO_METER);
|
||||||
|
@ -273,7 +264,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (marking == 0){
|
if (rwy.marking[rwhalf] == 0){
|
||||||
|
|
||||||
// No threshold
|
// No threshold
|
||||||
|
|
||||||
|
@ -301,11 +292,10 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
||||||
rwy_polys, texparams, accum );
|
rwy_polys, texparams, accum );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!marking == 0){
|
if (!rwy.marking[rwhalf] == 0){
|
||||||
//
|
//
|
||||||
// Runway designation letter
|
// Runway designation letter
|
||||||
//
|
//
|
||||||
|
|
||||||
int len = rwname.length();
|
int len = rwname.length();
|
||||||
string letter = "";
|
string letter = "";
|
||||||
for ( i = 0; i < len; ++i ) {
|
for ( i = 0; i < len; ++i ) {
|
||||||
|
@ -319,8 +309,8 @@ if (!marking == 0){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation1 = " << rwname);
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation = " << rwname);
|
||||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter1 = " << letter);
|
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway designation letter = " << letter);
|
||||||
|
|
||||||
if ( !letter.empty() ) {
|
if ( !letter.empty() ) {
|
||||||
start1_pct = end1_pct;
|
start1_pct = end1_pct;
|
||||||
|
@ -361,12 +351,12 @@ if (!marking == 0){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (marking > 1){
|
if (rwy.marking[rwhalf] > 1){
|
||||||
// Generate remaining markings depending on type of runway
|
// Generate remaining markings depending on type of runway
|
||||||
gen_rw_marking( runway_half,
|
gen_rw_marking( runway_half,
|
||||||
start1_pct, end1_pct,
|
start1_pct, end1_pct,
|
||||||
heading, material,
|
heading, material,
|
||||||
rwy_polys, texparams, accum, marking );
|
rwy_polys, texparams, accum, rwy.marking[rwhalf] );
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -45,9 +45,9 @@ void Runway::gen_simple_rwy( double alt_m,
|
||||||
|
|
||||||
TGPolygon runway_half;
|
TGPolygon runway_half;
|
||||||
|
|
||||||
for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
for ( int rwhalf=0; rwhalf<2; ++rwhalf ){
|
||||||
|
|
||||||
if (rwhalf == 1) {
|
if (rwhalf == 0) {
|
||||||
|
|
||||||
//Create the first half of the runway (first entry in apt.dat)
|
//Create the first half of the runway (first entry in apt.dat)
|
||||||
runway_half.erase();
|
runway_half.erase();
|
||||||
|
@ -57,7 +57,7 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
||||||
runway_half.add_node( 0, runway.get_pt(0, 2) );
|
runway_half.add_node( 0, runway.get_pt(0, 2) );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (rwhalf == 2) {
|
else if (rwhalf == 1) {
|
||||||
|
|
||||||
//Create the second runway half from apt.dat
|
//Create the second runway half from apt.dat
|
||||||
runway_half.erase();
|
runway_half.erase();
|
||||||
|
@ -71,40 +71,27 @@ for ( int rwhalf=1; rwhalf<3; ++rwhalf ){
|
||||||
// lines on the texture back to the edge of the runway where they
|
// lines on the texture back to the edge of the runway where they
|
||||||
// belong.
|
// belong.
|
||||||
double length = rwy.length / 2.0 + 0.5;
|
double length = rwy.length / 2.0 + 0.5;
|
||||||
int marking = 0;
|
|
||||||
double start1_pct = 0.0;
|
double start1_pct = 0.0;
|
||||||
double end1_pct = 0.0;
|
double end1_pct = 0.0;
|
||||||
double disp_thresh = 0.0;
|
|
||||||
double heading = 0.0;
|
double heading = 0.0;
|
||||||
double stopway = 0.0;
|
|
||||||
string rwname;
|
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Displaced threshold if it exists
|
// Displaced threshold if it exists
|
||||||
//
|
//
|
||||||
|
|
||||||
if (rwhalf == 1) {
|
if (rwhalf == 0) {
|
||||||
marking = rwy.marking[0];
|
|
||||||
disp_thresh = rwy.threshold[0];
|
|
||||||
heading = rwy.heading + 180.0;
|
heading = rwy.heading + 180.0;
|
||||||
rwname = rwy.rwnum[0];
|
|
||||||
stopway = rwy.overrun[0];
|
|
||||||
}
|
}
|
||||||
else if (rwhalf == 2) {
|
else if (rwhalf == 1) {
|
||||||
marking = rwy.marking[1];
|
|
||||||
disp_thresh = rwy.threshold[1];
|
|
||||||
heading = rwy.heading;
|
heading = rwy.heading;
|
||||||
rwname = rwy.rwnum[1];
|
|
||||||
stopway = rwy.overrun[1];
|
|
||||||
}
|
}
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << marking );
|
SG_LOG( SG_GENERAL, SG_INFO, "runway marking = " << rwy.marking[rwhalf] );
|
||||||
if ( disp_thresh > 0.0 ) {
|
if ( rwy.threshold[rwhalf] > 0.0 ) {
|
||||||
SG_LOG( SG_GENERAL, SG_INFO, "Displaced threshold for RW side " << rwhalf << " is "
|
SG_LOG( SG_GENERAL, SG_INFO, "Displaced threshold for RW side " << rwhalf << " is "
|
||||||
<< disp_thresh );
|
<< rwy.threshold[rwhalf] );
|
||||||
|
|
||||||
// reserve 90' for final arrows
|
// reserve 90' for final arrows
|
||||||
double thresh = disp_thresh - 90.0 * SG_FEET_TO_METER;
|
double thresh = rwy.threshold[rwhalf] - 90.0 * SG_FEET_TO_METER;
|
||||||
|
|
||||||
// number of full center arrows
|
// number of full center arrows
|
||||||
int count = (int)(thresh / 200.0 * SG_FEET_TO_METER);
|
int count = (int)(thresh / 200.0 * SG_FEET_TO_METER);
|
||||||
|
|
Loading…
Add table
Reference in a new issue