]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
Salome HOME
updated copyright message
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_CompositeSketch.cpp
index 8ee137663d548bb7d3fe7ce080caa3e2abc63ac9..3d5b66c2ad879c391dd64ee0a8abb2a4f099982f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -32,6 +32,8 @@
 #include <GeomAPI_ShapeExplorer.h>
 
 
+static const std::string COMPOSITESKETCH_VERSION_1("v9.6");
+
 static void storeSubShape(const std::shared_ptr<GeomAlgoAPI_MakeShape> theMakeShape,
                           ResultBodyPtr theResultBody,
                           const GeomShapePtr theShape,
@@ -49,8 +51,15 @@ void FeaturesPlugin_CompositeSketch::initCompositeSketchAttribtues(const int the
 
   // Initialize selection list.
   if(theInitFlags & InitBaseObjectsList) {
-    data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId());
+    AttributeSelectionListPtr anObjectsAttr =
+        std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(
+        data()->addAttribute(BASE_OBJECTS_ID(), ModelAPI_AttributeSelectionList::typeId()));
     myCurrentSelectionType = selectionList(BASE_OBJECTS_ID())->selectionType();
+    anObjectsAttr->setWholeResultAllowed(true);
+    if (!anObjectsAttr->isInitialized()) {
+      // new feature, specify the version
+      data()->setVersion(COMPOSITESKETCH_VERSION_1);
+    }
   }
 }
 
@@ -309,15 +318,3 @@ void storeSubShape(
     }
   }
 }
-
-//=================================================================================================
-void FeaturesPlugin_CompositeSketch::attributeChanged(const std::string& theID)
-{
-  if (theID == BASE_OBJECTS_ID()) {
-    AttributeSelectionListPtr anObjects = selectionList(BASE_OBJECTS_ID());
-    if (anObjects->size() == 0 || anObjects->selectionType() != myCurrentSelectionType) {
-      myCurrentSelectionType = anObjects->selectionType();
-      removeResults(0); // clear the results
-    }
-  }
-}