1 // File: PartSet_OperationFeatureCreate.h
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_OperationFeatureCreate_H
6 #define PartSet_OperationFeatureCreate_H
10 #include <PartSet_OperationFeatureBase.h>
11 #include <PartSet_Constants.h>
15 class GeomDataAPI_Point2D;
20 \class PartSet_OperationFeatureCreate
21 * \brief The operation for the sketch feature creation
23 class PARTSET_EXPORT PartSet_OperationFeatureCreate : public PartSet_OperationFeatureBase
28 /// Returns true if the feature with the given kind can be created by this operation
29 /// \param theId the feature kind
30 /// \return the boolean result
31 static bool canProcessKind(const std::string& theId);
34 /// \param theId the feature identifier
35 /// \param theParent the operation parent
36 /// \param theSketch the parent feature
37 PartSet_OperationFeatureCreate(const QString& theId, QObject* theParent, FeaturePtr theSketch);
39 virtual ~PartSet_OperationFeatureCreate();
41 /// Returns the operation local selection mode
42 /// \param theFeature the feature object to get the selection mode
43 /// \return the selection mode
44 virtual std::list<int> getSelectionModes(ObjectPtr theFeature) const;
46 /// Gives the current mouse point in the viewer
47 /// \param thePoint a point clicked in the viewer
48 /// \param theEvent the mouse event
49 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
51 /// Gives the current selected objects to be processed by the operation
52 /// \param theEvent the mouse event
53 /// \param theView a viewer to have the viewer the eye position
54 /// \param theSelected the list of selected presentations
55 /// \param theHighlighted the list of highlighted presentations
56 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
57 const std::list<ModuleBase_ViewerPrs>& theSelected,
58 const std::list<ModuleBase_ViewerPrs>& theHighlighted);
59 /// Processes the key pressed in the view
60 /// \param theKey a key value
61 virtual void keyReleased(const int theKey);
63 /// Initializes the operation with previously created feature. It is used in sequental operations
64 void initFeature(FeaturePtr theFeature) { myInitFeature = theFeature; }
67 /// Slots which listen the mode widget activation
68 /// \param theWidget the model widget
69 virtual void onWidgetActivated(ModuleBase_ModelWidget* theWidget);
72 /// \brief Virtual method called when operation is started
73 /// Virtual method called when operation started (see start() method for more description)
74 /// After the parent operation body perform, set sketch feature to the created line feature
75 virtual void startOperation();
77 /// Virtual method called when operation aborted (see abort() method for more description)
78 /// Before the feature is aborted, it should be hidden from the viewer
79 virtual void abortOperation();
81 /// Virtual method called when operation stopped - committed or aborted.
82 /// Restore the multi selection state
83 virtual void stopOperation();
85 /// Virtual method called after operation committed (see commit() method for more description)
86 virtual void afterCommitOperation();
88 /// Creates an operation new feature
89 /// In addition to the default realization it appends the created line feature to
90 /// the sketch feature
91 /// \param theFlushMessage the flag whether the create message should be flushed
92 /// \returns the created feature
93 virtual FeaturePtr createFeature(const bool theFlushMessage = true);
95 /// Verifies whether this operator can be commited.
96 /// \return Returns TRUE if current operation can be committed, e.g. all parameters are filled
97 virtual bool canBeCommitted() const;
100 /// Feature of previous operation (for sequintal operations)
101 FeaturePtr myInitFeature;