X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FNavaids%2Fmarkerbeacon.cxx;h=82726e8e1042293411872f536189f17960a7ff51;hb=487546c848ad5559760b4de4aa36f19b9b8627a7;hp=9eaeff2cd27dac67395fa29fad514911f94fedbe;hpb=030742fa4ae7d99facb517381da71fa404c4ee2b;p=flightgear.git diff --git a/src/Navaids/markerbeacon.cxx b/src/Navaids/markerbeacon.cxx index 9eaeff2cd..82726e8e1 100644 --- a/src/Navaids/markerbeacon.cxx +++ b/src/Navaids/markerbeacon.cxx @@ -24,45 +24,22 @@ #include "config.h" #endif -#include -#include - -#include "Navaids/markerbeacon.hxx" -#include "Airports/runways.hxx" -#include "Navaids/navdb.hxx" +#include +#include +#include using std::string; -FGPositioned::Type -FGMarkerBeacon::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", - "FGMarkerBeacon::mapType"); - } -} - -FGMarkerBeacon* -FGMarkerBeacon::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 FGMarkerBeacon(fgpTy, runway, pos); } - -FGMarkerBeacon::FGMarkerBeacon(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