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_Double.h>
11 #include <ModelHighAPI_Selection.h>
12 //--------------------------------------------------------------------------------------
13 ConstructionAPI_Plane::ConstructionAPI_Plane(
14 const std::shared_ptr<ModelAPI_Feature> & theFeature)
15 : ModelHighAPI_Interface(theFeature)
20 ConstructionAPI_Plane::ConstructionAPI_Plane(
21 const std::shared_ptr<ModelAPI_Feature> & theFeature,
22 const ModelHighAPI_Selection & theFace,
23 const ModelHighAPI_Double & theDistance)
24 : ModelHighAPI_Interface(theFeature)
27 setFaceAndDistance(theFace, theDistance);
30 ConstructionAPI_Plane::ConstructionAPI_Plane(
31 const std::shared_ptr<ModelAPI_Feature> & theFeature,
32 const ModelHighAPI_Double & theA,
33 const ModelHighAPI_Double & theB,
34 const ModelHighAPI_Double & theC,
35 const ModelHighAPI_Double & theD)
36 : ModelHighAPI_Interface(theFeature)
39 setGeneralEquation(theA, theB, theC, theD);
42 ConstructionAPI_Plane::~ConstructionAPI_Plane()
47 //--------------------------------------------------------------------------------------
48 void ConstructionAPI_Plane::setFaceAndDistance(
49 const ModelHighAPI_Selection & theFace,
50 const ModelHighAPI_Double & theDistance)
52 theFace.fillAttribute(myface);
53 theDistance.fillAttribute(mydistance);
58 void ConstructionAPI_Plane::setGeneralEquation(
59 const ModelHighAPI_Double & theA,
60 const ModelHighAPI_Double & theB,
61 const ModelHighAPI_Double & theC,
62 const ModelHighAPI_Double & theD)
64 theA.fillAttribute(myA);
65 theB.fillAttribute(myB);
66 theC.fillAttribute(myC);
67 theD.fillAttribute(myD);
72 //--------------------------------------------------------------------------------------
73 // TODO(spo): make add* as static functions of the class
75 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
76 const ModelHighAPI_Selection & theFace,
77 const ModelHighAPI_Double & theDistance)
79 // TODO(spo): check that thePart is not empty
80 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
81 return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance));
84 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
85 const ModelHighAPI_Double & theA,
86 const ModelHighAPI_Double & theB,
87 const ModelHighAPI_Double & theC,
88 const ModelHighAPI_Double & theD)
90 // TODO(spo): check that thePart is not empty
91 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
92 return PlanePtr(new ConstructionAPI_Plane(aFeature, theA, theB, theC, theD));