Salome HOME
Issue #1671: decrease point selection zone
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Intersection.cpp
index cefd80e6e506b47899fa4001f3c66d87337dddd0..a9653c320910c3661eae74569c66ac644dad5f70 100644 (file)
@@ -6,19 +6,22 @@
 
 #include "FeaturesAPI_Intersection.h"
 
+#include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 
 //==================================================================================================
-FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature)
+FeaturesAPI_Intersection::FeaturesAPI_Intersection(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature)
 : ModelHighAPI_Interface(theFeature)
 {
   initialize();
 }
 
 //==================================================================================================
-FeaturesAPI_Intersection::FeaturesAPI_Intersection(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                                   const std::list<ModelHighAPI_Selection>& theObjects,
-                                                   const std::list<ModelHighAPI_Selection>& theTools)
+FeaturesAPI_Intersection::FeaturesAPI_Intersection(
+  const std::shared_ptr<ModelAPI_Feature>& theFeature,
+  const std::list<ModelHighAPI_Selection>& theObjects,
+  const std::list<ModelHighAPI_Selection>& theTools)
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
@@ -51,7 +54,21 @@ void FeaturesAPI_Intersection::setTools(const std::list<ModelHighAPI_Selection>&
   execute();
 }
 
-// TODO(spo): make add* as static functions of the class
+//==================================================================================================
+void FeaturesAPI_Intersection::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aDocName = theDumper.name(aBase->document());
+
+  AttributeSelectionListPtr anAttrObjects =
+    aBase->selectionList(FeaturesPlugin_Intersection::OBJECT_LIST_ID());
+  AttributeSelectionListPtr anAttrTools =
+    aBase->selectionList(FeaturesPlugin_Intersection::TOOL_LIST_ID());
+
+  theDumper << aBase << " = model.addIntersection(" << aDocName << ", "
+            << anAttrObjects << ", " << anAttrTools << ")" << std::endl;
+}
+
 //==================================================================================================
 IntersectionPtr addIntersection(const std::shared_ptr<ModelAPI_Document>& thePart,
                                 const std::list<ModelHighAPI_Selection>& theObjects,