Analysis Solution

Analysis Modeler

Analysis Providers

Definition of providers on Analysis Features 

Quick Reference

Abstract

This 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]

CATISamProviders

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]

CATISamCtxMenuProvider

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.

  1. If you returns TRUE, your providers is automatically created and plugged at the level of the analysis workshop. In this case it is available for all the workbenches.
  2. If you returns FALSE, you have to manage by yourself the life cycle of your provider. For example, if you want to have a specific provider to a specific workbench, you have to implement the CATIWorkbenchInitialization interface. In the Init Method declare your provider and in the Dispose method removes it. See the following examples:
... 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();
    }
  }
...

CATISamCatalogProvider

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.

CATISamCCPFilter & CATISamCCPFilterProvider

Cut/Copy/Paste is based of three levels:

  1. Some rules of the analysis frameworks that do not allow the commands. For example Analysis manager can not be copied, or deleted.
  2. If the command is allowed, the CATISamCCPFilter interface can be implemented of the late type of the feature to disable the command.
  3. If the command is allowed, CATISamCCPFilterProvider interface can be implemented as a provider (for example dedicated to a workbench, or addin workshop) in order  to disable the command.

[Top]


History

Version: 1 [Jul 2003] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.