Salome HOME
Redesign of operations architecture
[modules/shaper.git] / src / ModuleBase / ModuleBase_IWorkshop.h
1 // File:        ModuleBase_IWorkshop.h
2 // Created:     2 June 2014
3 // Author:      Vitaly Smetannikov
4
5 #ifndef ModuleBase_IWorkshop_H
6 #define ModuleBase_IWorkshop_H
7
8 #include "ModuleBase.h"
9 #include "ModuleBase_Definitions.h"
10
11 #include <ModelAPI_Object.h>
12 #include <GeomAPI_AISObject.h>
13
14 #include <QObject>
15
16 class ModuleBase_IModule;
17 class ModuleBase_ISelection;
18 class ModuleBase_IViewer;
19 class ModuleBase_Operation;
20
21 /**
22  * Class which provides access to Workshop object serveces
23  */
24 class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
25 {
26 Q_OBJECT
27  public:
28   ModuleBase_IWorkshop(QObject* theParent)
29       : QObject(theParent)
30   {}
31
32   virtual ~ModuleBase_IWorkshop()
33   {}
34
35   virtual ModuleBase_ISelection* selection() const = 0;
36
37   /// Activate sub-shapes selection (opens local context)
38   /// Types has to be dined according to TopAbs_ShapeEnum
39   virtual void activateSubShapesSelection(const QIntList& theTypes) = 0;
40
41   /// Deactivate sub-shapes selection (closes local context)
42   virtual void deactivateSubShapesSelection() = 0;
43
44   //! Returns instance of loaded module
45   virtual ModuleBase_IModule* module() const = 0;
46
47   //! Returns current viewer
48   virtual ModuleBase_IViewer* viewer() const = 0;
49
50   //! Returns currently active operation
51   virtual ModuleBase_Operation* currentOperation() const = 0;
52
53   //! Returns true if the operation with id theId can be started
54   virtual bool canStartOperation(QString theId) = 0;
55
56   //! Returns AIS opbject by data object
57   virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0;
58
59   //! Returns data object by AIS
60   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
61
62   //! Select features clearing previous selection. 
63   //! If the list is empty then selection will be cleared
64   virtual void setSelected(const QObjectPtrList& theFeatures) = 0;
65
66 signals:
67   void selectionChanged();
68
69   /// Signal about an operation is started. It is emitted after the start() of operation is done.
70   void operationStarted(ModuleBase_Operation* theOperation);
71
72   /// Signal about an operation is stopped. It is emitted after the stop() of operation is done.
73   /// \param theOperation a stopped operation
74   void operationStopped(ModuleBase_Operation* theOperation);
75
76   /// Signal about an operation is resumed. It is emitted after the resume() of operation is done.
77   void operationResumed(ModuleBase_Operation* theOperation);
78
79   /// Emitted when current operation is comitted
80   void operationComitted(ModuleBase_Operation* theOperation);
81
82   /// Emitted when current operation is aborted
83   void operationAborted(ModuleBase_Operation* theOperation);
84
85   /// Signal which is emited after activation of property panel
86   void propertyPanelActivated();
87
88 };
89
90 #endif