]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchPlugin/SketchPlugin_SketchDrawer.h
Salome HOME
Merge commit 'refs/tags/V9_2_0^{}'
[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   /// Attribute name of the add-dimensions flag.
58   inline static const std::string& ADD_DIMENSIONS_ID()
59   {
60     static const std::string ID("add_dimensions");
61     return ID;
62   }
63
64   /// \return the kind of a feature.
65   SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
66   {
67     static std::string MY_KIND = SketchPlugin_SketchDrawer::ID();
68     return MY_KIND;
69   }
70
71   /// Creates a new sketch.
72   SKETCHPLUGIN_EXPORT virtual void execute();
73
74   /// Request for initialization of data model of the feature: adding all attributes.
75   SKETCHPLUGIN_EXPORT virtual void initAttributes();
76
77   /// Reimplemented from ModelAPI_Feature::isMacro(). Means that feature is removed on apply.
78   /// \returns true
79   SKETCHPLUGIN_EXPORT virtual bool isMacro() const {return true;}
80
81   /// No preview is generated until it is applied.
82   SKETCHPLUGIN_EXPORT virtual bool isPreviewNeeded() const {return false;}
83 };
84
85 #endif