#include <simgear/sg_inlines.h>
#include <simgear/props/propertyObject.hxx>
#include <simgear/misc/strutils.hxx>
+#include <simgear/sound/sample_group.hxx>
#include <Main/fg_props.hxx>
#include <Navaids/navlist.hxx>
protected:
virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
- virtual FGNavList * getNavaidList() = 0;
+ virtual FGNavList::TypeFilter* getNavaidFilter() = 0;
// General-purpose sawtooth function. Graph looks like this:
// /\ .
PropertyObject<double> _trackDistance_m;
PropertyObject<double> _slantDistance_m;
PropertyObject<double> _heightAboveStation_ft;
- PropertyObject<string> _ident;
+ PropertyObject<std::string> _ident;
PropertyObject<bool> _inRange;
PropertyObject<double> _range_nm;
};
void NavRadioComponent::search( double frequency, const SGGeod & aircraftPosition )
{
- if( NULL == (_navRecord = getNavaidList()->findByFreq(frequency, aircraftPosition )) ) {
+ _navRecord = FGNavList::findByFreq(frequency, aircraftPosition, getNavaidFilter() );
+ if( NULL == _navRecord ) {
SG_LOG(SG_INSTR,SG_ALERT, "No " << _name << " available at " << frequency );
_ident = "";
return;
virtual double getRange_nm(const SGGeod & aircraftPosition);
protected:
virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
- virtual FGNavList * getNavaidList();
+ virtual FGNavList::TypeFilter* getNavaidFilter();
private:
double _totalTime;
}
VOR::VOR( SGPropertyNode_ptr rootNode) :
- NavRadioComponentWithIdent("vor", rootNode, new VORAudioIdent(getIdentString(string("vor"), rootNode->getIndex()))),
+ NavRadioComponentWithIdent("vor", rootNode,
+ new VORAudioIdent(getIdentString(std::string("vor"),
+ rootNode->getIndex()))),
_totalTime(0.0),
_radial( rootNode->getNode(_name,true)->getNode("radial",true) ),
_radialInbound( rootNode->getNode(_name,true)->getNode("radial-inbound",true) )
return _serviceVolume.adjustRange( _heightAboveStation_ft, _navRecord->get_range() );
}
-FGNavList * VOR::getNavaidList()
+FGNavList::TypeFilter* VOR::getNavaidFilter()
{
- return globals->get_navlist();
+ static FGNavList::TypeFilter filter(FGPositioned::VOR);
+ return &filter;
}
double VOR::computeSignalQuality_norm( const SGGeod & aircraftPosition )
protected:
virtual double computeSignalQuality_norm( const SGGeod & aircraftPosition );
- virtual FGNavList * getNavaidList();
+ virtual FGNavList::TypeFilter* getNavaidFilter();
private:
class ServiceVolume {
}
LOC::LOC( SGPropertyNode_ptr rootNode) :
- NavRadioComponentWithIdent("loc", rootNode, new LOCAudioIdent(getIdentString(string("loc"), rootNode->getIndex()))),
+ NavRadioComponentWithIdent("loc", rootNode, new LOCAudioIdent(getIdentString(std::string("loc"),
+ rootNode->getIndex()))),
_serviceVolume(),
_localizerOffset_norm( rootNode->getNode(_name,true)->getNode("offset-norm",true) ),
_localizerWidth_deg( rootNode->getNode(_name,true)->getNode("width-deg",true) )
{
}
-FGNavList * LOC::getNavaidList()
+FGNavList::TypeFilter* LOC::getNavaidFilter()
{
- return globals->get_loclist();
+ return FGNavList::locFilter();
}
void LOC::search( double frequency, const SGGeod & aircraftPosition )
virtual double getRange_nm(const SGGeod & aircraftPosition);
protected:
- virtual FGNavList * getNavaidList();
-
+ virtual FGNavList::TypeFilter* getNavaidFilter();
private:
class ServiceVolume {
public:
{
}
-FGNavList * GS::getNavaidList()
+FGNavList::TypeFilter* GS::getNavaidFilter()
{
- return globals->get_gslist();
+ static FGNavList::TypeFilter filter(FGPositioned::GS);
+ return &filter;
}
double GS::getRange_nm(const SGGeod & aircraftPosition)
_legacy( this ),
_name(node->getStringValue("name", "nav")),
_num(node->getIntValue("number", 0)),
- _rootNode(fgGetNode( string("/instrumentation/") + _name, _num, true)),
+ _rootNode(fgGetNode( std::string("/instrumentation/") + _name, _num, true)),
_useFrequencyFormatter( _rootNode->getNode("frequencies/selected-mhz",true), _rootNode->getNode("frequencies/selected-mhz-fmt",true), 0.05 ),
_stbyFrequencyFormatter( _rootNode->getNode("frequencies/standby-mhz",true), _rootNode->getNode("frequencies/standby-mhz-fmt",true), 0.05 ),
_navIndicator(_rootNode),
void NavRadioImpl::init()
{
- if( 0 < _components.size() )
+ if( ! _components.empty() )
return;
_components.push_back( new VOR(_rootNode) );
_navRadioImpl->_components[VOR_COMPONENT]->valid() || _navRadioImpl->_components[LOC_COMPONENT]->valid()
);
- string ident = _navRadioImpl->_components[VOR_COMPONENT]->getIdent();
+ std::string ident = _navRadioImpl->_components[VOR_COMPONENT]->getIdent();
if( ident.empty() )
ident = _navRadioImpl->_components[LOC_COMPONENT]->getIdent();