AGXDynamics  2.31.1.0
agxRender::Graph::GraphRenderer Class Referenceabstract

Abstract base class that acts as an interface and can render the data from a Graph. More...

#include <Graph.h>

+ Inheritance diagram for agxRender::Graph::GraphRenderer:

Public Member Functions

 GraphRenderer ()
 
virtual void addChannel ()=0
 Setup structures/data for another data channel. More...
 
template<typename T >
T * as ()
 Subclass casting. More...
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match. More...
 
template<typename T >
const T * asSafe () const
 
virtual void clear ()=0
 Destruction of any data for this graph. More...
 
virtual void drawData (size_t channelIndex, const Graph::DataVector &data)=0
 Update the line geometry for a specified channel given the data (points) More...
 
virtual void drawLine (const agx::Vec2 &p1, const agx::Vec2 &p2) const =0
 Draw a line from p1 to p2. More...
 
virtual void drawText (const agx::Vec2 &pos, const agx::String &str)=0
 Called when text should be drawn. More...
 
virtual size_t getNumChannels () const =0
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
virtual void postDraw ()=0
 If the rendering of this graph requires some cleanup to be done it can be done in this method. More...
 
virtual void preDraw ()=0
 If the rendering of this graph requires some pre-state to be set (orthographic projection etc) this can be done in this method. More...
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
virtual void removeChannel ()=0
 Tear down data for the last added channel. More...
 
virtual void setColor (const agx::Vec4 &color)=0
 Set the current color for items to be drawn next. More...
 
virtual void setEnable (bool flag)=0
 Implement functionality for enabling/disabling the rendering of this graph. More...
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 

Static Public Member Functions

template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~GraphRenderer ()
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Static Protected Member Functions

static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to. More...
 

Protected Attributes

agx::observer_ptr< Graph > m_graph
 
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Abstract base class that acts as an interface and can render the data from a Graph.

This class has to be implemented for each rendering engine.

Definition at line 45 of file Graph.h.

Constructor & Destructor Documentation

◆ GraphRenderer()

agxRender::Graph::GraphRenderer::GraphRenderer ( )
inline

Definition at line 48 of file Graph.h.

References agxTerrain::Profiler::clear().

◆ ~GraphRenderer()

virtual agxRender::Graph::GraphRenderer::~GraphRenderer ( )
inlineprotectedvirtual

Reimplemented in agxOSG::GraphRenderer.

Definition at line 114 of file Graph.h.

Member Function Documentation

◆ addChannel()

virtual void agxRender::Graph::GraphRenderer::addChannel ( )
pure virtual

Setup structures/data for another data channel.

Will later be indexed from the drawData method.

Implemented in agxOSG::GraphRenderer.

◆ allocateObserverVector()

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited

◆ as() [1/2]

template<typename T >
T* agx::Referenced::as ( )
inherited

Subclass casting.

Template type must match actual type, dynamic_cast assertion will fail otherwise.

Referenced by agx::InternalData::get(), agxVehicle::Track::getNode(), agx::InternalData::getOrCreate(), and agx::InternalData::hasData().

◆ as() [2/2]

template<typename T >
const T* agx::Referenced::as ( ) const
inherited

◆ asSafe() [1/2]

template<typename T >
T* agx::Referenced::asSafe ( )
inherited

Safe subclass casting, return nullptr if template type does not match.

Referenced by agxUtil::CollectBodiesAndWiresVisitor::visit().

◆ asSafe() [2/2]

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited

◆ clear()

virtual void agxRender::Graph::GraphRenderer::clear ( )
pure virtual

Destruction of any data for this graph.

After this, no more calls to draw will be done.

Implemented in agxOSG::GraphRenderer.

◆ deleteUsingDeleteHandler()

void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited

◆ drawData()

virtual void agxRender::Graph::GraphRenderer::drawData ( size_t  channelIndex,
const Graph::DataVector &  data 
)
pure virtual

Update the line geometry for a specified channel given the data (points)

