]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FeaturesAPI/FeaturesAPI_BooleanCommon.cpp
Salome HOME
General approach of versioning the feature. Update Boolean operations according.
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_BooleanCommon.cpp
index 6b723697828d1f0f47e54f8ebc04f0014a6f29ed..c288682874d47a4050140029f91f8347234b518e 100644 (file)
@@ -34,13 +34,11 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
 //==================================================================================================
 FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
   const std::shared_ptr<ModelAPI_Feature>& theFeature,
-  const std::list<ModelHighAPI_Selection>& theMainObjects,
-  const int theVersion)
+  const std::list<ModelHighAPI_Selection>& theMainObjects)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
     fillAttribute(FeaturesPlugin_BooleanCommon::CREATION_METHOD_SIMPLE(), mycreationMethod);
-    fillAttribute(theVersion, theFeature->integer(FeaturesPlugin_Boolean::VERSION_ID()));
     fillAttribute(theMainObjects, mymainObjects);
 
     execute(false);
@@ -51,13 +49,11 @@ FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
 FeaturesAPI_BooleanCommon::FeaturesAPI_BooleanCommon(
   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(FeaturesPlugin_BooleanCommon::CREATION_METHOD_ADVANCED(), mycreationMethod);
-    fillAttribute(theVersion, theFeature->integer(FeaturesPlugin_Boolean::VERSION_ID()));
     fillAttribute(theMainObjects, mymainObjects);
     fillAttribute(theToolObjects, mytoolObjects);
 
@@ -115,8 +111,6 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const
     aBase->selectionList(FeaturesPlugin_BooleanCommon::OBJECT_LIST_ID());
   AttributeSelectionListPtr aTools =
     aBase->selectionList(FeaturesPlugin_BooleanCommon::TOOL_LIST_ID());
-  AttributeIntegerPtr aVersion =
-    aBase->integer(FeaturesPlugin_BooleanCommon::VERSION_ID());
 
   theDumper << "(" << aDocName << ", " << anObjects;
 
@@ -124,44 +118,25 @@ void FeaturesAPI_BooleanCommon::dump(ModelHighAPI_Dumper& theDumper) const
     theDumper << ", " << aTools;
   }
 
-  if (aVersion && aVersion->isInitialized() &&
-      aVersion->value() == FeaturesPlugin_VersionedBoolean::THE_VERSION_1) {
+  if (!aBase->data()->version().empty())
     theDumper << ", keepSubResults = True";
-  }
 
   theDumper << ")" << std::endl;
 }
 
-//==================================================================================================
-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));
-}
-
-//==================================================================================================
-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,
-                                                        theMainObjects,
-                                                        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);
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCommon::ID());
+  if (!keepSubResults)
+    aFeature->data()->setVersion("");
+  BooleanCommonPtr aCommon;
+  if (theToolObjects.empty())
+    aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects));
+  else
+    aCommon.reset(new FeaturesAPI_BooleanCommon(aFeature, theMainObjects, theToolObjects));
+  return aCommon;
 }