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 isValid(ModuleBase_IOperation* 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 /// Initializes the operation with previously created feature. It is used in sequental operations
50 virtual void initFeature(FeaturePtr theFeature);
52 /// Returns the operation sketch feature
53 /// \returns the sketch instance
54 virtual FeaturePtr sketch() const;
56 /// Processes the mouse pressed 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 mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
62 const std::list<ModuleBase_ViewerPrs>& theSelected,
63 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
64 /// Processes the mouse release in the point
65 /// \param theEvent the mouse event
66 /// \param theView a viewer to have the viewer the eye position
67 /// \param theSelected the list of selected presentations
68 /// \param theHighlighted the list of highlighted presentations
69 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
70 const std::list<ModuleBase_ViewerPrs>& theSelected,
71 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
73 /// Gives the current mouse point in the viewer
74 /// \param thePoint a point clicked in the viewer
75 /// \param theEvent the mouse event
76 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
78 /// Returns the list of the nested features
79 /// \return the list of subfeatures
80 virtual std::list<FeaturePtr> subFeatures() const;
82 /// Virtual method called when operation stopped - committed or aborted.
83 /// Emits a signal to hide the preview of the operation
84 virtual void stopOperation();
86 /// Returns whether the nested operations are enabled.
87 /// The state can depend on the operation current state.
88 /// It returns true after the sketch plane is choosen.
89 /// \return enabled state
90 virtual bool isNestedOperationsEnabled() const;
92 /// Returns whether the sketch plane is set
93 /// \return the boolean value whether the sketch is set
94 bool hasSketchPlane() const;
96 /// Set the plane to the current sketch
97 /// \param theShape the shape
98 void setSketchPlane(const TopoDS_Shape& theShape);
101 /// signal about the sketch plane is selected
102 /// \param theX the value in the X direction of the plane
103 /// \param theX the value in the Y direction value of the plane
104 /// \param theX the value in the Z direction of the plane
105 void planeSelected(double theX, double theY, double theZ);
106 // signal about the viewer fit all perform
110 /// Virtual method called when operation started (see start() method for more description)
111 /// Default impl calls corresponding slot and commits immediately.
112 virtual void startOperation();
115 std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation