1 // Copyright (C) 2014-2016 CEA/DEN, EDF R&D
3 // File: FeaturesPlugin_Translation.h
4 // Created: 8 June 2015
5 // Author: Dmitry Bobylev
7 // Modified by Clarisse Genrault (CEA) : 17 Nov 2016
9 #ifndef FeaturesPlugin_Translation_H_
10 #define FeaturesPlugin_Translation_H_
12 #include <FeaturesPlugin.h>
14 #include <ModelAPI_Feature.h>
16 #include <GeomAlgoAPI_Translation.h>
18 /// \class FeaturesPlugin_Translation
20 /// \brief Feature for translation objects along the axis.
21 class FeaturesPlugin_Translation : public ModelAPI_Feature
25 inline static const std::string& ID()
27 static const std::string MY_TRANSLATION_ID("Translation");
28 return MY_TRANSLATION_ID;
31 /// Attribute name for creation method.
32 inline static const std::string& CREATION_METHOD()
34 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
35 return MY_CREATION_METHOD_ID;
38 /// Attribute name for creation method "ByAxisAndDistance".
39 inline static const std::string& CREATION_METHOD_BY_DISTANCE()
41 static const std::string MY_CREATION_METHOD_ID("ByAxisAndDistance");
42 return MY_CREATION_METHOD_ID;
45 /// Attribute name for creation method "ByDimensions".
46 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
48 static const std::string MY_CREATION_METHOD_ID("ByDimensions");
49 return MY_CREATION_METHOD_ID;
52 /// Attribute name for creation method "ByTwoPoints".
53 inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
55 static const std::string MY_CREATION_METHOD_ID("ByTwoPoints");
56 return MY_CREATION_METHOD_ID;
59 /// Attribute name of referenced objects.
60 inline static const std::string& OBJECTS_LIST_ID()
62 static const std::string MY_OBJECTS_LIST_ID("main_objects");
63 return MY_OBJECTS_LIST_ID;
66 /// Attribute name of an axis.
67 inline static const std::string& AXIS_OBJECT_ID()
69 static const std::string MY_AXIS_OBJECT_ID("axis_object");
70 return MY_AXIS_OBJECT_ID;
73 /// Attribute name of distance.
74 inline static const std::string& DISTANCE_ID()
76 static const std::string MY_DISTANCE_ID("distance");
77 return MY_DISTANCE_ID;
80 /// Attribute name of dimension in X.
81 inline static const std::string& DX_ID()
83 static const std::string MY_DX_ID("dx");
87 /// Attribute name of dimension in Y.
88 inline static const std::string& DY_ID()
90 static const std::string MY_DY_ID("dy");
94 /// Attribute name of dimension in Z.
95 inline static const std::string& DZ_ID()
97 static const std::string MY_DZ_ID("dz");
101 /// Attribute name of start point.
102 inline static const std::string& START_POINT_ID()
104 static const std::string MY_START_POINT_ID("start_point");
105 return MY_START_POINT_ID;
108 /// Attribute name of end point.
109 inline static const std::string& END_POINT_ID()
111 static const std::string MY_END_POINT_ID("end_point");
112 return MY_END_POINT_ID;
115 /// \return the kind of a feature.
116 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
118 static std::string MY_KIND = FeaturesPlugin_Translation::ID();
122 /// Creates a new part document if needed.
123 FEATURESPLUGIN_EXPORT virtual void execute();
125 /// Request for initialization of data model of the feature: adding all attributes.
126 FEATURESPLUGIN_EXPORT virtual void initAttributes();
128 /// Use plugin manager for features creation.
129 FeaturesPlugin_Translation();
132 ///Perform the translation using an axis and a distance.
133 void performTranslationByAxisAndDistance();
135 ///Perform the translation using three dimensions X, Y and Z
136 void performTranslationByDimensions();
138 ///Perform the translation usind two points
139 void performTranslationByTwoPoints();
141 void loadNamingDS(GeomAlgoAPI_Translation& theTranslationAlgo,
142 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
143 std::shared_ptr<GeomAPI_Shape> theBaseShape);