Salome HOME
Updated copyright comment
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Translation.h
1 // Copyright (C) 2014-2024  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 FeaturesAPI_Translation_H_
21 #define FeaturesAPI_Translation_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Translation.h>
26
27 #include <ModelHighAPI_Double.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30 #include <ModelHighAPI_Selection.h>
31
32 class ModelHighAPI_Dumper;
33
34 /// \class FeaturesAPI_Translation
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Translation feature.
37 class FeaturesAPI_Translation: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   FEATURESAPI_EXPORT
42   explicit FeaturesAPI_Translation(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   FEATURESAPI_EXPORT
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);
50
51   /// Constructor with values.
52   FEATURESAPI_EXPORT
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);
58
59   /// Constructor with values.
60   FEATURESAPI_EXPORT
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);
65
66   /// Destructor.
67   FEATURESAPI_EXPORT
68   virtual ~FeaturesAPI_Translation();
69
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 */
89              )
90
91   /// Set main objects.
92   FEATURESAPI_EXPORT
93   void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
94
95   /// Modify CreationMethod, axis_object, distance attributes of the feature.
96   FEATURESAPI_EXPORT
97   void setAxisAndDistance(const ModelHighAPI_Selection& theAxisObject,
98                           const ModelHighAPI_Double& theDistance);
99
100   /// Modify CreationMethod, dx, dy, dz attributes of the feature.
101   FEATURESAPI_EXPORT
102   void setDimensions(const ModelHighAPI_Double& theDx,
103                      const ModelHighAPI_Double& theDy,
104                      const ModelHighAPI_Double& theDz);
105
106   /// Modify CreationMethod, start_point, end_point attributes of the feature.
107   FEATURESAPI_EXPORT
108   void setPoints(const ModelHighAPI_Selection& theStartPoint,
109                  const ModelHighAPI_Selection& theEndPoint);
110
111   /// Dump wrapped feature
112   FEATURESAPI_EXPORT
113   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
114 };
115
116 /// Pointer on Translation object.
117 typedef std::shared_ptr<FeaturesAPI_Translation> TranslationPtr;
118
119 #define DUMMY std::pair<ModelHighAPI_Selection, ModelHighAPI_Double>()
120
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 );
135
136 #endif // FeaturesAPI_Translation_H_