]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Supress whitespace.
authorClarisse Genrault <clarisse.genrault@cea.fr>
Mon, 21 Nov 2016 09:47:14 +0000 (10:47 +0100)
committerClarisse Genrault <clarisse.genrault@cea.fr>
Mon, 21 Nov 2016 09:47:14 +0000 (10:47 +0100)
src/PrimitivesAPI/PrimitivesAPI_Box.cpp
src/PrimitivesAPI/PrimitivesAPI_Box.h

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,
index 9dac5e2a86dc5b4acfec9f7c5fe86c7cda988330..17249ed29e5390455167432c633d5840af619e35 100644 (file)
@@ -68,6 +68,10 @@ public:
   PRIMITIVESAPI_EXPORT
   void setPoints(const ModelHighAPI_Selection& theFirstPoint,
                  const ModelHighAPI_Selection& theSecondPoint);
+
+  /// Dump wrapped feature
+  PRIMITIVESAPI_EXPORT
+  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
 };
 
 /// Pointer on primitive Box object