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