1 // File: ConstructionPlugin_Point.cxx
2 // Created: 27 Mar 2014
3 // Author: Mikhail PONIKAROV
5 #include "ConstructionPlugin_Point.h"
6 #include "ModelAPI_Session.h"
7 #include "ModelAPI_Document.h"
8 #include "ModelAPI_Data.h"
9 #include "ModelAPI_AttributeDouble.h"
10 #include <ModelAPI_ResultConstruction.h>
11 #include <GeomAlgoAPI_PointBuilder.h>
12 #include <GeomAPI_Pnt.h>
16 ConstructionPlugin_Point::ConstructionPlugin_Point()
20 void ConstructionPlugin_Point::initAttributes()
22 data()->addAttribute(POINT_ATTR_X, ModelAPI_AttributeDouble::type());
23 data()->addAttribute(POINT_ATTR_Y, ModelAPI_AttributeDouble::type());
24 data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type());
27 void ConstructionPlugin_Point::execute()
29 boost::shared_ptr<GeomAPI_Pnt> aPnt(
30 new GeomAPI_Pnt(data()->real(POINT_ATTR_X)->value(), data()->real(POINT_ATTR_Y)->value(),
31 data()->real(POINT_ATTR_Z)->value()));
33 boost::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
34 aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));