1
0
Fork 0

Renamed FGBucket -> SGBucket.

This commit is contained in:
curt 2000-12-13 20:06:36 +00:00
parent 698ca7b1a6
commit 583af21f9f
21 changed files with 124 additions and 121 deletions

View file

@ -327,7 +327,7 @@ point_list calc_elevations( const string& root, const point_list& geod_nodes ) {
}
if ( i < (int)result.size() ) {
FGBucket b( result[i].x(), result[i].y() );
SGBucket b( result[i].x(), result[i].y() );
string base = b.gen_base_path();
// try 3 arcsec dems first
@ -1606,7 +1606,7 @@ void build_airport( string airport_raw, string_list& runways_raw,
cout << " name = " << apt_name << endl;
*/
FGBucket b( apt_lon, apt_lat );
SGBucket b( apt_lon, apt_lat );
Point3D center_geod( b.get_center_lon() * DEG_TO_RAD,
b.get_center_lat() * DEG_TO_RAD, 0 );
Point3D gbs_center = sgGeodToCart( center_geod );

View file

@ -116,7 +116,7 @@ double calc_bounding_radius( Point3D center, point_list& wgs84_nodes ) {
// write out the structures to a file. We assume that the groups come
// to us sorted by material property. If not, things don't break, but
// the result won't be as optimal.
void write_obj( const string& base, const FGBucket& b, const string& name,
void write_obj( const string& base, const SGBucket& b, const string& name,
Point3D gbs_center, double gbs_radius,
const point_list& wgs84_nodes, const point_list& normals,
const point_list& texcoords,
@ -309,7 +309,7 @@ void write_obj( const string& base, const FGBucket& b, const string& name,
// update index
void write_index(const string& base, const FGBucket& b, const string& name) {
void write_index(const string& base, const SGBucket& b, const string& name) {
string dir = base + "/" + b.gen_base_path();
#ifdef _MSC_VER
fg_mkdir( dir.c_str() );
@ -333,7 +333,7 @@ void write_index(const string& base, const FGBucket& b, const string& name) {
}
void write_boundary( const string& base, const FGBucket& b,
void write_boundary( const string& base, const SGBucket& b,
const FGPolygon& bounds, long int p_index )
{
Point3D p;

View file

@ -56,7 +56,7 @@ double calc_bounding_radius( Point3D center, point_list& wgs84_nodes );
// write out the structures to a file. We assume that the groups come
// to us sorted by material property. If not, things don't break, but
// the result won't be as optimal.
void write_obj( const string& base, const FGBucket& b, const string& name,
void write_obj( const string& base, const SGBucket& b, const string& name,
Point3D gbs_center, double gbs_radius,
const point_list& wgs84_nodes, const point_list& normals,
const point_list& texcoords,
@ -69,9 +69,9 @@ void write_obj( const string& base, const FGBucket& b, const string& name,
// update index
void write_index(const string& base, const FGBucket& b, const string& name);
void write_index(const string& base, const SGBucket& b, const string& name);
void write_boundary( const string& base, const FGBucket& b,
void write_boundary( const string& base, const SGBucket& b,
const FGPolygon& bounds, long int p_index );
#endif // _TG_OUTPUT_HXX

View file

@ -12,6 +12,6 @@ testclipper_LDADD = \
$(top_builddir)/src/Lib/Polygon/libPolygon.a \
$(top_builddir)/src/Lib/landcover/liblandcover.a \
$(top_builddir)/src/Lib/poly2tri/libpoly2tri.a \
-lsgdebug -lsgmisc -lz -lgpc
-lsgbucket -lsgdebug -lsgmisc -lz -lgpc
INCLUDES += -I$(top_srcdir)/src/Lib

View file

@ -60,7 +60,7 @@ int main( int argc, char **argv ) {
long int index;
sscanf( base_name.c_str(), "%ld", &index);
FGBucket b(index);
SGBucket b(index);
cout << "bucket = " << b << endl;
// calculate bucket dimensions
@ -68,13 +68,13 @@ int main( int argc, char **argv ) {
c.x = b.get_center_lon();
c.y = b.get_center_lat();
double span = bucket_span(c.y);
double span = sg_bucket_span(c.y);
if ( (c.y >= -89.0) && (c.y < 89.0) ) {
min.x = c.x - span / 2.0;
max.x = c.x + span / 2.0;
min.y = c.y - FG_HALF_BUCKET_SPAN;
max.y = c.y + FG_HALF_BUCKET_SPAN;
min.y = c.y - SG_HALF_BUCKET_SPAN;
max.y = c.y + SG_HALF_BUCKET_SPAN;
} else if ( c.y < -89.0) {
min.x = -90.0;
max.x = -89.0;

View file

@ -45,7 +45,7 @@ void FGGenOutput::calc_gbs( FGConstruct& c ) {
double dist_squared;
double radius_squared = 0;
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
Point3D p( b.get_center_lon() * DEG_TO_RAD,
b.get_center_lat() * DEG_TO_RAD,
@ -78,7 +78,7 @@ int_list FGGenOutput::calc_tex_coords( FGConstruct& c, point_list geod_nodes,
// cout << "calculating texture coordinates for a specific fan of size = "
// << fan.size() << endl;
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
double clat = b.get_center_lat();
double clat_rad = clat * DEG_TO_RAD;
double cos_lat = cos( clat_rad );
@ -314,7 +314,7 @@ int FGGenOutput::write( FGConstruct &c ) {
int i;
string base = c.get_output_base();
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
string dir = base + "/Scenery/" + b.gen_base_path();

View file

@ -74,7 +74,7 @@ private:
int max_nodes;
// this bucket
FGBucket bucket;
SGBucket bucket;
// clipped polygons (gpc format)
FGPolyList clipped_polys;
@ -133,8 +133,8 @@ public:
inline void set_max_nodes( const int n ) { max_nodes = n; }
// this bucket
inline FGBucket get_bucket() const { return bucket; }
inline void set_bucket( const FGBucket b ) { bucket = b; }
inline SGBucket get_bucket() const { return bucket; }
inline void set_bucket( const SGBucket b ) { bucket = b; }
// clipped polygons
inline FGPolyList get_clipped_polys() const { return clipped_polys; }

View file

@ -253,11 +253,22 @@ static int actual_load_landcover ( FGConstruct & c,
FGPolygon polys[FG_MAX_AREA_TYPES];
FGPolygon poly; // working polygon
double dx = 1.0 / 120.0;
double dy = dx;
double half_dx = dx * 0.5;
double half_dy = half_dx;
double quarter_dx = dx * 0.25;
double quarter_dy = quarter_dx;
// Get the top corner of the tile
double base_lon = c.get_bucket().get_center_lon() -
(0.5 * c.get_bucket().get_width());
double base_lat = c.get_bucket().get_center_lat() -
(0.5 * c.get_bucket().get_height());
double base_lon = c.get_bucket().get_center_lon()
- 0.5 * c.get_bucket().get_width()
- quarter_dx;
double base_lat = c.get_bucket().get_center_lat()
- 0.5 * c.get_bucket().get_height()
- quarter_dy;
cout << "DPM: tile at " << base_lon << ',' << base_lat << endl;
@ -266,12 +277,6 @@ static int actual_load_landcover ( FGConstruct & c,
double max_lat = c.get_bucket().get_center_lat() +
(0.5 * c.get_bucket().get_height());
double dx = 1.0 / 120.0;
double dy = dx;
double half_dx = dx * 0.5;
double half_dy = half_dx;
// Figure out how many units wide and high this tile is; each unit
// is 30 arc seconds.
// int x_span = int(120 * bucket_span(base_lat)); // arcsecs of longitude
@ -282,21 +287,19 @@ static int actual_load_landcover ( FGConstruct & c,
double x2 = x1 + dx;
double y2 = y1 + dy;
while ( x1 < max_lon - (dx + half_dx) ) {
while ( y1 < max_lat - (dy + half_dy) ) {
while ( x1 < max_lon ) {
while ( y1 < max_lat ) {
make_area( cover, polys, x1, y1, x2, y2, half_dx, half_dy );
y1 = y2;
y2 += dy;
}
make_area( cover, polys, x1, y1, x2, max_lat, half_dx, half_dy );
x1 = x2;
x2 += dx;
y1 = base_lat;
y2 = y1 + dy;
}
make_area( cover, polys, x1, y1, max_lon, max_lat, half_dx, half_dy );
// Now that we're finished looking up land cover, we have a list
// of lists of polygons, one (possibly-empty) list for each area
@ -376,7 +379,7 @@ static int load_dem( FGConstruct& c, FGArray& array) {
}
}
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
array.parse( b );
return 1;
@ -751,7 +754,7 @@ static void do_output( FGConstruct& c, FGGenOutput& output ) {
// collect custom objects and move to scenery area
static void do_custom_objects( const FGConstruct& c ) {
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
for ( int i = 0; i < (int)load_dirs.size(); ++i ) {
string base_dir = load_dirs[i] + "/" + b.gen_base_path();
@ -1075,7 +1078,7 @@ int main(int argc, char **argv) {
// construct the tile around the
// specified location
cout << "Building single tile at " << lat << ',' << lon << endl;
FGBucket b( lon, lat );
SGBucket b( lon, lat );
c.set_bucket( b );
construct_tile( c );
} else {
@ -1086,26 +1089,26 @@ int main(int argc, char **argv) {
<< " and y distance " << ydist << endl;
double min_x = lon - xdist;
double min_y = lat - ydist;
FGBucket b_min( min_x, min_y );
FGBucket b_max( lon + xdist, lat + ydist );
SGBucket b_min( min_x, min_y );
SGBucket b_max( lon + xdist, lat + ydist );
FGBucket b_start(550401L);
SGBucket b_start(550401L);
bool do_tile = true;
if ( b_min == b_max ) {
c.set_bucket( b_min );
construct_tile( c );
} else {
FGBucket b_cur;
SGBucket b_cur;
int dx, dy, i, j;
fgBucketDiff(b_min, b_max, &dx, &dy);
sgBucketDiff(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);
b_cur = sgBucketOffset(min_x, min_y, i, j);
if ( b_cur == b_start ) {
do_tile = true;
@ -1125,7 +1128,7 @@ int main(int argc, char **argv) {
} else {
// construct the specified tile
cout << "Building tile " << tile_id << endl;
FGBucket b( tile_id );
SGBucket b( tile_id );
c.set_bucket( b );
construct_tile( c );
}

View file

@ -52,7 +52,7 @@ static bool file_exists( const string& file ) {
// check if the specified tile has data defined for it
static bool has_data( const string& path, const FGBucket& b ) {
static bool has_data( const string& path, const SGBucket& b ) {
string dem_file = path + "DEM-3/" + b.gen_base_path()
+ "/" + b.gen_index_str() + ".dem";
if ( file_exists( dem_file ) ) {
@ -70,7 +70,7 @@ static bool has_data( const string& path, const FGBucket& b ) {
// build the tile and check for success
bool build_tile( const string& work_base, const string& output_base,
const FGBucket& b ) {
const SGBucket& b ) {
string result_file = "result";
string command = "./construct " + work_base + " " + output_base + " "
@ -113,7 +113,7 @@ int main(int argc, char **argv) {
string work_base = argv[1];
string output_base = argv[2];
FGBucket tmp1( 0.0, 0.0 );
SGBucket tmp1( 0.0, 0.0 );
double dy = tmp1.get_height();
lat = 68.75 + dy * 0.5;
@ -122,7 +122,7 @@ int main(int argc, char **argv) {
lon = -152.9 /* + (1.0/16.0) */;
while ( lat <= 90.0 ) {
FGBucket tmp2( 0.0, lat );
SGBucket tmp2( 0.0, lat );
double dx = tmp2.get_width();
if ( ! start_lon ) {
@ -131,7 +131,7 @@ int main(int argc, char **argv) {
start_lon = false;
}
while ( lon <= 180.0 ) {
FGBucket b( lon, lat );
SGBucket b( lon, lat );
cout << "Bucket = " << b << endl;
if ( has_data( work_base, b ) ) {

View file

@ -48,7 +48,7 @@ FGMatch::~FGMatch( void ) {
// scan the specified share file for the specified information
void FGMatch::scan_share_file( const string& dir, const FGBucket& b,
void FGMatch::scan_share_file( const string& dir, const SGBucket& b,
neighbor_type search, neighbor_type dest )
{
string file = dir + "/" + b.gen_base_path() + "/" + b.gen_index_str();
@ -140,62 +140,62 @@ void FGMatch::scan_share_file( const string& dir, const FGBucket& b,
// try to find info for the specified shared component
void FGMatch::load_shared( const FGConstruct& c, neighbor_type n ) {
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
double clon = b.get_center_lon();
double clat = b.get_center_lat();
string base = c.get_work_base() + "/Shared/";
FGBucket cb;
SGBucket cb;
if ( n == SW_Corner ) {
// cout << "searching for SW corner data" << endl;
cb = fgBucketOffset(clon, clat, -1, 0);
cb = sgBucketOffset(clon, clat, -1, 0);
scan_share_file( base, cb, SE_Corner, n );
cb = fgBucketOffset(clon, clat, -1, -1);
cb = sgBucketOffset(clon, clat, -1, -1);
scan_share_file( base, cb, NE_Corner, n );
cb = fgBucketOffset(clon, clat, 0, -1);
cb = sgBucketOffset(clon, clat, 0, -1);
scan_share_file( base, cb, NW_Corner, n );
} else if ( n == SE_Corner ) {
// cout << "searching for SE corner data" << endl;
cb = fgBucketOffset(clon, clat, 0, -1);
cb = sgBucketOffset(clon, clat, 0, -1);
scan_share_file( base, cb, NE_Corner, n );
cb = fgBucketOffset(clon, clat, 1, -1);
cb = sgBucketOffset(clon, clat, 1, -1);
scan_share_file( base, cb, NW_Corner, n );
cb = fgBucketOffset(clon, clat, 1, 0);
cb = sgBucketOffset(clon, clat, 1, 0);
scan_share_file( base, cb, SW_Corner, n );
} else if ( n == NE_Corner ) {
// cout << "searching for NE corner data" << endl;
cb = fgBucketOffset(clon, clat, 1, 0);
cb = sgBucketOffset(clon, clat, 1, 0);
scan_share_file( base, cb, NW_Corner, n );
cb = fgBucketOffset(clon, clat, 1, 1);
cb = sgBucketOffset(clon, clat, 1, 1);
scan_share_file( base, cb, SW_Corner, n );
cb = fgBucketOffset(clon, clat, 0, 1);
cb = sgBucketOffset(clon, clat, 0, 1);
scan_share_file( base, cb, SE_Corner, n );
} else if ( n == NW_Corner ) {
// cout << "searching for NW corner data" << endl;
cb = fgBucketOffset(clon, clat, 0, 1);
cb = sgBucketOffset(clon, clat, 0, 1);
scan_share_file( base, cb, SW_Corner, n );
cb = fgBucketOffset(clon, clat, -1, 1);
cb = sgBucketOffset(clon, clat, -1, 1);
scan_share_file( base, cb, SE_Corner, n );
cb = fgBucketOffset(clon, clat, -1, 0);
cb = sgBucketOffset(clon, clat, -1, 0);
scan_share_file( base, cb, NE_Corner, n );
} else if ( n == NORTH ) {
// cout << "searching for NORTH edge data" << endl;
cb = fgBucketOffset(clon, clat, 0, 1);
cb = sgBucketOffset(clon, clat, 0, 1);
scan_share_file( base, cb, SOUTH, n );
} else if ( n == SOUTH ) {
// cout << "searching for SOUTH edge data" << endl;
cb = fgBucketOffset(clon, clat, 0, -1);
cb = sgBucketOffset(clon, clat, 0, -1);
scan_share_file( base, cb, NORTH, n );
} else if ( n == EAST ) {
// cout << "searching for EAST edge data" << endl;
cb = fgBucketOffset(clon, clat, 1, 0);
cb = sgBucketOffset(clon, clat, 1, 0);
scan_share_file( base, cb, WEST, n );
} else if ( n == WEST ) {
// cout << "searching for WEST edge data" << endl;
cb = fgBucketOffset(clon, clat, -1, 0);
cb = sgBucketOffset(clon, clat, -1, 0);
scan_share_file( base, cb, EAST, n );
}
}
@ -296,7 +296,7 @@ void FGMatch::split_tile( FGConstruct& c ) {
// calculate tile boundaries
point2d min, max;
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
min.x = b.get_center_lon() - 0.5 * b.get_width();
min.y = b.get_center_lat() - 0.5 * b.get_height();
max.x = b.get_center_lon() + 0.5 * b.get_width();
@ -457,7 +457,7 @@ void FGMatch::split_tile( FGConstruct& c ) {
// tile
void FGMatch::write_shared( FGConstruct& c ) {
string base = c.get_work_base();
FGBucket b = c.get_bucket();
SGBucket b = c.get_bucket();
string dir = base + "/Shared/" + b.gen_base_path();
string file = dir + "/" + b.gen_index_str();

View file

@ -84,7 +84,7 @@ public:
void load_neighbor_shared( FGConstruct& c );
// scan the specified share file for the specified information
void scan_share_file( const string& dir, const FGBucket& b,
void scan_share_file( const string& dir, const SGBucket& b,
neighbor_type search, neighbor_type dest );
// try to find info for the specified shared component

View file

@ -173,7 +173,7 @@ long int get_next_task( const string& host, int port, long int last_tile ) {
// build the specified tile, return true if contruction completed
// successfully
bool construct_tile( const FGBucket& b,
bool construct_tile( const SGBucket& b,
const string& result_file,
const string &cover ) {
double angle = 10.0;
@ -315,7 +315,7 @@ int main(int argc, char *argv[]) {
check_master_switch();
while ( (tile = get_next_task( host, port, last_tile )) >= 0 ) {
result = construct_tile( FGBucket(tile), result_file, cover );
result = construct_tile( SGBucket(tile), result_file, cover );
if ( result ) {
last_tile = tile;
} else {

View file

@ -86,7 +86,7 @@ static bool file_exists( const string& file ) {
// check if the specified tile has data defined for it [ depricated ]
static bool has_data( const string& path, const FGBucket& b ) {
static bool has_data( const string& path, const SGBucket& b ) {
string dem_file = path + ".dem" + "/" + b.gen_base_path()
+ "/" + b.gen_index_str() + ".dem";
if ( file_exists( dem_file ) ) {
@ -112,7 +112,7 @@ void init_tile_count( const string& chunk ) {
lat = 100;
// determine tile height
FGBucket tmp1( 0.0, 0.0 );
SGBucket tmp1( 0.0, 0.0 );
dy = tmp1.get_height();
string lons = chunk.substr(0, 4);
@ -134,7 +134,7 @@ void init_tile_count( const string& chunk ) {
// return the next tile
long int get_next_tile() {
FGBucket b;
SGBucket b;
static double shift_over = 0.0;
static double shift_up = 0.0;
static bool first_time = true;
@ -158,7 +158,7 @@ long int get_next_tile() {
// adjacent tiles)
lat += 2.0 * dy;
FGBucket tmp( 0.0, lat );
SGBucket tmp( 0.0, lat );
double dx = tmp.get_width();
lon = start_lon + (shift_over*dx) + (dx*0.5);
}
@ -187,7 +187,7 @@ long int get_next_tile() {
lat = start_lat + (shift_up*dy) + (dy*0.5);
// reset lon
FGBucket tmp( 0.0, lat );
SGBucket tmp( 0.0, lat );
double dx = tmp.get_width();
// lon = -82 + (shift_over*dx) + (dx*0.5);
lon = start_lon + (shift_over*dx) + (dx*0.5);
@ -202,10 +202,10 @@ long int get_next_tile() {
// start_lon = false;
// }
b = FGBucket( lon, lat );
b = SGBucket( lon, lat );
// increment to next tile
FGBucket tmp( 0.0, lat );
SGBucket tmp( 0.0, lat );
double dx = tmp.get_width();
// skip every other column (to avoid two clients working on
@ -235,7 +235,7 @@ long int get_next_tile() {
// log a pending tile (has been given out as a taks for some client)
void log_pending_tile( const string& path, long int tile ) {
FGBucket b(tile);
SGBucket b(tile);
string pending_file = path + "/" + b.gen_index_str() + ".pending";
@ -246,7 +246,7 @@ void log_pending_tile( const string& path, long int tile ) {
// a tile is finished (removed the .pending file)
void log_finished_tile( const string& path, long int tile ) {
FGBucket b(tile);
SGBucket b(tile);
string finished_file = path + "/" + b.gen_index_str() + ".pending";
// cout << "unlinking " << finished_file << endl;
@ -256,7 +256,7 @@ void log_finished_tile( const string& path, long int tile ) {
// make note of a failed tile
void log_failed_tile( const string& path, long int tile ) {
FGBucket b(tile);
SGBucket b(tile);
string failed_file = path + "/" + b.gen_index_str() + ".failed";
@ -302,7 +302,7 @@ int main( int argc, char **argv ) {
// temp test
// while ( (next_tile = get_next_tile()) != -1 ) {
// cout << next_tile << " " << FGBucket(next_tile) << endl;
// cout << next_tile << " " << SGBucket(next_tile) << endl;
// }
// cout << "done" << endl;
// exit(0);
@ -341,7 +341,7 @@ int main( int argc, char **argv ) {
}
}
cout << "Bucket = " << FGBucket(next_tile)
cout << "Bucket = " << SGBucket(next_tile)
<< " (" << pass << ")" << endl;
log_pending_tile( status_dir, next_tile );

View file

@ -115,7 +115,7 @@ FGArray::close() {
// parse Array file, pass in the bucket so we can make up values when
// the file wasn't found.
int
FGArray::parse( FGBucket& b ) {
FGArray::parse( SGBucket& b ) {
if ( in->is_open() ) {
// file open, parse
*in >> originx >> originy;
@ -464,7 +464,7 @@ double FGArray::interpolate_altitude( double lon, double lat ) const {
// Check for an optional "index.node.ex" file in case there is a .poly
// file to go along with this node file. Include these nodes first
// since they are referenced by position from the .poly file.
void FGArray::outputmesh_output_nodes( const string& fg_root, FGBucket& p )
void FGArray::outputmesh_output_nodes( const string& fg_root, SGBucket& p )
{
double exnodes[MAX_EX_NODES][3];
struct stat stat_buf;

View file

@ -88,7 +88,7 @@ public:
int close();
// parse a Array file
int parse( FGBucket& b );
int parse( SGBucket& b );
// Use least squares to fit a simpler data set to dem data.
// Return the number of fitted nodes

View file

@ -15,7 +15,7 @@ main(int argc, char **argv) {
lon = -146.248360; lat = 61.133950; // PAVD (Valdez, AK)
lon = -110.664244; lat = 33.352890; // P13
FGBucket b( lon, lat );
SGBucket b( lon, lat );
string base = b.gen_base_path();
string path = work_dir + "/" + base;

View file

@ -385,7 +385,7 @@ FGDem::parse( ) {
// is written out column by column starting at the lower left hand
// corner.
int
FGDem::write_area( const string& root, FGBucket& b, bool compress ) {
FGDem::write_area( const string& root, SGBucket& b, bool compress ) {
// calculate some boundaries
double min_x = ( b.get_center_lon() - 0.5 * b.get_width() ) * 3600.0;
double max_x = ( b.get_center_lon() + 0.5 * b.get_width() ) * 3600.0;
@ -576,7 +576,7 @@ double FGDem::interpolate_altitude( double lon, double lat ) {
// Use least squares to fit a simpler data set to dem data
void FGDem::fit( double error, FGBucket& p ) {
void FGDem::fit( double error, SGBucket& p ) {
double x[DEM_SIZE_1], y[DEM_SIZE_1];
double m, b, ave_error, max_error;
double cury, lasty;
@ -740,7 +740,7 @@ void FGDem::outputmesh_set_pt( int i, int j, double value ) {
// Check for an optional "index.node.ex" file in case there is a .poly
// file to go along with this node file. Include these nodes first
// since they are referenced by position from the .poly file.
void FGDem::outputmesh_output_nodes( const string& fg_root, FGBucket& p )
void FGDem::outputmesh_output_nodes( const string& fg_root, SGBucket& p )
{
double exnodes[MAX_EX_NODES][3];
struct stat stat_buf;

View file

@ -115,7 +115,7 @@ public:
// write out the area of data covered by the specified bucket.
// Data is written out column by column starting at the lower left
// hand corner.
int write_area( const string& root, FGBucket& b, bool compress );
int write_area( const string& root, SGBucket& b, bool compress );
#if 0
// return the current altitude based on grid data. We should
@ -124,7 +124,7 @@ public:
double interpolate_altitude( double lon, double lat );
// Use least squares to fit a simpler data set to dem data
void fit( double error, FGBucket& p );
void fit( double error, SGBucket& p );
// Initialize output mesh structure
void outputmesh_init( void );
@ -136,7 +136,7 @@ public:
void outputmesh_set_pt( int i, int j, double value );
// Write out a node file that can be used by the "triangle" program
void outputmesh_output_nodes( const string& fg_root, FGBucket& p );
void outputmesh_output_nodes( const string& fg_root, SGBucket& p );
#endif
// Informational methods

View file

@ -41,10 +41,10 @@ FG_USING_STD(cout);
static void clip_and_write_poly( string root, long int p_index, AreaType area,
FGBucket b, const FGPolygon& shape ) {
SGBucket b, const FGPolygon& shape ) {
Point3D c, min, max, p;
c = Point3D( b.get_center_lon(), b.get_center_lat(), 0 );
double span = bucket_span( c.y() );
double span = sg_bucket_span( c.y() );
FGPolygon base, result;
char tile_name[256], poly_index[256];
@ -52,8 +52,8 @@ static void clip_and_write_poly( string root, long int p_index, AreaType area,
if ( (c.y() >= -89.0) && (c.y() < 89.0) ) {
min.setx( c.x() - span / 2.0 );
max.setx( c.x() + span / 2.0 );
min.sety( c.y() - FG_HALF_BUCKET_SPAN );
max.sety( c.y() + FG_HALF_BUCKET_SPAN );
min.sety( c.y() - SG_HALF_BUCKET_SPAN );
max.sety( c.y() + SG_HALF_BUCKET_SPAN );
} else if ( c.y() < -89.0) {
min.setx( -90.0 );
max.setx( -89.0 );
@ -163,8 +163,8 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
// find buckets for min, and max points of convex hull.
// note to self: self, you should think about checking for
// polygons that span the date line
FGBucket b_min( min.x(), min.y() );
FGBucket b_max( max.x(), max.y() );
SGBucket b_min( min.x(), min.y() );
SGBucket b_max( max.x(), max.y() );
FG_LOG( FG_GENERAL, FG_INFO, " Bucket min = " << b_min );
FG_LOG( FG_GENERAL, FG_INFO, " Bucket max = " << b_max );
@ -174,10 +174,10 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
return;
}
FGBucket b_cur;
SGBucket b_cur;
int dx, dy;
fgBucketDiff(b_min, b_max, &dx, &dy);
sgBucketDiff(b_min, b_max, &dx, &dy);
FG_LOG( FG_GENERAL, FG_INFO,
" polygon spans tile boundaries" );
FG_LOG( FG_GENERAL, FG_INFO, " dx = " << dx
@ -194,7 +194,7 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
// bail
for ( j = 0; j <= 1; ++j ) {
for ( i = 0; i <= dx; ++i ) {
b_cur = fgBucketOffset(min.x(), min.y(), i, j);
b_cur = sgBucketOffset(min.x(), min.y(), i, j);
clip_and_write_poly( path, index, area, b_cur, shape );
}
}
@ -208,10 +208,10 @@ void split_polygon(const string& path, AreaType area, const FGPolygon& shape) {
int mid = (dy + 1) / 2 - 1;
// determine horizontal clip line
FGBucket b_clip = fgBucketOffset(min.x(), min.y(), 0, mid);
SGBucket b_clip = sgBucketOffset(min.x(), min.y(), 0, mid);
double clip_line = b_clip.get_center_lat();
if ( (clip_line >= -89.0) && (clip_line < 89.0) ) {
clip_line += FG_HALF_BUCKET_SPAN;
clip_line += SG_HALF_BUCKET_SPAN;
} else if ( clip_line < -89.0 ) {
clip_line = -89.0;
} else if ( clip_line >= 89.0 ) {

View file

@ -44,7 +44,7 @@ FG_USING_STD(string);
int main(int argc, char **argv) {
/*
fgDEM dem;
FGBucket p;
SGBucket p;
string fg_root;
string filename;
double error;
@ -74,23 +74,23 @@ int main(int argc, char **argv) {
dem.close();
point2d min, max;
min.x = dem.get_originx() / 3600.0 + FG_HALF_BUCKET_SPAN;
min.y = dem.get_originy() / 3600.0 + FG_HALF_BUCKET_SPAN;
FGBucket b_min( min.x, min.y );
min.x = dem.get_originx() / 3600.0 + SG_HALF_BUCKET_SPAN;
min.y = dem.get_originy() / 3600.0 + SG_HALF_BUCKET_SPAN;
SGBucket b_min( min.x, min.y );
max.x = (dem.get_originx() + dem.get_cols() * dem.get_col_step()) / 3600.0
- FG_HALF_BUCKET_SPAN;
- SG_HALF_BUCKET_SPAN;
max.y = (dem.get_originy() + dem.get_rows() * dem.get_row_step()) / 3600.0
- FG_HALF_BUCKET_SPAN;
FGBucket b_max( max.x, max.y );
- SG_HALF_BUCKET_SPAN;
SGBucket b_max( max.x, max.y );
if ( b_min == b_max ) {
dem.write_area( work_dir, b_min, true );
} else {
FGBucket b_cur;
SGBucket b_cur;
int dx, dy, i, j;
fgBucketDiff(b_min, b_max, &dx, &dy);
sgBucketDiff(b_min, b_max, &dx, &dy);
cout << "DEM file spans tile boundaries" << endl;
cout << " dx = " << dx << " dy = " << dy << endl;
@ -101,7 +101,7 @@ int main(int argc, char **argv) {
for ( j = 0; j <= dy; j++ ) {
for ( i = 0; i <= dx; i++ ) {
b_cur = fgBucketOffset(min.x, min.y, i, j);
b_cur = sgBucketOffset(min.x, min.y, i, j);
dem.write_area( work_dir, b_cur, true );
}
}

View file

@ -50,7 +50,7 @@ int main( int argc, char **argv ) {
// process all specified polygon files
string cur_dir=argv[0];
DIR *d;
struct dirent *de;
// struct dirent *de;
if ( (d = opendir( cur_dir.c_str() )) == NULL ) {
cout << "cannot open directory " << cur_dir << "\n";
return 0;
@ -81,7 +81,7 @@ int main( int argc, char **argv ) {
long int index;
sscanf( base_name.c_str(), "%ld", &index);
FGBucket b(index);
SGBucket b(index);
cout << "bucket = " << b << endl;
// calculate bucket dimensions
@ -89,13 +89,13 @@ int main( int argc, char **argv ) {
c.x = b.get_center_lon();
c.y = b.get_center_lat();
double span = bucket_span(c.y);
double span = sg_bucket_span(c.y);
if ( (c.y >= -89.0) && (c.y < 89.0) ) {
min.x = c.x - span / 2.0;
max.x = c.x + span / 2.0;
min.y = c.y - FG_HALF_BUCKET_SPAN;
max.y = c.y + FG_HALF_BUCKET_SPAN;
min.y = c.y - SG_HALF_BUCKET_SPAN;
max.y = c.y + SG_HALF_BUCKET_SPAN;
} else if ( c.y < -89.0) {
min.x = -90.0;
max.x = -89.0;
@ -125,7 +125,7 @@ int main( int argc, char **argv ) {
clipper.merge(subject);
const long int index=atoi(base_name.c_str());
FGBucket b(index);
SGBucket b(index);
string root=argv[argc-1];
string path = root + "/Scenery/" + b.gen_base_path();
string command = "mkdir -p " + path;