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_Operation;
25 class ModuleBase_ViewerPrs;
30 * Class which provides access to Workshop object services
32 class MODULEBASE_EXPORT ModuleBase_IWorkshop : public QObject
37 /// \param theParent parent object
38 ModuleBase_IWorkshop(QObject* theParent);
40 virtual ~ModuleBase_IWorkshop()
43 /// Return current selection instance
44 virtual ModuleBase_ISelection* selection() const = 0;
46 /// Activate sub-shapes selection (opens local context)
47 /// Types has to be defined according to TopAbs_ShapeEnum
48 virtual void activateSubShapesSelection(const QIntList& theTypes) = 0;
50 /// Activate objects in the module selection modes(opens local context)
51 virtual void activateModuleSelectionModes() = 0;
53 /// Deactivate sub-shapes selection (closes local context)
54 virtual void deactivateSubShapesSelection() = 0;
56 //! Returns instance of loaded module
57 virtual ModuleBase_IModule* module() const = 0;
59 //! Returns current viewer
60 virtual ModuleBase_IViewer* viewer() const = 0;
62 //! Returns property panel
63 virtual ModuleBase_IPropertyPanel* propertyPanel() const = 0;
65 /// A filter to process an attribute validators
67 Handle(ModuleBase_FilterValidated) validatorFilter();
69 //! Returns currently active operation
70 virtual ModuleBase_Operation* currentOperation() const = 0;
72 //! Returns true if the operation with id theId can be started
73 virtual bool canStartOperation(QString theId) = 0;
75 //! Performs the operation launch
76 //! \param theOperation an operation to be launched
77 virtual void processLaunchOperation(ModuleBase_Operation* theOperation) = 0;
79 //! Returns started operation by the operation identifier
80 //! \param theId an operation id
81 //! \return an operation instance or NULL
82 virtual ModuleBase_Operation* findStartedOperation(const QString& theId) = 0;
84 //! Returns true if the operation with id theId can be stopped
85 //! \param theOperation a stopped operation
86 //! \return boolean result
87 virtual bool canStopOperation(ModuleBase_Operation* theOperation) = 0;
89 //! Commits if possible or aborts the given operation.
90 //! \param theOperation an aborted operation
91 virtual void stopOperation(ModuleBase_Operation* theOperation) = 0;
93 //! Returns AIS object by data object
94 //! \param theObject a data object
95 virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const = 0;
97 //! Returns data object by AIS
98 //! \param theAIS a presentation
99 virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
101 //! Select features clearing previous selection.
102 //! If the list is empty then selection will be cleared
103 //! \param theValues a list of presentations
104 virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues) = 0;
106 //! Shows the message in the status bar
107 //! \param theMessage a message
108 virtual void setStatusBarMessage(const QString& theMessage) = 0;
110 /// Update of commands status
111 virtual void updateCommandStatus() = 0;
113 /// Returns feature info according to given feature ID
114 /// \param theId a feature Id
115 virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theId) const = 0;
117 /// Returns main window of the application
118 virtual QMainWindow* desktop() const = 0;
122 /// Signal selection changed.
123 void selectionChanged();
125 /// Signal which is emited after activation of property panel
126 void propertyPanelActivated();
129 /// A filter to process an attribute validators
130 Handle(ModuleBase_FilterValidated) myValidatorFilter;