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 /// Initializes the operation with previously created feature. It is used in sequental operations
74 virtual void initFeature(FeaturePtr theFeature);
76 /// Processes the mouse pressed in the point
77 /// \param theEvent the mouse event
78 /// \param theView a viewer to have the viewer the eye position
79 /// \param theSelected the list of selected presentations
80 /// \param theHighlighted the list of highlighted presentations
81 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
82 const std::list<ModuleBase_ViewerPrs>& theSelected,
83 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
84 /// Gives the current mouse point in the viewer
85 /// \param theEvent the mouse event
86 /// \param theView a viewer to have the viewer the eye position
87 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
88 /// Gives the current selected objects to be processed by the operation
89 /// \param thePoint a point clicked in the viewer
90 /// \param theEvent the mouse event
91 /// \param theSelected the list of selected presentations
92 /// \param theHighlighted the list of highlighted presentations
93 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
94 const std::list<ModuleBase_ViewerPrs>& theSelected,
95 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
97 /// Processes the mouse double click in the point
98 /// \param theEvent the mouse event
99 /// \param theView a viewer to have the viewer the eye position
100 /// \param theSelected the list of selected presentations
101 /// \param theHighlighted the list of highlighted presentations
102 virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
103 const std::list<ModuleBase_ViewerPrs>& theSelected,
104 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
107 /// \brief Virtual method called when operation is started
108 /// Virtual method called when operation started (see start() method for more description)
109 /// Switch off the multi selection state
110 virtual void startOperation();
112 /// Virtual method called when operation stopped - committed or aborted.
113 /// Restore the multi selection state
114 virtual void stopOperation();
116 /// Creates an operation new feature
117 /// Returns NULL feature. This is an operation of edition, not creation.
118 /// \param theFlushMessage the flag whether the create message should be flushed
119 /// \returns the created feature
120 virtual FeaturePtr createFeature(const bool theFlushMessage = true);
123 /// Emits a signal about the selection blocking. Emits a signal to change the selection.
124 /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
125 /// the internal operation features are to be selected
126 /// \param isBlocked the state whether the operation is blocked or unblocked
127 /// \param isRestoreSelection the state whether the selected objects should be reselected
128 void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
130 /// Sends the features
134 Point myCurPoint; ///< the current 3D point clicked or moved
135 bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal