AGXDynamics  2.31.1.0
agxRender::Graph Class Reference

Class that implements a simple graph for plotting scalar values. More...

#include <Graph.h>

+ Inheritance diagram for agxRender::Graph:

Classes

class  Channel
 Internal class for handling data for a channel. More...
 
class  GraphRenderer
 Abstract base class that acts as an interface and can render the data from a Graph. More...
 

Public Types

typedef agx::Vector< agx::Vec2 > DataVector
 
typedef agx::observer_ptr< const GraphRenderer > GraphRendererConstObserver
 
typedef agx::ref_ptr< const GraphRenderer > GraphRendererConstRef
 
typedef agx::observer_ptr< GraphRenderer > GraphRendererObserver
 
typedef agx::ref_ptr< GraphRenderer > GraphRendererRef
 

Public Member Functions

 Graph (float width=float(0.9), float height=float(0.2), const agx::Vec2 &offset=agx::Vec2(agx::Real(0.01), agx::Real(0.01)))
 
void addChannel (Channel *channel)
 
void addPoint (const agx::Vec2 &point)
 
void addText (const agx::Vec2 &point, const agx::String &str)
 
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
 
void clearChannels ()
 
void clearPoints ()
 
void draw ()
 
Channel * getChannel (size_t idx)
 
bool getEnable () const
 
float getHeight ()
 
const agx::Vec2 & getOffset () const
 
int getReferenceCount () const
 
GraphRenderer * getRenderer ()
 
const GraphRenderer * getRenderer () const
 
float getWidth ()
 
template<typename T >
bool is () const
 Subclass test. More...
 
size_t numChannels () const
 
void postDraw ()
 
void preDraw ()
 
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...
 
void reserve (size_t size)
 
void setEnable (bool flag)
 
void setOffset (const agx::Vec2 &offset)
 
void setRenderer (GraphRenderer *renderer)
 
void setSize (float width, float height)
 
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...
 
bool validate () const
 Will check so that the number of channels for the associated GraphRenderer has equal # channels as this graph. More...
 

Static Public Member Functions

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

Protected Member Functions

virtual ~Graph ()
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
void drawData (size_t channelIndex) 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

Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Class that implements a simple graph for plotting scalar values.

Definition at line 33 of file Graph.h.

Member Typedef Documentation

◆ DataVector

Definition at line 37 of file Graph.h.

◆ GraphRendererConstObserver

◆ GraphRendererConstRef

Definition at line 39 of file Graph.h.

◆ GraphRendererObserver

◆ GraphRendererRef

Constructor & Destructor Documentation

◆ Graph()

agxRender::Graph::Graph ( float  width = float(0.9),
float  height = float(0.2),
const agx::Vec2 &  offset = agx::Vec2(agx::Real(0.01), agx::Real(0.01)) 
)

◆ ~Graph()

virtual agxRender::Graph::~Graph ( )
protectedvirtual

Member Function Documentation

◆ addChannel()

void agxRender::Graph::addChannel ( Channel *  channel)

◆ addPoint()

void agxRender::Graph::addPoint ( const agx::Vec2 &  point)

◆ addText()

void agxRender::Graph::addText ( const agx::Vec2 &  point,
const agx::String &  str 
)

◆ 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

◆ clearChannels()

void agxRender::Graph::clearChannels ( )

◆ clearPoints()

void agxRender::Graph::clearPoints ( )
inline

Definition at line 227 of file Graph.h.

◆ deleteUsingDeleteHandler()

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

◆ draw()

void agxRender::Graph::draw ( )

◆ drawData()

void agxRender::Graph::drawData ( size_t  channelIndex) const
protected

◆ getChannel()

Channel* agxRender::Graph::getChannel ( size_t  idx)
inline

Definition at line 199 of file Graph.h.

◆ getDeleteHandler()

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

◆ getEnable()

bool agxRender::Graph::getEnable ( ) const
inline

Definition at line 195 of file Graph.h.

◆ getHeight()

float agxRender::Graph::getHeight ( )
inline

Definition at line 222 of file Graph.h.

◆ getOffset()

const agx::Vec2& agxRender::Graph::getOffset ( ) const
inline

Definition at line 215 of file Graph.h.

◆ getReferenceCount()

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

◆ getRenderer() [1/2]

GraphRenderer* agxRender::Graph::getRenderer ( )
inline

Definition at line 208 of file Graph.h.

◆ getRenderer() [2/2]

const GraphRenderer* agxRender::Graph::getRenderer ( ) const
inline

Definition at line 211 of file Graph.h.

◆ getWidth()

float agxRender::Graph::getWidth ( )
inline

Definition at line 219 of file Graph.h.

◆ is()

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

◆ numChannels()

size_t agxRender::Graph::numChannels ( ) const
inline

Definition at line 189 of file Graph.h.

◆ postDraw()

void agxRender::Graph::postDraw ( )

◆ preDraw()

void agxRender::Graph::preDraw ( )

◆ 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.

◆ reserve()

void agxRender::Graph::reserve ( size_t  size)
inline

Definition at line 230 of file Graph.h.

References agxOSG::addText().

◆ 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()

void agxRender::Graph::setEnable ( bool  flag)

◆ setOffset()

void agxRender::Graph::setOffset ( const agx::Vec2 &  offset)
inline

Definition at line 179 of file Graph.h.

◆ setRenderer()

void agxRender::Graph::setRenderer ( GraphRenderer *  renderer)
inline

Definition at line 204 of file Graph.h.

References agxRender::Graph::GraphRenderer::m_graph.

◆ setSize()

void agxRender::Graph::setSize ( float  width,
float  height 
)
inline

Definition at line 175 of file Graph.h.

◆ 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.

◆ validate()

bool agxRender::Graph::validate ( ) const

Will check so that the number of channels for the associated GraphRenderer has equal # channels as this graph.

◆ ValidateCast()

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

Member Data Documentation

◆ 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: