1
0
Fork 0

Fix runway "0" problem.

Fix problem with skirt node not being found in node list.
Other various tweaks.
This commit is contained in:
curt 2002-11-01 04:44:26 +00:00
parent 9f6fdee612
commit 276ad45d0e
5 changed files with 58 additions and 33 deletions

View file

@ -185,7 +185,7 @@ point_list calc_elevations( const string& root, const point_list& geod_nodes,
result[i].setz( -9999.0 );
}
// cout << "result.size() = " << result.size() << endl;
// cout << "result.size() = " << result.size() << endl;
while ( !done ) {
// find first node with -9999 elevation
@ -225,7 +225,7 @@ point_list calc_elevations( const string& root, const point_list& geod_nodes,
for ( j = 0; j < (int)result.size(); ++j ) {
if ( result[j].z() < -9000 ) {
done = false;
SG_LOG(SG_GENERAL, SG_DEBUG, "interpolating for " << result[j]);
SG_LOG(SG_GENERAL, SG_INFO, "interpolating for " << result[j]);
elev = array.interpolate_altitude( result[j].x() * 3600.0,
result[j].y() * 3600.0 );
if ( elev > -9000 ) {
@ -670,6 +670,13 @@ void build_airport( string airport_raw, float alt_m, string_list& runways_raw,
tmp_nodes.unique_add( base_poly.get_pt(i, j) );
}
}
// the divided base could contain points not found in base_poly,
// so we should add them because the skirt needs them.
for ( i = 0; i < divided_base.contours(); ++i ) {
for ( j = 0; j < divided_base.contour_size( i ); ++j ) {
tmp_nodes.unique_add( divided_base.get_pt(i, j) );
}
}
#if 0
// dump info for debugging purposes
@ -930,7 +937,9 @@ void build_airport( string airport_raw, float alt_m, string_list& runways_raw,
strip_n.push_back( index );
strip_n.push_back( index );
} else {
throw sg_exception("Ooops missing node when building skirt");
string message = "Ooops missing node when building skirt (in init)";
SG_LOG( SG_GENERAL, SG_INFO, message << " " << p );
throw sg_exception( message );
}
// loop through the list
@ -949,8 +958,10 @@ void build_airport( string airport_raw, float alt_m, string_list& runways_raw,
strip_n.push_back( index );
strip_n.push_back( index );
} else {
SG_LOG(SG_GENERAL, SG_ALERT,
"*** Ooops missing node when building skirt");
string message
= "Ooops missing node when building skirt (in loop)";
SG_LOG( SG_GENERAL, SG_INFO, message << " " << p );
throw sg_exception( message );
}
}
@ -969,7 +980,9 @@ void build_airport( string airport_raw, float alt_m, string_list& runways_raw,
strip_n.push_back( index );
strip_n.push_back( index );
} else {
throw sg_exception("Ooops missing node when building skirt");
string message = "Ooops missing node when building skirt (at end)";
SG_LOG( SG_GENERAL, SG_INFO, message << " " << p );
throw sg_exception( message );
}
strips_v.push_back( strip_v );

View file

@ -190,33 +190,36 @@ int main( int argc, char **argv ) {
<< lat << ',' << lon << "," << alt_ft);
SG_LOG(SG_GENERAL, SG_DEBUG, "Id portion = " << id);
if (lon >= min_lon && lon <= max_lon &&
lat >= min_lat && lat <= max_lat) {
if ( lon >= min_lon && lon <= max_lon &&
lat >= min_lat && lat <= max_lat ) {
if ( start_id.length() && start_id == (string)id ) {
ready_to_go = true;
}
if ( start_id.length() && start_id == (string)id ) {
ready_to_go = true;
}
if ( ready_to_go ) {
// check point our location
char command[256];
sprintf( command, "echo %s > last_apt", id );
system( command );
if ( ready_to_go ) {
// check point our location
char command[256];
sprintf( command, "echo %s > last_apt", id );
system( command );
// process previous record
// process_airport(last_airport, runways_list, argv[2]);
try {
build_airport( last_airport, alt_ft * SG_FEET_TO_METER,
runways_list, taxiways_list, work_dir );
} catch (sg_exception &e) {
SG_LOG(SG_GENERAL, SG_ALERT, "Failed to build airport "
<< id);
SG_LOG(SG_GENERAL, SG_ALERT, "Exception: "
<< e.getMessage());
}
}
// process previous record
// process_airport(last_airport, runways_list, argv[2]);
try {
build_airport( last_airport,
alt_ft * SG_FEET_TO_METER,
runways_list, taxiways_list,
work_dir );
} catch (sg_exception &e) {
SG_LOG(SG_GENERAL, SG_ALERT,
"Failed to build airport " << id);
SG_LOG(SG_GENERAL, SG_ALERT, "Exception: "
<< e.getMessage());
exit(-1);
}
}
} else {
SG_LOG(SG_GENERAL, SG_INFO, "Skipping airport " << id);
SG_LOG(SG_GENERAL, SG_INFO, "Skipping airport " << id);
}
}

View file

@ -175,14 +175,17 @@ void gen_non_precision_rwy( const FGRunway& rwy_info,
snum = rwy_info.rwy_no.substr(0, i);
}
}
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway num = '" << snum << "'");
SG_LOG(SG_GENERAL, SG_INFO, "Runway num = '" << snum << "'");
int num = atoi( snum.c_str() );
while ( num <= 0 ) {
num += 36;
}
gen_number_block( rwy_info, material, runway_b, rwy_info.heading + 180.0,
num, start_pct, end_pct, rwy_polys, texparams, accum );
num += 18;
if ( num > 36 ) {
while ( num > 36 ) {
num -= 36;
}

View file

@ -179,12 +179,15 @@ void gen_precision_rwy( const FGRunway& rwy_info,
}
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway num = '" << snum << "'");
int num = atoi( snum.c_str() );
while ( num <= 0 ) {
num += 36;
}
gen_number_block( rwy_info, material, runway_b, rwy_info.heading + 180.0,
num, start_pct, end_pct, rwy_polys, texparams, accum );
num += 18;
if ( num > 36 ) {
while ( num > 36 ) {
num -= 36;
}

View file

@ -166,12 +166,15 @@ void gen_visual_rwy( const FGRunway& rwy_info,
}
SG_LOG(SG_GENERAL, SG_DEBUG, "Runway num = '" << snum << "'");
int num = atoi( snum.c_str() );
while ( num <= 0 ) {
num += 36;
}
gen_number_block( rwy_info, material, runway_b, rwy_info.heading + 180.0,
num, start_pct, end_pct, rwy_polys, texparams, accum );
num += 18;
if ( num > 36 ) {
while ( num > 36 ) {
num -= 36;
}