Salome HOME
ModuleBase_ViewerPrs is wrapped into shared_ptr.
[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 #include <ModuleBase_ViewerPrs.h>
14
15 #include <ModelAPI_Object.h>
16 #include <GeomAPI_AISObject.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
27 /**
28  * \ingroup GUI
29  * Class which provides access to Workshop object services
30  */
31 class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
32 {
33 Q_OBJECT
34  public:
35    /// Constructor
36    /// \param theParent parent object
37   ModuleBase_IWorkshop(QObject* theParent);
38
39   virtual ~ModuleBase_IWorkshop()
40   {}
41
42   /// Return current selection instance
43   virtual ModuleBase_ISelection* selection() const = 0;
44
45   /// Activate sub-shapes selection (opens local context)
46   /// Types has to be defined according to TopAbs_ShapeEnum
47   virtual void activateSubShapesSelection(const QIntList& theTypes) = 0;
48
49   /// Activate objects in the module selection modes(opens local context)
50   virtual void activateModuleSelectionModes() = 0;
51
52   /// Deactivate sub-shapes selection (closes local context)
53   virtual void deactivateSubShapesSelection() = 0;
54
55   //! Returns instance of loaded module
56   virtual ModuleBase_IModule* module() const = 0;
57
58   //! Returns current viewer
59   virtual ModuleBase_IViewer* viewer() const = 0;
60
61   //! Returns property panel
62   virtual ModuleBase_IPropertyPanel* propertyPanel() const = 0;
63
64   /// A filter to process an attribute validators
65   /// \return a filter
66   Handle(ModuleBase_FilterValidated) validatorFilter();
67
68   //! Returns the factory of selection filters : the only one instance per application
69   ModuleBase_FilterFactory* selectionFilters() const;
70   
71   //! Returns currently active operation
72   virtual ModuleBase_Operation* currentOperation() const = 0;
73
74   //! Returns true if the operation with id theId can be started
75   virtual bool canStartOperation(QString theId) = 0;
76
77   //! Returns started operation by the operation identifier
78   //! \param theId an operation id
79   //! \return an operation instance or NULL
80   virtual ModuleBase_Operation* findStartedOperation(const QString& theId) = 0;
81
82   //! Returns true if the operation with id theId can be stopped
83   //! \param theOperation a stopped operation
84   //! \return boolean result
85   virtual bool canStopOperation(ModuleBase_Operation* theOperation) = 0;
86
87   //! Aborts the operation.
88   //! \param theOperation an aborted operation
89   virtual void abortOperation(ModuleBase_Operation* theOperation) = 0;
90
91   //! Returns AIS object by data object
92   //! \param theObject a data object
93   virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0;
94
95   //! Returns data object by AIS
96   //! \param theAIS a presentation
97   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
98
99   //! Select features clearing previous selection. 
100   //! If the list is empty then selection will be cleared
101   //! \param theValues a list of presentations
102   virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) = 0;
103
104    /// Update of commands status
105   virtual void updateCommandStatus() = 0;
106
107 signals:
108   /// Signal selection changed.
109   void selectionChanged();
110
111   /// Signal which is emited after activation of property panel
112   void propertyPanelActivated();
113
114 protected:
115   /// A filter to process an attribute validators
116   Handle(ModuleBase_FilterValidated) myValidatorFilter;
117 };
118
119 #endif