}
+// 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
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
// 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;
}