Analysis Solution |
Analysis Modeler |
Analysis ProvidersDefinition of providers on Analysis Features |
Quick Reference |
AbstractThis article explains how to customize some interactive behavior of analysis feature. This is done by using provider capabilities. |
As of today, the providers allow to:
[Top]
This interface may be used to manage a provider declaration to an analysis document. This is implemented on the analysis document by the Dassault Systèmes frameworks. If you do not manage by yourself the life cycle of your providers they will be automatically released with the analysis document life cycle.
[Top]
Because an interface can be implemented once only on a late type, analysis workbench needs to find a way of having differents providers of contextual menus on the same feature. The CATIContextualMenu interface is implemented by default on Analysis Features inside the Analysis Frameworks.
This implementation search all the objects that implement the analysis interface "CATISamCtxMenuProvider" to complete contextual menus and appends all those menus in the user interface. You should not reset the CATCmdContainer by only complete it. Note that it is always possible for your menu to decide to be selectable or not. For this, use CATCommandHeader interface and BecomeAvailable or BecomeUnavailable methods in your implementation
Two kinds of providers can be defined. To configure your provider use the IsPermanent methods.
... In your Init Implementation // Declare a contextual menu provider CATISamProviders* piProvider = NULL; if (pDoc) pDoc -> QueryInterface(IID_CATISamProviders, (void **) &piProvider); if (piProvider) { CAAAniCtxMenu * _piCtxMenu = new CAAAniCtxMenu (); if (_piCtxMenu)piProvider -> AddProvider(IID_CATISamCtxMenuProvider,_piCtxMenu); piProvider -> Release(); piProvider = NULL; } ... |
Note that to make your implementation easy to manage, you can keep your provider implementation as data member. In this example the instruction new CAAAniCtxMenu will create and "AddRef" the provider. It will be "Released" in the Dispose implementation.
... In your Dispose Implementation // Declare a contextual menu provider CATISamProviders* piProvider = NULL; if (pDoc) pDoc -> QueryInterface(IID_CATISamProviders, (void **) &piProvider); if (piProvider) { piProvider -> RemoveProvider(IID_CATISamCtxMenuProvider,_piCtxMenu); _piCtxMenu -> Release(); _piCtxMenu = NULL; piProvider -> Release(); piProvider = NULL; } ... |
To create your menus use the GetContextualMenu methods. You will receive as input the analysis feature and the CATCmdContainer that contains the menus definition. Never delete or release the commands container.
As example, to assign the visualization command to the solution set of the sample, the GetContextualMenu implementation may looks to:
... // Declare a contextual menu provider CATISpecObject_var spSpecObj (iObj); if (NULL_var == spSpecObj) return S_OK; CATString FeatureType = ((spSpecObj -> GetType()).ConvertToChar()); if (FeatureType == "AeroDynamicSet") { CATString HeaderId = "CreateOneImage" ; // header defined in the CAAAniCfg.cpp NewAccess (CATCmdStarter ,CmdStarterCreateOneImage ,CAAAniCreateOneImage); SetAccessCommand (CmdStarterCreateOneImage,HeaderId); if (ioCtxMenu) ioCtxMenu -> AddChild (CmdStarterCreateOneImage); CATCommandHeader* pHeader = NULL; CATAfrGetCommandHeader(HeaderId,pHeader); // provided by #include "CATAfrCommandHeaderServices.h" if (pHeader) { pHeader -> BecomeUnavailable(); if (spSpecObj -> IsUpToDate()) pHeader -> BecomeAvailable(); } } ... |
If you want to add some commands in a existing workbench, you will need to declare a feature catalog associated to your new features. For this, implement the CATISamCatalogProvider interface.
In CATISamAnalysisModelFactory implementation, if the creation of an analysis set or an entity doesn't find the required startup, all the providers that implement CATISamCatalogProvider interface will be called. It is preferable to have an implementation with good performance (for example based of the prefix of the startup). If the name of the startup is ok for your implementation, load the catalog on the container given as input argument by using the AccessCatalog method.
Cut/Copy/Paste is based of three levels:
[Top]
Version: 1 [Jul 2003] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.