SHAPER 9.16.0
SketchAPI_Rectangle.h
1// Copyright (C) 2014-2026 CEA, EDF
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
28//--------------------------------------------------------------------------------------
30class SketchAPI_Point;
31//--------------------------------------------------------------------------------------
37{
38public:
40 SKETCHAPI_EXPORT
41 explicit SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature);
43 SKETCHAPI_EXPORT
44 SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
45 double theX1, double theY1,
46 double theX2, double theY2,
47 bool theCreateByCenterAndCorner = false);
49 SKETCHAPI_EXPORT
50 SketchAPI_Rectangle(const std::shared_ptr<ModelAPI_Feature> & theFeature,
51 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint1,
52 const std::shared_ptr<GeomAPI_Pnt2d> & thePoint2,
53 bool theCreateByCenterAndCorner = false);
54
55
56
58 SKETCHAPI_EXPORT
59 virtual ~SketchAPI_Rectangle() = default;
60
61 INTERFACE_7("SketchRectangle",
62 type, "RectangleType", ModelAPI_AttributeString,,
64 startPoint, "RectStartPoint", GeomDataAPI_Point2D,,
66 endPoint, "RectEndPoint", GeomDataAPI_Point2D,,
68 centerPoint, "RectCenterPoint", GeomDataAPI_Point2D,,
70 centerPointRef, "RectCenterPointRef", ModelAPI_AttributeRefAttr,,
72 cornerPoint, "RectCornerPoint", GeomDataAPI_Point2D,,
74 linesList, "RectangleList", ModelAPI_AttributeRefList,
76 )
77
78
79 SKETCHAPI_EXPORT
80 void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
81
83 SKETCHAPI_EXPORT
84 void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theFirstPoint,
85 const std::shared_ptr<GeomAPI_Pnt2d> & theSecondPoint);
86
88 SKETCHAPI_EXPORT
90 double theCenterX, double theCenterY,
91 double theCornerX, double theCornerY
92 );
93
95 SKETCHAPI_EXPORT
97 const std::shared_ptr<GeomAPI_Pnt2d> & theCenterPoint,
98 const std::shared_ptr<GeomAPI_Pnt2d> & theCornerPoint
99 );
100
102 SKETCHAPI_EXPORT std::list<std::shared_ptr<SketchAPI_SketchEntity> > lines() const;
103
104 SKETCHAPI_EXPORT std::shared_ptr<SketchAPI_Point> centerSketchPoint() const;
105};
106
108typedef std::shared_ptr<SketchAPI_Rectangle> RectanglePtr;
109
110//--------------------------------------------------------------------------------------
111//--------------------------------------------------------------------------------------
112#endif /* SRC_SKETCHAPI_SKETCHAPI_RECTANGLE_H_ */
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
Attribute that contains 2D point coordinates.
Definition: GeomDataAPI_Point2D.h:37
Attribute that contains reference to an attribute of a feature or reference to a feature (switchable)
Definition: ModelAPI_AttributeRefAttr.h:33
Attribute that contains list of references to features (located in the same document).
Definition: ModelAPI_AttributeRefList.h:33
API for the attribute that contains std (null terminated) string.
Definition: ModelAPI_AttributeString.h:33
Class for filling ModelAPI_AttributeSelection.
Definition: ModelHighAPI_Selection.h:49
Interface for Point feature.
Definition: SketchAPI_Point.h:39
Interface for Rectangle feature.
Definition: SketchAPI_Rectangle.h:37
virtual std::shared_ptr< GeomDataAPI_Point2D > centerPoint() const
Center point.
Definition: SketchAPI_Rectangle.h:76
SketchAPI_Rectangle(const std::shared_ptr< ModelAPI_Feature > &theFeature)
Constructor without values.
Definition: SketchAPI_Rectangle.cpp:30
std::list< std::shared_ptr< SketchAPI_SketchEntity > > lines() const
List of lines composing rectangle.
Definition: SketchAPI_Rectangle.cpp:100
virtual std::shared_ptr< ModelAPI_AttributeRefAttr > centerPointRef() const
Reference to center point.
Definition: SketchAPI_Rectangle.h:76
virtual std::shared_ptr< ModelAPI_AttributeRefList > linesList() const
Lines list.
Definition: SketchAPI_Rectangle.h:76
void setByCenterAndCornerCoords(double theCenterX, double theCenterY, double theCornerX, double theCornerY)
Set by coordinates.
Definition: SketchAPI_Rectangle.cpp:78
void setByPoints(const std::shared_ptr< GeomAPI_Pnt2d > &theFirstPoint, const std::shared_ptr< GeomAPI_Pnt2d > &theSecondPoint)
Set by points.
Definition: SketchAPI_Rectangle.cpp:69
void setByCenterAndCornerPoints(const std::shared_ptr< GeomAPI_Pnt2d > &theCenterPoint, const std::shared_ptr< GeomAPI_Pnt2d > &theCornerPoint)
Set by points.
Definition: SketchAPI_Rectangle.cpp:88
void setByCoordinates(double theX1, double theY1, double theX2, double theY2)
Set by coordinates.
Definition: SketchAPI_Rectangle.cpp:60
virtual ~SketchAPI_Rectangle()=default
Destructor.
virtual std::shared_ptr< GeomDataAPI_Point2D > startPoint() const
Start point.
Definition: SketchAPI_Rectangle.h:76
virtual std::shared_ptr< ModelAPI_AttributeString > type() const
Creation type of rectangle.
Definition: SketchAPI_Rectangle.h:76
virtual std::shared_ptr< GeomDataAPI_Point2D > cornerPoint() const
Corner point.
Definition: SketchAPI_Rectangle.h:76
virtual std::shared_ptr< GeomDataAPI_Point2D > endPoint() const
End point.
Definition: SketchAPI_Rectangle.h:76
Base class for Sketch feature interfaces.
Definition: SketchAPI_SketchEntity.h:38