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 of referenced objects.
53 inline static const std::string& OBJECTS_LIST_ID()
55 static const std::string MY_OBJECTS_LIST_ID("main_objects");
56 return MY_OBJECTS_LIST_ID;
59 /// Attribute name of an axis.
60 inline static const std::string& AXIS_OBJECT_ID()
62 static const std::string MY_AXIS_OBJECT_ID("axis_object");
63 return MY_AXIS_OBJECT_ID;
66 /// Attribute name of distance.
67 inline static const std::string& DISTANCE_ID()
69 static const std::string MY_DISTANCE_ID("distance");
70 return MY_DISTANCE_ID;
73 /// Attribute name of dimension in X.
74 inline static const std::string& DX_ID()
76 static const std::string MY_DX_ID("dx");
80 /// Attribute name of dimension in Y.
81 inline static const std::string& DY_ID()
83 static const std::string MY_DY_ID("dy");
87 /// Attribute name of dimension in Z.
88 inline static const std::string& DZ_ID()
90 static const std::string MY_DZ_ID("dz");
94 /// \return the kind of a feature.
95 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
97 static std::string MY_KIND = FeaturesPlugin_Translation::ID();
101 /// Creates a new part document if needed.
102 FEATURESPLUGIN_EXPORT virtual void execute();
104 /// Request for initialization of data model of the feature: adding all attributes.
105 FEATURESPLUGIN_EXPORT virtual void initAttributes();
107 /// Use plugin manager for features creation.
108 FeaturesPlugin_Translation();
111 ///Perform the translation using an axis and a distance.
112 void performTranslationByAxisAndDistance();
114 ///Perform the translation using three dimensions X, Y and Z
115 void performTranslationByDimensions();
117 void loadNamingDS(GeomAlgoAPI_Translation& theTranslationAlgo,
118 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
119 std::shared_ptr<GeomAPI_Shape> theBaseShape);