More tweaks as I work through the airport database.
This commit is contained in:
parent
a72efe39c6
commit
ef22db9c3a
3 changed files with 47 additions and 11 deletions
|
@ -52,6 +52,7 @@
|
|||
#include <Polygon/superpoly.hxx>
|
||||
#include <Triangulate/trieles.hxx>
|
||||
|
||||
#include "build.hxx"
|
||||
#include "convex_hull.hxx"
|
||||
#include "output.hxx"
|
||||
#include "point2d.hxx"
|
||||
|
@ -691,13 +692,13 @@ static void gen_runway_section( const FGRunway& rwy_info,
|
|||
// that by nudging the areas a bit bigger so we don't end up with
|
||||
// polygon slivers.
|
||||
if ( startw_pct > 0.0 || endw_pct < 1.0 ) {
|
||||
startl_pct -= 80 * FG_EPSILON;
|
||||
endl_pct += 80 * FG_EPSILON;
|
||||
startl_pct -= nudge * FG_EPSILON;
|
||||
endl_pct += nudge * FG_EPSILON;
|
||||
if ( startw_pct > 0.0 ) {
|
||||
startw_pct -= 80 * FG_EPSILON;
|
||||
startw_pct -= nudge * FG_EPSILON;
|
||||
}
|
||||
if ( endw_pct < 1.0 ) {
|
||||
endw_pct += 80 * FG_EPSILON;
|
||||
endw_pct += nudge * FG_EPSILON;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
#include "point2d.hxx"
|
||||
|
||||
|
||||
extern int nudge;
|
||||
|
||||
|
||||
// build 3d airport
|
||||
void build_airport( string airport, string_list& runways_raw,
|
||||
const string& root );
|
||||
|
|
|
@ -48,6 +48,9 @@
|
|||
#include "convex_hull.hxx"
|
||||
|
||||
|
||||
int nudge = 10;
|
||||
|
||||
|
||||
// reads the apt_full file and extracts and processes the individual
|
||||
// airport records
|
||||
int main( int argc, char **argv ) {
|
||||
|
@ -58,14 +61,43 @@ int main( int argc, char **argv ) {
|
|||
|
||||
fglog().setLogLevels( FG_ALL, FG_DEBUG );
|
||||
|
||||
if ( argc != 3 ) {
|
||||
// parse arguments
|
||||
string work_dir = "";
|
||||
string input_file;
|
||||
int arg_pos;
|
||||
for (arg_pos = 1; arg_pos < argc; arg_pos++) {
|
||||
string arg = argv[arg_pos];
|
||||
if ( arg.find("--work=") == 0 ) {
|
||||
work_dir = arg.substr(7);
|
||||
} else if ( arg.find("--input=") == 0 ) {
|
||||
input_file = arg.substr(8);
|
||||
} else if ( arg.find("--nudge=") == 0 ) {
|
||||
nudge = atoi( arg.substr(8).c_str() );
|
||||
} else {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
"Usage " << argv[0] << " --input=<apt_file> "
|
||||
<< "--work=<work_dir> [ --nudge=n ]" );
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
cout << "Input file = " << input_file << endl;
|
||||
cout << "Work directory = " << work_dir << endl;
|
||||
cout << "Nudge = " << nudge << endl;
|
||||
|
||||
if ( work_dir == "" ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
"Usage " << argv[0] << " <apt_file> <work_dir>" );
|
||||
"Error: no work directory specified." );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ( input_file == "" ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT,
|
||||
"Error: no input file." );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// make work directory
|
||||
string work_dir = argv[2];
|
||||
string command = "mkdir -p " + work_dir;
|
||||
system( command.c_str() );
|
||||
|
||||
|
@ -73,9 +105,9 @@ int main( int argc, char **argv ) {
|
|||
string counter_file = work_dir + "/poly_counter";
|
||||
poly_index_init( counter_file );
|
||||
|
||||
fg_gzifstream in( argv[1] );
|
||||
fg_gzifstream in( input_file );
|
||||
if ( !in ) {
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << argv[1] );
|
||||
FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << input_file );
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -100,7 +132,7 @@ int main( int argc, char **argv ) {
|
|||
if ( last_airport.length() ) {
|
||||
// process previous record
|
||||
// process_airport(last_airport, runways_list, argv[2]);
|
||||
build_airport(last_airport, runways_list, argv[2]);
|
||||
build_airport(last_airport, runways_list, work_dir);
|
||||
}
|
||||
|
||||
// clear runway list for start of next airport
|
||||
|
@ -123,7 +155,7 @@ int main( int argc, char **argv ) {
|
|||
if ( last_airport.length() ) {
|
||||
// process previous record
|
||||
// process_airport(last_airport, runways_list, argv[2]);
|
||||
build_airport(last_airport, runways_list, argv[2]);
|
||||
build_airport(last_airport, runways_list, work_dir);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue