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>
20 class Handle_V3d_View;
26 \class PartSet_OperationSketchBase
27 * \brief The base operation for the sketch features.
28 * Base class for all sketch operations. It provides an access to the feature preview
30 class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_Operation
34 enum FeatureActionMode { FM_Activation, FM_Deactivation, FM_Abort };
38 /// \param theId an feature index
39 /// \param theParent the object parent
40 PartSet_OperationSketchBase(const QString& theId, QObject* theParent);
42 virtual ~PartSet_OperationSketchBase();
44 /// Returns the feature preview shape
45 /// \param theFeature the feature object to obtain the preview
46 boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
48 /// Returns the map of the operation previews including the nested feature previews
49 /// \return the map of feature to the feature preview
50 virtual std::map<boost::shared_ptr<ModelAPI_Feature>, boost::shared_ptr<GeomAPI_Shape> > preview() const;
52 /// Returns the operation local selection mode
53 /// \param theFeature the feature object to get the selection mode
54 /// \return the selection mode
55 virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
57 /// Initializes some fields accorging to the feature
58 /// \param theFeature the feature
59 virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature) {}
61 /// Processes the mouse pressed in the point
62 /// \param thePoint a point clicked in the viewer
63 /// \param theEvent the mouse event
64 virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView);
66 /// Processes the mouse release in the point
67 /// \param thePoint a point clicked in the viewer
68 /// \param theEvent the mouse event
69 /// \param theSelected the list of selected presentations
70 virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
71 const std::list<XGUI_ViewerPrs>& theSelected);
73 /// Processes the mouse move in the point
74 /// \param thePoint a 3D point clicked in the viewer
75 /// \param theEvent the mouse event
76 /// \param theSelected the list of selected presentations
77 virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView,
78 const std::list<XGUI_ViewerPrs>& theSelected);
80 /// Processes the key pressed in the view
81 /// \param theKey a key value
82 virtual void keyReleased(const int theKey) {};
85 /// Signal about the feature construing is finished
86 /// \param theFeature the result feature
87 /// \param theMode the mode of the feature modification
88 void featureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
90 /// signal about the request to launch operation
91 /// theName the operation name
92 /// theFeature the operation argument
93 void launchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
94 /// signal to enable/disable multi selection in the viewer
95 /// \param theEnabled the boolean state
96 void multiSelectionEnabled(bool theEnabled);
98 /// signal to enable/disable usual selection in the viewer
99 /// \param theEnabled the boolean state
100 void selectionEnabled(bool theEnabled);
103 /// Creates an operation new feature
104 /// In addition to the default realization it appends the created line feature to
105 /// the sketch feature
106 /// \returns the created feature
107 virtual boost::shared_ptr<ModelAPI_Feature> createFeature();