]> SALOME platform Git repositories - modules/shaper.git/blob - src/ConstructionPlugin/ConstructionPlugin_Point.cpp
Salome HOME
"Initialization" plugin: plugin and it's features stubs created
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Point.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ConstructionPlugin_Point.cxx
4 // Created:     27 Mar 2014
5 // Author:      Mikhail PONIKAROV
6
7 #include "ConstructionPlugin_Point.h"
8 #include "ModelAPI_Session.h"
9 #include "ModelAPI_Document.h"
10 #include "ModelAPI_Data.h"
11 #include "ModelAPI_AttributeDouble.h"
12 #include <ModelAPI_ResultConstruction.h>
13 #include <GeomAlgoAPI_PointBuilder.h>
14 #include <GeomAPI_Pnt.h>
15
16 using namespace std;
17
18 ConstructionPlugin_Point::ConstructionPlugin_Point()
19 {
20 }
21
22 const std::string& ConstructionPlugin_Point::getKind()
23 {
24   static std::string MY_KIND = ConstructionPlugin_Point::ID();
25   return MY_KIND;
26 }
27
28 void ConstructionPlugin_Point::initAttributes()
29 {
30   data()->addAttribute(ConstructionPlugin_Point::X(), ModelAPI_AttributeDouble::type());
31   data()->addAttribute(ConstructionPlugin_Point::Y(), ModelAPI_AttributeDouble::type());
32   data()->addAttribute(ConstructionPlugin_Point::Z(), ModelAPI_AttributeDouble::type());
33 }
34
35 void ConstructionPlugin_Point::execute()
36 {
37   std::shared_ptr<GeomAPI_Pnt> aPnt(
38       new GeomAPI_Pnt(data()->real(ConstructionPlugin_Point::X())->value(),
39                       data()->real(ConstructionPlugin_Point::Y())->value(),
40                       data()->real(ConstructionPlugin_Point::Z())->value()));
41
42   std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
43   aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));
44   setResult(aConstr);
45 }