Salome HOME
Merge branch 'CPPHighAPI'
[modules/shaper.git] / src / ConstructionAPI / ConstructionAPI_Point.cpp
1 // Name   : ConstructionAPI_Point.cpp
2 // Purpose: 
3 //
4 // History:
5 // 29/03/16 - Sergey POKHODENKO - Creation of the file
6
7 //--------------------------------------------------------------------------------------
8 #include "ConstructionAPI_Point.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Tools.h>
11 //--------------------------------------------------------------------------------------
12 ConstructionAPI_Point::ConstructionAPI_Point(
13     const std::shared_ptr<ModelAPI_Feature> & theFeature)
14 : ModelHighAPI_Interface(theFeature)
15 {
16   initialize();
17 }
18
19 ConstructionAPI_Point::ConstructionAPI_Point(
20     const std::shared_ptr<ModelAPI_Feature> & theFeature,
21     const ModelHighAPI_Double & theX,
22     const ModelHighAPI_Double & theY,
23     const ModelHighAPI_Double & theZ)
24 : ModelHighAPI_Interface(theFeature)
25 {
26   if (initialize())
27     setPoint(theX, theY, theZ);
28 }
29
30 ConstructionAPI_Point::~ConstructionAPI_Point()
31 {
32
33 }
34
35 //--------------------------------------------------------------------------------------
36 void ConstructionAPI_Point::setPoint(const ModelHighAPI_Double & theX,
37                                      const ModelHighAPI_Double & theY,
38                                      const ModelHighAPI_Double & theZ)
39 {
40   fillAttribute(theX, myx);
41   fillAttribute(theY, myy);
42   fillAttribute(theZ, myz);
43
44   execute();
45 }
46
47 //--------------------------------------------------------------------------------------
48 PointPtr addPoint(
49     const std::shared_ptr<ModelAPI_Document> & thePart,
50     const ModelHighAPI_Double& theX,
51     const ModelHighAPI_Double& theY,
52     const ModelHighAPI_Double& theZ)
53 {
54   // TODO(spo): check that thePart is not empty
55   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
56   return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
57 }