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() { return SKETCH_KIND; }
31 /// \param theId the feature identifier
32 /// \param theParent the operation parent
33 PartSet_OperationSketch(const QString& theId, QObject* theParent);
35 virtual ~PartSet_OperationSketch();
37 /// Returns the operation local selection mode
38 /// \param theFeature the feature object to get the selection mode
39 /// \return the selection mode
40 virtual std::list<int> getSelectionModes(FeaturePtr theFeature) const;
42 /// Initializes some fields accorging to the feature
43 /// \param theSelected the list of selected presentations
44 /// \param theHighlighted the list of highlighted presentations
45 virtual void init(FeaturePtr theFeature,
46 const std::list<XGUI_ViewerPrs>& theSelected,
47 const std::list<XGUI_ViewerPrs>& theHighlighted);
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<XGUI_ViewerPrs>& theSelected,
60 const std::list<XGUI_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<XGUI_ViewerPrs>& theSelected,
68 const std::list<XGUI_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 map of the operation previews including the nested feature previews
76 /// \return the map of feature to the feature preview
77 virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
80 /// Virtual method called when operation stopped - committed or aborted.
81 /// Emits a signal to hide the preview of the operation
82 virtual void stopOperation();
84 /// Returns whether the nested operations are enabled.
85 /// The state can depend on the operation current state.
86 /// It returns true after the sketch plane is choosen.
87 /// \return enabled state
88 virtual bool isNestedOperationsEnabled() const;
91 /// signal about the sketch plane is selected
92 /// \param theX the value in the X direction of the plane
93 /// \param theX the value in the Y direction value of the plane
94 /// \param theX the value in the Z direction of the plane
95 void planeSelected(double theX, double theY, double theZ);
96 // signal about the viewer fit all perform
100 /// Virtual method called when operation started (see start() method for more description)
101 /// Default impl calls corresponding slot and commits immediately.
102 virtual void startOperation();
104 /// Returns whether the sketch plane is set
105 /// \return the boolean value whether the sketch is set
106 bool hasSketchPlane() const;
108 /// Set the plane to the current sketch
109 /// \param theShape the shape
110 void setSketchPlane(const TopoDS_Shape& theShape);
113 std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation