#include <simgear/structure/exception.hxx>
+#include <Airports/runways.hxx>
#include <Navaids/waypoint.hxx>
using std::string;
{
}
+
+Approach* Approach::createTempApproach(const std::string& aIdent, FGRunway* aRunway, const WayptVec& aPath)
+{
+ Approach* app = new Approach(aIdent, PROCEDURE_APPROACH_RNAV);
+ app->setRunway(aRunway);
+ app->setPrimaryAndMissed(aPath, WayptVec());
+ return app;
+}
void Approach::setRunway(FGRunwayRef aRwy)
{
} // of transitions iteration
if (!haveTrans) {
- SG_LOG(SG_GENERAL, SG_INFO, "approach " << ident() << " has no transition " <<
+ SG_LOG(SG_NAVAID, SG_INFO, "approach " << ident() << " has no transition " <<
"for IAF: " << aIAF->ident());
return false;
}
return true;
}
- SG_LOG(SG_GENERAL, SG_INFO, ident() << " using runway transition for " << r->first->ident());
+ SG_LOG(SG_NAVAID, SG_INFO, ident() << " using runway transition for " << r->first->ident());
r->second->route(aPath);
return true;
}
WptTransitionMap::const_iterator eit;
for (eit = _enrouteTransitions.begin(); eit != _enrouteTransitions.end(); ++eit) {
if (eit->second->enroute()->matches(aEnroute)) {
- SG_LOG(SG_GENERAL, SG_INFO, ident() << " using enroute transition " << eit->second->ident());
+ SG_LOG(SG_NAVAID, SG_INFO, ident() << " using enroute transition " << eit->second->ident());
return eit->second;
}
} // of enroute transition iteration
{
// no transitions, that's easy
if (_enrouteTransitions.empty()) {
- SG_LOG(SG_GENERAL, SG_INFO, "no enroute transitions for " << ident());
+ SG_LOG(SG_NAVAID, SG_INFO, "no enroute transitions for " << ident());
return _common.front();
}
WptTransitionMap::const_iterator eit;
for (eit = _enrouteTransitions.begin(); eit != _enrouteTransitions.end(); ++eit) {
WayptRef c = eit->second->enroute();
- SG_LOG(SG_GENERAL, SG_INFO, "findBestTransition for " << ident() << ", looking at " << c->ident());
+ SG_LOG(SG_NAVAID, SG_INFO, "findBestTransition for " << ident() << ", looking at " << c->ident());
// assert(c->hasFixedPosition());
double cd = SGGeodesy::distanceM(aPos, c->position());
bool SID::route(FGRunwayRef aWay, Transition* trans, WayptVec& aPath)
{
if (!isForRunway(aWay)) {
- SG_LOG(SG_GENERAL, SG_WARN, "SID " << ident() << " not for runway " << aWay->ident());
+ SG_LOG(SG_NAVAID, SG_WARN, "SID " << ident() << " not for runway " << aWay->ident());
return false;
}
return true;
}
+
+SID* SID::createTempSID(const std::string& aIdent, FGRunway* aRunway, const WayptVec& aPath)
+{
+// flip waypoints since SID stores them reversed
+ WayptVec path;
+ std::back_insert_iterator<WayptVec> bi(path);
+ std::reverse_copy(aPath.begin(), aPath.end(), bi);
+
+ SID* sid = new SID(aIdent, aRunway->airport());
+ sid->setCommon(path);
+ sid->addRunway(aRunway);
+ return sid;
+}
////////////////////////////////////////////////////////////////////////////