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>
13 class Handle_AIS_InteractiveObject;
16 \class PartSet_OperationSketch
17 * \brief The operation for the sketch feature creation
19 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
23 /// Returns the operation type key
24 static std::string Type() { return "Sketch"; }
28 /// \param theId the feature identifier
29 /// \param theParent the operation parent
30 PartSet_OperationSketch(const QString& theId, QObject* theParent);
32 virtual ~PartSet_OperationSketch();
34 /// Returns the operation local selection mode
35 /// \param theFeature the feature object to get the selection mode
36 /// \return the selection mode
37 virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
39 /// Initializes some fields accorging to the feature
40 /// \param theSelected the list of selected presentations
41 /// \param theHighlighted the list of highlighted presentations
42 virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
43 const std::list<XGUI_ViewerPrs>& theSelected,
44 const std::list<XGUI_ViewerPrs>& theHighlighted);
46 /// Returns the operation sketch feature
47 /// \returns the sketch instance
48 virtual boost::shared_ptr<ModelAPI_Feature> sketch() const;
50 /// Processes the mouse pressed in the point
51 /// \param theEvent the mouse event
52 /// \param theView a viewer to have the viewer the eye position
53 /// \param theSelected the list of selected presentations
54 /// \param theHighlighted the list of highlighted presentations
55 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
56 const std::list<XGUI_ViewerPrs>& theSelected,
57 const std::list<XGUI_ViewerPrs>& theHighlighted);
58 /// Processes the mouse release in the point
59 /// \param theEvent the mouse event
60 /// \param theView a viewer to have the viewer the eye position
61 /// \param theSelected the list of selected presentations
62 /// \param theHighlighted the list of highlighted presentations
63 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
64 const std::list<XGUI_ViewerPrs>& theSelected,
65 const std::list<XGUI_ViewerPrs>& theHighlighted);
67 /// Gives the current mouse point in the viewer
68 /// \param thePoint a point clicked in the viewer
69 /// \param theEvent the mouse event
70 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
72 /// Returns the map of the operation previews including the nested feature previews
73 /// \return the map of feature to the feature preview
74 virtual std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
77 /// Virtual method called when operation stopped - committed or aborted.
78 /// Emits a signal to hide the preview of the operation
79 virtual void stopOperation();
81 /// Returns whether the nested operations are enabled.
82 /// The state can depend on the operation current state.
83 /// It returns true after the sketch plane is choosen.
84 /// \return enabled state
85 virtual bool isNestedOperationsEnabled() const;
88 /// signal about the sketch plane is selected
89 /// \param theX the value in the X direction of the plane
90 /// \param theX the value in the Y direction value of the plane
91 /// \param theX the value in the Z direction of the plane
92 void planeSelected(double theX, double theY, double theZ);
93 // signal about the viewer fit all perform
97 /// Virtual method called when operation started (see start() method for more description)
98 /// Default impl calls corresponding slot and commits immediately.
99 virtual void startOperation();
101 /// Returns whether the sketch plane is set
102 /// \return the boolean value whether the sketch is set
103 bool hasSketchPlane() const;
105 /// Set the plane to the current sketch
106 /// \param theShape the shape
107 void setSketchPlane(const TopoDS_Shape& theShape);
110 std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation