1 // Name : ConstructionAPI_Plane.cpp
5 // 27/05/16 - Sergey POKHODENKO - Creation of the file
7 //--------------------------------------------------------------------------------------
8 #include "ConstructionAPI_Plane.h"
9 //--------------------------------------------------------------------------------------
10 #include <ModelHighAPI_Tools.h>
11 //--------------------------------------------------------------------------------------
12 ConstructionAPI_Plane::ConstructionAPI_Plane(
13 const std::shared_ptr<ModelAPI_Feature> & theFeature)
14 : ModelHighAPI_Interface(theFeature)
19 ConstructionAPI_Plane::ConstructionAPI_Plane(
20 const std::shared_ptr<ModelAPI_Feature> & theFeature,
21 const ModelHighAPI_Selection & theFace,
22 const ModelHighAPI_Double & theDistance)
23 : ModelHighAPI_Interface(theFeature)
26 setFaceAndDistance(theFace, theDistance);
29 ConstructionAPI_Plane::ConstructionAPI_Plane(
30 const std::shared_ptr<ModelAPI_Feature> & theFeature,
31 const ModelHighAPI_Double & theA,
32 const ModelHighAPI_Double & theB,
33 const ModelHighAPI_Double & theC,
34 const ModelHighAPI_Double & theD)
35 : ModelHighAPI_Interface(theFeature)
38 setGeneralEquation(theA, theB, theC, theD);
41 ConstructionAPI_Plane::~ConstructionAPI_Plane()
46 //--------------------------------------------------------------------------------------
47 void ConstructionAPI_Plane::setFaceAndDistance(
48 const ModelHighAPI_Selection & theFace,
49 const ModelHighAPI_Double & theDistance)
51 fillAttribute(theFace, myface);
52 fillAttribute(theDistance, mydistance);
57 void ConstructionAPI_Plane::setGeneralEquation(
58 const ModelHighAPI_Double & theA,
59 const ModelHighAPI_Double & theB,
60 const ModelHighAPI_Double & theC,
61 const ModelHighAPI_Double & theD)
63 fillAttribute(theA, myA);
64 fillAttribute(theB, myB);
65 fillAttribute(theC, myC);
66 fillAttribute(theD, myD);
71 //--------------------------------------------------------------------------------------
72 // TODO(spo): make add* as static functions of the class
74 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
75 const ModelHighAPI_Selection & theFace,
76 const ModelHighAPI_Double & theDistance)
78 // TODO(spo): check that thePart is not empty
79 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
80 return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance));
83 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
84 const ModelHighAPI_Double & theA,
85 const ModelHighAPI_Double & theB,
86 const ModelHighAPI_Double & theC,
87 const ModelHighAPI_Double & theD)
89 // TODO(spo): check that thePart is not empty
90 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
91 return PlanePtr(new ConstructionAPI_Plane(aFeature, theA, theB, theC, theD));