2017-03-25 10:28:05 +00:00
|
|
|
#include "config.h"
|
|
|
|
|
2011-05-25 06:50:15 +00:00
|
|
|
#include "CommStation.hxx"
|
2013-03-06 22:21:29 +00:00
|
|
|
#include <Airports/airport.hxx>
|
2012-08-27 23:26:36 +00:00
|
|
|
#include <Navaids/NavDataCache.hxx>
|
2011-05-25 06:50:15 +00:00
|
|
|
|
|
|
|
namespace flightgear {
|
|
|
|
|
2012-08-27 23:26:36 +00:00
|
|
|
CommStation::CommStation(PositionedID aGuid, const std::string& name, FGPositioned::Type t, const SGGeod& pos, int range, int freq) :
|
|
|
|
FGPositioned(aGuid, t, name, pos),
|
2011-05-25 06:50:15 +00:00
|
|
|
mRangeNM(range),
|
|
|
|
mFreqKhz(freq),
|
2012-08-27 23:26:36 +00:00
|
|
|
mAirport(0)
|
|
|
|
{
|
2011-05-25 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
2012-08-27 23:26:36 +00:00
|
|
|
void CommStation::setAirport(PositionedID apt)
|
2011-05-25 06:50:15 +00:00
|
|
|
{
|
|
|
|
mAirport = apt;
|
|
|
|
}
|
2012-08-27 23:26:36 +00:00
|
|
|
|
2013-03-06 22:21:29 +00:00
|
|
|
FGAirportRef CommStation::airport() const
|
2012-08-27 23:26:36 +00:00
|
|
|
{
|
2013-03-06 22:21:29 +00:00
|
|
|
return FGPositioned::loadById<FGAirport>(mAirport);
|
2012-08-27 23:26:36 +00:00
|
|
|
}
|
2011-05-25 06:50:15 +00:00
|
|
|
|
|
|
|
double CommStation::freqMHz() const
|
|
|
|
{
|
2012-09-27 10:21:22 +00:00
|
|
|
return mFreqKhz / 1000.0;
|
2011-05-25 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
2013-03-06 22:21:29 +00:00
|
|
|
CommStationRef
|
2011-05-25 06:50:15 +00:00
|
|
|
CommStation::findByFreq(int freqKhz, const SGGeod& pos, FGPositioned::Filter* filt)
|
|
|
|
{
|
2012-08-27 23:26:36 +00:00
|
|
|
return (CommStation*) NavDataCache::instance()->findCommByFreq(freqKhz, pos, filt).ptr();
|
2011-05-25 06:50:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} // of namespace flightgear
|