SHAPER 9.16.0
FeaturesPlugin_Translation.h
1// Copyright (C) 2014-2026 CEA, EDF
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 email : webmaster.salome@opencascade.com
18//
19
20#ifndef FeaturesPlugin_Translation_H_
21#define FeaturesPlugin_Translation_H_
22
23#include <FeaturesPlugin.h>
24
25#include <ModelAPI_Feature.h>
26
27class GeomAPI_Trsf;
28
33{
34 public:
36 inline static const std::string& ID()
37 {
38 static const std::string MY_TRANSLATION_ID("Translation");
39 return MY_TRANSLATION_ID;
40 }
41
43 inline static const std::string& CREATION_METHOD()
44 {
45 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
46 return MY_CREATION_METHOD_ID;
47 }
48
50 inline static const std::string& CREATION_METHOD_BY_DISTANCE()
51 {
52 static const std::string MY_CREATION_METHOD_ID("ByAxisAndDistance");
53 return MY_CREATION_METHOD_ID;
54 }
55
57 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
58 {
59 static const std::string MY_CREATION_METHOD_ID("ByDimensions");
60 return MY_CREATION_METHOD_ID;
61 }
62
64 inline static const std::string& CREATION_METHOD_BY_TWO_POINTS()
65 {
66 static const std::string MY_CREATION_METHOD_ID("ByTwoPoints");
67 return MY_CREATION_METHOD_ID;
68 }
69
71 inline static const std::string& OBJECTS_LIST_ID()
72 {
73 static const std::string MY_OBJECTS_LIST_ID("main_objects");
74 return MY_OBJECTS_LIST_ID;
75 }
76
78 inline static const std::string& AXIS_OBJECT_ID()
79 {
80 static const std::string MY_AXIS_OBJECT_ID("axis_object");
81 return MY_AXIS_OBJECT_ID;
82 }
83
85 inline static const std::string& DISTANCE_ID()
86 {
87 static const std::string MY_DISTANCE_ID("distance");
88 return MY_DISTANCE_ID;
89 }
90
92 inline static const std::string& DX_ID()
93 {
94 static const std::string MY_DX_ID("dx");
95 return MY_DX_ID;
96 }
97
99 inline static const std::string& DY_ID()
100 {
101 static const std::string MY_DY_ID("dy");
102 return MY_DY_ID;
103 }
104
106 inline static const std::string& DZ_ID()
107 {
108 static const std::string MY_DZ_ID("dz");
109 return MY_DZ_ID;
110 }
111
113 inline static const std::string& START_POINT_ID()
114 {
115 static const std::string MY_START_POINT_ID("start_point");
116 return MY_START_POINT_ID;
117 }
118
120 inline static const std::string& END_POINT_ID()
121 {
122 static const std::string MY_END_POINT_ID("end_point");
123 return MY_END_POINT_ID;
124 }
125
127 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
128 {
129 static std::string MY_KIND = FeaturesPlugin_Translation::ID();
130 return MY_KIND;
131 }
132
134 FEATURESPLUGIN_EXPORT virtual void execute();
135
137 FEATURESPLUGIN_EXPORT virtual void initAttributes();
138
141
142private:
144 std::shared_ptr<GeomAPI_Trsf> translationByAxisAndDistance();
145
147 std::shared_ptr<GeomAPI_Trsf> translationByDimensions();
148
150 std::shared_ptr<GeomAPI_Trsf> translationByTwoPoints();
151
153 void performTranslation(const std::shared_ptr<GeomAPI_Trsf>& theTrsf);
154};
155
156#endif
Feature for translation objects along the axis.
Definition: FeaturesPlugin_Translation.h:33
virtual FEATURESPLUGIN_EXPORT void execute()
Performs the algorithm and stores results it in the data structure.
Definition: FeaturesPlugin_Translation.cpp:86
static const std::string & ID()
Translation kind.
Definition: FeaturesPlugin_Translation.h:36
static const std::string & OBJECTS_LIST_ID()
Attribute name of referenced objects.
Definition: FeaturesPlugin_Translation.h:71
static const std::string & END_POINT_ID()
Attribute name of end point.
Definition: FeaturesPlugin_Translation.h:120
virtual FEATURESPLUGIN_EXPORT const std::string & getKind()
Definition: FeaturesPlugin_Translation.h:127
static const std::string & CREATION_METHOD_BY_DIMENSIONS()
Attribute name for creation method "ByDimensions".
Definition: FeaturesPlugin_Translation.h:57
static const std::string & DY_ID()
Attribute name of dimension in Y.
Definition: FeaturesPlugin_Translation.h:99
static const std::string & CREATION_METHOD()
Attribute name for creation method.
Definition: FeaturesPlugin_Translation.h:43
FeaturesPlugin_Translation()
Use plugin manager for features creation.
Definition: FeaturesPlugin_Translation.cpp:48
static const std::string & CREATION_METHOD_BY_DISTANCE()
Attribute name for creation method "ByAxisAndDistance".
Definition: FeaturesPlugin_Translation.h:50
virtual FEATURESPLUGIN_EXPORT void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: FeaturesPlugin_Translation.cpp:53
static const std::string & START_POINT_ID()
Attribute name of start point.
Definition: FeaturesPlugin_Translation.h:113
static const std::string & AXIS_OBJECT_ID()
Attribute name of an axis.
Definition: FeaturesPlugin_Translation.h:78
static const std::string & DISTANCE_ID()
Attribute name of distance.
Definition: FeaturesPlugin_Translation.h:85
static const std::string & DZ_ID()
Attribute name of dimension in Z.
Definition: FeaturesPlugin_Translation.h:106
static const std::string & DX_ID()
Attribute name of dimension in X.
Definition: FeaturesPlugin_Translation.h:92
static const std::string & CREATION_METHOD_BY_TWO_POINTS()
Attribute name for creation method "ByTwoPoints".
Definition: FeaturesPlugin_Translation.h:64
Keep the transformation matrix coefficients.
Definition: GeomAPI_Trsf.h:36
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41