Salome HOME
Make SHAPER STUDY fields exported in SMESH into MED file
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_BooleanCommon.cpp
index d928b89da6b789ba63c4e0b4b19cc41344f80222..6b723697828d1f0f47e54f8ebc04f0014a6f29ed 100644 (file)
@@ -124,27 +124,28 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const
     theDumper << ", " << aTools;
   }
 
-  if (aVersion && aVersion->isInitialized()) {
-    theDumper << ", " << aVersion->value();
+  if (aVersion && aVersion->isInitialized() &&
+      aVersion->value() == FeaturesPlugin_VersionedBoolean::THE_VERSION_1) {
+    theDumper << ", keepSubResults = True";
   }
 
   theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
-BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
-                           const std::list<ModelHighAPI_Selection>& theMainObjects,
-                           const int theVersion)
+static BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                  const std::list<ModelHighAPI_Selection>& theMainObjects,
+                                  const int theVersion)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID());
   return BooleanCommonPtr(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theVersion));
 }
 
 //==================================================================================================
-BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
-                           const std::list<ModelHighAPI_Selection>& theMainObjects,
-                           const std::list<ModelHighAPI_Selection>& theToolObjects,
-                           const int theVersion)
+static BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+                                  const std::list<ModelHighAPI_Selection>& theMainObjects,
+                                  const std::list<ModelHighAPI_Selection>& theToolObjects,
+                                  const int theVersion)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID());
   return BooleanCommonPtr(new FeaturesAPI_BooleanCommon(aFeature,
@@ -152,3 +153,15 @@ BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
                                                         theToolObjects,
                                                         theVersion));
 }
+
+//==================================================================================================
+BooleanCommonPtr addCommon(const std::shared_ptr<ModelAPI_Document>& thePart,
+                           const std::list<ModelHighAPI_Selection>& theMainObjects,
+                           const std::list<ModelHighAPI_Selection>& theToolObjects,
+                           const bool keepSubResults)
+{
+  int aVersion = keepSubResults ? FeaturesPlugin_VersionedBoolean::THE_VERSION_1
+                                : FeaturesPlugin_VersionedBoolean::THE_VERSION_0;
+  return theToolObjects.empty() ? addCommon(thePart, theMainObjects, aVersion)
+                                : addCommon(thePart, theMainObjects, theToolObjects, aVersion);
+}