1 // File: PartSet_OperationFeatureEdit.h
2 // Created: 05 May 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_OperationFeatureEdit_H
6 #define PartSet_OperationFeatureEdit_H
10 #include <PartSet_OperationFeatureBase.h>
16 \class PartSet_OperationFeatureEdit
17 * \brief The operation for the sketch feature creation
19 class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationFeatureBase
22 /// Struct to define gp point, with the state is the point is initialized
28 myIsInitialized = false;
31 /// \param thePoint the point
32 Point(gp_Pnt thePoint)
40 /// clear the initialized flag.
43 myIsInitialized = false;
45 /// set the point and switch on the initialized flag
46 /// \param thePoint the point
47 void setPoint(const gp_Pnt& thePoint)
49 myIsInitialized = true;
53 bool myIsInitialized; /// the state whether the point is set
54 gp_Pnt myPoint; /// the point
58 /// Returns the operation type key
59 static std::string Type()
66 /// \param theId the feature identifier
67 /// \param theParent the operation parent
68 /// \param theFeature the parent feature
69 PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent, FeaturePtr theFeature);
71 virtual ~PartSet_OperationFeatureEdit();
73 /// Processes the mouse pressed in the point
74 /// \param theEvent the mouse event
75 /// \param theView a viewer to have the viewer the eye position
76 /// \param theSelected the list of selected presentations
77 /// \param theHighlighted the list of highlighted presentations
78 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
79 const std::list<ModuleBase_ViewerPrs>& theSelected,
80 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
81 /// Gives the current mouse point in the viewer
82 /// \param theEvent the mouse event
83 /// \param theView a viewer to have the viewer the eye position
84 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
85 /// Gives the current selected objects to be processed by the operation
86 /// \param thePoint a point clicked in the viewer
87 /// \param theEvent the mouse event
88 /// \param theSelected the list of selected presentations
89 /// \param theHighlighted the list of highlighted presentations
90 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
91 const std::list<ModuleBase_ViewerPrs>& theSelected,
92 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
94 /// Processes the mouse double click in the point
95 /// \param theEvent the mouse event
96 /// \param theView a viewer to have the viewer the eye position
97 /// \param theSelected the list of selected presentations
98 /// \param theHighlighted the list of highlighted presentations
99 virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
100 const std::list<ModuleBase_ViewerPrs>& theSelected,
101 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
104 /// \brief Virtual method called when operation is started
105 /// Virtual method called when operation started (see start() method for more description)
106 /// Switch off the multi selection state
107 virtual void startOperation();
109 /// Virtual method called when operation stopped - committed or aborted.
110 /// Restore the multi selection state
111 virtual void stopOperation();
113 /// Creates an operation new feature
114 /// Returns NULL feature. This is an operation of edition, not creation.
115 /// \param theFlushMessage the flag whether the create message should be flushed
116 /// \returns the created feature
117 virtual FeaturePtr createFeature(const bool theFlushMessage = true);
120 /// Emits a signal about the selection blocking. Emits a signal to change the selection.
121 /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
122 /// the internal operation features are to be selected
123 /// \param isBlocked the state whether the operation is blocked or unblocked
124 /// \param isRestoreSelection the state whether the selected objects should be reselected
125 void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
127 /// Sends the features
131 Point myCurPoint; ///< the current 3D point clicked or moved
132 bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal