Salome HOME
db61f9a7fa4ad1335976a9ab00117629fd43dab7
[modules/shaper.git] / src / FeaturesAPI / FeaturesAPI_Scale.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
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_SCALE_H_
21 #define FEATURESAPI_SCALE_H_
22
23 #include "FeaturesAPI.h"
24
25 #include <FeaturesPlugin_Scale.h>
26
27 #include <ModelHighAPI_Double.h>
28 #include <ModelHighAPI_Interface.h>
29 #include <ModelHighAPI_Macro.h>
30
31 class ModelHighAPI_Dumper;
32 class ModelHighAPI_Selection;
33
34 /// \class FeaturesAPI_Scale
35 /// \ingroup CPPHighAPI
36 /// \brief Interface for Scale feature.
37 class FeaturesAPI_Scale: public ModelHighAPI_Interface
38 {
39 public:
40   /// Constructor without values.
41   FEATURESAPI_EXPORT
42   explicit FeaturesAPI_Scale(const std::shared_ptr<ModelAPI_Feature>& theFeature);
43
44   /// Constructor with values.
45   FEATURESAPI_EXPORT
46   explicit FeaturesAPI_Scale(const std::shared_ptr<ModelAPI_Feature>& theFeature,
47                              const std::list<ModelHighAPI_Selection>& theMainObjects,
48                              const ModelHighAPI_Selection& theCenterPoint,
49                              const ModelHighAPI_Double& theScaleFactor);
50
51   /// Constructor with values.
52   FEATURESAPI_EXPORT
53   explicit FeaturesAPI_Scale(const std::shared_ptr<ModelAPI_Feature>& theFeature,
54                              const std::list<ModelHighAPI_Selection>& theMainObjects,
55                              const ModelHighAPI_Selection& theCenterPoint,
56                              const ModelHighAPI_Double& theScaleFactorX,
57                              const ModelHighAPI_Double& theScaleFactorY,
58                              const ModelHighAPI_Double& theScaleFactorZ);
59
60   /// Destructor.
61   FEATURESAPI_EXPORT
62   virtual ~FeaturesAPI_Scale();
63
64   INTERFACE_7(FeaturesPlugin_Scale::ID(),
65               creationMethod, FeaturesPlugin_Scale::CREATION_METHOD(),
66               ModelAPI_AttributeString, /** Creation method */,
67               mainObjects, FeaturesPlugin_Scale::OBJECTS_LIST_ID(),
68               ModelAPI_AttributeSelectionList, /** Main objects */,
69               centerPoint, FeaturesPlugin_Scale::CENTER_POINT_ID(),
70               ModelAPI_AttributeSelection, /** Center point */,
71               scaleFactor, FeaturesPlugin_Scale::SCALE_FACTOR_ID(),
72               ModelAPI_AttributeDouble, /** Scale factor */,
73               scaleFactorX, FeaturesPlugin_Scale::SCALE_FACTOR_X_ID(),
74               ModelAPI_AttributeDouble, /** Scale factor in X */,
75               scaleFactorY, FeaturesPlugin_Scale::SCALE_FACTOR_Y_ID(),
76               ModelAPI_AttributeDouble, /** Scale factor in Y */,
77               scaleFactorZ, FeaturesPlugin_Scale::SCALE_FACTOR_Z_ID(),
78               ModelAPI_AttributeDouble, /** Scale factor in Z */)
79
80   /// Set main objects.
81   FEATURESAPI_EXPORT
82   void setMainObjects(const std::list<ModelHighAPI_Selection>& theMainObjects);
83
84   /// Modify center_point attribute of the feature.
85   FEATURESAPI_EXPORT
86   void setCenterPoint(const ModelHighAPI_Selection& theCenterPoint);
87
88   /// Modify Creation Method and scale_factor attribute of the feature.
89   FEATURESAPI_EXPORT
90   void setScaleFactor(const ModelHighAPI_Double& theScaleFactor);
91
92   /// Modify Creation Method and scale_factor_x, scale_factor_y and scale_factor_z
93   /// attributes of the feature.
94   FEATURESAPI_EXPORT
95   void setDimensions(const ModelHighAPI_Double& theScaleFactorX,
96                      const ModelHighAPI_Double& theScaleFactorY,
97                      const ModelHighAPI_Double& theScaleFactorZ);
98
99   /// Dump wrapped feature
100   FEATURESAPI_EXPORT
101   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
102 };
103
104 /// Pointer on Scale object.
105 typedef std::shared_ptr<FeaturesAPI_Scale> ScalePtr;
106
107 /// \ingroup CPPHighAPI
108 /// \brief Create Scale feature.
109 FEATURESAPI_EXPORT
110 ScalePtr addScale(const std::shared_ptr<ModelAPI_Document>& thePart,
111                   const std::list<ModelHighAPI_Selection>& theMainObjects,
112                   const ModelHighAPI_Selection& theCenterPoint,
113                   const ModelHighAPI_Double& theScaleFactorX,
114                   const ModelHighAPI_Double& theScaleFactorY = ModelHighAPI_Double(0.0),
115                   const ModelHighAPI_Double& theScaleFactorZ = ModelHighAPI_Double(0.0),
116                   const bool keepSubResults = false);
117
118 #endif // FEATURESAPI_SCALE_H_