Salome HOME
c7d2c165e9057cc7944943ec8fe90536b9513884
[modules/shaper.git] / src / SketchAPI / SketchAPI_MacroRectangle.h
1 // Copyright (C) 2014-2020  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
18 //
19
20 #ifndef SketchAPI_MacroRectangle_H_
21 #define SketchAPI_MacroRectangle_H_
22
23 #include "SketchAPI.h"
24 #include "SketchAPI_SketchEntity.h"
25 #include <SketchPlugin_MacroRectangle.h>
26
27 class ModelHighAPI_Selection;
28
29 /// \class SketchAPI_MacroRectangle
30 /// \ingroup CPPHighAPI
31 /// \brief Interface for Rectangle feature.
32 class SketchAPI_MacroRectangle: public SketchAPI_SketchEntity
33 {
34 public:
35   /// Constructor without values.
36   SKETCHAPI_EXPORT
37   explicit SketchAPI_MacroRectangle(const std::shared_ptr<ModelAPI_Feature>& theFeature);
38
39   /// Constructor with values.
40   SKETCHAPI_EXPORT
41   SketchAPI_MacroRectangle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
42                         double theStartX,
43                         double theStartY,
44                         double theSecondX,
45                         double theSecondY, bool isFirstPointCenter = false);
46
47   /// Constructor with values.
48   SKETCHAPI_EXPORT
49   SketchAPI_MacroRectangle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
50                         const std::shared_ptr<GeomAPI_Pnt2d>& theStartPoint,
51                         const std::shared_ptr<GeomAPI_Pnt2d>& theSecondPoint, bool isFirstPointCenter = false);
52
53
54   /// Destructor.
55   SKETCHAPI_EXPORT
56   virtual ~SketchAPI_MacroRectangle();
57
58   INTERFACE_5(SketchPlugin_MacroRectangle::ID(),
59               rectangleType, SketchPlugin_MacroRectangle::RECTANGLE_TYPE_ID(),
60               ModelAPI_AttributeString, /** Rectangle type */,
61               startPoint1, SketchPlugin_MacroRectangle::START1_ID(),
62               GeomDataAPI_Point2D, /** Start point 1 */,
63               endPoint1, SketchPlugin_MacroRectangle::END1_ID(),
64               GeomDataAPI_Point2D, /** End point 1 */,
65               endPoint2, SketchPlugin_MacroRectangle::END2_ID(),
66               GeomDataAPI_Point2D, /** First point 2 */,
67               centerPoint, SketchPlugin_MacroRectangle::CENTER_ID(),
68               GeomDataAPI_Point2D, /** Center point */)
69
70   /*SKETCHAPI_EXPORT
71   void dump(ModelHighAPI_Dumper& theDumper) const;
72 */
73 private:
74   /// Set by start  and end points.
75   void setByStartAndEndPoints(double theStartX, double theStartY,
76                                   double theEndX, double theEndY);
77
78   /// Set by start and end points.
79   void setByStartAndEndPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theStartPoint,
80                                   const std::shared_ptr<GeomAPI_Pnt2d>& theEndPoint);
81
82   /// Set by start  and center points.
83   void setByCenterAndEndPoints(double theCenterX, double theCenterY,
84                                   double theEndX, double theEndY);
85
86   /// Set by start and center points.
87   void setByCenterAndEndPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
88                                   const std::shared_ptr<GeomAPI_Pnt2d>& theEndPoint);
89 };
90
91 /// Pointer on Rectangle object.
92 typedef std::shared_ptr<SketchAPI_MacroRectangle> MacroRectanglePtr;
93
94 #endif // SketchAPI_MacroRectangle_H_