SHAPER  9.12.0
SketchPlugin_Feature.h
1 // Copyright (C) 2014-2023 CEA, EDF
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 email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef SketchPlugin_Feature_H_
21 #define SketchPlugin_Feature_H_
22 
23 #include "SketchPlugin.h"
24 #include <ModelAPI_CompositeFeature.h>
25 #include <GeomAPI_Shape.h>
26 #include <ModelAPI_Document.h>
27 #include <ModelAPI_AttributeSelection.h>
28 #include <ModelAPI_AttributeBoolean.h>
29 
30 #include <Config_PropManager.h>
31 
33 
40 {
41  public:
43  SKETCHPLUGIN_EXPORT virtual bool isInHistory()
44  {
45  return false;
46  }
47 
49  SKETCHPLUGIN_EXPORT virtual bool isExternal() const
50  {
51  return false;
52  }
53 
55  SKETCHPLUGIN_EXPORT virtual bool isCopy() const
56  {
57  return false;
58  }
59 
62  SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const
63  {
64  return true;
65  }
66 
68  SKETCHPLUGIN_EXPORT virtual bool isFixed() {return false;}
69 
72 protected:
74  void setSketch(SketchPlugin_Sketch* theSketch)
75  {
76  mySketch = theSketch;
77  }
80 
82  void keepCurrentFeature();
84  void restoreCurrentFeature();
85 
86  friend class SketchPlugin_Sketch;
87 
88 private:
89  std::shared_ptr<GeomAPI_Shape> myPreview;
90  SketchPlugin_Sketch* mySketch;
91 
92  FeaturePtr myCurrentFeature;
93 };
94 
95 #endif
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Feature for creation of the new feature in PartSet.
Definition: SketchPlugin_Feature.h:40
void restoreCurrentFeature()
Restore current feature of the document after adding new feature to the sketch.
Definition: SketchPlugin_Feature.cpp:72
virtual bool isInHistory()
Returns true if this feature must be displayed in the history (top level of Part tree)
Definition: SketchPlugin_Feature.h:43
SketchPlugin_Sketch * sketch()
Returns the sketch of this feature.
Definition: SketchPlugin_Feature.cpp:42
virtual bool isExternal() const
Returns true of the feature is created basing on the external shape of not-this-sketch object.
Definition: SketchPlugin_Feature.h:49
virtual bool canBeDisplayed() const
Returns true if the feature and the feature results can be displayed.
Definition: SketchPlugin_Feature.h:62
virtual bool isFixed()
Returns true is sketch element is under the rigid constraint.
Definition: SketchPlugin_Feature.h:68
SketchPlugin_Feature()
initializes mySketch
Definition: SketchPlugin_Feature.cpp:37
void keepCurrentFeature()
Store current feature of the document if it is not the sub-feature of the current sketch.
Definition: SketchPlugin_Feature.cpp:60
void setSketch(SketchPlugin_Sketch *theSketch)
Sets the higher-level feature for the sub-feature (sketch for line)
Definition: SketchPlugin_Feature.h:74
virtual bool isCopy() const
Returns true if the feature is a copy of other feature.
Definition: SketchPlugin_Feature.h:55
Feature for creation of the new part in PartSet.
Definition: SketchPlugin_Sketch.h:47