1 // Name : ConstructionAPI_Point.cpp
5 // 29/03/16 - Sergey POKHODENKO - Creation of the file
7 #include "ConstructionAPI_Point.h"
9 #include <ModelHighAPI_Tools.h>
11 //==================================================================================================
12 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature)
13 : ModelHighAPI_Interface(theFeature)
18 //==================================================================================================
19 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
20 const ModelHighAPI_Double& theX,
21 const ModelHighAPI_Double& theY,
22 const ModelHighAPI_Double& theZ)
23 : ModelHighAPI_Interface(theFeature)
26 setByXYZ(theX, theY, theZ);
30 //==================================================================================================
31 ConstructionAPI_Point::ConstructionAPI_Point(const std::shared_ptr<ModelAPI_Feature>& theFeature,
32 const ModelHighAPI_Selection& theEdge,
33 const ModelHighAPI_Double& theDistanceValue,
34 const bool theDistancePercent,
35 const bool theReverse)
36 : ModelHighAPI_Interface(theFeature)
39 setByDistanceOnEdge(theEdge, theDistanceValue, theDistancePercent, theReverse);
43 //==================================================================================================
44 ConstructionAPI_Point::~ConstructionAPI_Point()
49 //==================================================================================================
50 void ConstructionAPI_Point::setByXYZ(const ModelHighAPI_Double& theX,
51 const ModelHighAPI_Double& theY,
52 const ModelHighAPI_Double& theZ)
54 fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_XYZ(), mycreationMethod);
55 fillAttribute(theX, myx);
56 fillAttribute(theY, myy);
57 fillAttribute(theZ, myz);
62 //==================================================================================================
63 void ConstructionAPI_Point::setByDistanceOnEdge(const ModelHighAPI_Selection& theEdge,
64 const ModelHighAPI_Double& theDistanceValue,
65 const bool theDistancePercent,
66 const bool theReverse)
68 fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_DISTANCE_ON_EDGE(), mycreationMethod);
69 fillAttribute(theEdge, myedge);
70 fillAttribute(theDistanceValue, mydistanceValue);
71 fillAttribute(theDistancePercent, mydistancePercent);
72 fillAttribute(theReverse, myreverse);
77 //==================================================================================================
78 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document>& thePart,
79 const ModelHighAPI_Double& theX,
80 const ModelHighAPI_Double& theY,
81 const ModelHighAPI_Double& theZ)
83 // TODO(spo): check that thePart is not empty
84 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
85 return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
88 //==================================================================================================
89 PointPtr addPoint(const std::shared_ptr<ModelAPI_Document> & thePart,
90 const ModelHighAPI_Selection& theEdge,
91 const ModelHighAPI_Double& theDistanceValue,
92 const bool theDistancePercent,
93 const bool theReverse)
95 // TODO(spo): check that thePart is not empty
96 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
97 return PointPtr(new ConstructionAPI_Point(aFeature, theEdge, theDistanceValue, theDistancePercent, theReverse));