1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef XGUI_ModuleConnector_H
22 #define XGUI_ModuleConnector_H
25 #include <ModuleBase_Definitions.h>
26 #include <ModuleBase_IWorkshop.h>
33 * Implementation of IWorkshop interface which provides access to Workshop services at module level
35 class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop
40 /// \param theWorkshop a workshop
41 XGUI_ModuleConnector(XGUI_Workshop* theWorkshop);
43 virtual ~XGUI_ModuleConnector();
45 //! Returns list of currently selected data objects
46 virtual ModuleBase_ISelection* selection() const;
48 //! Returns instance of loaded module
49 virtual ModuleBase_IModule* module() const;
51 //! Returns current viewer
52 virtual ModuleBase_IViewer* viewer() const;
54 //! Returns property panel
55 virtual ModuleBase_IPropertyPanel* propertyPanel() const;
57 //! Returns error manager
58 virtual ModuleBase_IErrorMgr* errorMgr() const;
60 /// A selection activate in 3D View handler
61 virtual ModuleBase_ISelectionActivate* selectionActivate() const;
63 //! Returns currently active operation
64 virtual ModuleBase_Operation* currentOperation() const;
66 //! Returns true if the operation with id theId can be started
67 /// \param theId id of the operation which is going to start
68 /// \param isCommitted boolean value if the operation was committed otherwise it was aborted
69 virtual bool canStartOperation(QString theId, bool& isCommitted);
71 //! Performs the operation launch
72 //! \param theOperation an operation to be launched
73 virtual void processLaunchOperation(ModuleBase_Operation* theOperation);
75 //! Returns started operation by the operation identifier. The operation manager is called.
76 //! \param theId an operation id
77 //! \return an operation instance or NULL
78 virtual ModuleBase_Operation* findStartedOperation(const QString& theId);
80 //! Returns true if the operation with id theId can be stopped. The operation manager is called.
81 //! \param theOperation a stopped operation
82 //! \return boolean result
83 virtual bool canStopOperation(ModuleBase_Operation* theOperation);
85 //! Commits if possible or aborts the given operation.
86 //! \param theOperation an aborted operation
87 /// \param isCommitted boolean value if the operation was committed otherwise it was aborted
88 virtual void stopOperation(ModuleBase_Operation* theOperation,
91 //! Returns AIS object by data object
92 virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const;
94 //! Returns data object by AIS
95 virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
97 //! Select features clearing previous selection.
98 //! If the list is empty then selection will be cleared
99 virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
101 //! Shows the message in the status bar
102 //! \param theMessage a message
103 virtual void setStatusBarMessage(const QString& theMessage);
105 /// Update of commands status
106 virtual void updateCommandStatus();
108 /// Returns Information about feature defined in corresponded XML
109 /// \param theId - id of the feature
110 virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theId) const;
112 /// Return application main window
113 virtual QMainWindow* desktop() const;
115 /// Returns true if SHIFT is pressed
116 /// \return boolean value
117 virtual bool hasSHIFTPressed() const;
120 XGUI_Workshop* workshop() const { return myWorkshop; }
123 QObjectPtrList activeObjects(const QObjectPtrList& theObjList) const;
125 /// Reference to workshop
126 XGUI_Workshop* myWorkshop;