Salome HOME
Issue #2660: Update data model before save.
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Point.cpp
index 43b222fb4952eb2dd0b6ee8d37df31a5a1274845..bb59c3d550acee82307197fd38c07ec3a372ee5b 100644 (file)
@@ -30,6 +30,8 @@
 #include <GeomAlgoAPI_ShapeTools.h>
 
 #include <GeomAPI_Circ.h>
+#include <GeomDataAPI_Point.h>
+
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Vertex.h>
@@ -50,9 +52,7 @@ const std::string& ConstructionPlugin_Point::getKind()
 //==================================================================================================
 void ConstructionPlugin_Point::initAttributes()
 {
-  data()->addAttribute(X(), ModelAPI_AttributeDouble::typeId());
-  data()->addAttribute(Y(), ModelAPI_AttributeDouble::typeId());
-  data()->addAttribute(Z(), ModelAPI_AttributeDouble::typeId());
+  data()->addAttribute(POINT3D(), GeomDataAPI_Point::typeId());
 
   data()->addAttribute(CREATION_METHOD(), ModelAPI_AttributeString::typeId());
 
@@ -161,9 +161,9 @@ bool ConstructionPlugin_Point::customisePresentation(ResultPtr theResult,
 //==================================================================================================
 std::shared_ptr<GeomAPI_Vertex> ConstructionPlugin_Point::createByXYZ()
 {
-  return GeomAlgoAPI_PointBuilder::vertex(real(X())->value(),
-                                          real(Y())->value(),
-                                          real(Z())->value());
+  AttributePointPtr aPoint =
+    std::dynamic_pointer_cast<GeomDataAPI_Point>(data()->attribute(POINT3D()));
+  return GeomAlgoAPI_PointBuilder::vertex(aPoint->x(), aPoint->y(), aPoint->z());
 }
 
 //==================================================================================================