X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FInstrumentation%2FNavDisplay.hxx;h=870c3cc3051a58089dd83a13cd143a221253ef3e;hb=0b9adf8854398461333eba43df18fa2f5c8231a1;hp=160733e795c67bbc70a940d47d488e192528eb65;hpb=342140a6945c18dce9e75176633517fd8b081031;p=flightgear.git diff --git a/src/Instrumentation/NavDisplay.hxx b/src/Instrumentation/NavDisplay.hxx index 160733e79..870c3cc30 100644 --- a/src/Instrumentation/NavDisplay.hxx +++ b/src/Instrumentation/NavDisplay.hxx @@ -44,6 +44,7 @@ class FGNavRecord; class SymbolInstance; class SymbolDef; +class SymbolRule; namespace flightgear { @@ -51,6 +52,7 @@ namespace flightgear } typedef std::set string_set; +typedef std::vector SymbolRuleVector; typedef std::vector SymbolDefVector; class NavDisplay : public SGSubsystem @@ -67,12 +69,22 @@ public: { _cachedItemsValid = false; } + + double textureSize() const + { return _textureSize; } + + void forceUpdate() + { _forceUpdate = true; } + + bool anyRuleForType(const std::string& type) const; + bool isPositionedShown(FGPositioned* pos); protected: std::string _name; int _num; double _time; double _updateInterval; - + bool _forceUpdate; + SGPropertyNode_ptr _serviceable_node; SGPropertyNode_ptr _Instrument; SGPropertyNode_ptr _radar_mode_control_node; @@ -87,11 +99,17 @@ protected: SGPropertyNode *getInstrumentNode(const char *name, DefaultType value); private: + friend class SymbolRule; + friend class SymbolDef; + + void addRule(SymbolRule*); + void addSymbolsToScene(); void addSymbolToScene(SymbolInstance* sym); void limitDisplayedSymbols(); void findItems(); + void isPositionedShownInner(FGPositioned* pos, SymbolRuleVector& rules); void foundPositionedItem(FGPositioned* pos); void computePositionedPropsAndHeading(FGPositioned* pos, SGPropertyNode* nd, double& heading); void computePositionedState(FGPositioned* pos, string_set& states); @@ -102,11 +120,9 @@ private: void processAI(); void computeAIStates(const SGPropertyNode* ai, string_set& states); - bool anyRuleForType(const std::string& type) const; - bool anyRuleMatches(const std::string& type, const string_set& states) const; - void findRules(const std::string& type, const string_set& states, SymbolDefVector& rules); + void findRules(const std::string& type, const string_set& states, SymbolRuleVector& rules); - bool addSymbolInstance(const osg::Vec2& proj, double heading, SymbolDef* def, SGPropertyNode* vars); + SymbolInstance* addSymbolInstance(const osg::Vec2& proj, double heading, SymbolDef* def, SGPropertyNode* vars); void addLine(osg::Vec2 a, osg::Vec2 b, const osg::Vec4& color); osg::Vec2 projectBearingRange(double bearingDeg, double rangeNm) const; osg::Vec2 projectGeod(const SGGeod& geod) const; @@ -117,7 +133,7 @@ private: void addTestSymbols(); std::string _texture_path; - + unsigned int _textureSize; float _scale; // factor to convert nm to display units float _view_heading; @@ -130,8 +146,9 @@ private: SGPropertyNode_ptr _ai_enabled_node; SGPropertyNode_ptr _navRadio1Node; SGPropertyNode_ptr _navRadio2Node; - - osg::ref_ptr _resultTexture; + SGPropertyNode_ptr _xCenterNode, _yCenterNode; + SGPropertyNode_ptr _viewHeadingNode; + osg::ref_ptr _symbolTexture; osg::ref_ptr _radarGeode; osg::ref_ptr _textGeode; @@ -162,7 +179,8 @@ private: double _rangeNm; SGPropertyNode_ptr _rangeNode; - SymbolDefVector _rules; + SymbolDefVector _definitions; + SymbolRuleVector _rules; FGNavRecord* _nav1Station; FGNavRecord* _nav2Station; std::vector _symbols; @@ -172,9 +190,13 @@ private: SGVec3d _cachedPos; FGPositioned::List _itemsInRange; SGPropertyNode_ptr _excessDataNode; - + int _maxSymbols; + class CacheListener; std::auto_ptr _cacheListener; + + class ForceUpdateListener; + std::auto_ptr _forceUpdateListener; }; #endif // _INST_ND_HXX