new fgcommand: "terrain-elevation"
- input: longitude-deg, latitude-deg - output: elevation-m
This commit is contained in:
parent
7e070759ad
commit
3eb6d4f708
1 changed files with 16 additions and 0 deletions
|
@ -28,6 +28,7 @@
|
||||||
#include <GUI/dialog.hxx>
|
#include <GUI/dialog.hxx>
|
||||||
#include <Aircraft/replay.hxx>
|
#include <Aircraft/replay.hxx>
|
||||||
#include <Scenery/tilemgr.hxx>
|
#include <Scenery/tilemgr.hxx>
|
||||||
|
#include <Scenery/scenery.hxx>
|
||||||
#if defined(HAVE_PLIB_PSL)
|
#if defined(HAVE_PLIB_PSL)
|
||||||
# include <Scripting/scriptmgr.hxx>
|
# include <Scripting/scriptmgr.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
@ -1230,6 +1231,20 @@ do_replay (const SGPropertyNode * arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return terrain elevation for given longitude/latitude pair.
|
||||||
|
*/
|
||||||
|
static bool
|
||||||
|
do_terrain_elevation (const SGPropertyNode * arg)
|
||||||
|
{
|
||||||
|
double lon = arg->getDoubleValue("longitude-deg", 0.0);
|
||||||
|
double lat = arg->getDoubleValue("latitude-deg", 0.0);
|
||||||
|
double elev;
|
||||||
|
bool ret = globals->get_scenery()->get_elevation_m(lat, lon, 10000.0, elev, 0, false);
|
||||||
|
const_cast<SGPropertyNode *>(arg)->setDoubleValue("elevation-m", elev);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
do_decrease_visibility (const SGPropertyNode * arg)
|
do_decrease_visibility (const SGPropertyNode * arg)
|
||||||
|
@ -1436,6 +1451,7 @@ static struct {
|
||||||
{ "presets-commit", do_presets_commit },
|
{ "presets-commit", do_presets_commit },
|
||||||
{ "log-level", do_log_level },
|
{ "log-level", do_log_level },
|
||||||
{ "replay", do_replay },
|
{ "replay", do_replay },
|
||||||
|
{ "terrain-elevation", do_terrain_elevation },
|
||||||
{ "decrease-visibility", do_decrease_visibility },
|
{ "decrease-visibility", do_decrease_visibility },
|
||||||
{ "increase-visibility", do_increase_visibility },
|
{ "increase-visibility", do_increase_visibility },
|
||||||
{ "hud-init", do_hud_init },
|
{ "hud-init", do_hud_init },
|
||||||
|
|
Loading…
Reference in a new issue