]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_OperationSketchBase.h
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_Operation.h>
15 #include <ModuleBase_Operation.h>
16 #include <QObject>
17
18 class GeomAPI_Shape;
19
20 /*!
21   \class PartSet_OperationSketchBase
22   * \brief The base operation for the sketch features.
23   *  Base class for all sketch operations. It provides an access to the feature preview
24 */
25 class PARTSET_EXPORT PartSet_OperationSketchBase : public ModuleBase_Operation
26 {
27   Q_OBJECT
28 public:
29   enum FeatureActionMode { FM_Activation, FM_Deactivation, FM_Abort };
30
31 public:
32   /// Constructor
33   /// \param theId an feature index
34   /// \param theParent the object parent
35   PartSet_OperationSketchBase(const QString& theId, QObject* theParent);
36   /// Destructor
37   virtual ~PartSet_OperationSketchBase();
38
39   /// Returns the feature preview shape
40   /// \param theFeature the feature object to obtain the preview
41   boost::shared_ptr<GeomAPI_Shape> preview(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
42
43   /// Returns the operation local selection mode
44   /// \param theFeature the feature object to get the selection mode
45   /// \return the selection mode
46   virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const = 0;
47
48   /// Initializes some fields accorging to the feature
49   /// \param theFeature the feature
50   virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature) {}
51
52   /// Gives the current selected objects to be processed by the operation
53   /// \param theFeature the selected feature
54   /// \param theShape the selected shape
55   virtual void setSelected(boost::shared_ptr<ModelAPI_Feature> theFeature,
56                            const TopoDS_Shape& theShape) {};
57
58   /// Processes the mouse release in the point
59   /// \param thePoint a point clicked in the viewer
60   virtual void mouseReleased(const gp_Pnt& thePoint) {};
61
62   /// Processes the mouse move in the point
63   /// \param thePoint a 3D point clicked in the viewer
64   virtual void mouseMoved(const gp_Pnt& thePoint) {};
65
66   /// Processes the key pressed in the view
67   /// \param theKey a key value
68   virtual void keyReleased(const int theKey) {};
69
70 signals:
71   /// Signal about the feature construing is finished
72   /// \param theFeature the result feature
73   /// \param theMode the mode of the feature modification
74   void featureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
75                           int theMode);
76   /// signal about the request to launch operation
77   /// theName the operation name
78   /// theFeature the operation argument
79   void launchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
80
81 protected:
82   /// Creates an operation new feature
83   /// In addition to the default realization it appends the created line feature to
84   /// the sketch feature
85   /// \returns the created feature
86   virtual boost::shared_ptr<ModelAPI_Feature> createFeature();
87 };
88
89 #endif