Salome HOME
support fuzzy parameter in all boolean operations
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Partition.cpp
index 54ff44bb30f6f0789e89d80db12b3bbd680618f3..c7ca9aa40f6aac7741722f0c84eb894ec90179f2 100644 (file)
@@ -32,11 +32,14 @@ FeaturesAPI_Partition::FeaturesAPI_Partition(const std::shared_ptr<ModelAPI_Feat
 //==================================================================================================
 FeaturesAPI_Partition::FeaturesAPI_Partition(
     const std::shared_ptr<ModelAPI_Feature>& theFeature,
-    const std::list<ModelHighAPI_Selection>& theBaseObjects)
+    const std::list<ModelHighAPI_Selection>& theBaseObjects,
+    const ModelHighAPI_Double& theFuzzy)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    setBase(theBaseObjects);
+    fillAttribute(theBaseObjects, mybaseObjects);
+    fillAttribute(theFuzzy, myfuzzyParam);
+    execute();
   }
 }
 
@@ -54,6 +57,14 @@ void FeaturesAPI_Partition::setBase(const std::list<ModelHighAPI_Selection>& the
   execute();
 }
 
+//==================================================================================================
+void FeaturesAPI_Partition::setFuzzy(const ModelHighAPI_Double& theFuzzy)
+{
+  fillAttribute(theFuzzy, myfuzzyParam);
+
+  execute();
+}
+
 //==================================================================================================
 void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const
 {
@@ -62,9 +73,12 @@ void FeaturesAPI_Partition::dump(ModelHighAPI_Dumper& theDumper) const
 
   AttributeSelectionListPtr anAttrObjects =
     aBase->selectionList(FeaturesPlugin_Partition::BASE_OBJECTS_ID());
+  double aFuzzy = aBase->real(FeaturesPlugin_Partition::FUZZY_PARAM_ID())->value();
 
   theDumper << aBase << " = model.addPartition(" << aDocName << ", " << anAttrObjects;
 
+  theDumper << ", fuzzyParam = " << aFuzzy;
+
   if (!aBase->data()->version().empty())
     theDumper << ", keepSubResults = True";
 
@@ -74,10 +88,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 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));
+  return PartitionPtr(new FeaturesAPI_Partition(aFeature, theBaseObjects, fuzzyParam));
 }