Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / PartSet / PartSet_OperationSketchBase.h
1 // File:        PartSet_OperationSketchBase.h
2 // Created:     20 Apr 2014
3 // Author:      Natalia ERMOLAEVA
4
5 #ifndef PartSet_OperationSketchBase_H
6 #define PartSet_OperationSketchBase_H
7
8 #include "PartSet.h"
9
10 #include <TopoDS_Shape.hxx>
11 #include <gp_Pnt.hxx>
12 #include <NCollection_List.hxx>
13
14 #include <ModuleBase_PropPanelOperation.h>
15 #include <QObject>
16
17 class GeomAPI_Shape;
18
19 /*!
20   \class PartSet_OperationSketchBase
21   * \brief The base operation for the sketch features.
22   *  Base class for all sketch operations. It provides an access to the feature preview
23 */
24 class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_PropPanelOperation
25 {
26   Q_OBJECT
27 public:
28   /// Constructor
29   /// \param theId an feature index
30   /// \param theParent the object parent
31   PartSet_OperationSketchBase(const QString& theId, QObject* theParent);
32   /// Destructor
33   virtual ~PartSet_OperationSketchBase();
34
35   /// Returns the feature preview shape
36   /// \param theFeature the feature object to obtain the preview
37   boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
38
39   /// Returns the operation local selection mode
40   /// \param theFeature the feature object to get the selection mode
41   /// \return the selection mode
42   virtual int getSelectionMode(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
43
44   /// Gives the current selected objects to be processed by the operation
45   /// \param theList a list of interactive selected shapes
46   virtual void setSelectedShapes(const NCollection_List<TopoDS_Shape>& theList) {};
47
48   /// Processes the mouse release in the point
49   /// \param thePoint a point clicked in the viewer
50   virtual void mouseReleased(const gp_Pnt& thePoint) {};
51
52   /// Processes the mouse move in the point
53   /// \param thePoint a 3D point clicked in the viewer
54   virtual void mouseMoved(const gp_Pnt& thePoint) {};
55
56   /// Processes the key pressed in the view
57   /// \param theKey a key value
58   virtual void keyReleased(const int theKey) {};
59
60 signals:
61   /// Signal about the feature construing is finished
62   /// \param theFeature the result feature
63   void featureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature);
64
65 public:
66   /// temporary code to provide edition mode
67   void setEditMode(const bool isEditMode) { myIsEditMode = isEditMode; };
68 protected:
69   bool isEditMode() const { return myIsEditMode; }
70 private:
71   bool myIsEditMode;
72 };
73
74 #endif