Browse Source

Change feature default values to something that will be identified as "not set". When a flight is created, features with missing values (not set) are not included. Note that all these are persistent, which may create a problem if something changes (different vehicle with large weight difference for instance). As the subsequent use of these are persistent, a question may not be asked because it's already set (the brief only asks for missing or problem values).

QGC4.4
Gus Grubba 7 years ago
parent
commit
4283729f83
  1. 5
      src/Airmap/AirMapFlightPlanManager.cc
  2. 6
      src/Airmap/AirMapRulesetsManager.cc
  3. 2
      src/Airmap/FlightFeature.qml

5
src/Airmap/AirMapFlightPlanManager.cc

@ -431,7 +431,10 @@ AirMapFlightPlanManager::_updateRulesAndFeatures(std::vector<RuleSet::Id>& rules @@ -431,7 +431,10 @@ AirMapFlightPlanManager::_updateRulesAndFeatures(std::vector<RuleSet::Id>& rules
if(feature && feature->value().isValid()) {
switch(feature->type()) {
case AirspaceRuleFeature::Boolean:
features[feature->name().toStdString()] = RuleSet::Feature::Value(feature->value().toBool());
//-- Skip not set responses (feature->value is initialized to "2")
if(feature->value().toInt() == 0 || feature->value().toInt() == 1) {
features[feature->name().toStdString()] = RuleSet::Feature::Value(feature->value().toBool());
}
break;
case AirspaceRuleFeature::Float:
//-- Sanity check for floats

6
src/Airmap/AirMapRulesetsManager.cc

@ -31,12 +31,10 @@ AirMapRuleFeature::AirMapRuleFeature(airmap::RuleSet::Feature feature, QObject* @@ -31,12 +31,10 @@ AirMapRuleFeature::AirMapRuleFeature(airmap::RuleSet::Feature feature, QObject*
settings.beginGroup(kAirMapFeatureGroup);
switch(_feature.type) {
case RuleSet::Feature::Type::boolean:
_value = settings.value(name(), false);
_value = settings.value(name(), 2);
break;;
case RuleSet::Feature::Type::floating_point:
//_value = settings.value(name(), 0.0f);
//-- Default to 1 for now
_value = settings.value(name(), 1.0f);
_value = settings.value(name(), NAN);
break;;
case RuleSet::Feature::Type::string:
_value = settings.value(name(), QString());

2
src/Airmap/FlightFeature.qml

@ -56,7 +56,7 @@ Rectangle { @@ -56,7 +56,7 @@ Rectangle {
QGCCheckBox {
id: checkBox
text: ""
checked: feature.value ? feature.value : false
checked: feature.value && feature.value < 2 ? feature.value : false
onClicked: feature.value = checked
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter

Loading…
Cancel
Save