1
0
Fork 0

Use .arr as the intermediate height field rather than .dem since .dem

implies a different format.
This commit is contained in:
curt 2003-02-27 21:19:00 +00:00
parent e483bf0a34
commit 1a46456fbd
4 changed files with 28 additions and 28 deletions

View file

@ -164,7 +164,7 @@ static int actual_load_polys( const string& dir,
ext = file.substr(pos + 1); ext = file.substr(pos + 1);
cout << file << " " << f_index << " '" << ext << "'" << endl; cout << file << " " << f_index << " '" << ext << "'" << endl;
full_path = dir + "/" + file; full_path = dir + "/" + file;
if ( (ext == "dem") || (ext == "dem.gz") ) { if ( (ext == "arr") || (ext == "arr.gz") ) {
// skip // skip
} else if (ext == "osgb36") { } else if (ext == "osgb36") {
cout << "Loading osgb36 poly definition file\n"; cout << "Loading osgb36 poly definition file\n";
@ -198,7 +198,7 @@ static int actual_load_polys( const string& dir,
ext = file.substr(pos + 1); ext = file.substr(pos + 1);
cout << file << " " << f_index << " '" << ext << "'" << endl; cout << file << " " << f_index << " '" << ext << "'" << endl;
full_path = dir + "/" + file; full_path = dir + "/" + file;
if ( (ext == "dem") || (ext == "dem.gz") || (ext == "ind") ) { if ( (ext == "arr") || (ext == "arr.gz") || (ext == "ind") ) {
// skip // skip
} else if (ext == "osgb36") { } else if (ext == "osgb36") {
cout << "Loading osgb36 poly definition file\n"; cout << "Loading osgb36 poly definition file\n";
@ -409,23 +409,23 @@ static int load_polys( FGConstruct& c ) {
} }
// Load elevation data from a DEM file, a regular grid of elevation // Load elevation data from an Array file, a regular grid of elevation
// data--dem based) and return list of fitted nodes. // data) and return list of fitted nodes.
static int load_dem( FGConstruct& c, TGArray& array) { static int load_array( FGConstruct& c, TGArray& array) {
point_list result; point_list result;
string base = c.get_bucket().gen_base_path(); string base = c.get_bucket().gen_base_path();
int i; int i;
for ( i = 0; i < (int)load_dirs.size(); ++i ) { for ( i = 0; i < (int)load_dirs.size(); ++i ) {
string dem_path = load_dirs[i] + "/" + base string array_path = load_dirs[i] + "/" + base
+ "/" + c.get_bucket().gen_index_str() + ".dem"; + "/" + c.get_bucket().gen_index_str() + ".arr";
cout << "dem_path = " << dem_path << endl; cout << "array_path = " << array_path << endl;
if ( array.open(dem_path) ) { if ( array.open(array_path) ) {
cout << "Found DEM file " << dem_path << endl; cout << "Found Array file " << array_path << endl;
break; break;
} else { } else {
cout << "Failed to open DEM file " << dem_path << endl; cout << "Failed to open Array file " << array_path << endl;
} }
} }
@ -436,8 +436,8 @@ static int load_dem( FGConstruct& c, TGArray& array) {
} }
// fit dem nodes, return number of fitted nodes // fit array nodes, return number of fitted nodes
static int fit_dem(TGArray& array, int error) { static int fit_array(TGArray& array, int error) {
return array.fit( error ); return array.fit( error );
} }
@ -445,7 +445,7 @@ static int fit_dem(TGArray& array, int error) {
// triangulate the data for each polygon ( first time before splitting ) // triangulate the data for each polygon ( first time before splitting )
static void first_triangulate( FGConstruct& c, const TGArray& array, static void first_triangulate( FGConstruct& c, const TGArray& array,
FGTriangle& t ) { FGTriangle& t ) {
// first we need to consolidate the points of the DEM fit list and // first we need to consolidate the points of the Array fit list and
// all the polygons into a more "Triangle" friendly format // all the polygons into a more "Triangle" friendly format
point_list corner_list = array.get_corner_node_list(); point_list corner_list = array.get_corner_node_list();
@ -878,14 +878,14 @@ static void construct_tile( FGConstruct& c ) {
return; return;
} }
// load grid of elevation data (dem) // load grid of elevation data (Array)
TGArray array; TGArray array;
load_dem( c, array ); load_array( c, array );
FGTriangle t; FGTriangle t;
while ( ! acceptable ) { while ( ! acceptable ) {
// do a least squares fit of the (dem) data with the given // do a least squares fit of the (array) data with the given
// error tolerance // error tolerance
array.fit( error ); array.fit( error );

View file

@ -56,14 +56,14 @@ static bool file_exists( const string& file ) {
// check if the specified tile has data defined for it // check if the specified tile has data defined for it
static bool has_data( const string& path, const SGBucket& b ) { static bool has_data( const string& path, const SGBucket& b ) {
string dem_file = path + "DEM-3/" + b.gen_base_path() string array_file = path + "DEM-3/" + b.gen_base_path()
+ "/" + b.gen_index_str() + ".dem"; + "/" + b.gen_index_str() + ".arr";
if ( file_exists( dem_file ) ) { if ( file_exists( array_file ) ) {
return true; return true;
} }
dem_file += ".gz"; array_file += ".gz";
if ( file_exists( dem_file ) ) { if ( file_exists( array_file ) ) {
return true; return true;
} }

View file

@ -100,14 +100,14 @@ static bool file_exists( const string& file ) {
// check if the specified tile has data defined for it [ depricated ] // check if the specified tile has data defined for it [ depricated ]
static bool has_data( const string& path, const SGBucket& b ) { static bool has_data( const string& path, const SGBucket& b ) {
string dem_file = path + ".dem" + "/" + b.gen_base_path() string array_file = path + ".arr" + "/" + b.gen_base_path()
+ "/" + b.gen_index_str() + ".dem"; + "/" + b.gen_index_str() + ".arr";
if ( file_exists( dem_file ) ) { if ( file_exists( array_file ) ) {
return true; return true;
} }
dem_file += ".gz"; array_file += ".gz";
if ( file_exists( dem_file ) ) { if ( file_exists( array_file ) ) {
return true; return true;
} }

View file

@ -59,7 +59,7 @@ FGTriangle::build( const point_list& corner_list,
// int junkc = 0; // int junkc = 0;
// FILE *junkfp; // FILE *junkfp;
// traverse the dem corner and fit lists and gpc_polys building a // traverse the array corner and fit lists and gpc_polys building a
// unified node list and converting the polygons so that they // unified node list and converting the polygons so that they
// reference the node list by index (starting at zero) rather than // reference the node list by index (starting at zero) rather than
// listing the points explicitely // listing the points explicitely