3D PLM Enterprise Architecture |
3D Visualization |
Catching the Visualization NotificationsRedefining the AnalyseNotification method of a document editor selector |
Use Case |
AbstractThis article discusses the CAAVisManager use case. This use case explains how to create and implement a specific visualization interface for geometric components, how to make the visualization manager aware of this interface to display these components, and how to catch the visualization notifications to manage the PSO and HSO contents. This article focuses on catching the visualization notifications. |
When a document is displayed in one or several windows and when the end user works in one of these windows, visualization notifications [1] that indicate the end user intents or actions are sent to a selector object attached to the document's editor. This selector must catch the notifications to process, take appropriate actions, and must be transparent for other notifications. With this use case, you will learn how a selector object can catch and process the visualization notifications. Companion articles of this use case deal with the implementation of a visualization interface of your own [2], and with the use of the visualization manager [3].
[Top]
CAAVisManager is a set of use cases of the CAAVisualization.edu framework that illustrates Visualization framework capabilities.
[Top]
CAAVisManager contains a series of modules that make up a small application.
This article focuses on catching the visualization notifications to manage the
PSO and HSO contents, how to decode a path element, and how to set a contextual
menu on component representations. To do this, a selector class [3]
deriving from the CATCommand class [4] is
created. It is instantiated for each document by the document's editor, and
passed to the visualization manager when attaching it to the document root
object. Thus, the visualization notifications are sent to the selector that can
decide to process them. The selector recognizes the notifications in the
redefined AnalyseNotification
method inherited from CATCommand.
[Top]
To launch CAAVisManager, you will need to set up the build time environment, then compile the four CAAVisManager modules along with their prerequisites, set up the run time environment, and then execute the use case [5]. You cannot launch CAAVisManager itself. CAAVisManager is simply used by the CAAVisManagerAppli use case. Type CAAVisManagerAppli instead of CAAVisManager to display the interactive application along with a viewer that displays the CAAVisManagerDefaultDocument.
[Top]
CAAVisManager code is located in the CAAVisualization.edu framework:
Windows | InstallRootDirectory\CAAVisualization.edu\ |
Unix | InstallRootDirectory/CAAVisualization.edu/ |
where InstallRootDirectory
is the root directory of your CAA V5
installation.
CAAVisManager includes the following modules:
CAAVisManagerAppli.m | Contains the interactive application, the windows and the documents |
CAAVisManagerComp.m | Contains the geometric components to display |
CAAVisManagerImp.m | Contains the extension classes required to make the geometric components displayable |
CAAVisManagerInt.m | Contains the interfaces implemented by the geometric components, especially the visualization interface. Their header files are located in the PrivateInterfaces directory |
This use case details the AnalyseNotification
method of the CAAVisManagerCmdSelector
class in the CAAVisManagerAppli.m module.
[Top]
To redefine the AnalyseNotification
method of the CAAVisManagerCmdSelector
class to catch the visualization notifications, there are nine main steps:
[Top]
CATNotifPropagationMode CAAVisManagerCmdSelector::AnalyseNotification( CATCommand * iFromClient, CATNotification * iNotification) { CATNotifPropagationMode propMode = CATNotifTransmitToFather; if ( iNotification->IsAKindOf(CATManipulatorNotification::ClassName()) ) { ... // see coming steps propMode = CATNotifDontTransmitToFather; } else if ( iNotification->IsAKindOf(CATMultiSel::ClassName()) ) { propMode = CATNotifDontTransmitToFather; CATSO * pSetOfObjects = (CATSO *) iFromClient->SendCommandSpecificObject( CATPathElement::ClassName(), iNotification); if (NULL != pSetOfObjects) { CATBaseUnknown *pComp = NULL; for (int ii=0; pComp=(*pSetOfObjects)[ii]; ii++) { _Hso.AddElements(pComp); } _Hso.EndAddElements(); } pSetOfObjects->Release(); pSetOfObjects = NULL; } return propMode; } |
CAAIVisManagerCmdSelector derives from the CATCommand class and
redefines the AnalyseNotification
method. Any received notification
is analyzed and, if the notification is an instance of a class that is, or
derives from, CATManipulatorNotification or CATMultiSel
notification classes, the notification is caught and processed, appropriate
actions are undertaken, and the notification propagation is stopped because AnalyseNotification
returns CATNotifDontTransmitToFather
. Otherwise, the notification
goes on up the command tree structure since AnalyseNotification
returns CATNotifTransmitToFather
. The case of CATManipulatorNotification
is detailed in the coming steps. Let see what's happen if a CATMultiSel
notification class instance is received.
In this case, a multiselection occurred. Several components are selected, and
can be retrieved by calling the SendCommandSpecificObject
method of
the sending command, that is, the child CATSelector instance associated
with the current selector. SendCommandSpecificObject
returns these
components in a CATSO instance, that is, a set of objects. Each component
found in this set is added to the HSO to highlight it thanks to the AddElements
method. The highlight takes place when the set of objects scan is completed
thanks to the EndAddElements
method.
[Top]
... if ( iNotification->IsAKindOf(CATManipulator::GetCATPreactivate()) ) { CATPathElement * pPath = (CATPathElement *)iFromClient->SendCommandSpecificObject( CATPathElement::ClassName(), iNotification); if ( NULL != pPath ) { _Pso.AddElement(pPath); pPath->Release(); } } ... |
A CATPreactivate notification is sent whenever the mouse moves above a
representation with no button pressed. In this case, the SendCommandSpecificObject
method of the sending command, that is, the child CATSelector instance
associated with the current selector, retrieves the path element of the
representation under the mouse, and if a valid path is retrieved, adds it to the
PSO to prehighlight the associated representation.
[Top]
... else if ( iNotification->IsAKindOf(CATManipulator::GetCATEndPreactivate()) ) { CATPathElement * pPath = (CATPathElement *)iFromClient->SendCommandSpecificObject( CATPathElement::ClassName(), iNotification); if ( NULL != pPath ) { _Pso.RemoveElement(pPath); pPath->Release(); } } ... |
A CATEndPreactivate notification is sent whenever the mouse leaves a
representation with no button pressed. In this case, the SendCommandSpecificObject
method of the sending command, that is, the child CATSelector instance
associated with the current selector, retrieves the path element of the
representation leaved by the mouse, and if a valid path is retrieved, removes it
from the PSO to dehighlight the associated representation.
[Top]
... else if ( iNotification->IsAKindOf(CATManipulator::GetCATActivate()) ) { CATPathElement * pPath = (CATPathElement *)iFromClient->SendCommandSpecificObject( CATPathElement::ClassName(), iNotification); _Hso.Empty(); if ( NULL != pPath ) { _Hso.AddElement(pPath); pPath->Release(); } else { _Pso.Empty(); } } ... |
A CATActivate notification is sent whenever the mouse left button is
pressed above a representation. In this case, the SendCommandSpecificObject
method of the sending command, that is, the child CATSelector instance
associated with the current selector, retrieves the path element of the
representation under the mouse, empties the HSO to leave it for the newly
activated representation, and if a valid path is retrieved, adds it to the HSO
to highlight the associated representation. If no valid path is retrieved, the
PSO is also emptied because it could contain the path element of the activated
component, added when it was preactivated. This path could have become invalid
between the preactivation and the activation.
[Top]
... else if ( iNotification->IsAKindOf(CATManipulator::GetCATEndActivate()) ) { CATPathElement * pPath = (CATPathElement *)iFromClient->SendCommandSpecificObject( CATPathElement::ClassName(), iNotification); if ( NULL != pPath ) { _Hso.RemoveElement(pPath); pPath->Release(); } } ... |
A CATEndActivate notification is sent whenever the mouse left button
is pressed above another representation not controlled by the manipulator or
above the background. In this case, the SendCommandSpecificObject
method of the sending command, that is, the child CATSelector instance
associated with the current selector, retrieves the path element of the
representation that was activated and removes it from the HSO.
[Top]
... else if ( iNotification->IsAKindOf(CATManipulator::GetCATMove()) ) { _Pso.Empty(); CATPathElement * pPath = (CATPathElement *)iFromClient->SendCommandSpecificObject( CATPathElement::ClassName(), iNotification); if ( NULL != pPath ) { _Pso.AddElement(pPath); pPath->Release(); } } ... |
A CATMove notification is sent whenever the mouse moves above a
representation. In this case, the PSO is emptied, the SendCommandSpecificObject
method of the sending command, that is, the child CATSelector instance
associated with the current selector, retrieves the path element of the
representation above which the mouse moves, and adds it to the PSO to
prehighlight the associated representation.
[Top]
... else if ( iNotification->IsAKindOf(CATManipulator::GetCATBeginManipulate()) ) {} else if ( iNotification->IsAKindOf(CATManipulator::GetCATManipulate()) ) {} else if ( iNotification->IsAKindOf(CATManipulator::GetCATEndManipulate()) ) {} ... |
A CATBeginManipulate notification is sent whenever the mouse begins to move above an activated representation, that is with the mouse left button pressed. If the mouse goes on moving with the mouse left button pressed, CATManipulate notifications are sent as long as the mouse moves. When the left button is released, A CATEndManipulate notification is sent. These notifications are simply caught with no associated action.
[Top]
... else if ( iNotification->IsAKindOf(CATManipulator::GetCATContext()) ) { CATPathElement *pPath = (CATPathElement *) iFromClient->SendCommandSpecificObject(CATPathElement::ClassName(),iNotification); if (NULL != pPath) { CATBaseUnknown *lastobj_of_path = (*pPath)[pPath->GetSize()-1]; if (NULL != lastobj_of_path) { CATViewer * pViewer = (CATViewer *) iFromClient->SendCommandSpecificObject(CATViewer::ClassName(), iNotification); if ( NULL != pViewer) { _Pso.Empty(); _Hso.Empty(); _Hso.AddElement(pPath); _pCxtMenu = new CAAVisManagerCxtMenu(this, "Context", pPath, pViewer); _pCxtMenu->Build(); pViewer->Release(); pViewer = NULL ; } } else { propMode = CATNotifTransmitToFather; } pPath->Release(); pPath = NULL; } } ... |
A CATContext notification is sent whenever the mouse right button is
pressed above a representation. In this case, the SendCommandSpecificObject
method of the sending command, that is, the child CATSelector instance
associated with the current selector, retrieves the path element of the
representation under the mouse. The viewer is also retrieved thanks to the SendCommandSpecificObject
method. If a valid path and a valid viewer are retrieved, the PSO and the HSO
are emptied, the retrieved path is added to the HSO to highlight the associated
representation, and a contextual menu is created.
[Top]
... else if ( iNotification->IsAKindOf(CATManipulator::GetCATEndContext()) ) { if ( NULL != _pCxtMenu ) { _Hso.Empty(); _pCxtMenu->RequestDelayedDestruction(); _pCxtMenu = NULL ; } } ... |
A CATEndContext notification is sent whenever the mouse right button is released. In this case, the HSO is emptied and the contextual menu is deleted.
[Top]
This use case shows how to catch the visualization notifications by
redefining the AnalyseNotification
method of CATCommand.
Their types can be recognized thanks to the IsAKindOf
method and
appropriate actions can be undertaken.
[Top]
Version: 1 [May 2000] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.