Salome HOME
7e8190eb16755222d7d0290f4bf5c0d2a6ee8963
[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 XGUI_ViewWindow;
17 class QMouseEvent;
18 class QKeyEvent;
19 class PartSet_Listener;
20 class ModelAPI_Feature;
21
22 class PARTSET_EXPORT PartSet_Module: public QObject, public XGUI_Module
23 {
24 Q_OBJECT
25
26 public:
27   PartSet_Module(XGUI_Workshop* theWshop);
28   virtual ~PartSet_Module();
29
30   virtual void createFeatures();
31   virtual void featureCreated(XGUI_Command* theFeature);
32   virtual QStringList nestedFeatures(QString theFeature);
33   std::string featureFile(const std::string&);
34
35   virtual void launchOperation(const QString& theCmdId);
36
37   /// Displays or erase the current operation preview, if it has it.
38   /// \param theF
39   /// \param isDisplay the state whether the presentation should be displayed or erased
40   void visualizePreview(boost::shared_ptr<ModelAPI_Feature> theFeature, bool isDisplay);
41
42 public slots:
43   void onFeatureTriggered();
44   /// SLOT, that is called after the operation is started. Perform some specific for module
45   /// actions, e.g. connect the sketch feature to the viewer selection and show the sketch preview.
46   void onOperationStarted();
47   /// SLOT, that is called after the operation is stopped. Disconnect the sketch feature
48   /// from the viewer selection and show the sketch preview.
49   void onOperationStopped(ModuleBase_Operation* theOperation);
50
51   /// SLOT, that is called by the selection in the viewer is changed.
52   /// The selection is sent to the current operation if it listens selection.
53   void onSelectionChanged();
54   /// SLOT, that is called by mouse click in the viewer.
55   /// The mouse released point is sent to the current operation to be processed.
56   /// \param theWindow the window where the signal appears
57   /// \param theEvent the mouse event
58   void onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
59   /// SLOT, that is called by the selection in the viewer is changed.
60   /// The mouse moved point is sent to the current operation to be processed.
61   /// \param theWindow the window where the signal appears
62   /// \param theEvent the mouse event
63   void onMouseMoved(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
64
65   /// SLOT, that is called by the key in the viewer is clicked.
66   /// \param theWindow the window where the signal appears
67   /// \param theEvent the mouse event
68   void onKeyRelease(XGUI_ViewWindow*, QKeyEvent*);
69
70   /// SLOT, to apply to the current viewer the operation
71   /// \param theX the X projection value
72   /// \param theY the Y projection value
73   /// \param theZ the Z projection value
74   void onPlaneSelected(double theX, double theY, double theZ);
75
76   /// SLOT, to visualize the feature in another local context mode
77   /// \param theFeature the feature to be put in another local context mode
78   void onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature);
79
80 private:
81   XGUI_Workshop* myWorkshop;
82   PartSet_Listener* myListener;
83
84   std::map<std::string, std::string> myFeaturesInFiles;
85 };
86
87 #endif