Salome HOME
Temporary correction to make compilation on Jenkins stable.
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Placement.cpp
index 4d087061590cff9d46651bce2d4ce19cc1c90601..5d3aff8b494772236e606a977c33f50076148300 100644 (file)
@@ -6,17 +6,18 @@
 
 #include "FeaturesAPI_Placement.h"
 
+#include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 
 //==================================================================================================
-FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature> & theFeature)
+FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature)
 : ModelHighAPI_Interface(theFeature)
 {
   initialize();
 }
 
 //==================================================================================================
-FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature> & theFeature,
+FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feature>& theFeature,
                                              const std::list<ModelHighAPI_Selection>& theObjects,
                                              const ModelHighAPI_Selection& theStartShape,
                                              const ModelHighAPI_Selection& theEndShape,
@@ -25,10 +26,10 @@ FeaturesAPI_Placement::FeaturesAPI_Placement(const std::shared_ptr<ModelAPI_Feat
 : ModelHighAPI_Interface(theFeature)
 {
   if(initialize()) {
-    setObjects(theObjects);
-    setStartShape(theStartShape);
-    setEndShape(theEndShape);
-    setReverseDirection(theReverseDirection);
+    fillAttribute(theObjects, myobjects);
+    fillAttribute(theStartShape, mystartShape);
+    fillAttribute(theEndShape, myendShape);
+    fillAttribute(theReverseDirection, myreverseDirection);
     setCentering(theCentering);
   }
 }
@@ -79,9 +80,25 @@ void FeaturesAPI_Placement::setCentering(const bool theCentering)
   execute();
 }
 
-// TODO(spo): make add* as static functions of the class
 //==================================================================================================
-PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document> & thePart,
+void FeaturesAPI_Placement::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aDocName = theDumper.name(aBase->document());
+
+  AttributeSelectionListPtr anAttrObjects = aBase->selectionList(FeaturesPlugin_Placement::OBJECTS_LIST_ID());
+  AttributeSelectionPtr anAttrStartShape = aBase->selection(FeaturesPlugin_Placement::START_SHAPE_ID());
+  AttributeSelectionPtr anAttrEndShape = aBase->selection(FeaturesPlugin_Placement::END_SHAPE_ID());
+  AttributeBooleanPtr anAttrReverse = aBase->boolean(FeaturesPlugin_Placement::REVERSE_ID());
+  AttributeBooleanPtr anAttrCentering = aBase->boolean(FeaturesPlugin_Placement::CENTERING_ID());
+
+  theDumper << aBase << " = model.addPlacement(" << aDocName << ", "
+            << anAttrObjects << ", " << anAttrStartShape << ", " << anAttrEndShape << ", "
+            << anAttrReverse << ", " << anAttrCentering << ")" << std::endl;
+}
+
+//==================================================================================================
+PlacementPtr addPlacement(const std::shared_ptr<ModelAPI_Document>& thePart,
                           const std::list<ModelHighAPI_Selection>& theObjects,
                           const ModelHighAPI_Selection& theStartShape,
                           const ModelHighAPI_Selection& theEndShape,