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 SketchPlugin_MacroRectangle_H_
21 #define SketchPlugin_MacroRectangle_H_
23 #include "SketchPlugin.h"
24 #include <SketchPlugin_SketchEntity.h>
25 #include <GeomAPI_IPresentable.h>
29 /**\class SketchPlugin_MacroRectangle
31 * \brief Feature for creation of the new Rectangle in Sketch.
33 class SketchPlugin_MacroRectangle: public SketchPlugin_SketchEntity, public GeomAPI_IPresentable
36 /// Rectangle feature kind
37 inline static const std::string& ID()
39 static const std::string ID("SketchMacroRectangle");
43 inline static const std::string& TYPE_ID()
45 static const std::string ID("rectangle_type");
49 inline static const std::string& EDIT_TYPE_ID()
51 static const std::string ID("edit_rectangle_type");
55 inline static const std::string& START_END_POINT_TYPE_ID()
57 static const std::string ID("rectangle_type_by_start_and_end_points");
61 inline static const std::string& START_CENTER_POINT_TYPE_ID()
63 static const std::string ID("rectangle_type_by_start_and_center_points");
67 /// 2D point - start point of the Rectangle
68 inline static const std::string& START1_ID()
70 static const std::string ID("rectangle_start_point1");
73 /// 2D point - end point of the Rectangle
74 inline static const std::string& END1_ID()
76 static const std::string ID("rectangle_end_point1");
79 /// 2D point - start point of the second Rectangle type
80 inline static const std::string& START2_ID()
82 static const std::string ID("rectangle_start_point2");
86 /// 2D point - center point of the second Rectangle type
87 inline static const std::string& CENTER_ID()
89 static const std::string ID("rectangle_center_point");
93 /// Returns the kind of a feature
94 SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
96 static std::string MY_KIND = SketchPlugin_MacroRectangle::ID();
100 /// Called on change of any argument-attribute of this object
101 SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
103 /// Creates a new part document if needed
104 SKETCHPLUGIN_EXPORT virtual void execute();
106 /// Use plugin manager for features creation
107 SketchPlugin_MacroRectangle();
109 SKETCHPLUGIN_EXPORT virtual bool isMacro() const
112 SKETCHPLUGIN_EXPORT virtual void initAttributes();
114 SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}
116 /// Returns the AIS preview
117 virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
121 std::shared_ptr<GeomAPI_Pnt2d> myStartPoint;
122 std::shared_ptr<GeomAPI_Pnt2d> myEndPoint;
126 FeaturePtr createRectangle();