1 // File: PartSet_OperationSketch.h
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_OperationSketch_H
6 #define PartSet_OperationSketch_H
10 #include <PartSet_OperationSketchBase.h>
12 #include <SketchPlugin_Sketch.h>
17 class Handle_AIS_InteractiveObject;
20 \class PartSet_OperationSketch
21 * \brief The operation for the sketch feature creation
23 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
27 /// Returns the operation type key
28 static std::string Type()
30 return SketchPlugin_Sketch::ID();
35 /// \param theId the feature identifier
36 /// \param theParent the operation parent
37 PartSet_OperationSketch(const QString& theId, QObject* theParent);
39 virtual ~PartSet_OperationSketch();
41 /// Returns True if the given operation is a Sketcher operation
42 virtual bool isGranted(ModuleBase_Operation* theOperation) const;
45 /// Returns the operation sketch feature
46 /// \returns the sketch instance
47 virtual CompositeFeaturePtr sketch() const;
49 /// Processes the mouse pressed in the point
50 /// \param theEvent the mouse event
51 /// \param theView a viewer to have the viewer the eye position
52 /// \param theSelected the list of selected presentations
53 /// \param theHighlighted the list of highlighted presentations
54 virtual void mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection);
56 /// Processes the mouse release in the point
57 /// \param theEvent the mouse event
58 /// \param theView a viewer to have the viewer the eye position
59 /// \param theSelected the list of selected presentations
60 /// \param theHighlighted the list of highlighted presentations
61 virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
62 ModuleBase_ISelection* theSelection);
64 /// Gives the current mouse point in the viewer
65 /// \param thePoint a point clicked in the viewer
66 /// \param theEvent the mouse event
67 virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
69 /// Returns the list of the nested features
70 /// \return the list of subfeatures
71 virtual std::list<FeaturePtr> subFeatures() const;
73 /// Virtual method called when operation stopped - committed or aborted.
74 /// Emits a signal to hide the preview of the operation
75 virtual void stopOperation();
77 /// Returns whether the nested operations are enabled.
78 /// The state can depend on the operation current state.
79 /// It returns true after the sketch plane is choosen.
80 /// \return enabled state
81 virtual bool isNestedOperationsEnabled() const;
83 /// Returns whether the sketch plane is set
84 /// \return the boolean value whether the sketch is set
85 bool hasSketchPlane() const;
87 /// Set the plane to the current sketch
88 /// \param theShape the shape
89 /// \return selected direction
90 boost::shared_ptr<GeomAPI_Dir> setSketchPlane(const TopoDS_Shape& theShape);
92 /// Called on selection changed when the operation is active
93 virtual void selectionChanged(ModuleBase_ISelection* theSelection);
95 /// If operation needs to redisplay its result during operation
96 /// then this method has to return True
97 virtual bool hasPreview() const { return false; }
100 /// signal about the sketch plane is selected
101 /// \param theX the value in the X direction of the plane
102 /// \param theX the value in the Y direction value of the plane
103 /// \param theX the value in the Z direction of the plane
104 void planeSelected(double theX, double theY, double theZ);
105 // signal about the viewer fit all perform
108 /// Signal to define sketch mode
111 /// Signal to update property panel
112 void updatePropPanel();
115 /// Virtual method called when operation started (see start() method for more description)
116 /// Default impl calls corresponding slot and commits immediately.
117 virtual void startOperation();
119 /// Virtual method called after operation committed (see commit() method for more description)
120 virtual void afterCommitOperation();
123 QList<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation