]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_Module.h
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
[modules/shaper.git] / src / PartSet / PartSet_Module.h
1 #ifndef PartSet_Module_H
2 #define PartSet_Module_H
3
4 #include "PartSet.h"
5
6 #include <XGUI_Module.h>
7 #include <XGUI_Command.h>
8
9 #include <QMap>
10 #include <QObject>
11
12 #include <string>
13
14 #include <boost/shared_ptr.hpp>
15
16 class QMouseEvent;
17 class QKeyEvent;
18 class PartSet_Listener;
19 class ModelAPI_Feature;
20
21 class PARTSET_EXPORT PartSet_Module: public QObject, public XGUI_Module
22 {
23 Q_OBJECT
24
25 public:
26   PartSet_Module(XGUI_Workshop* theWshop);
27   virtual ~PartSet_Module();
28
29   virtual void createFeatures();
30   virtual void featureCreated(XGUI_Command* theFeature);
31   virtual QStringList nestedFeatures(QString theFeature);
32   std::string featureFile(const std::string&);
33
34   virtual void launchOperation(const QString& theCmdId);
35
36   /// Displays or erase the current operation preview, if it has it.
37   /// \param theF
38   /// \param isDisplay the state whether the presentation should be displayed or erased
39   void visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFeature, bool isDisplay);
40
41 public slots:
42   void onFeatureTriggered();
43   /// SLOT, that is called after the operation is started. Perform some specific for module
44   /// actions, e.g. connect the sketch feature to the viewer selection and show the sketch preview.
45   void onOperationStarted();
46   /// SLOT, that is called after the operation is stopped. Disconnect the sketch feature
47   /// from the viewer selection and show the sketch preview.
48   void onOperationStopped(ModuleBase_Operation* theOperation);
49
50   /// SLOT, that is called by the selection in the viewer is changed.
51   /// The selection is sent to the current operation if it listens selection.
52   void onSelectionChanged();
53   /// SLOT, that is called by mouse click in the viewer.
54   /// The mouse released point is sent to the current operation to be processed.
55   /// \param theEvent the mouse event
56   void onMouseReleased(QMouseEvent* theEvent);
57   /// SLOT, that is called by the selection in the viewer is changed.
58   /// The mouse moved point is sent to the current operation to be processed.
59   /// \param theEvent the mouse event
60   void onMouseMoved(QMouseEvent* theEvent);
61
62   /// SLOT, that is called by the key in the viewer is clicked.
63   /// \param theEvent the mouse event
64   void onKeyRelease(QKeyEvent*);
65
66   /// SLOT, to apply to the current viewer the operation
67   /// \param theX the X projection value
68   /// \param theY the Y projection value
69   /// \param theZ the Z projection value
70   void onPlaneSelected(double theX, double theY, double theZ);
71
72   /// SLOT, to visualize the feature in another local context mode
73   /// \param theFeature the feature to be put in another local context mode
74   void onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature);
75
76 private:
77   XGUI_Workshop* myWorkshop;
78   PartSet_Listener* myListener;
79
80   std::map<std::string, std::string> myFeaturesInFiles;
81 };
82
83 #endif