From bb2a5ce2e561fde1250c0be3cef883c3c388a477 Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 28 Apr 2016 20:12:57 +0300 Subject: [PATCH] Issue #1472: Do not duplicate features in table and process all parameters as float values --- .../ParametersPlugin_Parameter.cpp | 6 +++- .../ParametersPlugin_WidgetParamsMgr.cpp | 30 +++++++++++-------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp index 1df9618d4..5d99ee00b 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.cpp @@ -123,7 +123,11 @@ double ParametersPlugin_Parameter::evaluate(const std::string& theExpression, st std::ostringstream sstream; sstream << aValue; std::string aParamValue = sstream.str(); - aContext.push_back(*it + "=" + aParamValue); + size_t aPos = aParamValue.find("."); + std::string aPnt = ""; + if (aPos == std::string::npos) + aPnt = "."; + aContext.push_back(*it + "=" + aParamValue + aPnt); } // compare the list of parameters to store if changed AttributeRefListPtr aParams = reflist(ARGUMENTS_ID()); diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index 524e92710..526850d63 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -292,6 +292,7 @@ QList ParametersPlugin_WidgetParamsMgr:: { QList aItemsList; ResultParameterPtr aParam; + QList aFeatures; foreach(FeaturePtr aParameter, theFeatures) { aParam = std::dynamic_pointer_cast(aParameter->firstResult()); const std::set>& aRefs = aParam->data()->refsToMe(); @@ -307,21 +308,24 @@ QList ParametersPlugin_WidgetParamsMgr:: QList aItems = featuresItems(aList); aItemsList.append(aItems); } else { - QStringList aValNames; - aValNames << aReferenced->data()->name().c_str(); - - AttributeDoublePtr aDouble = std::dynamic_pointer_cast(aAttr); - if (aDouble.get()) { - aValNames << aDouble->text().c_str(); - aValNames << QString::number(aDouble->value()); - } else { - AttributeIntegerPtr aInt = std::dynamic_pointer_cast(aAttr); - if (aInt.get()) { - aValNames << aInt->text().c_str(); - aValNames << QString::number(aInt->value()); + if (!aFeatures.contains(aReferenced)) { + QStringList aValNames; + aValNames << aReferenced->data()->name().c_str(); + + AttributeDoublePtr aDouble = std::dynamic_pointer_cast(aAttr); + if (aDouble.get()) { + aValNames << aDouble->text().c_str(); + aValNames << QString::number(aDouble->value()); + } else { + AttributeIntegerPtr aInt = std::dynamic_pointer_cast(aAttr); + if (aInt.get()) { + aValNames << aInt->text().c_str(); + aValNames << QString::number(aInt->value()); + } } + aItemsList.append(aValNames); + aFeatures.append(aReferenced); } - aItemsList.append(aValNames); } } } -- 2.39.2