Salome HOME
Supress whitespace.
[modules/shaper.git] / src / PrimitivesAPI / PrimitivesAPI_Box.cpp
index 2c2e016cb5c03210fff0f9897cbd2d36f41c990f..3e3fb54c0d85e1dc84be92a59b77157f5e75079f 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "PrimitivesAPI_Box.h"
 
+#include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 
 //==================================================================================================
@@ -66,6 +67,34 @@ void PrimitivesAPI_Box::setPoints(const ModelHighAPI_Selection& theFirstPoint,
   execute();
 }
 
+//==================================================================================================
+void PrimitivesAPI_Box::dump(ModelHighAPI_Dumper& theDumper) const
+{
+  FeaturePtr aBase = feature();
+  const std::string& aDocName = theDumper.name(aBase->document());
+
+  theDumper << aBase << " = model.addBox(" << aDocName;
+
+  std::string aCreationMethod = aBase->string(PrimitivesPlugin_Box::CREATION_METHOD())->value();
+  
+  if(aCreationMethod == PrimitivesPlugin_Box::CREATION_METHOD_BY_DIMENSIONS()) {
+    AttributeDoublePtr anAttrDx = aBase->real(PrimitivesPlugin_Box::DX_ID());
+    AttributeDoublePtr anAttrDy = aBase->real(PrimitivesPlugin_Box::DY_ID());
+    AttributeDoublePtr anAttrDz = aBase->real(PrimitivesPlugin_Box::DZ_ID());
+    
+    theDumper << ", " << anAttrDx << ", " << anAttrDy << ", " << anAttrDz;
+  } else if (aCreationMethod == PrimitivesPlugin_Box::CREATION_METHOD_BY_TWO_POINTS()) {
+    AttributeSelectionPtr anAttrFirstPnt =
+      aBase->selection(PrimitivesPlugin_Box::POINT_FIRST_ID());
+    AttributeSelectionPtr anAttrSecondPnt =
+      aBase->selection(PrimitivesPlugin_Box::POINT_SECOND_ID());
+
+    theDumper << ", " << anAttrFirstPnt << ", " << anAttrSecondPnt;
+  }
+
+  theDumper << ")" << std::endl;
+}
+
 //==================================================================================================
 BoxPtr addBox(const std::shared_ptr<ModelAPI_Document>& thePart,
               const ModelHighAPI_Double& theDx,