1 // File: PartSet_OperationSketchBase.h
2 // Created: 20 Apr 2014
3 // Author: Natalia ERMOLAEVA
5 #ifndef PartSet_OperationSketchBase_H
6 #define PartSet_OperationSketchBase_H
10 #include <TopoDS_Shape.hxx>
12 #include <NCollection_List.hxx>
14 #include <ModuleBase_Operation.h>
15 #include <ModuleBase_Operation.h>
18 class Handle_V3d_View;
24 \class PartSet_OperationSketchBase
25 * \brief The base operation for the sketch features.
26 * Base class for all sketch operations. It provides an access to the feature preview
28 class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_Operation
32 enum FeatureActionMode { FM_Activation, FM_Deactivation, FM_Abort };
36 /// \param theId an feature index
37 /// \param theParent the object parent
38 PartSet_OperationSketchBase(const QString& theId, QObject* theParent);
40 virtual ~PartSet_OperationSketchBase();
42 /// Returns the feature preview shape
43 /// \param theFeature the feature object to obtain the preview
44 boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
46 /// Returns the operation local selection mode
47 /// \param theFeature the feature object to get the selection mode
48 /// \return the selection mode
49 virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
51 /// Initializes some fields accorging to the feature
52 /// \param theFeature the feature
53 virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature) {}
55 /// Processes the mouse pressed in the point
56 /// \param thePoint a point clicked in the viewer
57 /// \param theEvent the mouse event
58 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView);
60 /// Processes the mouse release in the point
61 /// \param thePoint a point clicked in the viewer
62 /// \param theEvent the mouse event
63 /// \param theSelected the list of selected presentations
64 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
65 const std::list<XGUI_ViewerPrs>& theSelected);
67 /// Processes the mouse move in the point
68 /// \param thePoint a 3D point clicked in the viewer
69 /// \param theEvent the mouse event
70 /// \param theSelected the list of selected presentations
71 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView,
72 const std::list<XGUI_ViewerPrs>& theSelected);
74 /// Processes the key pressed in the view
75 /// \param theKey a key value
76 virtual void keyReleased(const int theKey) {};
79 /// Signal about the feature construing is finished
80 /// \param theFeature the result feature
81 /// \param theMode the mode of the feature modification
82 void featureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
84 /// signal about the request to launch operation
85 /// theName the operation name
86 /// theFeature the operation argument
87 void launchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
88 /// signal to enable/disable multi selection in the viewer
89 /// \param theEnabled the boolean state
90 void multiSelectionEnabled(bool theEnabled);
92 /// signal to enable/disable usual selection in the viewer
93 /// \param theEnabled the boolean state
94 void selectionEnabled(bool theEnabled);
97 /// Creates an operation new feature
98 /// In addition to the default realization it appends the created line feature to
99 /// the sketch feature
100 /// \returns the created feature
101 virtual boost::shared_ptr<ModelAPI_Feature> createFeature();