X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModuleBase%2FModuleBase_IModule.h;h=a482586078a557b85c3f94bdac403013e1377155;hb=b263f22d52ccb191c4fad8f7455d9714a3024514;hp=6ae486f6c72c7d8c8170be9716eb25773d2ef48e;hpb=b41cff0a399dc4d129b61e5e52f6b08e8681e5eb;p=modules%2Fshaper.git diff --git a/src/ModuleBase/ModuleBase_IModule.h b/src/ModuleBase/ModuleBase_IModule.h index 6ae486f6c..a48258607 100644 --- a/src/ModuleBase/ModuleBase_IModule.h +++ b/src/ModuleBase/ModuleBase_IModule.h @@ -40,6 +40,12 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject virtual ~ModuleBase_IModule() {} + // Add default selection filters of the module to the current viewer + virtual void activateSelectionFilters() {}; + + // Remove default selection filters of the module from the current viewer + virtual void deactivateSelectionFilters() {}; + /// Reads description of features from XML file virtual void createFeatures(); @@ -56,20 +62,21 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Realizes some functionality by an operation start /// \param theOperation a started operation - virtual void operationStarted(ModuleBase_Operation* theOperation) {} + virtual void onOperationStarted(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation resume + /// By default it emits operationResumed signal /// \param theOperation a resumed operation - virtual void operationResumed(ModuleBase_Operation* theOperation) {} + virtual void onOperationResumed(ModuleBase_Operation* theOperation); /// Realizes some functionality by an operation stop - virtual void operationStopped(ModuleBase_Operation* theOperation) {} + virtual void onOperationStopped(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation commit - virtual void operationCommitted(ModuleBase_Operation* theOperation) {} + virtual void onOperationCommitted(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation abort - virtual void operationAborted(ModuleBase_Operation* theOperation) {} + virtual void onOperationAborted(ModuleBase_Operation* theOperation) {} /// Realizes some functionality by an operation start /// \param theOperation a started operation @@ -113,6 +120,20 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject //! Returns True if there are available Redos and there is not an active operation virtual bool canRedo() const; + /// Returnas true if the action can be applyed to the object + /// \param theObject a checked object + /// \param theActionId an identifier of action, to be found in the menu manager like "DELETE_CMD" + /// \return the a booean result + virtual bool canApplyAction(const ObjectPtr& theObject, const QString& theActionId) const = 0; + + /// Returns True if the current operation can be committed. By default it is true. + /// \return a boolean value + virtual bool canCommitOperation() const; + + /// Returns whether the object can be erased. The default realization returns true. + /// \param theObject a model object + virtual bool canEraseObject(const ObjectPtr& theObject) const; + /// Returns whether the object can be displayed. The default realization returns true. /// \param theObject a model object virtual bool canDisplayObject(const ObjectPtr& theObject) const; @@ -129,17 +150,56 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject /// Returns data model object for representation of data tree in Object browser virtual ModuleBase_IDocumentDataModel* dataModel() const = 0; + /// Performs functionality on closing document + virtual void closeDocument() = 0; + + /// Clears specific presentations in the viewer + virtual void clearViewer() = 0; + /// Returns a list of modes, where the AIS objects should be activated /// \param theModes a list of modes virtual void activeSelectionModes(QIntList& theModes) {} + /** Update the object presentable properties such as color, lines width and other + * If the object is result with the color attribute value set, it is used, + * otherwise the customize is applyed to the object's feature if it is a custom prs + * \param theObject an object instance + * \param theUpdateViewer the parameter whether the viewer should be update immediatelly + * \returns true if the object is modified + */ + virtual bool customizeObject(ObjectPtr theObject, const bool theUpdateViewer); + /// This method is called on object browser creation for customisation of module specific features /// \param theObjectBrowser a pinter on Object Browser widget virtual void customizeObjectBrowser(QWidget* theObjectBrowser) {} + /// Creates a new operation + /// \param theCmdId the operation name + virtual ModuleBase_Operation* createOperation(const std::string& theCmdId); + + /// Sends the operation for launching + /// \param theOperation the operation + virtual void sendOperation(ModuleBase_Operation* theOperation); + + //! Returns data object by AIS + virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0; + + /// Update state of pop-up menu items in object browser + /// \param theStdActions - a map of standard actions + virtual void updateObjectBrowserMenu(const QMap& theStdActions) {} + + /// Update state of pop-up menu items in viewer + /// \param theStdActions - a map of standard actions + virtual void updateViewerMenu(const QMap& theStdActions) {} + +signals: + void operationLaunched(); + + void operationResumed(ModuleBase_Operation* theOp); + public slots: /// Called on call of command corresponded to a feature - void onFeatureTriggered(); + virtual void onFeatureTriggered(); /// Slolt called on object display /// \param theObject a data object @@ -156,14 +216,6 @@ protected slots: virtual void onSelectionChanged() {} protected: - /// Sends the operation for launching - /// \param theOperation the operation - virtual void sendOperation(ModuleBase_Operation* theOperation); - - /// Creates a new operation - /// \param theCmdId the operation name - virtual ModuleBase_Operation* createOperation(const std::string& theCmdId); - /// Register validators for this module virtual void registerValidators() {}