1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef FEATURESPLUGIN_SCALE_H_
22 #define FEATURESPLUGIN_SCALE_H_
24 #include <FeaturesPlugin.h>
26 #include <ModelAPI_Feature.h>
28 #include <GeomAlgoAPI_Scale.h>
30 /** \class FeaturesPlugin_Scale
32 * \brief Feature for changing the scale of an object.
34 class FeaturesPlugin_Scale : public ModelAPI_Feature
38 inline static const std::string& ID()
40 static const std::string MY_SCALE_ID("Scale");
44 /// Attribute name for creation method.
45 inline static const std::string& CREATION_METHOD()
47 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
48 return MY_CREATION_METHOD_ID;
51 /// Attribute name for creation method "ByFactor".
52 inline static const std::string& CREATION_METHOD_BY_FACTOR()
54 static const std::string MY_CREATION_METHOD_ID("ByFactor");
55 return MY_CREATION_METHOD_ID;
58 /// Attribute name for creation method "ByFactor".
59 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
61 static const std::string MY_CREATION_METHOD_ID("ByDimensions");
62 return MY_CREATION_METHOD_ID;
65 /// Attribute name of referenced objects.
66 inline static const std::string& OBJECTS_LIST_ID()
68 static const std::string MY_OBJECTS_LIST_ID("main_objects");
69 return MY_OBJECTS_LIST_ID;
72 /// Attribute name of center point.
73 inline static const std::string& CENTER_POINT_ID()
75 static const std::string MY_CENTER_POINT_ID("center_point");
76 return MY_CENTER_POINT_ID;
79 /// Attribute name of scale factor.
80 inline static const std::string& SCALE_FACTOR_ID()
82 static const std::string MY_SCALE_FACTOR_ID("scale_factor");
83 return MY_SCALE_FACTOR_ID;
86 /// Attribute name of scale factor in X.
87 inline static const std::string& SCALE_FACTOR_X_ID()
89 static const std::string MY_SCALE_FACTOR_X_ID("scale_factor_x");
90 return MY_SCALE_FACTOR_X_ID;
93 /// Attribute name of scale factor in Y.
94 inline static const std::string& SCALE_FACTOR_Y_ID()
96 static const std::string MY_SCALE_FACTOR_Y_ID("scale_factor_y");
97 return MY_SCALE_FACTOR_Y_ID;
100 /// Attribute name of scale factor in Z.
101 inline static const std::string& SCALE_FACTOR_Z_ID()
103 static const std::string MY_SCALE_FACTOR_Z_ID("scale_factor_z");
104 return MY_SCALE_FACTOR_Z_ID;
107 /// \return the kind of a feature.
108 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
110 static std::string MY_KIND = FeaturesPlugin_Scale::ID();
114 /// Creates a new part document if needed.
115 FEATURESPLUGIN_EXPORT virtual void execute();
117 /// Request for initialization of data model of the feature: adding all attributes.
118 FEATURESPLUGIN_EXPORT virtual void initAttributes();
120 /// Use plugin manager for features creation.
121 FeaturesPlugin_Scale();
124 /// Perform scale using a central point and a value of the scale.
125 void performScaleByFactor();
127 /// Perform symmetry using a central point and three dimensions
128 void performScaleByDimensions();
130 /// Perform the naming
131 void loadNamingDS(GeomAlgoAPI_Scale& theScaleAlgo,
132 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
133 std::shared_ptr<GeomAPI_Shape> theBaseShape);
136 #endif // FEATURESPLUGIN_SCALE_H_