]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1472: Do not duplicate features in table and process all parameters as float...
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 28 Apr 2016 17:12:57 +0000 (20:12 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 28 Apr 2016 17:12:57 +0000 (20:12 +0300)
src/ParametersPlugin/ParametersPlugin_Parameter.cpp
src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp

index 1df9618d48defa7ce64841c2bda9019f1c905af5..5d99ee00b147ba5faa80759db12386a9d9c85256 100644 (file)
@@ -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());
index 524e92710d5c5ee53d10553cb15f0d4f623aee57..526850d6326bf71cde31d668cee2de89a248b408 100644 (file)
@@ -292,6 +292,7 @@ QList<QStringList> ParametersPlugin_WidgetParamsMgr::
 {
   QList<QStringList> aItemsList;
   ResultParameterPtr aParam;
+  QList<FeaturePtr> aFeatures;
   foreach(FeaturePtr aParameter, theFeatures) {
     aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aParameter->firstResult());
     const std::set<std::shared_ptr<ModelAPI_Attribute>>& aRefs = aParam->data()->refsToMe();
@@ -307,21 +308,24 @@ QList<QStringList> ParametersPlugin_WidgetParamsMgr::
           QList<QStringList> aItems = featuresItems(aList);
           aItemsList.append(aItems);
         } else {
-          QStringList aValNames;
-          aValNames << aReferenced->data()->name().c_str();
-
-          AttributeDoublePtr aDouble = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aAttr);
-          if (aDouble.get()) {
-            aValNames << aDouble->text().c_str();
-            aValNames << QString::number(aDouble->value());
-          } else {
-            AttributeIntegerPtr aInt = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(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<ModelAPI_AttributeDouble>(aAttr);
+            if (aDouble.get()) {
+              aValNames << aDouble->text().c_str();
+              aValNames << QString::number(aDouble->value());
+            } else {
+              AttributeIntegerPtr aInt = std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(aAttr);
+              if (aInt.get()) {
+                aValNames << aInt->text().c_str();
+                aValNames << QString::number(aInt->value());
+              }
             }
+            aItemsList.append(aValNames);
+            aFeatures.append(aReferenced);
           }
-          aItemsList.append(aValNames);
         }
       }
     }