Usage: you can derive this class.
public class CATModelForRep3D
Class for dialog help 3D 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:
... CAT3DxxxRep * pMyRep = new CAT3DxxxRep(); CATModelForRep3D * pFor3DModel = new CATModelForRep3D(); pFor3DModel->SetRep(pMyRep); pMyRep = NULL; CATISO *pISO = .... // to retrieve from the CATFrmEditor pISO->AddElement(pFor3DModel); ... pISO->RemoveElement(pFor3DModel); //pMyRep is deleted ... // To do a new visualization pMyRep = new CAT3DxxxRep(); pFor3DModel->SetRep(pMyRep); pISO->AddElement(pFor3DModel); ... pISO->RemoveElement(pFor3DModel); //pMyRep is deleted ... //No more need of the model pFor3DModel->Release(); pFor3DModel=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_CATI3DGeoVisu); ...With this agent,
_daPathElement
, your component will be selectable since it
implements the CATI3DGeoVisu interface. But unfortunately, this criterion is not
enough discriminating, because all the 3D visualized objects are also selectable.
To filter the selection, you can
create a new component which derives from the CATModelForRep3D component and which
implements a dedicated interface. In short:
MyNewInterface
MyModelForRep
, which OM and C++ derives from CATModelForRep3D#include "CATModelForRep3D.h" class MyModelForRep : public CATModelForRep3D { // 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 // CATModelForRep3D CATImplementClass(MyModelForRep, Implementation, CATModelForRep3D, CATNull); MyModelForRep::MyModelForRep(); { } MyModelForRep::~MyModelForRep(); { } // The component implements MyNewInterface interface #include "TIE_MyNewInterface.h" TIE_MyNewInterface(MyModelForRep);
MyModelForRep MyNewInterface libxxxx
public CATModelForRep3D( | ) |
public virtual SetRep( | iRep) |
Copyright © 1999-2014, Dassault Systèmes. All rights reserved.