X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Plane.h;h=546577b44ea5d35a31fe8df7881b2ab083b5ea47;hb=3dba9bfac0fe2de547b60a58f68db0822b9865ab;hp=369f20586bf2d0aadd87700b2972d8bf20ba56b0;hpb=db0e21ea2f1117dd9af3320009ba8b50dc2e828b;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.h b/src/ConstructionPlugin/ConstructionPlugin_Plane.h index 369f20586..546577b44 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@ -9,19 +9,13 @@ #include "ConstructionPlugin.h" #include +#include #include -/// Point kind -const std::string CONSTRUCTION_PLANE_KIND("Plane"); -/// attribute name for base face -const std::string FACE_ATTR = "planeFace"; - -/// attribute name for distance -const std::string DISTANCE_ATTR = "distance"; /**\class ConstructionPlugin_Plane - * \ingroup DataModel + * \ingroup Plugins * \brief Feature for creation of the new planar surface in PartSet. */ class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs @@ -30,24 +24,88 @@ class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustom /// Returns the kind of a feature CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind() { - static std::string MY_KIND = CONSTRUCTION_PLANE_KIND; + static std::string MY_KIND = ConstructionPlugin_Plane::ID(); return MY_KIND; } + /// default color for a plane + inline static const std::string& DEFAULT_COLOR() + { + static const std::string CONSTRUCTION_PLANE_COLOR("150,150,180"); + return CONSTRUCTION_PLANE_COLOR; + } + + /// Plane kind + inline static const std::string& ID() + { + static const std::string CONSTRUCTION_PLANE_KIND("Plane"); + return CONSTRUCTION_PLANE_KIND; + } + + /// attribute name for first point + inline static const std::string& METHOD() + { + static const std::string METHOD_ATTR("CreationMethod"); + return METHOD_ATTR; + } + + /// attribute name for base face + inline static const std::string& FACE() + { + static const std::string FACE_ATTR("planeFace"); + return FACE_ATTR; + } + /// attribute name for distance + inline static const std::string& DISTANCE() + { + static const std::string DISTANCE_ATTR("distance"); + return DISTANCE_ATTR; + } + + /// the a parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& A() + { + static const std::string PARAM_A_ATTR("A"); + return PARAM_A_ATTR; + } + /// the b parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& B() + { + static const std::string PARAM_B_ATTR("B"); + return PARAM_B_ATTR; + } + /// the c parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& C() + { + static const std::string PARAM_C_ATTR("C"); + return PARAM_C_ATTR; + } + /// the d parameter for the general equation of a plane (ax+by+cz+d=0) + inline static const std::string& D() + { + static const std::string PARAM_D_ATTR("D"); + return PARAM_D_ATTR; + } + /// Creates a new part document if needed CONSTRUCTIONPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes(); - /// Construction result is allways recomuted on the fly + /// Construction result is always recomputed on the fly CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;} /// Use plugin manager for features creation ConstructionPlugin_Plane(); /// Customize presentation of the feature - virtual void customisePresentation(AISObjectPtr thePrs); + virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, + std::shared_ptr theDefaultPrs); + + protected: + std::shared_ptr createPlaneByFaceAndDistance(); + std::shared_ptr createPlaneByGeneralEquation(); }; -#endif \ No newline at end of file +#endif