1 // Name : ConstructionAPI_Plane.cpp
5 // 27/05/16 - Sergey POKHODENKO - Creation of the file
7 #include "ConstructionAPI_Plane.h"
9 #include <ModelHighAPI_Tools.h>
11 ConstructionAPI_Plane::ConstructionAPI_Plane(
12 const std::shared_ptr<ModelAPI_Feature> & theFeature)
13 : ModelHighAPI_Interface(theFeature)
18 ConstructionAPI_Plane::ConstructionAPI_Plane(
19 const std::shared_ptr<ModelAPI_Feature> & theFeature,
20 const ModelHighAPI_Selection & theFace,
21 const ModelHighAPI_Double & theDistance)
22 : ModelHighAPI_Interface(theFeature)
25 setFaceAndDistance(theFace, theDistance);
28 ConstructionAPI_Plane::ConstructionAPI_Plane(
29 const std::shared_ptr<ModelAPI_Feature> & theFeature,
30 const ModelHighAPI_Double & theA,
31 const ModelHighAPI_Double & theB,
32 const ModelHighAPI_Double & theC,
33 const ModelHighAPI_Double & theD)
34 : ModelHighAPI_Interface(theFeature)
37 setGeneralEquation(theA, theB, theC, theD);
40 ConstructionAPI_Plane::~ConstructionAPI_Plane()
45 //--------------------------------------------------------------------------------------
46 void ConstructionAPI_Plane::setFaceAndDistance(
47 const ModelHighAPI_Selection & theFace,
48 const ModelHighAPI_Double & theDistance)
50 fillAttribute("PlaneByFaceAndDistance", mycreationMethod);
51 fillAttribute(theFace, myplane);
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(ConstructionPlugin_Plane::CREATION_METHOD_BY_GENERAL_EQUATION(), mycreationMethod);
64 fillAttribute(theA, myA);
65 fillAttribute(theB, myB);
66 fillAttribute(theC, myC);
67 fillAttribute(theD, myD);
72 //--------------------------------------------------------------------------------------
73 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
74 const ModelHighAPI_Selection & theFace,
75 const ModelHighAPI_Double & theDistance)
77 // TODO(spo): check that thePart is not empty
78 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
79 return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance));
82 PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
83 const ModelHighAPI_Double & theA,
84 const ModelHighAPI_Double & theB,
85 const ModelHighAPI_Double & theC,
86 const ModelHighAPI_Double & theD)
88 // TODO(spo): check that thePart is not empty
89 std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
90 return PlanePtr(new ConstructionAPI_Plane(aFeature, theA, theB, theC, theD));