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,
52 bool isFirstPointCenter = false);
57 virtual ~SketchAPI_MacroRectangle();
59 INTERFACE_5(SketchPlugin_MacroRectangle::ID(),
60 rectangleType, SketchPlugin_MacroRectangle::RECTANGLE_TYPE_ID(),
61 ModelAPI_AttributeString, /** Rectangle type */,
62 startPoint1, SketchPlugin_MacroRectangle::START1_ID(),
63 GeomDataAPI_Point2D, /** Start point 1 */,
64 endPoint1, SketchPlugin_MacroRectangle::END1_ID(),
65 GeomDataAPI_Point2D, /** End point 1 */,
66 endPoint2, SketchPlugin_MacroRectangle::END2_ID(),
67 GeomDataAPI_Point2D, /** First point 2 */,
68 centerPoint, SketchPlugin_MacroRectangle::CENTER_ID(),
69 GeomDataAPI_Point2D, /** Center point */)
72 void dump(ModelHighAPI_Dumper& theDumper) const;
75 /// Set by start and end points.
76 void setByStartAndEndPoints(double theStartX, double theStartY,
77 double theEndX, double theEndY);
79 /// Set by start and end points.
80 void setByStartAndEndPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theStartPoint,
81 const std::shared_ptr<GeomAPI_Pnt2d>& theEndPoint);
83 /// Set by start and center points.
84 void setByCenterAndEndPoints(double theCenterX, double theCenterY,
85 double theEndX, double theEndY);
87 /// Set by start and center points.
88 void setByCenterAndEndPoints(const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
89 const std::shared_ptr<GeomAPI_Pnt2d>& theEndPoint);
92 /// Pointer on Rectangle object.
93 typedef std::shared_ptr<SketchAPI_MacroRectangle> MacroRectanglePtr;
95 #endif // SketchAPI_MacroRectangle_H_