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>
14 class ModuleBase_ISelection;
17 \class PartSet_OperationFeatureEdit
18 * \brief The operation for the sketch feature creation
20 class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationFeatureBase
23 /// Struct to define gp point, with the state is the point is initialized
29 myIsInitialized = false;
32 /// \param thePoint the point
33 Point(gp_Pnt thePoint)
41 /// clear the initialized flag.
44 myIsInitialized = false;
46 /// set the point and switch on the initialized flag
47 /// \param thePoint the point
48 void setPoint(const gp_Pnt& thePoint)
50 myIsInitialized = true;
54 bool myIsInitialized; /// the state whether the point is set
55 gp_Pnt myPoint; /// the point
59 /// Returns the operation type key
60 static std::string Type()
67 /// \param theId the feature identifier
68 /// \param theParent the operation parent
69 /// \param theFeature the parent feature
70 PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent, CompositeFeaturePtr theFeature);
72 virtual ~PartSet_OperationFeatureEdit();
75 /// Initialisation of operation with preliminary selection
76 /// \param theSelected the list of selected presentations
77 /// \param theHighlighted the list of highlighted presentations
78 /// \param theViewer a viewer to have the viewer the eye position
79 virtual void initSelection(ModuleBase_ISelection* theSelection,
80 ModuleBase_IViewer* theViewer);
82 /// Processes the mouse pressed in the point
83 /// \param theEvent the mouse event
84 /// \param theView a viewer to have the viewer the eye position
85 /// \param theSelected the list of selected presentations
86 /// \param theHighlighted the list of highlighted presentations
87 virtual void mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection);
89 /// Gives the current mouse point in the viewer
90 /// \param theEvent the mouse event
91 /// \param theView a viewer to have the viewer the eye position
92 virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
93 /// Gives the current selected objects to be processed by the operation
94 /// \param thePoint a point clicked in the viewer
95 /// \param theEvent the mouse event
96 /// \param theSelected the list of selected presentations
97 /// \param theHighlighted the list of highlighted presentations
98 virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
99 ModuleBase_ISelection* theSelection);
101 /// Processes the mouse double click in the point
102 /// \param theEvent the mouse event
103 /// \param theView a viewer to have the viewer the eye position
104 /// \param theSelected the list of selected presentations
105 /// \param theHighlighted the list of highlighted presentations
106 virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
107 ModuleBase_ISelection* theSelection);
110 /// \brief Virtual method called when operation is started
111 /// Virtual method called when operation started (see start() method for more description)
112 /// Switch off the multi selection state
113 virtual void startOperation();
115 /// Virtual method called when operation stopped - committed or aborted.
116 /// Restore the multi selection state
117 virtual void stopOperation();
119 /// Creates an operation new feature
120 /// Returns NULL feature. This is an operation of edition, not creation.
121 /// \param theFlushMessage the flag whether the create message should be flushed
122 /// \returns the created feature
123 virtual FeaturePtr createFeature(const bool theFlushMessage = true,
124 CompositeFeaturePtr theCompositeFeature = CompositeFeaturePtr());
127 /// Emits a signal about the selection blocking. Emits a signal to change the selection.
128 /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
129 /// the internal operation features are to be selected
130 /// \param isBlocked the state whether the operation is blocked or unblocked
131 /// \param isRestoreSelection the state whether the selected objects should be reselected
132 //void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
134 /// Sends the features
138 // the next map should be removed when selection is processed in the move function
139 std::map<FeaturePtr, std::list<std::string> > myFeature2Attribute; /// a map of a feature to attributes
141 Point myCurPoint; ///< the current 3D point clicked or moved
142 bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal