1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
20 #ifndef FEATURESPLUGIN_SYMMETRY_H_
21 #define FEATURESPLUGIN_SYMMETRY_H_
23 #include <FeaturesPlugin.h>
25 #include <ModelAPI_Feature.h>
27 #include <GeomAlgoAPI_Symmetry.h>
29 /** \class FeaturesPlugin_Symmetry
31 * \brief Feature that performs reflection with respect to a point, axis, or plane.
33 class FeaturesPlugin_Symmetry : public ModelAPI_Feature
37 inline static const std::string& ID()
39 static const std::string MY_SYMMETRY_ID("Symmetry");
40 return MY_SYMMETRY_ID;
43 /// Attribute name for creation method.
44 inline static const std::string& CREATION_METHOD()
46 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
47 return MY_CREATION_METHOD_ID;
50 /// Attribute name for creation method "ByPoint".
51 inline static const std::string& CREATION_METHOD_BY_POINT()
53 static const std::string MY_CREATION_METHOD_ID("ByPoint");
54 return MY_CREATION_METHOD_ID;
57 /// Attribute name for creation method "ByAxis".
58 inline static const std::string& CREATION_METHOD_BY_AXIS()
60 static const std::string MY_CREATION_METHOD_ID("ByAxis");
61 return MY_CREATION_METHOD_ID;
64 /// Attribute name for creation method "ByPlane".
65 inline static const std::string& CREATION_METHOD_BY_PLANE()
67 static const std::string MY_CREATION_METHOD_ID("ByPlane");
68 return MY_CREATION_METHOD_ID;
71 /// Attribute name of referenced objects.
72 inline static const std::string& OBJECTS_LIST_ID()
74 static const std::string MY_OBJECTS_LIST_ID("main_objects");
75 return MY_OBJECTS_LIST_ID;
78 /// Attribute name of a point.
79 inline static const std::string& POINT_OBJECT_ID()
81 static const std::string MY_POINT_OBJECT_ID("point_object");
82 return MY_POINT_OBJECT_ID;
85 /// Attribute name of an axis.
86 inline static const std::string& AXIS_OBJECT_ID()
88 static const std::string MY_AXIS_OBJECT_ID("axis_object");
89 return MY_AXIS_OBJECT_ID;
92 /// Attribute name of a plane.
93 inline static const std::string& PLANE_OBJECT_ID()
95 static const std::string MY_PLANE_OBJECT_ID("plane_object");
96 return MY_PLANE_OBJECT_ID;
99 /// \return the kind of a feature.
100 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
102 static std::string MY_KIND = FeaturesPlugin_Symmetry::ID();
106 /// Creates a new part document if needed.
107 FEATURESPLUGIN_EXPORT virtual void execute();
109 /// Request for initialization of data model of the feature: adding all attributes.
110 FEATURESPLUGIN_EXPORT virtual void initAttributes();
112 /// Use plugin manager for features creation.
113 FeaturesPlugin_Symmetry();
116 /// Perform symmetry with respect to a point.
117 void performSymmetryByPoint();
119 /// Perform symmetry with respect to an axis.
120 void performSymmetryByAxis();
122 /// Perform symmetry with respect to a plane.
123 void performSymmetryByPlane();
125 /// Perform the naming
126 void loadNamingDS(GeomAlgoAPI_Symmetry& theSymmetryAlgo,
127 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
128 std::shared_ptr<GeomAPI_Shape> theBaseShape);
131 #endif // FEATURESPLUGIN_SYMMETRY_H_