X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2Fmarkerbeacon.cxx;h=82726e8e1042293411872f536189f17960a7ff51;hb=487546c848ad5559760b4de4aa36f19b9b8627a7;hp=3a49e328056fb4f0cedad3b82c10f3ffee051d17;hpb=a6db6d89ff41a619569e6433409e8bf62ff98499;p=flightgear.git diff --git a/src/Navaids/markerbeacon.cxx b/src/Navaids/markerbeacon.cxx index 3a49e3280..82726e8e1 100644 --- a/src/Navaids/markerbeacon.cxx +++ b/src/Navaids/markerbeacon.cxx @@ -24,45 +24,22 @@ #include "config.h" #endif -#include -#include - #include #include -#include +#include using std::string; -FGPositioned::Type -FGMarkerBeaconRecord::mapType(int aTy) -{ - switch (aTy) { - case 7: return FGPositioned::OM; - case 8: return FGPositioned::MM; - case 9: return FGPositioned::IM; - default: - throw sg_range_exception("Got a non-marker-beacon-type", - "FGMarkerBeaconRecord::mapType"); - } -} - -FGMarkerBeaconRecord* -FGMarkerBeaconRecord::create(int aTy, const string& aName, const SGGeod& aPos) +FGMarkerBeaconRecord::FGMarkerBeaconRecord(PositionedID aGuid, Type aTy, + PositionedID aRunway, const SGGeod& aPos) : + FGPositioned(aGuid, aTy, string(), aPos), + _runway(aRunway) { - Type fgpTy = mapType(aTy); - FGRunway* runway = getRunwayFromName(aName); - SGGeod pos(aPos); - // fudge elevation to the runway elevation if it's not specified - if (fabs(pos.getElevationFt()) < 0.01) { - pos.setElevationFt(runway->elevation()); - } - - return new FGMarkerBeaconRecord(fgpTy, runway, pos); } - -FGMarkerBeaconRecord::FGMarkerBeaconRecord(Type aTy, FGRunway* aRunway, const SGGeod& aPos) : - FGPositioned(aTy, string(), aPos), - _runway(aRunway) +FGRunwayRef FGMarkerBeaconRecord::runway() const { -} + FGPositioned* p = flightgear::NavDataCache::instance()->loadById(_runway); + assert(p->type() == FGPositioned::RUNWAY); + return static_cast(p); +} \ No newline at end of file