1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: ModuleBase_IWorkshop.h
4 // Created: 2 June 2014
5 // Author: Vitaly Smetannikov
7 #ifndef ModuleBase_IWorkshop_H
8 #define ModuleBase_IWorkshop_H
10 #include "ModuleBase.h"
11 #include "ModuleBase_Definitions.h"
12 #include <ModuleBase_FilterValidated.h>
14 #include <ModelAPI_Object.h>
15 #include <GeomAPI_AISObject.h>
16 #include <Config_FeatureMessage.h>
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;
31 * Class which provides access to Workshop object services
33 class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
38 /// \param theParent parent object
39 ModuleBase_IWorkshop(QObject* theParent);
41 virtual ~ModuleBase_IWorkshop()
44 /// Return current selection instance
45 virtual ModuleBase_ISelection* selection() const = 0;
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;
51 /// Activate objects in the module selection modes(opens local context)
52 virtual void activateModuleSelectionModes() = 0;
54 /// Deactivate sub-shapes selection (closes local context)
55 virtual void deactivateSubShapesSelection() = 0;
57 //! Returns instance of loaded module
58 virtual ModuleBase_IModule* module() const = 0;
60 //! Returns current viewer
61 virtual ModuleBase_IViewer* viewer() const = 0;
63 //! Returns property panel
64 virtual ModuleBase_IPropertyPanel* propertyPanel() const = 0;
66 //! Returns error manager
67 virtual ModuleBase_IErrorMgr* errorMgr() const = 0;
69 /// A filter to process an attribute validators
71 Handle(ModuleBase_FilterValidated) validatorFilter();
73 //! Returns currently active operation
74 virtual ModuleBase_Operation* currentOperation() const = 0;
76 //! Returns true if the operation with id theId can be started
77 virtual bool canStartOperation(QString theId, bool& isCommitted) = 0;
79 //! Performs the operation launch
80 //! \param theOperation an operation to be launched
81 virtual void processLaunchOperation(ModuleBase_Operation* theOperation) = 0;
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;
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;
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;
99 //! Returns AIS object by data object
100 //! \param theObject a data object
101 virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0;
103 //! Returns data object by AIS
104 //! \param theAIS a presentation
105 virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
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;
112 //! Shows the message in the status bar
113 //! \param theMessage a message
114 virtual void setStatusBarMessage(const QString& theMessage) = 0;
116 /// Update of commands status
117 virtual void updateCommandStatus() = 0;
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;
123 /// Returns main window of the application
124 virtual QMainWindow* desktop() const = 0;
128 /// Signal selection changed.
129 void selectionChanged();
131 /// Signal which is emited after activation of property panel
132 void propertyPanelActivated();
135 /// A filter to process an attribute validators
136 Handle(ModuleBase_FilterValidated) myValidatorFilter;