1 // Name : ConstructionAPI_Point.cpp
5 // 29/03/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ConstructionAPI_Point.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelAPI_AttributeDouble.h>
11 #include <ModelAPI_Feature.h>
13 #include <ModelHighAPI_Double.h>
14 //--------------------------------------------------------------------------------------
15 ConstructionAPI_Point::ConstructionAPI_Point(
16 const std::shared_ptr<ModelAPI_Feature> & theFeature)
17 : ModelHighAPI_Interface(theFeature)
22 ConstructionAPI_Point::ConstructionAPI_Point(
23 const std::shared_ptr<ModelAPI_Feature> & theFeature,
24 const ModelHighAPI_Double & theX,
25 const ModelHighAPI_Double & theY,
26 const ModelHighAPI_Double & theZ)
27 : ModelHighAPI_Interface(theFeature)
30 setPoint(theX, theY, theZ);
35 ConstructionAPI_Point::~ConstructionAPI_Point()
40 //--------------------------------------------------------------------------------------
41 bool ConstructionAPI_Point::initialize()
44 throwException("ConstructionAPI_Point exception: The feature is NULL.");
48 if (feature()->getKind() != "Point") {
49 throwException("ConstructionAPI_Point exception: Wrong feature kind.");
53 // data() throws exceptions if the attribute is invalid
54 myX = feature()->real("x");
55 myY = feature()->real("y");
56 myZ = feature()->real("z");
58 if (!myX || !myY || !myZ)
64 //--------------------------------------------------------------------------------------
65 void ConstructionAPI_Point::setPoint(const ModelHighAPI_Double & theX,
66 const ModelHighAPI_Double & theY,
67 const ModelHighAPI_Double & theZ)
69 theX.fillAttribute(myX);
70 theY.fillAttribute(myY);
71 theZ.fillAttribute(myZ);
74 //--------------------------------------------------------------------------------------
75 std::shared_ptr<ModelAPI_AttributeDouble> ConstructionAPI_Point::x() const
79 std::shared_ptr<ModelAPI_AttributeDouble> ConstructionAPI_Point::y() const
83 std::shared_ptr<ModelAPI_AttributeDouble> ConstructionAPI_Point::z() const