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>
16 class Handle_AIS_InteractiveObject;
19 \class PartSet_OperationSketch
20 * \brief The operation for the sketch feature creation
22 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
26 /// Returns the operation type key
27 static std::string Type()
29 return SketchPlugin_Sketch::ID();
34 /// \param theId the feature identifier
35 /// \param theParent the operation parent
36 PartSet_OperationSketch(const QString& theId, QObject* theParent);
38 virtual ~PartSet_OperationSketch();
40 /// Returns True if the given operation is a Sketcher operation
41 virtual bool isGranted(ModuleBase_Operation* theOperation) const;
44 /// Returns the operation sketch feature
45 /// \returns the sketch instance
46 virtual FeaturePtr sketch() const;
48 /// Processes the mouse pressed in the point
49 /// \param theEvent the mouse event
50 /// \param theView a viewer to have the viewer the eye position
51 /// \param theSelected the list of selected presentations
52 /// \param theHighlighted the list of highlighted presentations
53 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
54 const std::list<ModuleBase_ViewerPrs>& theSelected,
55 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
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, Handle_V3d_View theView,
62 const std::list<ModuleBase_ViewerPrs>& theSelected,
63 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
65 /// Gives the current mouse point in the viewer
66 /// \param thePoint a point clicked in the viewer
67 /// \param theEvent the mouse event
68 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
70 /// Returns the list of the nested features
71 /// \return the list of subfeatures
72 virtual std::list<FeaturePtr> subFeatures() const;
74 /// Virtual method called when operation stopped - committed or aborted.
75 /// Emits a signal to hide the preview of the operation
76 virtual void stopOperation();
78 /// Returns whether the nested operations are enabled.
79 /// The state can depend on the operation current state.
80 /// It returns true after the sketch plane is choosen.
81 /// \return enabled state
82 virtual bool isNestedOperationsEnabled() const;
84 /// Returns whether the sketch plane is set
85 /// \return the boolean value whether the sketch is set
86 bool hasSketchPlane() const;
88 /// Set the plane to the current sketch
89 /// \param theShape the shape
90 void setSketchPlane(const TopoDS_Shape& theShape);
92 /// If operation needs to redisplay its result during operation
93 /// then this method has to return True
94 virtual bool hasPreview() const { return false; }
97 /// signal about the sketch plane is selected
98 /// \param theX the value in the X direction of the plane
99 /// \param theX the value in the Y direction value of the plane
100 /// \param theX the value in the Z direction of the plane
101 void planeSelected(double theX, double theY, double theZ);
102 // signal about the viewer fit all perform
106 /// Virtual method called when operation started (see start() method for more description)
107 /// Default impl calls corresponding slot and commits immediately.
108 virtual void startOperation();
110 /// Virtual method called after operation committed (see commit() method for more description)
111 virtual void afterCommitOperation();
114 std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation