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>
14 \class PartSet_OperationSketch
15 * \brief The operation for the sketch feature creation
17 class PARTSET_EXPORT PartSet_OperationSketch : public PartSet_OperationSketchBase
21 /// Returns the operation type key
22 static std::string Type() { return "Sketch"; }
26 /// \param theId the feature identifier
27 /// \param theParent the operation parent
28 PartSet_OperationSketch(const QString& theId, QObject* theParent);
30 virtual ~PartSet_OperationSketch();
32 /// Returns the operation local selection mode
33 /// \param theFeature the feature object to get the selection mode
34 /// \return the selection mode
35 virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
37 /// Initializes some fields accorging to the feature
38 /// \param theSelected the list of selected presentations
39 /// \param theHighlighted the list of highlighted presentations
40 virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
41 const std::list<XGUI_ViewerPrs>& theSelected,
42 const std::list<XGUI_ViewerPrs>& theHighlighted);
44 /// Returns the operation sketch feature
45 /// \returns the sketch instance
46 virtual boost::shared_ptr<ModelAPI_Feature> 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<XGUI_ViewerPrs>& theSelected,
55 const std::list<XGUI_ViewerPrs>& theHighlighted);
56 /// Gives the current mouse point in the viewer
57 /// \param thePoint a point clicked in the viewer
58 /// \param theEvent the mouse event
59 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
61 /// Returns the map of the operation previews including the nested feature previews
62 /// \return the map of feature to the feature preview
63 virtual std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> >
66 /// Virtual method called when operation stopped - committed or aborted.
67 /// Emits a signal to hide the preview of the operation
68 virtual void stopOperation();
70 /// Returns whether the nested operations are enabled.
71 /// The state can depend on the operation current state.
72 /// It returns true after the sketch plane is choosen.
73 /// \return enabled state
74 virtual bool isNestedOperationsEnabled() const;
77 /// signal about the sketch plane is selected
78 /// \param theX the value in the X direction of the plane
79 /// \param theX the value in the Y direction value of the plane
80 /// \param theX the value in the Z direction of the plane
81 void planeSelected(double theX, double theY, double theZ);
82 // signal about the viewer fit all perform
86 /// Virtual method called when operation started (see start() method for more description)
87 /// Default impl calls corresponding slot and commits immediately.
88 virtual void startOperation();
90 /// Returns whether the sketch plane is set
91 /// \return the boolean value whether the sketch is set
92 bool hasSketchPlane() const;
94 /// Set the plane to the current sketch
95 /// \param theShape the shape
96 void setSketchPlane(const TopoDS_Shape& theShape);
99 std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation