From: curt Date: Thu, 6 May 1999 02:19:39 +0000 (+0000) Subject: Added master.cxx, prepairing main.cxx to be called by other programs. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f5bb467c576147bf78bf77db128846105baf3fe6;p=flightgear.git Added master.cxx, prepairing main.cxx to be called by other programs. --- diff --git a/Tools/Construct/Main/Makefile.am b/Tools/Construct/Main/Makefile.am index fe38511be..fd54cdf68 100644 --- a/Tools/Construct/Main/Makefile.am +++ b/Tools/Construct/Main/Makefile.am @@ -1,4 +1,4 @@ -bin_PROGRAMS = construct +bin_PROGRAMS = construct master construct_SOURCES = construct.cxx construct.hxx main.cxx construct_types.hxx @@ -18,6 +18,8 @@ construct_LDADD = \ $(top_builddir)/Lib/zlib/libz.a \ -lgpc -lgfc +master_SOURCES = master.cxx + INCLUDES += \ -I$(top_builddir) \ -I$(top_builddir)/Lib \ diff --git a/Tools/Construct/Main/main.cxx b/Tools/Construct/Main/main.cxx index 2b8ad4296..f60d867ba 100644 --- a/Tools/Construct/Main/main.cxx +++ b/Tools/Construct/Main/main.cxx @@ -435,14 +435,24 @@ void construct_tile( FGConstruct& c ) { } +// display usage and exit +void usage( const string name ) { + cout << "Usage: " << name + << " tile_id" << endl; + cout << "Usage: " << name + << " center_lon center_lat xdist ydist" + << endl; + exit(-1); +} + + main(int argc, char **argv) { double lon, lat; fglog().setLogLevels( FG_ALL, FG_DEBUG ); - if ( argc != 3 ) { - cout << "Usage: " << argv[0] << " " << endl; - exit(-1); + if ( argc < 3 ) { + usage( argv[0] ); } // main construction data management class @@ -454,7 +464,7 @@ main(int argc, char **argv) { c.set_min_nodes( 50 ); c.set_max_nodes( (int)(FG_MAX_NODES * 0.8) ); - lon = -146.248360; lat = 61.133950; // PAVD (Valdez, AK) + // lon = -146.248360; lat = 61.133950; // PAVD (Valdez, AK) // lon = -110.664244; lat = 33.352890; // P13 // lon = -93.211389; lat = 45.145000; // KANE // lon = -92.486188; lat = 44.590190; // KRGK @@ -471,53 +481,65 @@ main(int argc, char **argv) { // lon = -111.977773; lat = 40.788388; // KSLC // lon = -121.914; lat = 42.5655; // TEST (Oregon SW of Crater) // lon = -76.201239; lat = 36.894606; // KORF (Norfolk, Virginia) + // lon = -147.166; lat = 60.9925; // Hale-bop test - double xdist = 3.0; - double ydist = 1.0; - double min_x = lon - xdist; - double min_y = lat - ydist; - FGBucket b_min( min_x, min_y ); - FGBucket b_max( lon + xdist, lat + ydist ); - - FGBucket b_start(566777L); - bool do_tile = true; - - // FGBucket b_omit(-1L); - // FGBucket b(1122504L); - // FGBucket b(-146.248360, 61.133950); - // c.set_bucket( b ); - // construct_tile( c ); - // exit(0); - - if ( b_min == b_max ) { - c.set_bucket( b_min ); + if ( argc == 4 ) { + // construct a specific tile and exit + + long index = atoi( argv[3] ); + FGBucket b( index ); + c.set_bucket( b ); construct_tile( c ); - } else { - FGBucket b_cur; - int dx, dy, i, j; + } else if ( argc == 7 ) { + // build all the tiles in an area + + lon = atof( argv[3] ); + lat = atof( argv[4] ); + double xdist = atof( argv[5] ); + double ydist = atof( argv[6] ); + + double min_x = lon - xdist; + double min_y = lat - ydist; + FGBucket b_min( min_x, min_y ); + FGBucket b_max( lon + xdist, lat + ydist ); + + FGBucket b_start(550401L); + bool do_tile = true; + + if ( b_min == b_max ) { + c.set_bucket( b_min ); + construct_tile( c ); + } else { + FGBucket b_cur; + int dx, dy, i, j; - fgBucketDiff(b_min, b_max, &dx, &dy); - cout << " construction area spans tile boundaries" << endl; - cout << " dx = " << dx << " dy = " << dy << endl; - - for ( j = 0; j <= dy; j++ ) { - for ( i = 0; i <= dx; i++ ) { - b_cur = fgBucketOffset(min_x, min_y, i, j); - - if ( b_cur == b_start ) { - do_tile = true; - } - - if ( do_tile ) { - c.set_bucket( b_cur ); - construct_tile( c ); - } else { - cout << "skipping " << b_cur << endl; + fgBucketDiff(b_min, b_max, &dx, &dy); + cout << " construction area spans tile boundaries" << endl; + cout << " dx = " << dx << " dy = " << dy << endl; + + for ( j = 0; j <= dy; j++ ) { + for ( i = 0; i <= dx; i++ ) { + b_cur = fgBucketOffset(min_x, min_y, i, j); + + if ( b_cur == b_start ) { + do_tile = true; + } + + if ( do_tile ) { + c.set_bucket( b_cur ); + construct_tile( c ); + } else { + cout << "skipping " << b_cur << endl; + } } } + // string answer; cin >> answer; } - // string answer; cin >> answer; + } else { + usage( argv[0] ); } + + cout << "[Finished successfully]" << endl; }