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 local selection mode
45 /// \param theFeature the feature object to get the selection mode
46 /// \return the selection mode
47 virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
49 /// Returns the operation sketch feature
50 /// \returns the sketch instance
51 virtual FeaturePtr sketch() const;
53 /// Processes the mouse pressed in the point
54 /// \param theEvent the mouse event
55 /// \param theView a viewer to have the viewer the eye position
56 /// \param theSelected the list of selected presentations
57 /// \param theHighlighted the list of highlighted presentations
58 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
59 const std::list<ModuleBase_ViewerPrs>& theSelected,
60 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
61 /// Processes the mouse release in the point
62 /// \param theEvent the mouse event
63 /// \param theView a viewer to have the viewer the eye position
64 /// \param theSelected the list of selected presentations
65 /// \param theHighlighted the list of highlighted presentations
66 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
67 const std::list<ModuleBase_ViewerPrs>& theSelected,
68 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
70 /// Gives the current mouse point in the viewer
71 /// \param thePoint a point clicked in the viewer
72 /// \param theEvent the mouse event
73 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
75 /// Returns the list of the nested features
76 /// \return the list of subfeatures
77 virtual std::list<FeaturePtr> subFeatures() const;
79 /// Virtual method called when operation stopped - committed or aborted.
80 /// Emits a signal to hide the preview of the operation
81 virtual void stopOperation();
83 /// Returns whether the nested operations are enabled.
84 /// The state can depend on the operation current state.
85 /// It returns true after the sketch plane is choosen.
86 /// \return enabled state
87 virtual bool isNestedOperationsEnabled() const;
89 /// Returns whether the sketch plane is set
90 /// \return the boolean value whether the sketch is set
91 bool hasSketchPlane() const;
93 /// Set the plane to the current sketch
94 /// \param theShape the shape
95 void setSketchPlane(const TopoDS_Shape& theShape);
97 /// If operation needs to redisplay its result during operation
98 /// then this method has to return True
99 virtual bool hasPreview() const { return false; }
102 /// signal about the sketch plane is selected
103 /// \param theX the value in the X direction of the plane
104 /// \param theX the value in the Y direction value of the plane
105 /// \param theX the value in the Z direction of the plane
106 void planeSelected(double theX, double theY, double theZ);
107 // signal about the viewer fit all perform
111 /// Virtual method called when operation started (see start() method for more description)
112 /// Default impl calls corresponding slot and commits immediately.
113 virtual void startOperation();
115 /// Virtual method called after operation committed (see commit() method for more description)
116 virtual void afterCommitOperation();
119 std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation