Commit c5cc545f authored by Tomaz Canabrava's avatar Tomaz Canabrava Committed by Daniel Agar

AirMapFlightPlanManager: use qobject_cast instead of dynamic cast

qobject_cast is times faster dynamic_cast for objects that
inherit QObject. also, use auto keyword to not duplicate
class names.
parent 9f413930
......@@ -428,7 +428,7 @@ AirMapFlightPlanManager::_createFlightPlan()
void
AirMapFlightPlanManager::_updateRulesAndFeatures(std::vector<RuleSet::Id>& rulesets, std::unordered_map<std::string, RuleSet::Feature::Value>& features, bool updateFeatures)
{
AirMapRulesetsManager* pRulesMgr = dynamic_cast<AirMapRulesetsManager*>(qgcApp()->toolbox()->airspaceManager()->ruleSets());
auto* pRulesMgr = qobject_cast<AirMapRulesetsManager*>(qgcApp()->toolbox()->airspaceManager()->ruleSets());
if(pRulesMgr) {
for(int rs = 0; rs < pRulesMgr->ruleSets()->count(); rs++) {
AirMapRuleSet* ruleSet = qobject_cast<AirMapRuleSet*>(pRulesMgr->ruleSets()->get(rs));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment