Salome HOME
Parameters management implementation
[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_Operation;
25 class ModuleBase_FilterFactory;
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   /// A filter to process an attribute validators
67   /// \return a filter
68   Handle(ModuleBase_FilterValidated) validatorFilter();
69
70   //! Returns the factory of selection filters : the only one instance per application
71   ModuleBase_FilterFactory* selectionFilters() const;
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) = 0;
78
79   //! Returns started operation by the operation identifier
80   //! \param theId an operation id
81   //! \return an operation instance or NULL
82   virtual ModuleBase_Operation* findStartedOperation(const QString& theId) = 0;
83
84   //! Returns true if the operation with id theId can be stopped
85   //! \param theOperation a stopped operation
86   //! \return boolean result
87   virtual bool canStopOperation(ModuleBase_Operation* theOperation) = 0;
88
89   //! Aborts the operation.
90   //! \param theOperation an aborted operation
91   virtual void abortOperation(ModuleBase_Operation* theOperation) = 0;
92
93   //! Returns AIS object by data object
94   //! \param theObject a data object
95   virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0;
96
97   //! Returns data object by AIS
98   //! \param theAIS a presentation
99   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
100
101   //! Select features clearing previous selection. 
102   //! If the list is empty then selection will be cleared
103   //! \param theValues a list of presentations
104   virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) = 0;
105
106    /// Update of commands status
107   virtual void updateCommandStatus() = 0;
108
109   virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theId) const = 0;
110
111   virtual QMainWindow* desktop() const = 0;
112
113
114 signals:
115   /// Signal selection changed.
116   void selectionChanged();
117
118   /// Signal which is emited after activation of property panel
119   void propertyPanelActivated();
120
121 protected:
122   /// A filter to process an attribute validators
123   Handle(ModuleBase_FilterValidated) myValidatorFilter;
124 };
125
126 #endif