Salome HOME
Make SHAPER STUDY fields exported in SMESH into MED file
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_BooleanFill.cpp
index f9924204a341c8ac9d3b4f5d04dcc2a05f2ebeca..da25a8b4330df50bae539cf46414d0a197905f47 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "FeaturesAPI_BooleanFill.h"
@@ -36,10 +35,12 @@ FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
 FeaturesAPI_BooleanFill::FeaturesAPI_BooleanFill(
   const std::shared_ptr<ModelAPI_Feature>& theFeature,
   const std::list<ModelHighAPI_Selection>& theMainObjects,
-  const std::list<ModelHighAPI_Selection>& theToolObjects)
+  const std::list<ModelHighAPI_Selection>& theToolObjects,
+  const int theVersion)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
+    fillAttribute(theVersion, theFeature->integer(FeaturesPlugin_Boolean::VERSION_ID()));
     fillAttribute(theMainObjects, mymainObjects);
     fillAttribute(theToolObjects, mytoolObjects);
 
@@ -76,24 +77,36 @@ void FeaturesAPI_BooleanFill::dump(ModelHighAPI_Dumper& theDumper) const
 {
   FeaturePtr aBase = feature();
 
-  theDumper << aBase << " = model.addFill";
+  theDumper << aBase << " = model.addSplit";
 
   const std::string& aDocName = theDumper.name(aBase->document());
   AttributeSelectionListPtr anObjects =
     aBase->selectionList(FeaturesPlugin_BooleanFill::OBJECT_LIST_ID());
   AttributeSelectionListPtr aTools =
     aBase->selectionList(FeaturesPlugin_BooleanFill::TOOL_LIST_ID());
+  AttributeIntegerPtr aVersion =
+    aBase->integer(FeaturesPlugin_BooleanFill::VERSION_ID());
+
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools;
+
+  if (aVersion && aVersion->isInitialized() &&
+      aVersion->value() == FeaturesPlugin_VersionedBoolean::THE_VERSION_1)
+    theDumper << ", keepSubResults = True";
 
-  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+  theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
-BooleanFillPtr addFill(const std::shared_ptr<ModelAPI_Document>& thePart,
-                       const std::list<ModelHighAPI_Selection>& theMainObjects,
-                       const std::list<ModelHighAPI_Selection>& theToolObjects)
+BooleanFillPtr addSplit(const std::shared_ptr<ModelAPI_Document>& thePart,
+                        const std::list<ModelHighAPI_Selection>& theMainObjects,
+                        const std::list<ModelHighAPI_Selection>& theToolObjects,
+                        const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanFill::ID());
+  int aVersion = keepSubResults ? FeaturesPlugin_VersionedBoolean::THE_VERSION_1
+                                : FeaturesPlugin_VersionedBoolean::THE_VERSION_0;
   return BooleanFillPtr(new FeaturesAPI_BooleanFill(aFeature,
                                                     theMainObjects,
-                                                    theToolObjects));
+                                                    theToolObjects,
+                                                    aVersion));
 }