2011-05-25 06:50:15 +00:00
|
|
|
#include "CommStation.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
|
|
|
|
|
|
|
FGAirport* CommStation::airport() const
|
|
|
|
{
|
|
|
|
return (FGAirport*) NavDataCache::instance()->loadById(mAirport);
|
|
|
|
}
|
2011-05-25 06:50:15 +00:00
|
|
|
|
|
|
|
double CommStation::freqMHz() const
|
|
|
|
{
|
|
|
|
return mFreqKhz / 100.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
CommStation*
|
|
|
|
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
|