1 // Copyright (C) 2014-2020 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
20 #ifndef FeaturesAPI_Translation_H_
21 #define FeaturesAPI_Translation_H_
23 #include "FeaturesAPI.h"
25 #include <FeaturesPlugin_Translation.h>
27 #include <ModelHighAPI_Double.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30 #include <ModelHighAPI_Selection.h>
32 class ModelHighAPI_Dumper;
34 /// \class FeaturesAPI_Translation
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Translation feature.
37 class FeaturesAPI_Translation: public ModelHighAPI_Interface
40 /// Constructor without values.
42 explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature);
44 /// Constructor with values.
46 explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47 const std::list<ModelHighAPI_Selection>& theMainObjects,
48 const ModelHighAPI_Selection& theAxisObject,
49 const ModelHighAPI_Double& theDistance);
51 /// Constructor with values.
53 explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
54 const std::list<ModelHighAPI_Selection>& theMainObjects,
55 const ModelHighAPI_Double& theDx,
56 const ModelHighAPI_Double& theDy,
57 const ModelHighAPI_Double& theDz);
59 /// Constructor with values.
61 explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature,
62 const std::list<ModelHighAPI_Selection>& theMainObjects,
63 const ModelHighAPI_Selection& theStartPoint,
64 const ModelHighAPI_Selection& theEndPoint);
68 virtual ~FeaturesAPI_Translation();
70 INTERFACE_9(FeaturesPlugin_Translation::ID(),
71 creationMethod, FeaturesPlugin_Translation::CREATION_METHOD(),
72 ModelAPI_AttributeString, /** Creation method */,
73 mainObjects, FeaturesPlugin_Translation::OBJECTS_LIST_ID(),
74 ModelAPI_AttributeSelectionList, /** Main objects */,
75 axisObject, FeaturesPlugin_Translation::AXIS_OBJECT_ID(),
76 ModelAPI_AttributeSelection, /** Axis object */,
77 distance, FeaturesPlugin_Translation::DISTANCE_ID(),
78 ModelAPI_AttributeDouble, /** Distance */,
79 dx, FeaturesPlugin_Translation::DX_ID(),
80 ModelAPI_AttributeDouble, /** Dimension in X */,
81 dy, FeaturesPlugin_Translation::DY_ID(),
82 ModelAPI_AttributeDouble, /** Dimension in Y */,
83 dz, FeaturesPlugin_Translation::DZ_ID(),
84 ModelAPI_AttributeDouble, /** Dimension in Z */,
85 startPoint, FeaturesPlugin_Translation::START_POINT_ID(),
86 ModelAPI_AttributeSelection, /** Start point object */,
87 endPoint, FeaturesPlugin_Translation::END_POINT_ID(),
88 ModelAPI_AttributeSelection, /** End point object */
93 void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
95 /// Modify CreationMethod, axis_object, distance attributes of the feature.
97 void setAxisAndDistance(const ModelHighAPI_Selection& theAxisObject,
98 const ModelHighAPI_Double& theDistance);
100 /// Modify CreationMethod, dx, dy, dz attributes of the feature.
102 void setDimensions(const ModelHighAPI_Double& theDx,
103 const ModelHighAPI_Double& theDy,
104 const ModelHighAPI_Double& theDz);
106 /// Modify CreationMethod, start_point, end_point attributes of the feature.
108 void setPoints(const ModelHighAPI_Selection& theStartPoint,
109 const ModelHighAPI_Selection& theEndPoint);
111 /// Dump wrapped feature
113 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
116 /// Pointer on Translation object.
117 typedef std::shared_ptr<FeaturesAPI_Translation> TranslationPtr;
119 #define DUMMY std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>()
121 /// \ingroup CPPHighAPI
122 /// \brief Create Translation feature.
123 FEATURESAPI_EXPORT TranslationPtr addTranslation(
124 const std::shared_ptr<ModelAPI_Document>& part,
125 const std::list<ModelHighAPI_Selection>& objects,
126 const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated1 = DUMMY,
127 const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated2 = DUMMY,
128 const std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>& deprecated3 = DUMMY,
129 const ModelHighAPI_Selection& axis = ModelHighAPI_Selection(),
130 const ModelHighAPI_Double& distance = ModelHighAPI_Double(0.0),
131 const std::list<ModelHighAPI_Double>& vector = std::list<ModelHighAPI_Double>(),
132 const ModelHighAPI_Selection& startPoint = ModelHighAPI_Selection(),
133 const ModelHighAPI_Selection& endPoint = ModelHighAPI_Selection(),
134 const bool keepSubResults = false );
136 #endif // FeaturesAPI_Translation_H_