]> git.mxchange.org Git - flightgear.git/commitdiff
Added master.cxx, prepairing main.cxx to be called by other programs.
authorcurt <curt>
Thu, 6 May 1999 02:19:39 +0000 (02:19 +0000)
committercurt <curt>
Thu, 6 May 1999 02:19:39 +0000 (02:19 +0000)
Tools/Construct/Main/Makefile.am
Tools/Construct/Main/main.cxx

index fe38511bea9dea3df513420b44e11cd2461c2ae3..fd54cdf6899883c3995b3b167f88e4642c32fcb3 100644 (file)
@@ -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 \
index 2b8ad4296541b4e20e92bd40eb99f2815c50d3a5..f60d867ba3750ef6b3a93d8bf147ee1a5aebf891 100644 (file)
@@ -435,14 +435,24 @@ void construct_tile( FGConstruct& c ) {
 }
 
 
+// display usage and exit
+void usage( const string name ) {
+    cout << "Usage: " << name
+        << " <work_base> <output_base> tile_id" << endl;
+    cout << "Usage: " << name
+        << " <work_base> <output_base> 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] << " <work_base> <output_base>" << 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;
 }