Salome HOME
Change color for construction/body/group.
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Plane.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ConstructionPlugin_Plane.h
4 // Created:     12 Dec 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ConstructionPlugin_Plane_H
8 #define ConstructionPlugin_Plane_H
9
10 #include "ConstructionPlugin.h"
11 #include <ModelAPI_Feature.h>
12 #include <ModelAPI_Result.h>
13 #include <GeomAPI_ICustomPrs.h>
14
15
16
17 /**\class ConstructionPlugin_Plane
18  * \ingroup Plugins
19  * \brief Feature for creation of the new planar surface in PartSet.
20  */
21 class ConstructionPlugin_Plane : public ModelAPI_Feature, public GeomAPI_ICustomPrs
22 {
23  public:
24   /// Returns the kind of a feature
25   CONSTRUCTIONPLUGIN_EXPORT virtual const std::string& getKind()
26   {
27     static std::string MY_KIND = ConstructionPlugin_Plane::ID();
28     return MY_KIND;
29   }
30
31   /// default color for a plane
32   inline static const std::string& DEFAULT_COLOR()
33   {
34     static const std::string CONSTRUCTION_PLANE_COLOR("#32FF32");
35     return CONSTRUCTION_PLANE_COLOR;
36   }
37
38   /// Plane kind
39   inline static const std::string& ID()
40   {
41     static const std::string CONSTRUCTION_PLANE_KIND("Plane");
42     return CONSTRUCTION_PLANE_KIND;
43   }
44   /// attribute name for base face
45   inline static const std::string& FACE()
46   {
47     static const std::string FACE_ATTR("planeFace");
48     return FACE_ATTR;
49   }
50   /// attribute name for distance
51   inline static const std::string& DISTANCE()
52   {
53     static const std::string DISTANCE_ATTR("distance");
54     return DISTANCE_ATTR;
55   }
56
57   /// the a parameter for the general equation of a plane (ax+by+cz+d=0)
58   inline static const std::string& A()
59   {
60     static const std::string PARAM_A_ATTR("A");
61     return PARAM_A_ATTR;
62   }
63   /// the b parameter for the general equation of a plane (ax+by+cz+d=0)
64   inline static const std::string& B()
65   {
66     static const std::string PARAM_B_ATTR("B");
67     return PARAM_B_ATTR;
68   }
69   /// the c parameter for the general equation of a plane (ax+by+cz+d=0)
70   inline static const std::string& C()
71   {
72     static const std::string PARAM_C_ATTR("C");
73     return PARAM_C_ATTR;
74   }
75   /// the d parameter for the general equation of a plane (ax+by+cz+d=0)
76   inline static const std::string& D()
77   {
78     static const std::string PARAM_D_ATTR("D");
79     return PARAM_D_ATTR;
80   }
81
82   /// Creates a new part document if needed
83   CONSTRUCTIONPLUGIN_EXPORT virtual void execute();
84
85   /// Request for initialization of data model of the feature: adding all attributes
86   CONSTRUCTIONPLUGIN_EXPORT virtual void initAttributes();
87
88   /// Construction result is always recomputed on the fly
89   CONSTRUCTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
90
91   /// Use plugin manager for features creation
92   ConstructionPlugin_Plane();
93
94   /// Customize presentation of the feature
95   virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs,
96                                      std::shared_ptr<GeomAPI_ICustomPrs> theDefaultPrs);
97 };
98
99 #endif