Implemented in agxOSG::GraphRenderer.

◆ drawLine()

virtual void agxRender::Graph::GraphRenderer::drawLine ( const agx::Vec2 &  p1,
const agx::Vec2 &  p2 
) const
pure virtual

Draw a line from p1 to p2.

Implemented in agxOSG::GraphRenderer.

◆ drawText()

virtual void agxRender::Graph::GraphRenderer::drawText ( const agx::Vec2 &  pos,
const agx::String &  str 
)
pure virtual

Called when text should be drawn.

Parameters
pos- position in x,y in the range [0..1]
str- text to draw

Implemented in agxOSG::GraphRenderer.

◆ getDeleteHandler()

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.

◆ getNumChannels()

virtual size_t agxRender::Graph::GraphRenderer::getNumChannels ( ) const
pure virtual
Returns
number of added channels

Implemented in agxOSG::GraphRenderer.

◆ getReferenceCount()

int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.

◆ is()

template<typename T >
bool agx::Referenced::is ( ) const
inherited

◆ postDraw()

virtual void agxRender::Graph::GraphRenderer::postDraw ( )
pure virtual

If the rendering of this graph requires some cleanup to be done it can be done in this method.

It will be called AFTER any draw* calls.

Implemented in agxOSG::GraphRenderer.

◆ preDraw()

virtual void agxRender::Graph::GraphRenderer::preDraw ( )
pure virtual

If the rendering of this graph requires some pre-state to be set (orthographic projection etc) this can be done in this method.

It will be called before any draw* methods

Implemented in agxOSG::GraphRenderer.

◆ reference()

void agx::Referenced::reference ( void *  ptr = nullptr) const
inherited

Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.

This method should be used with care, always balanced with the same number of calls to unreference.

◆ removeChannel()

virtual void agxRender::Graph::GraphRenderer::removeChannel ( )
pure virtual

Tear down data for the last added channel.

Implemented in agxOSG::GraphRenderer.

◆ setColor()

virtual void agxRender::Graph::GraphRenderer::setColor ( const agx::Vec4 &  color)
pure virtual

Set the current color for items to be drawn next.

Parameters
color- Color to draw

Implemented in agxOSG::GraphRenderer.

◆ setDeleteHandler()

static void agx::Referenced::setDeleteHandler ( DeleteHandler *  handler)
staticprotectedinherited

Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.

◆ setEnable()

virtual void agxRender::Graph::GraphRenderer::setEnable ( bool  flag)
pure virtual

Implement functionality for enabling/disabling the rendering of this graph.

Might involve removing stuff from your specific scenegraph or similar.

Implemented in agxOSG::GraphRenderer.

◆ unreference()

void agx::Referenced::unreference ( void *  ptr = nullptr) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

If the reference count goes to zero, it is assumed that this object is no longer referenced and is automatically deleted.

This method should be used with care, always balanced with the same number of calls to reference.

Referenced by agxData::EntityRef< ContactMaterialPtr >::~EntityRef().

◆ unreference_nodelete()

void agx::Referenced::unreference_nodelete ( ) const
inherited

Decrement the reference count by one, indicating that a pointer to this object is referencing it.

However, do not delete it, even if ref count goes to 0. Warning, unref_nodelete() should only be called if the user knows exactly who will be responsible for, one should prefer unref() over unref_nodelete() as the later can lead to memory leaks.

◆ ValidateCast()

template<typename T >
static bool agx::Referenced::ValidateCast ( const Referenced *  object)
staticinherited

Member Data Documentation

◆ m_graph

agx::observer_ptr<Graph> agxRender::Graph::GraphRenderer::m_graph
protected

Definition at line 113 of file Graph.h.

Referenced by agxRender::Graph::setRenderer().

◆ m_mutex

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

◆ m_observers

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

◆ m_refCount

AtomicValue agx::Referenced::m_refCount
mutableprotectedinherited

Definition at line 241 of file Referenced.h.


The documentation for this class was generated from the following file: