1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef SketchAPI_MacroRectangle_H_
21 #define SketchAPI_MacroRectangle_H_
23 #include "SketchAPI.h"
24 #include "SketchAPI_SketchEntity.h"
25 #include <SketchPlugin_MacroRectangle.h>
27 class ModelHighAPI_Selection;
29 /// \class SketchAPI_MacroRectangle
30 /// \ingroup CPPHighAPI
31 /// \brief Interface for Rectangle feature.
32 class SketchAPI_MacroRectangle: public SketchAPI_SketchEntity
35 /// Constructor without values.
37 explicit SketchAPI_MacroRectangle(const std::shared_ptr<ModelAPI_Feature>& theFeature);
39 /// Constructor with values.
41 SketchAPI_MacroRectangle(const std::shared_ptr<ModelAPI_Feature>& theFeature,
45 double theSecondY, bool isFirstPointCenter = false);
47 /// Constructor with values.
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);
56 virtual ~SketchAPI_MacroRectangle();
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 */)
71 void dump(ModelHighAPI_Dumper& theDumper) const;
74 /// Set by start and end points.
75 void setByStartAndEndPoints(double theStartX, double theStartY,
76 double theEndX, double theEndY);
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);
82 /// Set by start and center points.
83 void setByCenterAndEndPoints(double theCenterX, double theCenterY,
84 double theEndX, double theEndY);
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);
91 /// Pointer on Rectangle object.
92 typedef std::shared_ptr<SketchAPI_MacroRectangle> MacroRectanglePtr;
94 #endif // SketchAPI_MacroRectangle_H_