]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Use ID() static functions of ConstructionAPI_Plane & ConstructionAPI_Point in add...
authorspo <sergey.pokhodenko@opencascade.com>
Mon, 6 Jun 2016 09:33:07 +0000 (12:33 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:41:03 +0000 (14:41 +0300)
src/ConstructionAPI/ConstructionAPI_Plane.cpp
src/ConstructionAPI/ConstructionAPI_Plane.h
src/ConstructionAPI/ConstructionAPI_Point.cpp

index 103d9d6eb36ad0cf618a0800f0a8d725d9a82889..b8160ca89367790a266a78be6792c27dd6245459 100644 (file)
@@ -44,6 +44,7 @@ ConstructionAPI_Plane::~ConstructionAPI_Plane()
 
 }
 
+//--------------------------------------------------------------------------------------
 void ConstructionAPI_Plane::setFaceAndDistance(
     const ModelHighAPI_Selection & theFace,
     const ModelHighAPI_Double & theDistance)
@@ -67,3 +68,26 @@ void ConstructionAPI_Plane::setGeneralEquation(
 
   execute();
 }
+
+//--------------------------------------------------------------------------------------
+// TODO(spo): make add* as static functions of the class
+
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection & theFace,
+                  const ModelHighAPI_Double & theDistance)
+{
+  // TODO(spo): check that thePart is not empty
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
+  return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance));
+}
+
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Double & theA,
+                  const ModelHighAPI_Double & theB,
+                  const ModelHighAPI_Double & theC,
+                  const ModelHighAPI_Double & theD)
+{
+  // TODO(spo): check that thePart is not empty
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Plane::ID());
+  return PlanePtr(new ConstructionAPI_Plane(aFeature, theA, theB, theC, theD));
+}
index a71c23e1457479e75357db6fdad9f27ce114a066..7031b9f88c6bdeb076e8f149a0274dc5830991f0 100644 (file)
@@ -62,6 +62,22 @@ public:
 //! Pointer on Plane object
 typedef std::shared_ptr<ConstructionAPI_Plane> PlanePtr;
 
+/**\ingroup CPPHighAPI
+ * \brief Create Plane feature
+ */
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Selection & theFace,
+                  const ModelHighAPI_Double & theDistance);
+
+/**\ingroup CPPHighAPI
+ * \brief Create Plane feature
+ */
+PlanePtr addPlane(const std::shared_ptr<ModelAPI_Document> & thePart,
+                  const ModelHighAPI_Double & theA,
+                  const ModelHighAPI_Double & theB,
+                  const ModelHighAPI_Double & theC,
+                  const ModelHighAPI_Double & theD);
+
 //--------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------
 #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_ */
index e28a96bb4445c97db7c28a8b59b12d8aa57a03f2..26df2de8b15e6261ae423312947583c99a706fc4 100644 (file)
@@ -57,6 +57,6 @@ PointPtr addPoint(
     const ModelHighAPI_Double& theZ)
 {
   // TODO(spo): check that thePart is not empty
-  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature("Point");
+  std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ConstructionAPI_Point::ID());
   return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ));
 }