genapts elevation: remove unused function
This commit is contained in:
parent
4504d4764c
commit
097abcb9a6
3 changed files with 9 additions and 105 deletions
|
@ -984,7 +984,7 @@ void Airport::BuildBtg(const std::string& root, const string_list& elev_src )
|
|||
}
|
||||
}
|
||||
|
||||
double average = tgAverageElevationGeod( root, elev_src, nodes.get_list() );
|
||||
double average = tgAverageElevation( root, elev_src, nodes.get_list() );
|
||||
|
||||
// Now build the fitted airport surface ...
|
||||
|
||||
|
|
|
@ -34,102 +34,9 @@
|
|||
#include "apt_surface.hxx"
|
||||
|
||||
|
||||
// lookup node elevations for each point in the point_list. Returns
|
||||
// lookup node elevations for each point in the SGGeod list. Returns
|
||||
// average of all points. Doesn't modify the original list.
|
||||
|
||||
double tgAverageElevation( const std::string &root, const string_list elev_src,
|
||||
const point_list points_source )
|
||||
{
|
||||
bool done = false;
|
||||
unsigned int i;
|
||||
TGArray array;
|
||||
|
||||
// make a copy so our routine is non-destructive.
|
||||
point_list points = points_source;
|
||||
|
||||
// just bail if no work to do
|
||||
if ( points.size() == 0 ) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// set all elevations to -9999
|
||||
for ( i = 0; i < points.size(); ++i ) {
|
||||
points[i].setz( -9999.0 );
|
||||
}
|
||||
|
||||
while ( !done ) {
|
||||
// find first node with -9999 elevation
|
||||
SGGeod first = SGGeod();
|
||||
bool found_one = false;
|
||||
for ( i = 0; i < points.size(); ++i ) {
|
||||
if ( points[i].z() < -9000.0 && !found_one ) {
|
||||
first = points[i].toSGGeod();
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "found first = " << first );
|
||||
|
||||
found_one = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( found_one ) {
|
||||
SGBucket b( first );
|
||||
std::string base = b.gen_base_path();
|
||||
|
||||
// try the various elevation sources
|
||||
i = 0;
|
||||
bool found_file = false;
|
||||
while ( !found_file && i < elev_src.size() ) {
|
||||
std::string array_path = root + "/" + elev_src[i] + "/" + base + "/" + b.gen_index_str();
|
||||
|
||||
if ( array.open(array_path) ) {
|
||||
found_file = true;
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Using array_path = " << array_path );
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
// this will fill in a zero structure if no array data
|
||||
// found/opened
|
||||
array.parse( b );
|
||||
|
||||
// this will do a hasty job of removing voids by inserting
|
||||
// data from the nearest neighbor (sort of)
|
||||
array.remove_voids();
|
||||
|
||||
// update all the non-updated elevations that are inside
|
||||
// this array file
|
||||
double elev;
|
||||
done = true;
|
||||
for ( i = 0; i < points.size(); ++i ) {
|
||||
if ( points[i].z() < -9000.0 ) {
|
||||
done = false;
|
||||
elev = array.altitude_from_grid( points[i].lon() * 3600.0,
|
||||
points[i].lat() * 3600.0 );
|
||||
if ( elev > -9000 ) {
|
||||
points[i].setz( elev );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
array.close();
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
|
||||
// now find the average height of the queried points
|
||||
double total = 0.0;
|
||||
int count = 0;
|
||||
for ( i = 0; i < points.size(); ++i ) {
|
||||
total += points[i].z();
|
||||
count++;
|
||||
}
|
||||
double average = total / (double) count;
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Average surface height of point list = " << average);
|
||||
|
||||
return average;
|
||||
}
|
||||
|
||||
double tgAverageElevationGeod( const std::string &root, const string_list elev_src,
|
||||
const std::vector<SGGeod> points_source )
|
||||
{
|
||||
bool done = false;
|
||||
|
@ -272,10 +179,10 @@ void tgCalcElevations( const std::string &root, const string_list elev_src,
|
|||
if ( array.open(array_path) ) {
|
||||
found_file = true;
|
||||
SG_LOG( SG_GENERAL, SG_DEBUG, "Using array_path = " << array_path );
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// this will fill in a zero structure if no array data
|
||||
// found/opened
|
||||
array.parse( b );
|
||||
|
@ -310,8 +217,8 @@ void tgCalcElevations( const std::string &root, const string_list elev_src,
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// do some post processing for sanity's sake
|
||||
|
||||
// find the average height of the queried points
|
||||
double total = 0.0;
|
||||
int count = 0;
|
||||
|
@ -324,11 +231,12 @@ void tgCalcElevations( const std::string &root, const string_list elev_src,
|
|||
}
|
||||
double grid_average = total / (double) count;
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "Average surface height of matrix = " << grid_average);
|
||||
#endif
|
||||
}
|
||||
|
||||
// clamp all elevations to the specified range
|
||||
void tgClampElevations( SimpleMatrix &Pts,
|
||||
double center_m,
|
||||
double center_m,
|
||||
double max_clamp_m )
|
||||
{
|
||||
int i, j;
|
||||
|
|
|
@ -23,13 +23,9 @@
|
|||
#include "apt_surface.hxx"
|
||||
|
||||
|
||||
// lookup node elevations for each point in the point_list. Returns
|
||||
// lookup node elevations for each point in the SGGeod list. Returns
|
||||
// average of all points. Doesn't modify the original list.
|
||||
double tgAverageElevation( const std::string &root, const string_list elev_src,
|
||||
const point_list points_source );
|
||||
|
||||
// same - with a geod list
|
||||
double tgAverageElevationGeod( const std::string &root, const string_list elev_src,
|
||||
const std::vector<SGGeod> points_source );
|
||||
|
||||
// lookup node elevations for each point in the specified nurbs++
|
||||
|
|
Loading…
Add table
Reference in a new issue