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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef FeaturesPlugin_Rotation_H_
22 #define FeaturesPlugin_Rotation_H_
24 #include <FeaturesPlugin.h>
26 #include <ModelAPI_Feature.h>
28 #include <GeomAlgoAPI_Rotation.h>
30 /// \class FeaturesPlugin_Rotation
32 /// \brief Feature for rotation objects around the axis.
33 class FeaturesPlugin_Rotation : public ModelAPI_Feature
37 inline static const std::string& ID()
39 static const std::string MY_ROTATION_ID("Rotation");
40 return MY_ROTATION_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 "ByAxisAndAngle".
51 inline static const std::string& CREATION_METHOD_BY_ANGLE()
53 static const std::string MY_CREATION_METHOD_ID("ByAxisAndAngle");
54 return MY_CREATION_METHOD_ID;
57 /// Attribute name for creation method "ByThreePoints".
58 inline static const std::string& CREATION_METHOD_BY_THREE_POINTS()
60 static const std::string MY_CREATION_METHOD_ID("ByThreePoints");
61 return MY_CREATION_METHOD_ID;
64 /// Attribute name of referenced objects.
65 inline static const std::string& OBJECTS_LIST_ID()
67 static const std::string MY_OBJECTS_LIST_ID("main_objects");
68 return MY_OBJECTS_LIST_ID;
71 /// Attribute name of an axis.
72 inline static const std::string& AXIS_OBJECT_ID()
74 static const std::string MY_AXIS_OBJECT_ID("axis_object");
75 return MY_AXIS_OBJECT_ID;
78 /// Attribute name of angle.
79 inline static const std::string& ANGLE_ID()
81 static const std::string MY_ANGLE_ID("angle");
85 /// Attribute name of a center point.
86 inline static const std::string& CENTER_POINT_ID()
88 static const std::string MY_CENTER_POINT_ID("center_point");
89 return MY_CENTER_POINT_ID;
92 /// Attribute name of a center point.
93 inline static const std::string& START_POINT_ID()
95 static const std::string MY_START_POINT_ID("start_point");
96 return MY_START_POINT_ID;
99 /// Attribute name of a center point.
100 inline static const std::string& END_POINT_ID()
102 static const std::string MY_END_POINT_ID("end_point");
103 return MY_END_POINT_ID;
106 /// \return the kind of a feature.
107 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
109 static std::string MY_KIND = FeaturesPlugin_Rotation::ID();
113 /// Creates a new part document if needed.
114 FEATURESPLUGIN_EXPORT virtual void execute();
116 /// Request for initialization of data model of the feature: adding all attributes.
117 FEATURESPLUGIN_EXPORT virtual void initAttributes();
119 /// Use plugin manager for features creation.
120 FeaturesPlugin_Rotation();
123 ///Perform the rotation using an axis and an angle.
124 void performTranslationByAxisAndAngle();
126 ///Perform the rotation using a center and two points.
127 void performTranslationByThreePoints();
129 void loadNamingDS(GeomAlgoAPI_Rotation& theRotaionAlgo,
130 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
131 std::shared_ptr<GeomAPI_Shape> theBaseShape);