NavDisplay - custom symbol support enabled.
This commit is contained in:
parent
e248ea8183
commit
a1031b052d
2 changed files with 44 additions and 1 deletions
|
@ -566,6 +566,8 @@ NavDisplay::init ()
|
||||||
_userLonNode = _Instrument->getChild("user-longitude-deg", 0, true);
|
_userLonNode = _Instrument->getChild("user-longitude-deg", 0, true);
|
||||||
_userPositionEnable = _Instrument->getChild("user-position", 0, true);
|
_userPositionEnable = _Instrument->getChild("user-position", 0, true);
|
||||||
|
|
||||||
|
_customSymbols = _Instrument->getChild("symbols", 0, true);
|
||||||
|
|
||||||
// OSG geometry setup
|
// OSG geometry setup
|
||||||
_radarGeode = new osg::Geode;
|
_radarGeode = new osg::Geode;
|
||||||
|
|
||||||
|
@ -745,6 +747,7 @@ NavDisplay::update (double delta_time_sec)
|
||||||
processRoute();
|
processRoute();
|
||||||
processNavRadios();
|
processNavRadios();
|
||||||
processAI();
|
processAI();
|
||||||
|
processCustomSymbols();
|
||||||
findItems();
|
findItems();
|
||||||
limitDisplayedSymbols();
|
limitDisplayedSymbols();
|
||||||
}
|
}
|
||||||
|
@ -1439,3 +1442,39 @@ void NavDisplay::addRule(SymbolRule* r)
|
||||||
_rules.push_back(r);
|
_rules.push_back(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NavDisplay::computeCustomSymbolStates(const SGPropertyNode* sym, string_set& states)
|
||||||
|
{
|
||||||
|
BOOST_FOREACH(SGPropertyNode* st, sym->getChildren("state")) {
|
||||||
|
states.insert(st->getStringValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void NavDisplay::processCustomSymbols()
|
||||||
|
{
|
||||||
|
for (int i = _customSymbols->nChildren() - 1; i >= 0; i--) {
|
||||||
|
SGPropertyNode *symNode = _customSymbols->getChild(i);
|
||||||
|
if (!symNode->nChildren()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
string_set ss;
|
||||||
|
computeCustomSymbolStates(symNode, ss);
|
||||||
|
SymbolRuleVector rules;
|
||||||
|
findRules(symNode->getName(), ss, rules);
|
||||||
|
if (rules.empty()) {
|
||||||
|
return; // no rules matched, we can skip this item
|
||||||
|
}
|
||||||
|
|
||||||
|
double heading = symNode->getDoubleValue("true-heading-deg", 0.0);
|
||||||
|
SGGeod pos = SGGeod::fromDegFt(symNode->getDoubleValue("longitude-deg"),
|
||||||
|
symNode->getDoubleValue("latitude-deg"),
|
||||||
|
symNode->getDoubleValue("altitude-ft"));
|
||||||
|
|
||||||
|
|
||||||
|
osg::Vec2 projected = projectGeod(pos);
|
||||||
|
BOOST_FOREACH(SymbolRule* r, rules) {
|
||||||
|
addSymbolInstance(projected, heading, r->getDefinition(), symNode);
|
||||||
|
}
|
||||||
|
} // of custom symbols iteration
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -121,6 +121,9 @@ private:
|
||||||
void processAI();
|
void processAI();
|
||||||
void computeAIStates(const SGPropertyNode* ai, string_set& states);
|
void computeAIStates(const SGPropertyNode* ai, string_set& states);
|
||||||
|
|
||||||
|
void computeCustomSymbolStates(const SGPropertyNode* sym, string_set& states);
|
||||||
|
void processCustomSymbols();
|
||||||
|
|
||||||
void findRules(const std::string& type, const string_set& states, SymbolRuleVector& rules);
|
void findRules(const std::string& type, const string_set& states, SymbolRuleVector& rules);
|
||||||
|
|
||||||
SymbolInstance* addSymbolInstance(const osg::Vec2& proj, double heading, SymbolDef* def, SGPropertyNode* vars);
|
SymbolInstance* addSymbolInstance(const osg::Vec2& proj, double heading, SymbolDef* def, SGPropertyNode* vars);
|
||||||
|
@ -192,6 +195,7 @@ private:
|
||||||
FGPositioned::List _itemsInRange;
|
FGPositioned::List _itemsInRange;
|
||||||
SGPropertyNode_ptr _excessDataNode;
|
SGPropertyNode_ptr _excessDataNode;
|
||||||
int _maxSymbols;
|
int _maxSymbols;
|
||||||
|
SGPropertyNode_ptr _customSymbols;
|
||||||
|
|
||||||
class CacheListener;
|
class CacheListener;
|
||||||
std::auto_ptr<CacheListener> _cacheListener;
|
std::auto_ptr<CacheListener> _cacheListener;
|
||||||
|
|
Loading…
Reference in a new issue