Salome HOME
fixed usage of fuzzy value as parameter in API
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Partition.cpp
index 0f482bd32a7f4aa11d1dad64eb6ee6ba449c3574..ae64a0bdb9dd5e6f6fd9524ba1342ecb091f59da 100644 (file)
@@ -41,11 +41,17 @@ FeaturesAPI_Partition::FeaturesAPI_Partition(
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    bool aUseFuzzy = (theFuzzy.value() > 0);
-    ModelHighAPI_Double aFuzzy = (aUseFuzzy ? theFuzzy : ModelHighAPI_Double(DEFAULT_FUZZY));
-    fillAttribute(theBaseObjects, mybaseObjects);
-    fillAttribute(aUseFuzzy, myuseFuzzy);
-    fillAttribute(aFuzzy, myfuzzyParam);
+    fillAttribute(theBaseObjects, VAR_NAME(baseObjects));
+    fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
+
+    // Get the evaluated fuzzy parameter from the attribute!!
+    bool aUseFuzzy = (fuzzyParam()->value() > 0);
+    fillAttribute(aUseFuzzy, VAR_NAME(useFuzzy));
+    if (!aUseFuzzy) {
+      ModelHighAPI_Double aFuzzy(DEFAULT_FUZZY);
+      fillAttribute(aFuzzy, VAR_NAME(fuzzyParam));
+    }
+
     execute();
   }
 }
@@ -59,7 +65,7 @@ FeaturesAPI_Partition::~FeaturesAPI_Partition()
 //==================================================================================================
 void FeaturesAPI_Partition::setBase(const std::list<ModelHighAPI_Selection>& theBaseObjects)
 {
-  fillAttribute(theBaseObjects, mybaseObjects);
+  fillAttribute(theBaseObjects, VAR_NAME(baseObjects));
 
   execute();
 }
@@ -67,7 +73,7 @@ void FeaturesAPI_Partition::setBase(const std::list<ModelHighAPI_Selection>& the
 //==================================================================================================
 void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy)
 {
-  fillAttribute(theUseFuzzy, myuseFuzzy);
+  fillAttribute(theUseFuzzy, VAR_NAME(useFuzzy));
 
   execute();
 }
@@ -75,7 +81,7 @@ void FeaturesAPI_Partition::setUseFuzzy(bool theUseFuzzy)
 //==================================================================================================
 void FeaturesAPI_Partition::setFuzzy(const ModelHighAPI_Double& theFuzzy)
 {
-  fillAttribute(theFuzzy, myfuzzyParam);
+  fillAttribute(theFuzzy, VAR_NAME(fuzzyParam));
 
   execute();
 }
@@ -105,11 +111,11 @@ void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const
 //==================================================================================================
 PartitionPtr addPartition(const std::shared_ptr<ModelAPI_Document>& thePart,
                           const std::list<ModelHighAPI_Selection>& theBaseObjects,
-                          const ModelHighAPI_Double& fuzzyParam,
+                          const ModelHighAPI_Double& theFuzzy,
                           const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_Partition::ID());
   if (!keepSubResults)
     aFeature->data()->setVersion("");
-  return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects, fuzzyParam));
+  return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects, theFuzzy));
 }