Allow additional or non-standard terrain source directories to be specified
on the command line with the --terrain= option. You can specify as many as you like. Directories specified on the command line will take precidence over the default directories and the directories will be searched in the order specified.
This commit is contained in:
parent
473c4d9b94
commit
5a84f39f83
5 changed files with 35 additions and 14 deletions
src/Airports/GenAirports
|
@ -37,13 +37,14 @@ SG_USING_NAMESPACE( PLib );
|
||||||
|
|
||||||
|
|
||||||
// fix node elevations. Offset is added to the final elevation
|
// fix node elevations. Offset is added to the final elevation
|
||||||
static void calc_elevations( const string &root, Matrix_Point3Df &Pts ) {
|
static void calc_elevations( const string &root, const string_list elev_src,
|
||||||
string_list elev_src;
|
Matrix_Point3Df &Pts ) {
|
||||||
elev_src.clear();
|
// string_list elev_src;
|
||||||
elev_src.push_back( "SRTM-1" );
|
// elev_src.clear();
|
||||||
elev_src.push_back( "SRTM-3" );
|
// elev_src.push_back( "SRTM-1" );
|
||||||
elev_src.push_back( "DEM-3" );
|
// elev_src.push_back( "SRTM-3" );
|
||||||
elev_src.push_back( "DEM-30" );
|
// elev_src.push_back( "DEM-3" );
|
||||||
|
// elev_src.push_back( "DEM-30" );
|
||||||
|
|
||||||
bool done = false;
|
bool done = false;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -164,6 +165,7 @@ static void calc_elevations( const string &root, Matrix_Point3Df &Pts ) {
|
||||||
// Constructor, specify min and max coordinates of desired area in
|
// Constructor, specify min and max coordinates of desired area in
|
||||||
// lon/lat degrees
|
// lon/lat degrees
|
||||||
TGAptSurface::TGAptSurface( const string& path,
|
TGAptSurface::TGAptSurface( const string& path,
|
||||||
|
const string_list& elev_src,
|
||||||
Point3D _min_deg, Point3D _max_deg )
|
Point3D _min_deg, Point3D _max_deg )
|
||||||
{
|
{
|
||||||
// Calculate desired size of grid
|
// Calculate desired size of grid
|
||||||
|
@ -208,7 +210,7 @@ TGAptSurface::TGAptSurface( const string& path,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine elevation of the grid points
|
// Determine elevation of the grid points
|
||||||
calc_elevations( path, dPts );
|
calc_elevations( path, elev_src, dPts );
|
||||||
|
|
||||||
// Build the normal res input grid from the double res version
|
// Build the normal res input grid from the double res version
|
||||||
Matrix_Point3Df Pts(xdivs + 1, ydivs + 1);
|
Matrix_Point3Df Pts(xdivs + 1, ydivs + 1);
|
||||||
|
|
|
@ -61,7 +61,8 @@ public:
|
||||||
|
|
||||||
// Constructor, specify min and max coordinates of desired area in
|
// Constructor, specify min and max coordinates of desired area in
|
||||||
// lon/lat degrees
|
// lon/lat degrees
|
||||||
TGAptSurface( const string &path, Point3D _min_deg, Point3D _max_deg );
|
TGAptSurface( const string &path, const string_list& elev_src,
|
||||||
|
Point3D _min_deg, Point3D _max_deg );
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~TGAptSurface();
|
~TGAptSurface();
|
||||||
|
|
|
@ -323,7 +323,9 @@ static void build_runway( const TGRunway& rwy_info,
|
||||||
// build 3d airport
|
// build 3d airport
|
||||||
void build_airport( string airport_id, float alt_m,
|
void build_airport( string airport_id, float alt_m,
|
||||||
string_list& runways_raw,
|
string_list& runways_raw,
|
||||||
string_list& taxiways_raw, const string& root )
|
string_list& taxiways_raw,
|
||||||
|
const string& root,
|
||||||
|
const string_list& elev_src )
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int i, j, k;
|
||||||
|
|
||||||
|
@ -911,7 +913,7 @@ void build_airport( string airport_id, float alt_m,
|
||||||
min_deg.setlat( min_deg.lat() - 0.1 * dlat );
|
min_deg.setlat( min_deg.lat() - 0.1 * dlat );
|
||||||
max_deg.setlat( max_deg.lat() + 0.1 * dlat );
|
max_deg.setlat( max_deg.lat() + 0.1 * dlat );
|
||||||
|
|
||||||
TGAptSurface apt_surf( root, min_deg, max_deg );
|
TGAptSurface apt_surf( root, elev_src, min_deg, max_deg );
|
||||||
cout << "Surface created" << endl;
|
cout << "Surface created" << endl;
|
||||||
|
|
||||||
// calculate node elevations
|
// calculate node elevations
|
||||||
|
|
|
@ -35,7 +35,9 @@
|
||||||
|
|
||||||
// build 3d airport
|
// build 3d airport
|
||||||
void build_airport( string airport_id, float alt_m, string_list& runways_raw,
|
void build_airport( string airport_id, float alt_m, string_list& runways_raw,
|
||||||
string_list& taxiways_raw, const string& root );
|
string_list& taxiways_raw,
|
||||||
|
const string& root,
|
||||||
|
const string_list& elev_src );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,9 @@ int main( int argc, char **argv ) {
|
||||||
float max_lat = 90;
|
float max_lat = 90;
|
||||||
bool ready_to_go = true;
|
bool ready_to_go = true;
|
||||||
|
|
||||||
|
string_list elev_src;
|
||||||
|
elev_src.clear();
|
||||||
|
|
||||||
sglog().setLogLevels( SG_GENERAL, SG_INFO );
|
sglog().setLogLevels( SG_GENERAL, SG_INFO );
|
||||||
|
|
||||||
// parse arguments
|
// parse arguments
|
||||||
|
@ -89,6 +92,8 @@ int main( int argc, char **argv ) {
|
||||||
work_dir = arg.substr(7);
|
work_dir = arg.substr(7);
|
||||||
} else if ( arg.find("--input=") == 0 ) {
|
} else if ( arg.find("--input=") == 0 ) {
|
||||||
input_file = arg.substr(8);
|
input_file = arg.substr(8);
|
||||||
|
} else if ( arg.find("--terrain=") == 0 ) {
|
||||||
|
elev_src.push_back( arg.substr(10) );
|
||||||
} else if ( arg.find("--start-id=") == 0 ) {
|
} else if ( arg.find("--start-id=") == 0 ) {
|
||||||
start_id = arg.substr(11);
|
start_id = arg.substr(11);
|
||||||
ready_to_go = false;
|
ready_to_go = false;
|
||||||
|
@ -114,7 +119,16 @@ int main( int argc, char **argv ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
elev_src.push_back( "SRTM-1" );
|
||||||
|
elev_src.push_back( "SRTM-3" );
|
||||||
|
elev_src.push_back( "DEM-3" );
|
||||||
|
elev_src.push_back( "DEM-30" );
|
||||||
|
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Input file = " << input_file);
|
SG_LOG(SG_GENERAL, SG_INFO, "Input file = " << input_file);
|
||||||
|
SG_LOG(SG_GENERAL, SG_INFO, "Terrain sources = ");
|
||||||
|
for ( unsigned int i = 0; i < elev_src.size(); ++i ) {
|
||||||
|
SG_LOG(SG_GENERAL, SG_INFO, " " << work_dir << "/" << elev_src[i] );
|
||||||
|
}
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Work directory = " << work_dir);
|
SG_LOG(SG_GENERAL, SG_INFO, "Work directory = " << work_dir);
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Nudge = " << nudge);
|
SG_LOG(SG_GENERAL, SG_INFO, "Nudge = " << nudge);
|
||||||
SG_LOG(SG_GENERAL, SG_INFO, "Longitude = " << min_lon << ':' << max_lon);
|
SG_LOG(SG_GENERAL, SG_INFO, "Longitude = " << min_lon << ':' << max_lon);
|
||||||
|
@ -215,7 +229,7 @@ int main( int argc, char **argv ) {
|
||||||
try {
|
try {
|
||||||
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
||||||
runways_list, taxiways_list,
|
runways_list, taxiways_list,
|
||||||
work_dir );
|
work_dir, elev_src );
|
||||||
} catch (sg_exception &e) {
|
} catch (sg_exception &e) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Failed to build airport = "
|
"Failed to build airport = "
|
||||||
|
@ -286,7 +300,7 @@ int main( int argc, char **argv ) {
|
||||||
try {
|
try {
|
||||||
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
build_airport( last_apt_id, elev * SG_FEET_TO_METER,
|
||||||
runways_list, taxiways_list,
|
runways_list, taxiways_list,
|
||||||
work_dir );
|
work_dir, elev_src );
|
||||||
} catch (sg_exception &e) {
|
} catch (sg_exception &e) {
|
||||||
SG_LOG( SG_GENERAL, SG_ALERT,
|
SG_LOG( SG_GENERAL, SG_ALERT,
|
||||||
"Failed to build airport = "
|
"Failed to build airport = "
|
||||||
|
|
Loading…
Add table
Reference in a new issue