]> SALOME platform Git repositories - modules/shaper.git/blob - src/ConstructionPlugin/ConstructionPlugin_Point.cpp
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[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 #include <Config_PropManager.h>
17
18 using namespace std;
19
20 ConstructionPlugin_Point::ConstructionPlugin_Point()
21 {
22 }
23
24 void ConstructionPlugin_Point::initAttributes()
25 {
26   data()->addAttribute(POINT_ATTR_X, ModelAPI_AttributeDouble::type());
27   data()->addAttribute(POINT_ATTR_Y, ModelAPI_AttributeDouble::type());
28   data()->addAttribute(POINT_ATTR_Z, ModelAPI_AttributeDouble::type());
29 }
30
31 void ConstructionPlugin_Point::execute()
32 {
33   std::shared_ptr<GeomAPI_Pnt> aPnt(
34       new GeomAPI_Pnt(data()->real(POINT_ATTR_X)->value(), data()->real(POINT_ATTR_Y)->value(),
35                       data()->real(POINT_ATTR_Z)->value()));
36
37   std::shared_ptr<ModelAPI_ResultConstruction> aConstr = document()->createConstruction(data());
38   aConstr->setShape(GeomAlgoAPI_PointBuilder::point(aPnt));
39   setResult(aConstr);
40 }
41
42 void ConstructionPlugin_Point::customisePresentation(AISObjectPtr thePrs)
43 {
44   std::vector<int> aRGB = Config_PropManager::color("Visualization", "construction_point_color",
45                                                     CONSTRUCTION_POINT_COLOR);
46   thePrs->setColor(aRGB[0], aRGB[1], aRGB[2]);
47   thePrs->redisplay();
48 }