1 // Copyright (C) 2014-201x CEA/DEN, EDF R&D
3 // File: FeaturesPlugin_Scale.h
4 // Created: 13 Jan 2017
5 // Author: Clarisse Genrault (CEA)
7 #ifndef FEATURESPLUGIN_SCALE_H_
8 #define FEATURESPLUGIN_SCALE_H_
10 #include <FeaturesPlugin.h>
12 #include <ModelAPI_Feature.h>
14 #include <GeomAlgoAPI_Scale.h>
16 /** \class FeaturesPlugin_Scale
18 * \brief Feature for changing the scale of an object.
20 class FeaturesPlugin_Scale : public ModelAPI_Feature
24 inline static const std::string& ID()
26 static const std::string MY_SCALE_ID("Scale");
30 /// Attribute name for creation method.
31 inline static const std::string& CREATION_METHOD()
33 static const std::string MY_CREATION_METHOD_ID("CreationMethod");
34 return MY_CREATION_METHOD_ID;
37 /// Attribute name for creation method "ByFactor".
38 inline static const std::string& CREATION_METHOD_BY_FACTOR()
40 static const std::string MY_CREATION_METHOD_ID("ByFactor");
41 return MY_CREATION_METHOD_ID;
44 /// Attribute name for creation method "ByFactor".
45 inline static const std::string& CREATION_METHOD_BY_DIMENSIONS()
47 static const std::string MY_CREATION_METHOD_ID("ByDimensions");
48 return MY_CREATION_METHOD_ID;
51 /// Attribute name of referenced objects.
52 inline static const std::string& OBJECTS_LIST_ID()
54 static const std::string MY_OBJECTS_LIST_ID("main_objects");
55 return MY_OBJECTS_LIST_ID;
58 /// Attribute name of center point.
59 inline static const std::string& CENTER_POINT_ID()
61 static const std::string MY_CENTER_POINT_ID("center_point");
62 return MY_CENTER_POINT_ID;
65 /// Attribute name of scale factor.
66 inline static const std::string& SCALE_FACTOR_ID()
68 static const std::string MY_SCALE_FACTOR_ID("scale_factor");
69 return MY_SCALE_FACTOR_ID;
72 /// Attribute name of scale factor in X.
73 inline static const std::string& SCALE_FACTOR_X_ID()
75 static const std::string MY_SCALE_FACTOR_X_ID("scale_factor_x");
76 return MY_SCALE_FACTOR_X_ID;
79 /// Attribute name of scale factor in Y.
80 inline static const std::string& SCALE_FACTOR_Y_ID()
82 static const std::string MY_SCALE_FACTOR_Y_ID("scale_factor_y");
83 return MY_SCALE_FACTOR_Y_ID;
86 /// Attribute name of scale factor in Z.
87 inline static const std::string& SCALE_FACTOR_Z_ID()
89 static const std::string MY_SCALE_FACTOR_Z_ID("scale_factor_z");
90 return MY_SCALE_FACTOR_Z_ID;
93 /// \return the kind of a feature.
94 FEATURESPLUGIN_EXPORT virtual const std::string& getKind()
96 static std::string MY_KIND = FeaturesPlugin_Scale::ID();
100 /// Creates a new part document if needed.
101 FEATURESPLUGIN_EXPORT virtual void execute();
103 /// Request for initialization of data model of the feature: adding all attributes.
104 FEATURESPLUGIN_EXPORT virtual void initAttributes();
106 /// Use plugin manager for features creation.
107 FeaturesPlugin_Scale();
110 /// Perform scale using a central point and a value of the scale.
111 void performScaleByFactor();
113 /// Perform symmetry using a central point and three dimensions
114 void performScaleByDimensions();
116 /// Perform the naming
117 void loadNamingDS(GeomAlgoAPI_Scale& theScaleAlgo,
118 std::shared_ptr<ModelAPI_ResultBody> theResultBody,
119 std::shared_ptr<GeomAPI_Shape> theBaseShape);
122 #endif // FEATURESPLUGIN_SCALE_H_