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_OperationSketchBase.h>
16 \class PartSet_OperationFeatureEdit
17 * \brief The operation for the sketch feature creation
19 class PARTSET_EXPORT PartSet_OperationFeatureEdit : public PartSet_OperationSketchBase
22 /// Struct to define gp point, with the state is the point is initialized
30 /// \param thePoint the point
31 Point(gp_Pnt thePoint)
39 /// clear the initialized flag.
42 myIsInitialized = false;
44 /// set the point and switch on the initialized flag
45 /// \param thePoint the point
46 void setPoint(const gp_Pnt& thePoint)
48 myIsInitialized = true;
52 bool myIsInitialized; /// the state whether the point is set
53 gp_Pnt myPoint; /// the point
57 /// Returns the operation type key
58 static std::string Type()
65 /// \param theId the feature identifier
66 /// \param theParent the operation parent
67 /// \param theFeature the parent feature
68 PartSet_OperationFeatureEdit(const QString& theId, QObject* theParent, FeaturePtr theFeature);
70 virtual ~PartSet_OperationFeatureEdit();
72 /// Returns the operation local selection mode
73 /// \param theFeature the feature object to get the selection mode
74 /// \return the selection mode
75 virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
77 /// Initializes the operation with previously created feature. It is used in sequental operations
78 virtual void initFeature(FeaturePtr theFeature);
80 /// Returns the operation sketch feature
81 /// \returns the sketch instance
82 virtual FeaturePtr sketch() const;
84 /// Processes the mouse pressed in the point
85 /// \param theEvent the mouse event
86 /// \param theView a viewer to have the viewer the eye position
87 /// \param theSelected the list of selected presentations
88 /// \param theHighlighted the list of highlighted presentations
89 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
90 const std::list<ModuleBase_ViewerPrs>& theSelected,
91 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
92 /// Gives the current mouse point in the viewer
93 /// \param theEvent the mouse event
94 /// \param theView a viewer to have the viewer the eye position
95 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
96 /// Gives the current selected objects to be processed by the operation
97 /// \param thePoint a point clicked in the viewer
98 /// \param theEvent the mouse event
99 /// \param theSelected the list of selected presentations
100 /// \param theHighlighted the list of highlighted presentations
101 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
102 const std::list<ModuleBase_ViewerPrs>& theSelected,
103 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
105 /// Processes the mouse double click in the point
106 /// \param theEvent the mouse event
107 /// \param theView a viewer to have the viewer the eye position
108 /// \param theSelected the list of selected presentations
109 /// \param theHighlighted the list of highlighted presentations
110 virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
111 const std::list<ModuleBase_ViewerPrs>& theSelected,
112 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
115 /// \brief Virtual method called when operation is started
116 /// Virtual method called when operation started (see start() method for more description)
117 /// Switch off the multi selection state
118 virtual void startOperation();
120 /// Virtual method called when operation stopped - committed or aborted.
121 /// Restore the multi selection state
122 virtual void stopOperation();
124 /// Creates an operation new feature
125 /// Returns NULL feature. This is an operation of edition, not creation.
126 /// \param theFlushMessage the flag whether the create message should be flushed
127 /// \returns the created feature
128 virtual FeaturePtr createFeature(const bool theFlushMessage = true);
131 /// Emits a signal about the selection blocking. Emits a signal to change the selection.
132 /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
133 /// the internal operation features are to be selected
134 /// \param isBlocked the state whether the operation is blocked or unblocked
135 /// \param isRestoreSelection the state whether the selected objects should be reselected
136 void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
138 /// Sends the features
142 FeaturePtr mySketch; ///< the sketch feature
143 Point myCurPoint; ///< the current 3D point clicked or moved
144 bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal