The VgPoint object can be associated with a layer within the 3D view. More...
Public Types | |
typedef VgPointDescriptor | Descriptor |
Public Member Functions | |
VgEngine::VgConstRefPtr < Descriptor > | getDescriptor () const |
Vg3DModule::VgIGeometryType | getType () const |
Protected Member Functions | |
VgPoint () | |
Constructor. | |
virtual | ~VgPoint () |
Destructor. | |
Friends | |
class | VgEngine::VgInstanceFactory |
class | VgEngine::VgObjectBridge |
The VgPoint object can be associated with a layer within the 3D view.
When the associated layer is visible, so to will the VgPoint. The VgPoint is located at a specified geographical position and is represented as a textured square.
To use a VgPoint, one must first create it (using Vg3DModule::VgInstanceFactory::instantiate) and then associate it with a layer (using setLayer).
... VgApplication::VgIApplication* mVgApplication; Vg3DModule::VgPointDescriptor lPointDesc; ... // Instantiate the VgPoint object. VgEngine::VgRefPtr< Vg3DModule::VgPoint > lPoint = mVgApplication->editEngine()->editInstanceFactory()->instantiate(lPointDesc); const VgEngine::VgLayerManager::LayerList& lLayers = mVgApplication->editEngine()->editLayerManager()->getLayers(); // Choose the first layer. VgEngine::VgRefPtr< VgEngine::VgLayer > lLayer = lLayers.at(0); // Note: The Point will only be seen if the associated layer is visible. See VgEngine::VgVgLayer for more information. lPoint->setLayer(lLayer); // To remove the Point from the layer. lPoint->setLayer(NULL); // If the point is no longer required, then we can release it's memory. // But since it is reference counted we don't delete, we null-out the VgRefPtr. lPoint = NULL;
It's possible to subclass VgPoint in order to add custom data. This is demonstrated by the following code snippet:
// Custom VgPoint class to encapsulate some additional information (just a simple string mName in this case) class MyPoint : public Vg3DModule::VgPoint { public: MyPoint(VgEngine::VgRefPtr< Vg3DModule::VgPoint >& pPoint, const std::string& pName) : mPoint(pPoint) , mName(pName) {} virtual ~MyPoint() { mPoint = NULL; } virtual Vg3DModule::VgIGeometryType getType () const { return mPoint->getType(); } virtual const Vg3DModule::VgPointDescriptor& getDescriptor () const { return mPoint->getDescriptor(); } VgEngine::VgRefPtr< Vg3DModule::VgPoint > getPoint () const { return mPoint; } const std::string& getName () const { return mName; } protected: VgEngine::VgRefPtr< Vg3DModule::VgPoint > mPoint; // MyPoint specific information below const std::string mName; };
Once the Point is created, it can be wrapped by MyPoint and associated with a layer.
... VgApplication::VgIApplication* mVgApplication; Vg3DModule::VgPointDescriptor lPointDesc; ... VgEngine::VgRefPtr< Vg3DModule::VgPoint > lPoint = mApplication->editEngine()->editInstanceFactory()->instantiate(lPointDescr); MyPoint* lMyPoint = new MyPoint(lPoint.get()); lMyPoint->getPoint()->setLayer(lLayerName);
Vg3DModule::VgPoint::VgPoint | ( | ) | [protected] |
Constructor.
virtual Vg3DModule::VgPoint::~VgPoint | ( | ) | [protected, virtual] |
Destructor.
VgEngine::VgConstRefPtr< Descriptor > Vg3DModule::VgPoint::getDescriptor | ( | ) | const |
Vg3DModule::VgIGeometryType Vg3DModule::VgPoint::getType | ( | ) | const [virtual] |
Reimplemented from Vg3DModule::VgIGeometry.
friend class VgEngine::VgInstanceFactory [friend] |
friend class VgEngine::VgObjectBridge [friend] |
Reimplemented from Vg3DModule::VgIGeometry.