Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Scale.h
1 // Copyright (C) 2014-201x CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Scale.h
4 // Created:     23 Jan 2017
5 // Author:      Clarisse Genrault (CEA)
6
7 #ifndef GEOMALGOAPI_SCALE_H_
8 #define GEOMALGOAPI_SCALE_H_
9
10 #include <GeomAlgoAPI_MakeShape.h>
11
12 #include <GeomAPI_Pnt.h>
13
14 /// \class GeomAlgoAPI_Scale
15 /// \ingroup DataAlgo
16 /// \brief Creates a copy of the object by performing a scale operation by a factor or
17 ///        by dimensions.
18 class GeomAlgoAPI_Scale : public GeomAlgoAPI_MakeShape
19 {
20 public:
21   /// Type of scale operation
22   enum MethodType {
23     BY_FACTOR,     ///< Scale by factor.
24     BY_DIMENSIONS, ///< Scale by dimensions.
25   };
26
27   /// \brief Creates an object which is obtained from current object by performing
28   ///        a scale operation by a factor.
29   /// \param[in] theSourceShape  the shape to be moved.
30   /// \param[in] theCenterPoint  the center point.
31   /// \param[in] theFactor       the scale factor.
32   GEOMALGOAPI_EXPORT GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceShape,
33                                        std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
34                                        double                         theScaleFactor);
35
36   /// \brief Creates an object which is obtained from current object by performing
37   ///        a scale operation by dimensions.
38   /// \param[in] theSourceShape  the shape to be moved.
39   /// \param[in] theCenterPoint  the center point.
40   /// \param[in] theFactorX      the scale factor in X.
41   /// \param[in] theFactorY      the scale factor in Y.
42   /// \param[in] theFactorZ      the scale factor in Z.
43   GEOMALGOAPI_EXPORT GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceShape,
44                                        std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
45                                        double                         theScaleFactorX,
46                                        double                         theScaleFactorY,
47                                        double                         theScaleFactorZ);
48
49   /// Checks if data for the scale transform is OK.
50   GEOMALGOAPI_EXPORT bool check();
51
52   /// Execute the scale transform.
53   GEOMALGOAPI_EXPORT void build();
54
55 private:
56   MethodType myMethodType; /// Type of method used.
57   std::shared_ptr<GeomAPI_Shape> mySourceShape; /// Shape to be moved.
58   std::shared_ptr<GeomAPI_Pnt> myCenterPoint; /// Center point.
59   double myScaleFactor; /// Scale factor.
60   double myScaleFactorX; /// Scale factor in X.
61   double myScaleFactorY; /// Scale factor in Y.
62   double myScaleFactorZ; /// Scale factor in Z.
63
64   void buildByFactor();
65   void buildByDimensions();
66 };
67
68 #endif // GEOMALGOAPI_SCALE_H_