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
AddElement
to add such a component into the ISO.
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:
MyNewInterface
MyModelForRep
, which OM and C++ derives from CATModelForRep2D#include "CATModelForRep2D.h" class MyModelForRep : public CATModelForRep2D { // Used in conjunction with CATImplementClass in the .cpp file CATDeclareClass; MyModelForRep() ; virtual ~MyModelForRep(); private: // Copy constructor, not implemented // Set as private to prevent from compiler automatic creation as public. MyModelForRep(const MyModelForRep &iObjectToCopy); // Assignment operator, not implemented // Set as private to prevent from compiler automatic creation as public. MyModelForRep & operator = (const MyModelForRep &iObjectToCopy); };
#include "MyModelForRep.h" // To declare that the class is a component main class which OM derives from // CATModelForRep2D CATImplementClass(MyModelForRep, Implementation, CATModelForRep2D, CATNull); MyModelForRep::MyModelForRep(); { } MyModelForRep::~MyModelForRep(); { } // The component implements MyNewInterface interface #include "TIE_MyNewInterface.h" TIE_MyNewInterface(MyModelForRep);
MyModelForRep MyNewInterface libxxxx
public CATModelForRep2D( | ) |
public virtual SetRep( | iRep) |
Copyright © 1999-2014, Dassault Systèmes. All rights reserved.