+// airways
+ FGPositioned::TypeFilter vorFilt(FGPositioned::VOR);
+ FGPositionedRef tla = FGPositioned::findClosestWithIdent("TLA", pos, &vorFilt);
+ FGPositionedRef big = FGPositioned::findClosestWithIdent("BIG", pos, &vorFilt);
+ FGPositionedRef pol = FGPositioned::findClosestWithIdent("POL", pos, &vorFilt);
+
+ const FGAirport* eddm = fgFindAirportID("EDDM");
+ FGPositionedRef mun = FGPositioned::findClosestWithIdent("MUN",
+ eddm->geod(), &vorFilt);
+
+ const FGAirport* ksfo = fgFindAirportID("KSFO");
+ FGPositionedRef sfo = FGPositioned::findClosestWithIdent("SFO",
+ 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);
+
+ WayptRef awy6 = new NavaidWaypoint(
+ (FGPositioned*) fgFindAirportID("KJFK"), NULL);
+
+ SGPath p("/Users/jmt/Desktop/airways.kml");
+ std::fstream f;
+ f.open(p.str().c_str(), fstream::out | fstream::trunc);
+
+// 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);
+
+ Airway::lowLevel()->route(awy1, awy2, route);
+ Route::dumpRouteToLineString("egph-big", route, f);
+
+ Airway::lowLevel()->route(awy2, awy4, route);
+ Route::dumpRouteToLineString("big-mun", route, f);
+
+ Airway::highLevel()->route(awy4, awy5, route);
+ Route::dumpRouteToLineString("mun-sfo", route, f);
+
+ Airway::lowLevel()->route(awy5, awy6, route);
+ Route::dumpRouteToLineString("sfo-jfk", route, f);
+
+ // post-amble
+ f << "</Document>\n"
+ "</kml>" << endl;
+ f.close();
+
+// procedures
+ SGPath op("/Users/jmt/Desktop/procedures.kml");
+ f.open(op.str().c_str(), fstream::out | fstream::trunc);
+
+ FGAirport* eham = (FGAirport*) fgFindAirportID("EHAM");
+ FGPositioned::TypeFilter fixFilt(FGPositioned::FIX);
+
+ WayptVec approach;
+ FGPositionedRef redfa = FGPositioned::findClosestWithIdent("REDFA",
+ eham->geod(), &fixFilt);
+ bool ok = eham->buildApproach(new NavaidWaypoint(redfa, NULL),
+ eham->getRunwayByIdent("18R"), approach);
+ if (!ok ) {
+ SG_LOG(SG_GENERAL, SG_INFO, "failed to build approach");
+ }