1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 // File: XGUI_ModuleConnector.h
4 // Created: 3 June 2014
5 // Author: Vitaly Smetannikov
7 #ifndef XGUI_ModuleConnector_H
8 #define XGUI_ModuleConnector_H
11 #include <ModuleBase_Definitions.h>
12 #include <ModuleBase_IWorkshop.h>
19 * Implementation of IWorkshop interface which provides access to Workshop services at module level
21 class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop
26 /// \param theWorkshop a workshop
27 XGUI_ModuleConnector(XGUI_Workshop* theWorkshop);
29 virtual ~XGUI_ModuleConnector();
31 //! Returns list of currently selected data objects
32 virtual ModuleBase_ISelection* selection() const;
34 /// Activate sub-shapes selection (opens local context if it was not opened)
35 /// Types has to be dined according to TopAbs_ShapeEnum
36 virtual void activateSubShapesSelection(const QIntList& theTypes);
38 /// Activate objects in the module selection modes(opens local context)
39 virtual void activateModuleSelectionModes();
41 /// Deactivate sub-shapes selection (closes local context)
42 virtual void deactivateSubShapesSelection();
44 //! Returns instance of loaded module
45 virtual ModuleBase_IModule* module() const;
47 //! Returns current viewer
48 virtual ModuleBase_IViewer* viewer() const;
50 //! Returns property panel
51 virtual ModuleBase_IPropertyPanel* propertyPanel() const;
53 //! Returns error manager
54 virtual ModuleBase_IErrorMgr* errorMgr() const;
56 //! Returns currently active operation
57 virtual ModuleBase_Operation* currentOperation() const;
59 //! Returns true if the operation with id theId can be started
60 /// \param theId id of the operation which is going to start
61 /// \param isCommitted boolean value if the operation was committed otherwise it was aborted
62 virtual bool canStartOperation(QString theId, bool& isCommitted);
64 //! Performs the operation launch
65 //! \param theOperation an operation to be launched
66 virtual void processLaunchOperation(ModuleBase_Operation* theOperation);
68 //! Returns started operation by the operation identifier. The operation manager is called.
69 //! \param theId an operation id
70 //! \return an operation instance or NULL
71 virtual ModuleBase_Operation* findStartedOperation(const QString& theId);
73 //! Returns true if the operation with id theId can be stopped. The operation manager is called.
74 //! \param theOperation a stopped operation
75 //! \return boolean result
76 virtual bool canStopOperation(ModuleBase_Operation* theOperation);
78 //! Commits if possible or aborts the given operation.
79 //! \param theOperation an aborted operation
80 /// \param isCommitted boolean value if the operation was committed otherwise it was aborted
81 virtual void stopOperation(ModuleBase_Operation* theOperation,
84 //! Returns AIS object by data object
85 virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const;
87 //! Returns data object by AIS
88 virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
90 //! Select features clearing previous selection.
91 //! If the list is empty then selection will be cleared
92 virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
94 //! Shows the message in the status bar
95 //! \param theMessage a message
96 virtual void setStatusBarMessage(const QString& theMessage);
98 /// Update of commands status
99 virtual void updateCommandStatus();
101 /// Returns Information about feature defined in corresponded XML
102 /// \param theId - id of the feature
103 virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theId) const;
105 /// Return application main window
106 virtual QMainWindow* desktop() const;
110 XGUI_Workshop* workshop() const { return myWorkshop; }
113 QObjectPtrList activeObjects(const QObjectPtrList& theObjList) const;
115 /// Reference to workshop
116 XGUI_Workshop* myWorkshop;