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("PlaneByFaceAndDistance", mycreationMethod);
52 fillAttribute(theFace, myplane);
53 fillAttribute(theDistance, 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 fillAttribute("PlaneByGeneralEquation", mycreationMethod);
65 fillAttribute(theA, myA);
66 fillAttribute(theB, myB);
67 fillAttribute(theC, myC);
68 fillAttribute(theD, myD);
73 //--------------------------------------------------------------------------------------
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));