Salome HOME
Adjust unit tests to new behavior of SketchBuilder
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Symmetry.h
1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
2
3 // File:        FeaturesPlugin_Symmetry.h
4 // Created:     30 Nov 2016
5 // Author:      Clarisse Genrault (CEA)
6
7 #ifndef FEATURESPLUGIN_SYMMETRY_H_
8 #define FEATURESPLUGIN_SYMMETRY_H_
9
10 #include <FeaturesPlugin.h>
11
12 #include <ModelAPI_Feature.h>
13
14 #include <GeomAlgoAPI_Symmetry.h>
15
16 /** \class FeaturesPlugin_Symmetry
17  *  \ingroup Plugins
18  *  \brief Feature that performs reflection with respect to a point, axis, or plane.
19  */
20 class FeaturesPlugin_Symmetry : public ModelAPI_Feature
21 {
22  public:
23   /// Symmetry kind.
24   inline static const std::string& ID()
25   {
26     static const std::string MY_SYMMETRY("Symmetry");
27     return MY_SYMMETRY;
28   }
29
30   /// Attribute name for creation method.
31   inline static const std::string& CREATION_METHOD()
32   {
33     static const std::string MY_CREATION_METHOD_ID("CreationMethod");
34     return MY_CREATION_METHOD_ID;
35   }
36
37   /// Attribute name for creation method "ByAxisAndDistance".
38   inline static const std::string& CREATION_METHOD_BY_POINT()
39   {
40     static const std::string MY_CREATION_METHOD_ID("ByPoint");
41     return MY_CREATION_METHOD_ID;
42   }
43
44   /// Attribute name for creation method "ByDimensions".
45   inline static const std::string& CREATION_METHOD_BY_AXIS()
46   {
47     static const std::string MY_CREATION_METHOD_ID("ByAxis");
48     return MY_CREATION_METHOD_ID;
49   }
50
51   /// Attribute name for creation method "ByTwoPoints".
52   inline static const std::string& CREATION_METHOD_BY_PLANE()
53   {
54     static const std::string MY_CREATION_METHOD_ID("ByPlane");
55     return MY_CREATION_METHOD_ID;
56   }
57
58   /// Attribute name of referenced objects.
59   inline static const std::string& OBJECTS_LIST_ID()
60   {
61     static const std::string MY_OBJECTS_LIST_ID("main_objects");
62     return MY_OBJECTS_LIST_ID;
63   }
64
65   /// Attribute name of a point.
66   inline static const std::string& POINT_OBJECT_ID()
67   {
68     static const std::string MY_POINT_OBJECT_ID("point_object");
69     return MY_POINT_OBJECT_ID;
70   }
71
72   /// Attribute name of an axis.
73   inline static const std::string& AXIS_OBJECT_ID()
74   {
75     static const std::string MY_AXIS_OBJECT_ID("axis_object");
76     return MY_AXIS_OBJECT_ID;
77   }
78
79   /// Attribute name of a plane.
80   inline static const std::string& PLANE_OBJECT_ID()
81   {
82     static const std::string MY_PLANE_OBJECT_ID("plane_object");
83     return MY_PLANE_OBJECT_ID;
84   }
85
86   /// \return the kind of a feature.
87   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
88   {
89     static std::string MY_KIND = FeaturesPlugin_Symmetry::ID();
90     return MY_KIND;
91   }
92
93   /// Creates a new part document if needed.
94   FEATURESPLUGIN_EXPORT virtual void execute();
95
96   /// Request for initialization of data model of the feature: adding all attributes.
97   FEATURESPLUGIN_EXPORT virtual void initAttributes();
98
99   /// Use plugin manager for features creation.
100   FeaturesPlugin_Symmetry();
101
102 private:
103   ///Perform symmetry with respect to a point.
104   void performSymmetryByPoint();
105
106   ///Perform symmetry with respect to an axis.
107   void performSymmetryByAxis();
108
109   ///Perform symmetry with respect to a plane.
110   void performSymmetryByPlane();
111
112   void loadNamingDS(GeomAlgoAPI_Symmetry& theSymmetryAlgo,
113                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
114                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
115 };
116
117 #endif // FEATURESPLUGIN_SYMMETRY_H_