X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConstructionPlugin%2FConstructionPlugin_Plane.h;h=b82f1e8c3f8b238b1fd2b804618c5e096ded9923;hb=4d6bb9de0e54f09a9bbacc94a058cb7cd437d535;hp=aedaff7f8e037e2c137d4ebbb322a39edf0b0ca8;hpb=85253719b1f5e630551c2590d23deab11db55fe1;p=modules%2Fshaper.git diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plane.h b/src/ConstructionPlugin/ConstructionPlugin_Plane.h index aedaff7f8..b82f1e8c3 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plane.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Plane.h @@ -9,48 +9,106 @@ #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 Plugins * \brief Feature for creation of the new planar surface in PartSet. */ -#define CONSTRUCTION_PLANE_COLOR "#32FF32" - - class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs { public: /// 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: + /// Creates a new plane by copy of face plane with translation along the normal + /// to the specified distance. + std::shared_ptr createPlaneByFaceAndDistance(); + /// Creates a new plane by general equation. + std::shared_ptr createPlaneByGeneralEquation(); }; -#endif \ No newline at end of file +#endif