Salome HOME
fix coding style
[modules/shaper.git] / src / SketchAPI / SketchAPI_Rectangle.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 SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_
21 #define SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_
22
23 //--------------------------------------------------------------------------------------
24 #include "SketchAPI.h"
25
26 #include "SketchAPI_SketchEntity.h"
27 #include "SketchPlugin_Rectangle.h"
28
29 //--------------------------------------------------------------------------------------
30 class ModelHighAPI_Selection;
31 //--------------------------------------------------------------------------------------
32 /**\class SketchAPI_Rectangle
33  * \ingroup CPPHighAPI
34  * \brief Interface for Rectangle feature
35  */
36 class SketchAPI_Rectangle : public SketchAPI_SketchEntity
37 {
38 public:
39   /// Constructor without values
40   SKETCHAPI_EXPORT
41   explicit SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature);
42   /// Constructor with values
43   SKETCHAPI_EXPORT
44   SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
45                       double theX1, double theY1, double theX2, double theY2,
46                       bool isFirstPointCenter = false);
47   /// Constructor with values
48   SKETCHAPI_EXPORT
49   SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
50                       const std::shared_ptr<GeomAPI_Pnt2d> & theFirstPoint,
51                       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint,
52                       bool isFirstPointCenter = false);
53   /// Destructor
54   SKETCHAPI_EXPORT
55   virtual ~SketchAPI_Rectangle();
56
57   INTERFACE_4(SketchPlugin_Rectangle::ID(),
58               startPoint, SketchPlugin_Rectangle::START_ID(), GeomDataAPI_Point2D,
59               /** Start point */,
60               endPoint, SketchPlugin_Rectangle::END_ID(), GeomDataAPI_Point2D,
61               /** End point */,
62               centerPoint, SketchPlugin_Rectangle::CENTER_ID(), GeomDataAPI_Point2D,
63               /** Center point */,
64               linesList, SketchPlugin_Rectangle::LINES_LIST_ID(), ModelAPI_AttributeRefList,
65               /** Lines list */
66   )
67
68   /// Set by coordinates
69   SKETCHAPI_EXPORT
70   void setByCoordinates(double theX1, double theY1, double theX2, double theY2,
71                         bool isFirstPointCenter);
72
73   /// Set by points
74   SKETCHAPI_EXPORT
75   void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theFirstPoint,
76                    const std::shared_ptr<GeomAPI_Pnt2d> & theSecondPoint, bool isFirstPointCenter);
77
78   /// List of lines composing rectangle
79   SKETCHAPI_EXPORT std::list<std::shared_ptr<SketchAPI_SketchEntity> > lines() const;
80
81   SKETCHAPI_EXPORT
82   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
83   };
84
85 //! Pointer on Rectangle object
86 typedef std::shared_ptr<SketchAPI_Rectangle> RectanglePtr;
87
88 //--------------------------------------------------------------------------------------
89 //--------------------------------------------------------------------------------------
90 #endif /* SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_ */