Salome HOME
Very first implementation of shape-result management
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Point.cpp
1 // File:        ConstructionPlugin_Point.cxx
2 // Created:     27 Mar 2014
3 // Author:      Mikhail PONIKAROV
4
5 #include "ConstructionPlugin_Point.h"
6 #include "ModelAPI_PluginManager.h"
7 #include "ModelAPI_Document.h"
8 #include "ModelAPI_Data.h"
9 #include "ModelAPI_AttributeDouble.h"
10 #include <GeomAlgoAPI_PointBuilder.h>
11 #include <GeomAPI_Pnt.h>
12
13 using namespace std;
14
15 ConstructionPlugin_Point::ConstructionPlugin_Point()
16 {
17 }
18
19 void ConstructionPlugin_Point::initAttributes()
20 {
21   data()->addAttribute(POINT_ATTR_X, ModelAPI_AttributeDouble::type());
22   data()->addAttribute(POINT_ATTR_Y, ModelAPI_AttributeDouble::type());
23   data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type());
24 }
25
26 void ConstructionPlugin_Point::execute() 
27 {
28   boost::shared_ptr<GeomAPI_Pnt> aPnt(new GeomAPI_Pnt(
29     data()->real(POINT_ATTR_X)->value(), data()->real(POINT_ATTR_Y)->value(), data()->real(POINT_ATTR_Z)->value()));
30
31   data()->store(GeomAlgoAPI_PointBuilder::point(aPnt));
32 }