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 ModuleBase_IWorkshop_H
22 #define ModuleBase_IWorkshop_H
24 #include "ModuleBase.h"
25 #include "ModuleBase_Definitions.h"
26 #include <ModuleBase_FilterValidated.h>
28 #include <ModelAPI_Object.h>
29 #include <GeomAPI_AISObject.h>
30 #include <Config_FeatureMessage.h>
34 class ModuleBase_IModule;
35 class ModuleBase_ISelection;
36 class ModuleBase_IViewer;
37 class ModuleBase_IPropertyPanel;
38 class ModuleBase_IErrorMgr;
39 class ModuleBase_Operation;
40 class ModuleBase_ISelectionActivate;
41 class ModuleBase_ViewerPrs;
46 * Class which provides access to Workshop object services
48 class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
53 /// \param theParent parent object
54 ModuleBase_IWorkshop(QObject* theParent);
56 virtual ~ModuleBase_IWorkshop()
59 /// Return current selection instance
60 virtual ModuleBase_ISelection* selection() const = 0;
62 //! Returns instance of loaded module
63 virtual ModuleBase_IModule* module() const = 0;
65 //! Returns current viewer
66 virtual ModuleBase_IViewer* viewer() const = 0;
68 //! Returns property panel
69 virtual ModuleBase_IPropertyPanel* propertyPanel() const = 0;
71 //! Returns error manager
72 virtual ModuleBase_IErrorMgr* errorMgr() const = 0;
74 /// A filter to process an attribute validators
76 Handle(ModuleBase_FilterValidated) validatorFilter();
78 /// A selection activate in 3D View handler
79 virtual ModuleBase_ISelectionActivate* selectionActivate() const = 0;
81 //! Returns currently active operation
82 virtual ModuleBase_Operation* currentOperation() const = 0;
84 //! Returns true if the operation with id theId can be started
85 virtual bool canStartOperation(QString theId, bool& isCommitted) = 0;
87 //! Performs the operation launch
88 //! \param theOperation an operation to be launched
89 virtual void processLaunchOperation(ModuleBase_Operation* theOperation) = 0;
91 //! Returns started operation by the operation identifier
92 //! \param theId an operation id
93 //! \return an operation instance or NULL
94 virtual ModuleBase_Operation* findStartedOperation(const QString& theId) = 0;
96 //! Returns true if the operation with id theId can be stopped
97 //! \param theOperation a stopped operation
98 //! \return boolean result
99 virtual bool canStopOperation(ModuleBase_Operation* theOperation) = 0;
101 //! Commits if possible or aborts the given operation.
102 //! \param theOperation an aborted operation
103 /// \param isCommitted boolean value if the operation was committed otherwise it was aborted
104 virtual void stopOperation(ModuleBase_Operation* theOperation,
105 bool& isCommitted) = 0;
107 //! Returns AIS object by data object
108 //! \param theObject a data object
109 virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0;
111 //! Returns data object by AIS
112 //! \param theAIS a presentation
113 virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
115 //! Select features clearing previous selection.
116 //! If the list is empty then selection will be cleared
117 //! \param theValues a list of presentations
118 virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) = 0;
120 //! Shows the message in the status bar
121 //! \param theMessage a message
122 virtual void setStatusBarMessage(const QString& theMessage) = 0;
124 /// Update of commands status
125 virtual void updateCommandStatus() = 0;
127 /// Returns feature info according to given feature ID
128 /// \param theId a feature Id
129 virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theId) const = 0;
131 /// Returns main window of the application
132 virtual QMainWindow* desktop() const = 0;
134 /// Returns true if SHIFT is pressed
135 /// \return boolean value
136 virtual bool hasSHIFTPressed() const = 0;
139 /// Signal selection changed.
140 void selectionChanged();
142 /// Signal which is emited after activation of property panel
143 void propertyPanelActivated();
146 /// A filter to process an attribute validators
147 Handle(ModuleBase_FilterValidated) myValidatorFilter;