Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / ModuleBase / ModuleBase_IWorkshop.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        ModuleBase_IWorkshop.h
4 // Created:     2 June 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef ModuleBase_IWorkshop_H
8 #define ModuleBase_IWorkshop_H
9
10 #include "ModuleBase.h"
11 #include "ModuleBase_Definitions.h"
12 #include <ModuleBase_FilterValidated.h>
13
14 #include <ModelAPI_Object.h>
15 #include <GeomAPI_AISObject.h>
16 #include <Config_FeatureMessage.h>
17
18 #include <QObject>
19
20 class ModuleBase_IModule;
21 class ModuleBase_ISelection;
22 class ModuleBase_IViewer;
23 class ModuleBase_IPropertyPanel;
24 class ModuleBase_IErrorMgr;
25 class ModuleBase_Operation;
26 class ModuleBase_ViewerPrs;
27 class QMainWindow;
28
29 /**
30  * \ingroup GUI
31  * Class which provides access to Workshop object services
32  */
33 class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
34 {
35 Q_OBJECT
36  public:
37    /// Constructor
38    /// \param theParent parent object
39   ModuleBase_IWorkshop(QObject* theParent);
40
41   virtual ~ModuleBase_IWorkshop()
42   {}
43
44   /// Return current selection instance
45   virtual ModuleBase_ISelection* selection() const = 0;
46
47   /// Activate sub-shapes selection (opens local context)
48   /// Types has to be defined according to TopAbs_ShapeEnum
49   virtual void activateSubShapesSelection(const QIntList& theTypes) = 0;
50
51   /// Activate objects in the module selection modes(opens local context)
52   virtual void activateModuleSelectionModes() = 0;
53
54   /// Deactivate sub-shapes selection (closes local context)
55   virtual void deactivateSubShapesSelection() = 0;
56
57   //! Returns instance of loaded module
58   virtual ModuleBase_IModule* module() const = 0;
59
60   //! Returns current viewer
61   virtual ModuleBase_IViewer* viewer() const = 0;
62
63   //! Returns property panel
64   virtual ModuleBase_IPropertyPanel* propertyPanel() const = 0;
65
66   //! Returns error manager
67   virtual ModuleBase_IErrorMgr* errorMgr() const = 0;
68
69   /// A filter to process an attribute validators
70   /// \return a filter
71   Handle(ModuleBase_FilterValidated) validatorFilter();
72
73   //! Returns currently active operation
74   virtual ModuleBase_Operation* currentOperation() const = 0;
75
76   //! Returns true if the operation with id theId can be started
77   virtual bool canStartOperation(QString theId, bool& isCommitted) = 0;
78
79   //! Performs the operation launch
80   //! \param theOperation an operation to be launched
81   virtual void processLaunchOperation(ModuleBase_Operation* theOperation) = 0;
82
83   //! Returns started operation by the operation identifier
84   //! \param theId an operation id
85   //! \return an operation instance or NULL
86   virtual ModuleBase_Operation* findStartedOperation(const QString& theId) = 0;
87
88   //! Returns true if the operation with id theId can be stopped
89   //! \param theOperation a stopped operation
90   //! \return boolean result
91   virtual bool canStopOperation(ModuleBase_Operation* theOperation) = 0;
92
93   //! Commits if possible or aborts the given operation.
94   //! \param theOperation an aborted operation
95   /// \param isCommitted boolean value if the operation was committed otherwise it was aborted
96   virtual void stopOperation(ModuleBase_Operation* theOperation,
97                              bool& isCommitted) = 0;
98
99   //! Returns AIS object by data object
100   //! \param theObject a data object
101   virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0;
102
103   //! Returns data object by AIS
104   //! \param theAIS a presentation
105   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
106
107   //! Select features clearing previous selection.
108   //! If the list is empty then selection will be cleared
109   //! \param theValues a list of presentations
110   virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) = 0;
111
112   //! Shows the message in the status bar
113   //! \param theMessage a message
114   virtual void setStatusBarMessage(const QString& theMessage) = 0;
115
116    /// Update of commands status
117   virtual void updateCommandStatus() = 0;
118
119   /// Returns feature info according to given feature ID
120   /// \param theId a feature Id
121   virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theId) const = 0;
122
123   /// Returns main window of the application
124   virtual QMainWindow* desktop() const = 0;
125
126
127 signals:
128   /// Signal selection changed.
129   void selectionChanged();
130
131   /// Signal which is emited after activation of property panel
132   void propertyPanelActivated();
133
134 protected:
135   /// A filter to process an attribute validators
136   Handle(ModuleBase_FilterValidated) myValidatorFilter;
137 };
138
139 #endif