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>
14 class Handle_AIS_InteractiveContext;
20 * Implementation of IWorkshop interface which provides access to Workshop sevices at module level
22 class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop
27 /// \param theWorkshop a workshop
28 XGUI_ModuleConnector(XGUI_Workshop* theWorkshop);
30 virtual ~XGUI_ModuleConnector();
32 //! Returns list of currently selected data objects
33 virtual ModuleBase_ISelection* selection() const;
35 /// Activate sub-shapes selection (opens local context if it was not opened)
36 /// Types has to be dined according to TopAbs_ShapeEnum
37 virtual void activateSubShapesSelection(const QIntList& theTypes);
39 /// Activate objects in the module selection modes(opens local context)
40 virtual void activateModuleSelectionModes();
42 /// Deactivate sub-shapes selection (closes local context)
43 virtual void deactivateSubShapesSelection();
45 //! Returns instance of loaded module
46 virtual ModuleBase_IModule* module() const;
48 //! Returns current viewer
49 virtual ModuleBase_IViewer* viewer() const;
51 //! Returns property panel
52 virtual ModuleBase_IPropertyPanel* propertyPanel() const;
54 //! Returns currently active operation
55 virtual ModuleBase_Operation* currentOperation() const;
57 //! Returns true if the operation with id theId can be started
58 virtual bool canStartOperation(QString theId);
60 //! Returns started operation by the operation identifier. The operation manager is called.
61 //! \param theId an operation id
62 //! \return an operation instance or NULL
63 virtual ModuleBase_Operation* findStartedOperation(const QString& theId);
65 //! Returns true if the operation with id theId can be stopped. The operation manager is called.
66 //! \return boolean result
67 virtual bool canStopOperation();
69 //! Aborts the operation. The operation manager is called.
70 //! \param theId an aborted operation
71 void abortOperation(ModuleBase_Operation* theOperation);
73 //! Returns AIS opbject by data object
74 virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const;
76 //! Returns data object by AIS
77 virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
79 //! Select features clearing previous selection.
80 //! If the list is empty then selection will be cleared
81 virtual void setSelected(const QList<ModuleBase_ViewerPrs>& theValues);
84 XGUI_Workshop* workshop() const { return myWorkshop; }
87 QObjectPtrList activeObjects(const QObjectPtrList& theObjList) const;
89 /// Reference to workshop
90 XGUI_Workshop* myWorkshop;