1 // File: PartSet_OperationFeatureEditMulti.h
2 // Created: 05 May 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_OperationFeatureEditMulti_H
6 #define PartSet_OperationFeatureEditMulti_H
10 #include <PartSet_OperationSketchBase.h>
16 \class PartSet_OperationFeatureEditMulti
17 * \brief The operation for the sketch feature creation
19 class PARTSET_EXPORT PartSet_OperationFeatureEditMulti : 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_OperationFeatureEditMulti(const QString& theId, QObject* theParent,
69 FeaturePtr theFeature);
71 virtual ~PartSet_OperationFeatureEditMulti();
73 /// Returns that this operator can be started above already running one.
74 /// The runned operation should be the sketch feature modified operation
75 /// \param theOperation the previous running operation
76 virtual bool isGranted(ModuleBase_IOperation* theOperation) const;
78 /// Initializes the operation with previously created feature. It is used in sequental operations
79 virtual void initFeature(FeaturePtr theFeature);
81 /// Initialisation of operation with preliminary selection
82 /// \param theSelected the list of selected presentations
83 /// \param theHighlighted the list of highlighted presentations
84 virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
85 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
87 /// Returns the operation sketch feature
88 /// \returns the sketch instance
89 virtual FeaturePtr sketch() const;
91 /// Processes the mouse pressed in the point
92 /// \param theEvent the mouse event
93 /// \param theView a viewer to have the viewer the eye position
94 /// \param theSelected the list of selected presentations
95 /// \param theHighlighted the list of highlighted presentations
96 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
97 const std::list<ModuleBase_ViewerPrs>& theSelected,
98 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
99 /// Gives the current mouse point in the viewer
100 /// \param theEvent the mouse event
101 /// \param theView a viewer to have the viewer the eye position
102 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
103 /// Gives the current selected objects to be processed by the operation
104 /// \param thePoint a point clicked in the viewer
105 /// \param theEvent the mouse event
106 /// \param theSelected the list of selected presentations
107 /// \param theHighlighted the list of highlighted presentations
108 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
109 const std::list<ModuleBase_ViewerPrs>& theSelected,
110 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
112 /// \brief Virtual method called when operation is started
113 /// Virtual method called when operation started (see start() method for more description)
114 /// Switch off the multi selection state
115 virtual void startOperation();
117 /// Virtual method called when operation stopped - committed or aborted.
118 /// Restore the multi selection state
119 virtual void stopOperation();
122 /// Emits a signal about the selection blocking. Emits a signal to change the selection.
123 /// If the block is true, the signal clear selection, otherwise if restore selection flag allows,
124 /// the internal operation features are to be selected
125 /// \param isBlocked the state whether the operation is blocked or unblocked
126 /// \param isRestoreSelection the state whether the selected objects should be reselected
127 void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
129 /// Sends the features
133 FeaturePtr mySketch; ///< the sketch feature
134 std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
135 Point myCurPoint; ///< the current 3D point clicked or moved
136 bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal