From: spo Date: Mon, 6 Jun 2016 09:33:07 +0000 (+0300) Subject: Use ID() static functions of ConstructionAPI_Plane & ConstructionAPI_Point in add... X-Git-Tag: V_2.4.0~91^2~84 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1f4eea0442b8b32ac5e3bd7c4c7266102a0f4908;p=modules%2Fshaper.git Use ID() static functions of ConstructionAPI_Plane & ConstructionAPI_Point in add* functions --- diff --git a/src/ConstructionAPI/ConstructionAPI_Plane.cpp b/src/ConstructionAPI/ConstructionAPI_Plane.cpp index 103d9d6eb..b8160ca89 100644 --- a/src/ConstructionAPI/ConstructionAPI_Plane.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Plane.cpp @@ -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 & thePart, + const ModelHighAPI_Selection & theFace, + const ModelHighAPI_Double & theDistance) +{ + // TODO(spo): check that thePart is not empty + std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); + return PlanePtr(new ConstructionAPI_Plane(aFeature, theFace, theDistance)); +} + +PlanePtr addPlane(const std::shared_ptr & 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 aFeature = thePart->addFeature(ConstructionAPI_Plane::ID()); + return PlanePtr(new ConstructionAPI_Plane(aFeature, theA, theB, theC, theD)); +} diff --git a/src/ConstructionAPI/ConstructionAPI_Plane.h b/src/ConstructionAPI/ConstructionAPI_Plane.h index a71c23e14..7031b9f88 100644 --- a/src/ConstructionAPI/ConstructionAPI_Plane.h +++ b/src/ConstructionAPI/ConstructionAPI_Plane.h @@ -62,6 +62,22 @@ public: //! Pointer on Plane object typedef std::shared_ptr PlanePtr; +/**\ingroup CPPHighAPI + * \brief Create Plane feature + */ +PlanePtr addPlane(const std::shared_ptr & thePart, + const ModelHighAPI_Selection & theFace, + const ModelHighAPI_Double & theDistance); + +/**\ingroup CPPHighAPI + * \brief Create Plane feature + */ +PlanePtr addPlane(const std::shared_ptr & thePart, + const ModelHighAPI_Double & theA, + const ModelHighAPI_Double & theB, + const ModelHighAPI_Double & theC, + const ModelHighAPI_Double & theD); + //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- #endif /* SRC_CONSTRUCTIONAPI_CONSTRUCTIONAPI_PLANE_H_ */ diff --git a/src/ConstructionAPI/ConstructionAPI_Point.cpp b/src/ConstructionAPI/ConstructionAPI_Point.cpp index e28a96bb4..26df2de8b 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Point.cpp @@ -57,6 +57,6 @@ PointPtr addPoint( const ModelHighAPI_Double& theZ) { // TODO(spo): check that thePart is not empty - std::shared_ptr aFeature = thePart->addFeature("Point"); + std::shared_ptr aFeature = thePart->addFeature(ConstructionAPI_Point::ID()); return PointPtr(new ConstructionAPI_Point(aFeature, theX, theY, theZ)); }