Salome HOME
ea7d30e4dac0997544fc34b33fece681e758cb6a
[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 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 theWindow the window where the signal appears
56   /// \param theEvent the mouse event
57   void onMouseReleased(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
58   /// SLOT, that is called by the selection in the viewer is changed.
59   /// The mouse moved point is sent to the current operation to be processed.
60   /// \param theWindow the window where the signal appears
61   /// \param theEvent the mouse event
62   void onMouseMoved(XGUI_ViewWindow* theWindow, QMouseEvent* theEvent);
63
64   /// SLOT, to apply to the current viewer the operation
65   /// \param theX the X projection value
66   /// \param theY the Y projection value
67   /// \param theZ the Z projection value
68   void onPlaneSelected(double theX, double theY, double theZ);
69
70   /// SLOT, to visualize the feature in another local context mode
71   /// \param theFeature the feature to be put in another local context mode
72   void onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature);
73
74 private:
75   XGUI_Workshop* myWorkshop;
76   PartSet_Listener* myListener;
77
78   std::map<std::string, std::string> myFeaturesInFiles;
79 };
80
81 #endif