2009-10-05 21:09:20 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
#include <simgear/misc/sg_path.hxx>
|
2017-02-09 18:48:33 +00:00
|
|
|
#include <simgear/io/iostreams/sgstream.hxx>
|
2009-10-11 11:37:13 +00:00
|
|
|
#include <simgear/structure/exception.hxx>
|
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
#include <Main/fg_init.hxx>
|
|
|
|
#include <Main/fg_props.hxx>
|
|
|
|
|
|
|
|
#include <Instrumentation/gps.hxx>
|
|
|
|
#include <Autopilot/route_mgr.hxx>
|
|
|
|
#include <Environment/environment_mgr.hxx>
|
2009-10-11 11:37:13 +00:00
|
|
|
#include <Navaids/airways.hxx>
|
|
|
|
#include <Navaids/waypoint.hxx>
|
|
|
|
#include <Navaids/procedure.hxx>
|
2009-10-05 21:09:20 +00:00
|
|
|
|
2018-06-14 18:28:22 +00:00
|
|
|
#include "test_suite/helpers/globals.hxx"
|
|
|
|
#include "test_suite/helpers/NavDataCache.hxx"
|
|
|
|
|
|
|
|
#include "testgps.hxx"
|
|
|
|
|
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
using std::string;
|
2009-10-11 11:37:13 +00:00
|
|
|
using namespace flightgear;
|
2009-10-05 21:09:20 +00:00
|
|
|
|
|
|
|
char *homedir = ::getenv( "HOME" );
|
|
|
|
char *hostname = ::getenv( "HOSTNAME" );
|
|
|
|
bool free_hostname = false;
|
|
|
|
|
|
|
|
void testSetPosition(const SGGeod& aPos)
|
|
|
|
{
|
|
|
|
fgSetDouble("/position/longitude-deg", aPos.getLongitudeDeg());
|
|
|
|
fgSetDouble("/position/latitude-deg", aPos.getLatitudeDeg());
|
|
|
|
fgSetDouble("/position/altitude-ft", aPos.getElevationFt());
|
|
|
|
}
|
|
|
|
|
|
|
|
void printScratch(SGPropertyNode* scratch)
|
|
|
|
{
|
|
|
|
if (!scratch->getBoolValue("valid", false)) {
|
2016-07-01 09:54:29 +00:00
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "Scratch is invalid.");
|
2009-10-05 21:09:20 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "Scratch:" <<
|
|
|
|
scratch->getStringValue("ident") << "/" << scratch->getStringValue("name"));
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "\t" << scratch->getDoubleValue("longitude-deg")
|
|
|
|
<< " " << scratch->getDoubleValue("latitude-deg") << " @ " << scratch->getDoubleValue("altitude-ft"));
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "\t" << scratch->getDoubleValue("true-bearing-deg") <<
|
|
|
|
" (" << scratch->getDoubleValue("mag-bearing-deg") << " magnetic) " << scratch->getDoubleValue("distance-nm"));
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
if (scratch->hasChild("result-index")) {
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "\tresult-index:" << scratch->getIntValue("result-index"));
|
2016-07-01 09:54:29 +00:00
|
|
|
}
|
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
if (scratch->hasChild("route-index")) {
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "\troute-index:" << scratch->getIntValue("route-index"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
void printRoute(const WayptVec& aRoute)
|
|
|
|
{
|
|
|
|
SG_LOG(SG_GENERAL, SG_INFO, "route size=" << aRoute.size());
|
|
|
|
for (unsigned int r=0; r<aRoute.size();++r) {
|
|
|
|
Waypt* w = aRoute[r];
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "\t" << r << ": " << w->ident() << " "
|
|
|
|
<< w->owner()->ident());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
void createDummyRoute(FGRouteMgr* rm)
|
|
|
|
{
|
|
|
|
SGPropertyNode* rmInput = fgGetNode("/autopilot/route-manager/input", true);
|
|
|
|
rmInput->setStringValue("UW");
|
|
|
|
rmInput->setStringValue("TLA/347/13");
|
|
|
|
rmInput->setStringValue("TLA");
|
|
|
|
rmInput->setStringValue("HAVEN");
|
|
|
|
rmInput->setStringValue("NEW/305/29");
|
|
|
|
rmInput->setStringValue("NEW");
|
|
|
|
rmInput->setStringValue("OTR");
|
|
|
|
}
|
|
|
|
|
2018-06-14 18:28:22 +00:00
|
|
|
|
|
|
|
void GPSTests::setUp()
|
2009-10-05 21:09:20 +00:00
|
|
|
{
|
2018-06-14 18:28:22 +00:00
|
|
|
fgtest::initTestGlobals("GPS");
|
|
|
|
fgtest::initNavDataCache();
|
|
|
|
}
|
2009-10-11 11:37:13 +00:00
|
|
|
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2018-06-14 18:28:22 +00:00
|
|
|
void GPSTests::tearDown()
|
|
|
|
{
|
|
|
|
fgtest::shutdownTestGlobals();
|
|
|
|
}
|
2016-07-01 09:54:29 +00:00
|
|
|
|
|
|
|
|
2018-06-14 18:28:22 +00:00
|
|
|
void GPSTests::testGPS()
|
|
|
|
{
|
2009-10-11 11:37:13 +00:00
|
|
|
fgSetDouble("/environment/magnetic-variation-deg", 0.0);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
Airway::load();
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "hello world!");
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-12-17 12:36:51 +00:00
|
|
|
const FGAirport* egph = fgFindAirportID("EGPH");
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "egph: cart location:" << egph->cart());
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-12-17 12:36:51 +00:00
|
|
|
FGAirport::AirportFilter af;
|
2018-06-14 18:28:22 +00:00
|
|
|
FGPositionedList l = FGPositioned::findClosestN(egph->geod(), 20, 2000.0, &af);
|
2009-12-17 12:36:51 +00:00
|
|
|
for (unsigned int i=0; i<l.size(); ++i) {
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "\t" << l[i]->ident() << "/" << l[i]->name());
|
|
|
|
}
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-12-17 12:36:51 +00:00
|
|
|
//l = FGPositioned::findWithinRange(egph->geod(), 500.0, &af);
|
|
|
|
//for (unsigned int i=0; i<l.size(); ++i) {
|
|
|
|
// SG_LOG(SG_GENERAL, SG_ALERT, "\t" << l[i]->ident() << "/" << l[i]->name());
|
|
|
|
//}
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-12-17 12:36:51 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
FGRouteMgr* rm = new FGRouteMgr;
|
2018-05-07 07:09:20 +00:00
|
|
|
globals->get_subsystem_mgr()->add( "route-manager", rm );
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// FGEnvironmentMgr* envMgr = new FGEnvironmentMgr;
|
2018-05-07 07:09:20 +00:00
|
|
|
// globals->get_subsystem_mgr()->add("environment", envMgr);
|
2009-10-05 21:09:20 +00:00
|
|
|
// envMgr->init();
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
fgSetBool("/sim/realism/simple-gps", true);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
// _realismSimpleGps
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
SGPropertyNode* nd = fgGetNode("/instrumentation/gps", true);
|
|
|
|
GPS* gps = new GPS(nd);
|
2018-05-07 07:09:20 +00:00
|
|
|
globals->get_subsystem_mgr()->add("gps", gps);
|
2009-10-11 11:37:13 +00:00
|
|
|
|
|
|
|
const FGAirport* egph = fgFindAirportID("EGPH");
|
2009-10-05 21:09:20 +00:00
|
|
|
testSetPosition(egph->geod());
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// startup the route manager
|
|
|
|
rm->init();
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setBoolValue("serviceable", true);
|
|
|
|
fgSetBool("/systems/electrical/outputs/gps", true);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
gps->init();
|
|
|
|
SGPropertyNode* scratch = nd->getChild("scratch", 0, true);
|
|
|
|
SGPropertyNode* wp = nd->getChild("wp", 0, true);
|
|
|
|
SGPropertyNode* wp1 = wp->getChild("wp", 1, true);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// update a few times
|
|
|
|
gps->update(0.05);
|
|
|
|
gps->update(0.05);
|
2009-10-11 11:37:13 +00:00
|
|
|
gps->update(0.05);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-27 19:23:56 +00:00
|
|
|
scratch->setStringValue("query", "TL");
|
2009-10-05 21:09:20 +00:00
|
|
|
scratch->setStringValue("type", "Vor");
|
|
|
|
scratch->setBoolValue("exact", false);
|
|
|
|
nd->setStringValue("command", "search");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// alphanumeric sort, partial matching
|
|
|
|
nd->setDoubleValue("config/min-runway-length-ft", 5000.0);
|
|
|
|
scratch->setBoolValue("exact", false);
|
|
|
|
scratch->setBoolValue("order-by-distance", false);
|
2009-10-27 19:23:56 +00:00
|
|
|
scratch->setStringValue("query", "KS");
|
2009-10-05 21:09:20 +00:00
|
|
|
scratch->setStringValue("type", "apt");
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "search");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// alphanumeric sort, explicit matching
|
|
|
|
scratch->setBoolValue("exact", true);
|
|
|
|
scratch->setBoolValue("order-by-distance", true);
|
|
|
|
scratch->setStringValue("type", "vor");
|
2009-10-27 19:23:56 +00:00
|
|
|
scratch->setStringValue("query", "DCS");
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "search");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// search on totally missing
|
|
|
|
scratch->setBoolValue("exact", true);
|
|
|
|
scratch->setBoolValue("order-by-distance", true);
|
2009-10-27 19:23:56 +00:00
|
|
|
scratch->setStringValue("query", "FOFOFOFOF");
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "search");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// nearest
|
|
|
|
scratch->setStringValue("type", "apt");
|
|
|
|
scratch->setIntValue("max-results", 10);
|
|
|
|
nd->setStringValue("command", "nearest");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// direct to
|
|
|
|
nd->setStringValue("command", "direct");
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "mode:" << nd->getStringValue("mode") << "\n\t"
|
2016-07-01 09:54:29 +00:00
|
|
|
<< wp1->getStringValue("ID") << " " << wp1->getDoubleValue("longitude-deg")
|
2009-10-05 21:09:20 +00:00
|
|
|
<< " " << wp1->getDoubleValue("latitude-deg"));
|
|
|
|
|
|
|
|
// OBS mode
|
2009-10-27 19:23:56 +00:00
|
|
|
scratch->setStringValue("query", "UW");
|
2009-10-05 21:09:20 +00:00
|
|
|
scratch->setBoolValue("order-by-distance", true);
|
|
|
|
nd->setStringValue("command", "search");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "obs");
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "mode:" << nd->getStringValue("mode") << "\n\t"
|
2016-07-01 09:54:29 +00:00
|
|
|
<< wp1->getStringValue("ID") << " " << wp1->getDoubleValue("longitude-deg")
|
2009-10-05 21:09:20 +00:00
|
|
|
<< " " << wp1->getDoubleValue("latitude-deg"));
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// load route waypoints
|
|
|
|
createDummyRoute(rm);
|
|
|
|
|
|
|
|
scratch->setIntValue("route-index", 5);
|
|
|
|
nd->setStringValue("command", "load-route-wpt");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
nd->setStringValue("command", "next");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
scratch->setIntValue("route-index", 2);
|
|
|
|
nd->setStringValue("command", "load-route-wpt");
|
|
|
|
nd->setStringValue("command", "direct");
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT, "mode:" << nd->getStringValue("mode") << "\n\t"
|
2016-07-01 09:54:29 +00:00
|
|
|
<< wp1->getStringValue("ID") << " " << wp1->getDoubleValue("longitude-deg")
|
2009-10-05 21:09:20 +00:00
|
|
|
<< " " << wp1->getDoubleValue("latitude-deg"));
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-05 21:09:20 +00:00
|
|
|
// route editing
|
|
|
|
SGGeod pos = egph->geod();
|
|
|
|
scratch->setStringValue("ident", "FOOBAR");
|
|
|
|
scratch->setDoubleValue("longitude-deg", pos.getLongitudeDeg());
|
|
|
|
scratch->setDoubleValue("latitude-deg", pos.getLatitudeDeg());
|
|
|
|
nd->setStringValue("command", "define-user-wpt");
|
|
|
|
printScratch(scratch);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
// airways
|
|
|
|
FGPositioned::TypeFilter vorFilt(FGPositioned::VOR);
|
|
|
|
FGPositionedRef tla = FGPositioned::findClosestWithIdent("TLA", pos, &vorFilt);
|
2016-07-01 09:54:29 +00:00
|
|
|
FGPositionedRef big = FGPositioned::findClosestWithIdent("BIG", pos, &vorFilt);
|
2009-10-11 11:37:13 +00:00
|
|
|
FGPositionedRef pol = FGPositioned::findClosestWithIdent("POL", pos, &vorFilt);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
const FGAirport* eddm = fgFindAirportID("EDDM");
|
2016-07-01 09:54:29 +00:00
|
|
|
FGPositionedRef mun = FGPositioned::findClosestWithIdent("MUN",
|
2009-10-11 11:37:13 +00:00
|
|
|
eddm->geod(), &vorFilt);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
const FGAirport* ksfo = fgFindAirportID("KSFO");
|
2016-07-01 09:54:29 +00:00
|
|
|
FGPositionedRef sfo = FGPositioned::findClosestWithIdent("SFO",
|
2009-10-11 11:37:13 +00:00
|
|
|
ksfo->geod(), &vorFilt);
|
|
|
|
|
|
|
|
|
|
|
|
WayptRef awy1 = new NavaidWaypoint(tla, NULL);
|
|
|
|
WayptRef awy2 = new NavaidWaypoint(big, NULL);
|
|
|
|
WayptRef awy3 = new NavaidWaypoint(pol, NULL);
|
|
|
|
WayptRef awy4 = new NavaidWaypoint(mun, NULL);
|
|
|
|
WayptRef awy5 = new NavaidWaypoint(sfo, NULL);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
WayptRef awy6 = new NavaidWaypoint(
|
|
|
|
(FGPositioned*) fgFindAirportID("KJFK"), NULL);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
SGPath p("/Users/jmt/Desktop/airways.kml");
|
2016-07-01 09:54:29 +00:00
|
|
|
sg_ofstream f;
|
|
|
|
f.open(p, fstream::out | fstream::trunc);
|
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
// pre-amble
|
|
|
|
f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
|
|
"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n"
|
|
|
|
"<Document>\n";
|
|
|
|
|
|
|
|
WayptVec route;
|
|
|
|
Airway::highLevel()->route(awy1, awy3, route);
|
|
|
|
Route::dumpRouteToLineString("egph-egcc", route, f);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
Airway::lowLevel()->route(awy1, awy2, route);
|
|
|
|
Route::dumpRouteToLineString("egph-big", route, f);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
Airway::lowLevel()->route(awy2, awy4, route);
|
|
|
|
Route::dumpRouteToLineString("big-mun", route, f);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
Airway::highLevel()->route(awy4, awy5, route);
|
|
|
|
Route::dumpRouteToLineString("mun-sfo", route, f);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
Airway::lowLevel()->route(awy5, awy6, route);
|
|
|
|
Route::dumpRouteToLineString("sfo-jfk", route, f);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
// post-amble
|
2016-07-01 09:54:29 +00:00
|
|
|
f << "</Document>\n"
|
2009-10-11 11:37:13 +00:00
|
|
|
"</kml>" << endl;
|
|
|
|
f.close();
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
// procedures
|
|
|
|
SGPath op("/Users/jmt/Desktop/procedures.kml");
|
2016-07-01 09:54:29 +00:00
|
|
|
f.open(op, fstream::out | fstream::trunc);
|
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
FGAirport* eham = (FGAirport*) fgFindAirportID("EHAM");
|
|
|
|
FGPositioned::TypeFilter fixFilt(FGPositioned::FIX);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
WayptVec approach;
|
2016-07-01 09:54:29 +00:00
|
|
|
FGPositionedRef redfa = FGPositioned::findClosestWithIdent("REDFA",
|
2009-10-11 11:37:13 +00:00
|
|
|
eham->geod(), &fixFilt);
|
2016-07-01 09:54:29 +00:00
|
|
|
bool ok = eham->buildApproach(new NavaidWaypoint(redfa, NULL),
|
2009-10-11 11:37:13 +00:00
|
|
|
eham->getRunwayByIdent("18R"), approach);
|
|
|
|
if (!ok ) {
|
|
|
|
SG_LOG(SG_GENERAL, SG_INFO, "failed to build approach");
|
|
|
|
}
|
2016-07-01 09:54:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
FGAirport* egll = (FGAirport*) fgFindAirportID("EGLL");
|
2009-10-11 11:37:13 +00:00
|
|
|
WayptVec approach2;
|
2016-07-01 09:54:29 +00:00
|
|
|
ok = egll->buildApproach(new NavaidWaypoint(big, NULL),
|
2009-10-11 11:37:13 +00:00
|
|
|
egll->getRunwayByIdent("27R"), approach2);
|
|
|
|
if (!ok ) {
|
|
|
|
SG_LOG(SG_GENERAL, SG_INFO, "failed to build approach");
|
|
|
|
}
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
// pre-amble
|
|
|
|
f << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
|
|
|
"<kml xmlns=\"http://www.opengis.net/kml/2.2\">\n"
|
|
|
|
"<Document>\n";
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
Route::dumpRouteToLineString("REDFA 18R", approach, f);
|
|
|
|
Route::dumpRouteToLineString("EGLL 27R", approach2, f);
|
2016-07-01 09:54:29 +00:00
|
|
|
|
2009-10-11 11:37:13 +00:00
|
|
|
// post-amble
|
2016-07-01 09:54:29 +00:00
|
|
|
f << "</Document>\n"
|
2009-10-11 11:37:13 +00:00
|
|
|
"</kml>" << endl;
|
2016-07-01 09:54:29 +00:00
|
|
|
f.close();
|
2009-10-05 21:09:20 +00:00
|
|
|
}
|