Salome HOME
Task 3.2. To keep compounds’ sub-shapes for all operations (issue #3139)
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_BooleanSmash.cpp
index a91647c0979b8e4977479451c6a14cc24ee8e78a..0d2abf81f36fff3df4e704437be28a3404cc99dc 100644 (file)
@@ -35,12 +35,10 @@ FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
 FeaturesAPI_BooleanSmash::FeaturesAPI_BooleanSmash(
   const std::shared_ptr<ModelAPI_Feature>& theFeature,
   const std::list<ModelHighAPI_Selection>& theMainObjects,
-  const std::list<ModelHighAPI_Selection>& theToolObjects,
-  const int theVersion)
+  const std::list<ModelHighAPI_Selection>& theToolObjects)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    fillAttribute(theVersion, theFeature->integer(FeaturesPlugin_Boolean::VERSION_ID()));
     fillAttribute(theMainObjects, mymainObjects);
     fillAttribute(theToolObjects, mytoolObjects);
 
@@ -84,13 +82,10 @@ void FeaturesAPI_BooleanSmash::dump(ModelHighAPI_Dumper& theDumper) const
     aBase->selectionList(FeaturesPlugin_BooleanSmash::OBJECT_LIST_ID());
   AttributeSelectionListPtr aTools =
     aBase->selectionList(FeaturesPlugin_BooleanSmash::TOOL_LIST_ID());
-  AttributeIntegerPtr aVersion =
-    aBase->integer(FeaturesPlugin_BooleanSmash::VERSION_ID());
 
   theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools;
 
-  if (aVersion && aVersion->isInitialized() &&
-      aVersion->value() == FeaturesPlugin_VersionedBoolean::THE_VERSION_1)
+  if (!aBase->data()->version().empty())
     theDumper << ", keepSubResults = True";
 
   theDumper << ")" << std::endl;
@@ -103,10 +98,7 @@ BooleanSmashPtr addSmash(const std::shared_ptr<ModelAPI_Document>& thePart,
                          const bool keepSubResults)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanSmash::ID());
-  int aVersion = keepSubResults ? FeaturesPlugin_VersionedBoolean::THE_VERSION_1
-                                : FeaturesPlugin_VersionedBoolean::THE_VERSION_0;
-  return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature,
-                                                      theMainObjects,
-                                                      theToolObjects,
-                                                      aVersion));
+  if (!keepSubResults)
+    aFeature->data()->setVersion("");
+  return BooleanSmashPtr(new FeaturesAPI_BooleanSmash(aFeature, theMainObjects, theToolObjects));
 }