Salome HOME
First implementation of the sketch drawer: helper for creation of sketch on imported...
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_SketchDrawer.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 SketchPlugin_SketchDrawer_H_
22 #define SketchPlugin_SketchDrawer_H_
23
24 #include "SketchPlugin.h"
25 #include <ModelAPI_Feature.h>
26
27 /// \class SketchPlugin_SketchDrawer
28 /// \ingroup Plugins
29 /// \brief Feature for creation of a sketch on selected base object and plane. It tries
30 ///  to make sketch elements equal to edges and vertices of the objects that belong to
31 ///  the selected plane.
32 class SketchPlugin_SketchDrawer: public ModelAPI_Feature
33 {
34  public:
35   /// A constructor
36   SketchPlugin_SketchDrawer();
37
38   /// Feature kind.
39   inline static const std::string& ID()
40   {
41     static const std::string MY_FEATURE_ID("SketchDrawer");
42     return MY_FEATURE_ID;
43   }
44
45   /// Attribute name of the base shape selected.
46   inline static const std::string& BASE_ID()
47   {
48     static const std::string ID("base_shape");
49     return ID;
50   }
51   /// Attribute name of the plane selected.
52   inline static const std::string& PLANE_ID()
53   {
54     static const std::string ID("plane");
55     return ID;
56   }
57
58   /// \return the kind of a feature.
59   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
60   {
61     static std::string MY_KIND = SketchPlugin_SketchDrawer::ID();
62     return MY_KIND;
63   }
64
65   /// Creates a new sketch.
66   SKETCHPLUGIN_EXPORT virtual void execute();
67
68   /// Request for initialization of data model of the feature: adding all attributes.
69   SKETCHPLUGIN_EXPORT virtual void initAttributes();
70
71   /// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is removed on apply.
72   /// \returns true
73   SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}
74
75   /// No preview is generated until it is applied.
76   SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}
77 };
78
79 #endif