Salome HOME
Issue #3039: Add a constraint on a last line of a contour
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_BooleanCut.cpp
index 5b81a2be3ed55df17b9b723e152c1f0f9654f12f..b0bbd4cb613c5ed0d3a3c4a98f092b9346fd00ef 100644 (file)
@@ -34,10 +34,12 @@ FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(const std::shared_ptr<ModelAPI_Fe
 FeaturesAPI_BooleanCut::FeaturesAPI_BooleanCut(
   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);
 
@@ -79,17 +81,26 @@ void FeaturesAPI_BooleanCut::dump(ModelHighAPI_Dumper& theDumper) const
     aBase->selectionList(FeaturesPlugin_BooleanCut::OBJECT_LIST_ID());
   AttributeSelectionListPtr aTools =
     aBase->selectionList(FeaturesPlugin_BooleanCut::TOOL_LIST_ID());
+  AttributeIntegerPtr aVersion =
+    aBase->integer(FeaturesPlugin_BooleanCut::VERSION_ID());
 
-  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools << ")" << std::endl;
+  theDumper << "(" << aDocName << ", " << anObjects << ", " << aTools;
+
+  if (aVersion && aVersion->isInitialized())
+    theDumper << ", " << aVersion->value();
+
+  theDumper << ")" << std::endl;
 }
 
 //==================================================================================================
 BooleanCutPtr addCut(const std::shared_ptr<ModelAPI_Document>& thePart,
                      const std::list<ModelHighAPI_Selection>& theMainObjects,
-                     const std::list<ModelHighAPI_Selection>& theToolObjects)
+                     const std::list<ModelHighAPI_Selection>& theToolObjects,
+                     const int theVersion)
 {
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(FeaturesAPI_BooleanCut::ID());
   return BooleanCutPtr(new FeaturesAPI_BooleanCut(aFeature,
                                                   theMainObjects,
-                                                  theToolObjects));
+                                                  theToolObjects,
+                                                  theVersion));
 }