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>
23 \class PartSet_OperationSketchBase
24 * \brief The base operation for the sketch features.
25 * Base class for all sketch operations. It provides an access to the feature preview
27 class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_Operation
31 enum FeatureActionMode { FM_Activation, FM_Deactivation, FM_Abort };
35 /// \param theId an feature index
36 /// \param theParent the object parent
37 PartSet_OperationSketchBase(const QString& theId, QObject* theParent);
39 virtual ~PartSet_OperationSketchBase();
41 /// Returns the feature preview shape
42 /// \param theFeature the feature object to obtain the preview
43 boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
45 /// Returns the operation local selection mode
46 /// \param theFeature the feature object to get the selection mode
47 /// \return the selection mode
48 virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
50 /// Initializes some fields accorging to the feature
51 /// \param theFeature the feature
52 virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature) {}
54 /// Gives the current selected objects to be processed by the operation
55 /// \param theFeature the selected feature
56 /// \param theShape the selected shape
57 virtual void setSelected(boost::shared_ptr<ModelAPI_Feature> theFeature,
58 const TopoDS_Shape& theShape) {};
60 /// Processes the mouse pressed in the point
61 /// \param thePoint a point clicked in the viewer
62 /// \param theEvent the mouse event
63 virtual void mousePressed(const gp_Pnt& thePoint, QMouseEvent* theEvent) {};
65 /// Processes the mouse release in the point
66 /// \param thePoint a point clicked in the viewer
67 /// \param theEvent the mouse event
68 virtual void mouseReleased(const gp_Pnt& thePoint, QMouseEvent* theEvent) {};
70 /// Processes the mouse move in the point
71 /// \param thePoint a 3D point clicked in the viewer
72 /// \param theEvent the mouse event
73 virtual void mouseMoved(const gp_Pnt& thePoint, QMouseEvent* theEvent) {};
75 /// Processes the key pressed in the view
76 /// \param theKey a key value
77 virtual void keyReleased(const int theKey) {};
80 /// Signal about the feature construing is finished
81 /// \param theFeature the result feature
82 /// \param theMode the mode of the feature modification
83 void featureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
85 /// signal about the request to launch operation
86 /// theName the operation name
87 /// theFeature the operation argument
88 void launchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
91 /// Creates an operation new feature
92 /// In addition to the default realization it appends the created line feature to
93 /// the sketch feature
94 /// \returns the created feature
95 virtual boost::shared_ptr<ModelAPI_Feature> createFeature();