Commit 4283729f authored by Gus Grubba's avatar Gus Grubba

Change feature default values to something that will be identified as "not...

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).
parent ec510466
......@@ -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
......
......@@ -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());
......
......@@ -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
......
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