Salome HOME
Merge branch 'Pre_2.8.0_development'
[modules/shaper.git] / src / SketchAPI / SketchAPI_Rectangle.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 SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_
22 #define SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_
23
24 //--------------------------------------------------------------------------------------
25 #include "SketchAPI.h"
26
27 #include "SketchAPI_SketchEntity.h"
28 //--------------------------------------------------------------------------------------
29 class ModelHighAPI_Selection;
30 //--------------------------------------------------------------------------------------
31 /**\class SketchAPI_Rectangle
32  * \ingroup CPPHighAPI
33  * \brief Interface for Rectangle feature
34  */
35 class SketchAPI_Rectangle : public SketchAPI_SketchEntity
36 {
37 public:
38   /// Constructor without values
39   SKETCHAPI_EXPORT
40   explicit SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature);
41   /// Constructor with values
42   SKETCHAPI_EXPORT
43   SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
44                       double theX1, double theY1, double theX2, double theY2);
45   /// Constructor with values
46   SKETCHAPI_EXPORT
47   SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
48                       const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
49                       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
50   /// Destructor
51   SKETCHAPI_EXPORT
52   virtual ~SketchAPI_Rectangle();
53
54   INTERFACE_3("SketchRectangle",
55               startPoint, "RectStartPoint", GeomDataAPI_Point2D, /** Start point */,
56               endPoint, "RectEndPoint", GeomDataAPI_Point2D, /** End point */,
57               linesList, "RectangleList", ModelAPI_AttributeRefList, /** Lines list */
58   )
59
60   /// Set by coordinates
61   SKETCHAPI_EXPORT
62   void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
63
64   /// Set by points
65   SKETCHAPI_EXPORT
66   void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
67                    const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
68
69   /// List of lines composing rectangle
70   SKETCHAPI_EXPORT std::list<std::shared_ptr<SketchAPI_SketchEntity> > lines() const;
71 };
72
73 //! Pointer on Rectangle object
74 typedef std::shared_ptr<SketchAPI_Rectangle> RectanglePtr;
75
76 //--------------------------------------------------------------------------------------
77 //--------------------------------------------------------------------------------------
78 #endif /* SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_ */