AGXDynamics  2.31.1.0
agxQt::CameraDescriptionSet Class Reference

CameraViewSet is a class that handles and manages a set of cameras that the user should be able to switch between in the active scene Different Cameras can be stored to the active set while looking at the scene for future references. More...

#include <CameraViewSet.h>

+ Inheritance diagram for agxQt::CameraDescriptionSet:

Public Member Functions

 CameraDescriptionSet ()
 Constructor. More...
 
void addCamera (CameraDescription *camera)
 Add/Remove a camera to the camera set. 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
 
bool containsCameraDescription (const CameraDescription *camera)
 Check if the camera is contained in the set. More...
 
CameraDescription * getActiveCameraDescription ()
 Returns the active camera description in the set. More...
 
agx::UInt getActiveCameraIndex ()
 Get the active camera index in the set. More...
 
CameraDescription * getCameraDescription (const agx::UInt &index)
 Gets the camera description given an index. More...
 
CameraDescription * getCameraDescriptionFromName (const agx::String &name)
 Returns a camera description given a name. More...
 
agx::Vector< agx::String > getCameraViewNames ()
 Get the names for all loaded views. More...
 
agx::UInt getNumberOfCameraDescriptions ()
 Returns the number of camera descriptions in the active set. More...
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. More...
 
agx::UInt nextCameraDescription ()
 Increments the active camera index to the next one. If the active camera index is at max, it cycles back to the first index. Returns the active index after increment. More...
 
agx::UInt previousCameraDescription ()
 Decrements the active camera index to the previous one. If the active camera index is at 0, it cycles forward to the last index. Returns the active index after increment. 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...
 
void removeCamera (CameraDescription *camera)
 
bool removeCameraViewFromName (const agx::String &name)
 Remove a loaded camera view given an string identifier. Returns false if not found, true if found and deleted. More...
 
bool renameCameraDescription (const agx::String &oldname, const agx::String &newName)
 Tries to rename a camera description given a name identifier. Returns false if no camera description of that name exists in the set. More...
 
void setActiveCameraViewIndex (agx::UInt index)
 Sets the active camera view index. If the index is out of bounds, nothing happens. More...
 
bool setActiveViewFromName (const agx::String &name)
 Set active view in manager from name. Returns false if not found, true if found and deleted. More...
 
agx::String toString ()
 Print the set. 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 ~CameraDescriptionSet ()
 Destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
bool getIndexFromCamera (CameraDescription *camera, agx::UInt &index)
 

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::UInt m_activeCameraIndex
 
CameraDescriptionList m_cameraDescriptionContainer
 
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

CameraViewSet is a class that handles and manages a set of cameras that the user should be able to switch between in the active scene Different Cameras can be stored to the active set while looking at the scene for future references.

This class serves as a container and manager for the different types of views that the user want to store

TODO - nextCam.., prevCam.. should reutrn a descirption instead of index. Should only expose index at getCameraDescription().

Definition at line 59 of file CameraViewSet.h.

Constructor & Destructor Documentation

◆ CameraDescriptionSet()

agxQt::CameraDescriptionSet::CameraDescriptionSet ( )

Constructor.

◆ ~CameraDescriptionSet()

virtual agxQt::CameraDescriptionSet::~CameraDescriptionSet ( )
protectedvirtual

Destructor.

Member Function Documentation

◆ addCamera()

void agxQt::CameraDescriptionSet::addCamera ( CameraDescription *  camera)

Add/Remove a camera to the camera set.

◆ 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

◆ containsCameraDescription()

bool agxQt::CameraDescriptionSet::containsCameraDescription ( const CameraDescription *  camera)

Check if the camera is contained in the set.

◆ deleteUsingDeleteHandler()

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

◆ getActiveCameraDescription()

CameraDescription* agxQt::CameraDescriptionSet::getActiveCameraDescription ( )

Returns the active camera description in the set.

◆ getActiveCameraIndex()

agx::UInt agxQt::CameraDescriptionSet::getActiveCameraIndex ( )

Get the active camera index in the set.

◆ getCameraDescription()

CameraDescription* agxQt::CameraDescriptionSet::getCameraDescription ( const agx::UInt &  index)

Gets the camera description given an index.

◆ getCameraDescriptionFromName()

CameraDescription* agxQt::CameraDescriptionSet::getCameraDescriptionFromName ( const agx::String &  name)

Returns a camera description given a name.

◆ getCameraViewNames()

agx::Vector<agx::String> agxQt::CameraDescriptionSet::getCameraViewNames ( )

Get the names for all loaded views.

◆ getDeleteHandler()

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

◆ getIndexFromCamera()

bool agxQt::CameraDescriptionSet::getIndexFromCamera ( CameraDescription *  camera,
agx::UInt &  index 
)
protected

◆ getNumberOfCameraDescriptions()

agx::UInt agxQt::CameraDescriptionSet::getNumberOfCameraDescriptions ( )

Returns the number of camera descriptions in the active set.

◆ 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

◆ nextCameraDescription()

agx::UInt agxQt::CameraDescriptionSet::nextCameraDescription ( )

Increments the active camera index to the next one. If the active camera index is at max, it cycles back to the first index. Returns the active index after increment.

◆ previousCameraDescription()

agx::UInt agxQt::CameraDescriptionSet::previousCameraDescription ( )

Decrements the active camera index to the previous one. If the active camera index is at 0, it cycles forward to the last index. Returns the active index after increment.

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

◆ removeCamera()

void agxQt::CameraDescriptionSet::removeCamera ( CameraDescription *  camera)

◆ removeCameraViewFromName()

bool agxQt::CameraDescriptionSet::removeCameraViewFromName ( const agx::String &  name)

Remove a loaded camera view given an string identifier. Returns false if not found, true if found and deleted.

◆ renameCameraDescription()

bool agxQt::CameraDescriptionSet::renameCameraDescription ( const agx::String &  oldname,
const agx::String &  newName 
)

Tries to rename a camera description given a name identifier. Returns false if no camera description of that name exists in the set.

◆ setActiveCameraViewIndex()

void agxQt::CameraDescriptionSet::setActiveCameraViewIndex ( agx::UInt  index)

Sets the active camera view index. If the index is out of bounds, nothing happens.

◆ setActiveViewFromName()

bool agxQt::CameraDescriptionSet::setActiveViewFromName ( const agx::String &  name)

Set active view in manager from name. Returns false if not found, true if found and deleted.

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

◆ toString()

agx::String agxQt::CameraDescriptionSet::toString ( )

Print the set.

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

agx::UInt agxQt::CameraDescriptionSet::m_activeCameraIndex
protected

Definition at line 125 of file CameraViewSet.h.

◆ m_cameraDescriptionContainer

CameraDescriptionList agxQt::CameraDescriptionSet::m_cameraDescriptionContainer
protected

Definition at line 124 of file CameraViewSet.h.

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