]> SALOME platform Git repositories - modules/shaper.git/blob - src/FeaturesPlugin/FeaturesPlugin_Symmetry.h
Salome HOME
aa67bd79b72580d9c245a18f0bb0bfbf8e38c668
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_Symmetry.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef FEATURESPLUGIN_SYMMETRY_H_
22 #define FEATURESPLUGIN_SYMMETRY_H_
23
24 #include <FeaturesPlugin.h>
25
26 #include <ModelAPI_Feature.h>
27
28 #include <GeomAlgoAPI_Symmetry.h>
29
30 /** \class FeaturesPlugin_Symmetry
31  *  \ingroup Plugins
32  *  \brief Feature that performs reflection with respect to a point, axis, or plane.
33  */
34 class FeaturesPlugin_Symmetry : public ModelAPI_Feature
35 {
36  public:
37   /// Symmetry kind.
38   inline static const std::string& ID()
39   {
40     static const std::string MY_SYMMETRY_ID("Symmetry");
41     return MY_SYMMETRY_ID;
42   }
43
44   /// Attribute name for creation method.
45   inline static const std::string& CREATION_METHOD()
46   {
47     static const std::string MY_CREATION_METHOD_ID("CreationMethod");
48     return MY_CREATION_METHOD_ID;
49   }
50
51   /// Attribute name for creation method "ByPoint".
52   inline static const std::string& CREATION_METHOD_BY_POINT()
53   {
54     static const std::string MY_CREATION_METHOD_ID("ByPoint");
55     return MY_CREATION_METHOD_ID;
56   }
57
58   /// Attribute name for creation method "ByAxis".
59   inline static const std::string& CREATION_METHOD_BY_AXIS()
60   {
61     static const std::string MY_CREATION_METHOD_ID("ByAxis");
62     return MY_CREATION_METHOD_ID;
63   }
64
65   /// Attribute name for creation method "ByPlane".
66   inline static const std::string& CREATION_METHOD_BY_PLANE()
67   {
68     static const std::string MY_CREATION_METHOD_ID("ByPlane");
69     return MY_CREATION_METHOD_ID;
70   }
71
72   /// Attribute name of referenced objects.
73   inline static const std::string& OBJECTS_LIST_ID()
74   {
75     static const std::string MY_OBJECTS_LIST_ID("main_objects");
76     return MY_OBJECTS_LIST_ID;
77   }
78
79   /// Attribute name of a point.
80   inline static const std::string& POINT_OBJECT_ID()
81   {
82     static const std::string MY_POINT_OBJECT_ID("point_object");
83     return MY_POINT_OBJECT_ID;
84   }
85
86   /// Attribute name of an axis.
87   inline static const std::string& AXIS_OBJECT_ID()
88   {
89     static const std::string MY_AXIS_OBJECT_ID("axis_object");
90     return MY_AXIS_OBJECT_ID;
91   }
92
93   /// Attribute name of a plane.
94   inline static const std::string& PLANE_OBJECT_ID()
95   {
96     static const std::string MY_PLANE_OBJECT_ID("plane_object");
97     return MY_PLANE_OBJECT_ID;
98   }
99
100   /// \return the kind of a feature.
101   FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
102   {
103     static std::string MY_KIND = FeaturesPlugin_Symmetry::ID();
104     return MY_KIND;
105   }
106
107   /// Creates a new part document if needed.
108   FEATURESPLUGIN_EXPORT virtual void execute();
109
110   /// Request for initialization of data model of the feature: adding all attributes.
111   FEATURESPLUGIN_EXPORT virtual void initAttributes();
112
113   /// Use plugin manager for features creation.
114   FeaturesPlugin_Symmetry();
115
116 private:
117   /// Perform symmetry with respect to a point.
118   void performSymmetryByPoint();
119
120   /// Perform symmetry with respect to an axis.
121   void performSymmetryByAxis();
122
123   /// Perform symmetry with respect to a plane.
124   void performSymmetryByPlane();
125
126   /// Perform the naming
127   void loadNamingDS(GeomAlgoAPI_Symmetry& theSymmetryAlgo,
128                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
129                     std::shared_ptr<GeomAPI_Shape> theBaseShape);
130 };
131
132 #endif // FEATURESPLUGIN_SYMMETRY_H_