VisualizationController CATModelForRep2D

Usage: you can derive this class.


public class CATModelForRep2D

Class for dialog help 2D objects.

This class is the main class (implementation) of a component that implements the interface. It is dedicated to hold a graphic representation of an object that is not part of the document, but is used to ease the dialog. This representation is to be built outside and set to the component thanks to the method.
You can visualize the component thanks to a CATISO object and you can select it. Create a with the component, and use the and the to highlight, and to prehighlight respectively.

Sample:

  ...
  CAT2DxxxRep * pMyRep = new CAT2DxxxRep();

  CATModelForRep2D * pFor2DModel = new CATModelForRep2D(); 
  pFor2DModel->SetRep(pMyRep);
  pMyRep = NULL;
  
  CATISO *pISO = .... // to retrieve from the CATFrmEditor 
  pISO->AddElement(pFor2DModel);
  ...

  pISO->RemoveElement(pFor2DModel);  //pMyRep is deleted 
  ...

  // To do a new visualization 
  pMyRep = new CAT2DxxxRep();
  pFor2DModel->SetRep(pMyRep);
  pISO->AddElement(pFor2DModel);
  ...

  pISO->RemoveElement(pFor2DModel);  //pMyRep is deleted 
  ...

  //No more need of the model
  pFor2DModel->Release();
  pFor2DModel=NULL;
  ...
  
Life Cycle of the graphic representation
The graphic representation associated with the current class is managed by the . So after the SetRep method, it will be deleted when the CATModelForRep2D instance will be removed from the ISO (but not from the HSO and PSO). A new graphic representation must be created whenever you call AddElement to add such a component into the ISO.

Why to derive from this class?
To understand, here is an extract of the BuildGraph method of a CATStateCommand:
  ...
  _daPathElement = new CATPathElementAgent("MyAgentName");
  _daPathElement->AddElementType(IID_CATI2DGeoVisu);
  ...
  
With this agent, _daPathElement, your component will be selectable since it implements the CATI2DGeoVisu interface. But unfortunately, this criterion is not enough discriminating, because all the 2D visualized objects are also selectable. To filter the selection, you can create a new component which derives from the CATModelForRep2D component and which implements a dedicated interface. In short:


Constructor and Destructor Index


o CATModelForRep2D()
Default constructor.

Method Index


o SetRep(CATRep*)
Associates a graphic representation.

Constructor and Destructor


o CATModelForRep2D
public CATModelForRep2D()
Default constructor.

Methods


o SetRep
public virtual SetRep( iRep)
Associates a graphic representation.
Parameters:
iRep
The given representation which you want CATModelForRep2D to be associated with. Once the representation iRep has been associated with a CATModelForRep2D component its lifecycle is managed by the
.
iRep is a pointer to an instance of a class which derives from .

This object is included in the file: CATModelForRep2D.h
If needed, your Imakefile.mk should include the module: CATVisController

Copyright © 1999-2014, Dassault Systèmes. All rights reserved.