Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Scale.h
1 // Copyright (C) 2014-2017  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<mailto:webmaster.salome@opencascade.com>
18 //
19
20 #ifndef GEOMALGOAPI_SCALE_H_
21 #define GEOMALGOAPI_SCALE_H_
22
23 #include <GeomAlgoAPI_MakeShape.h>
24
25 #include <GeomAPI_Pnt.h>
26
27 /// \class GeomAlgoAPI_Scale
28 /// \ingroup DataAlgo
29 /// \brief Creates a copy of the object by performing a scale operation by a factor or
30 ///        by dimensions.
31 class GeomAlgoAPI_Scale : public GeomAlgoAPI_MakeShape
32 {
33 public:
34   /// Type of scale operation
35   enum MethodType {
36     BY_FACTOR,     ///< Scale by factor.
37     BY_DIMENSIONS, ///< Scale by dimensions.
38   };
39
40   /// \brief Creates an object which is obtained from current object by performing
41   ///        a scale operation by a factor.
42   /// \param[in] theSourceShape  the shape to be moved.
43   /// \param[in] theCenterPoint  the center point.
44   /// \param[in] theFactor       the scale factor.
45   GEOMALGOAPI_EXPORT GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceShape,
46                                        std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
47                                        double                         theScaleFactor);
48
49   /// \brief Creates an object which is obtained from current object by performing
50   ///        a scale operation by dimensions.
51   /// \param[in] theSourceShape  the shape to be moved.
52   /// \param[in] theCenterPoint  the center point.
53   /// \param[in] theFactorX      the scale factor in X.
54   /// \param[in] theFactorY      the scale factor in Y.
55   /// \param[in] theFactorZ      the scale factor in Z.
56   GEOMALGOAPI_EXPORT GeomAlgoAPI_Scale(std::shared_ptr<GeomAPI_Shape> theSourceShape,
57                                        std::shared_ptr<GeomAPI_Pnt>   theCenterPoint,
58                                        double                         theScaleFactorX,
59                                        double                         theScaleFactorY,
60                                        double                         theScaleFactorZ);
61
62   /// Checks if data for the scale transform is OK.
63   GEOMALGOAPI_EXPORT bool check();
64
65   /// Execute the scale transform.
66   GEOMALGOAPI_EXPORT void build();
67
68 private:
69   MethodType myMethodType; /// Type of method used.
70   std::shared_ptr<GeomAPI_Shape> mySourceShape; /// Shape to be moved.
71   std::shared_ptr<GeomAPI_Pnt> myCenterPoint; /// Center point.
72   double myScaleFactor; /// Scale factor.
73   double myScaleFactorX; /// Scale factor in X.
74   double myScaleFactorY; /// Scale factor in Y.
75   double myScaleFactorZ; /// Scale factor in Z.
76
77   void buildByFactor();
78   void buildByDimensions();
79 };
80
81 #endif // GEOMALGOAPI_SCALE_H_