AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
agxQt::OsgCameraViewManager Class Reference

Manager class that acts as a wrapper container for the CameravViewset class for OSG based view systems. More...

#include <CameraViewSet.h>

+ Inheritance diagram for agxQt::OsgCameraViewManager:

Public Member Functions

 OsgCameraViewManager ()
 Default constructor. 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
 
agx::String getActiveCameraViewName () const
 Returns the active view name. More...
 
CameraDescriptionSet * getCameraDescriptionSet ()
 Returns the internal structure of the camera view set. More...
 
agx::Vector< agx::String > getCameraViewNames ()
 Get the names for all loaded views. More...
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test. 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...
 
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 restoreViewsetFromCFGFile (const agx::String &filename)
 Restores the a view set from a .cfg file. Will overwrite the current view set in the manager. More...
 
void setActiveView (osgViewer::Viewer *viewer)
 Sets the active view in the manager an osgViewer. 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...
 
void setNextView (osgViewer::Viewer *viewer)
 Toggles the next view in stored views and sets it to an osgViewer. More...
 
void setPreviousView (osgViewer::Viewer *viewer)
 Toggles a previous view in stored views and sets it to an osgViewer. More...
 
void storeCurrentView (osgViewer::Viewer *viewer)
 Stores the current view in osg viewer. More...
 
bool storeViewsetAsCFGFile (const agx::String &filename)
 Store the active configuration to a file. 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

static CameraDescription * getCameraDescriptionFromOsgViewer (osgViewer::Viewer *viewer)
 Utility method for converting osgViewer views to CameraViewDescriptions. More...
 
template<typename T >
static bool ValidateCast (const Referenced *object)
 

Protected Member Functions

virtual ~OsgCameraViewManager ()
 Default destructor. More...
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 
bool parseCameraState (agxCFG::ConfigScript *cfg, CameraDescription *c)
 Tries to parse a camera state from the current position in the config script. More...
 
void setViewOnOSGViewer (CameraDescription *c, osgViewer::Viewer *viewer)
 
bool storeCameraState (agxCFG::ConfigScript *cfg, CameraDescription *c)
 Stores the camera description in the in the current place in the configure script. More...
 

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

CameraDescriptionSetRef m_cameraSet
 
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Manager class that acts as a wrapper container for the CameravViewset class for OSG based view systems.

Definition at line 196 of file CameraViewSet.h.

Constructor & Destructor Documentation

agxQt::OsgCameraViewManager::OsgCameraViewManager ( )

Default constructor.

virtual agxQt::OsgCameraViewManager::~OsgCameraViewManager ( )
protectedvirtual

Default destructor.

Member Function Documentation

void agx::Referenced::allocateObserverVector ( ) const
protectedinherited
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(), and agx::InternalData::getOrCreate().

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

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

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

template<typename T >
const T* agx::Referenced::asSafe ( ) const
inherited
void agx::Referenced::deleteUsingDeleteHandler ( ) const
protectedinherited
agx::String agxQt::OsgCameraViewManager::getActiveCameraViewName ( ) const

Returns the active view name.

static CameraDescription* agxQt::OsgCameraViewManager::getCameraDescriptionFromOsgViewer ( osgViewer::Viewer *  viewer)
static

Utility method for converting osgViewer views to CameraViewDescriptions.

CameraDescriptionSet * agxQt::OsgCameraViewManager::getCameraDescriptionSet ( )

Returns the internal structure of the camera view set.

Definition at line 261 of file CameraViewSet.h.

References agx::ref_ptr< T >::get(), and m_cameraSet.

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

Get the names for all loaded views.

static DeleteHandler* agx::Referenced::getDeleteHandler ( )
staticprotectedinherited
Returns
a DeleteHandler.
int agx::Referenced::getReferenceCount ( ) const
inherited
Returns
the number pointers currently referencing this object.
template<typename T >
bool agx::Referenced::is ( ) const
inherited
bool agxQt::OsgCameraViewManager::parseCameraState ( agxCFG::ConfigScript *  cfg,
CameraDescription *  c 
)
protected

Tries to parse a camera state from the current position in the config script.

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.

Referenced by agxData::Val< UInt >::Val().

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

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

bool agxQt::OsgCameraViewManager::restoreViewsetFromCFGFile ( const agx::String &  filename)

Restores the a view set from a .cfg file. Will overwrite the current view set in the manager.

void agxQt::OsgCameraViewManager::setActiveView ( osgViewer::Viewer *  viewer)

Sets the active view in the manager an osgViewer.

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

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

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

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

void agxQt::OsgCameraViewManager::setNextView ( osgViewer::Viewer *  viewer)

Toggles the next view in stored views and sets it to an osgViewer.

void agxQt::OsgCameraViewManager::setPreviousView ( osgViewer::Viewer *  viewer)

Toggles a previous view in stored views and sets it to an osgViewer.

void agxQt::OsgCameraViewManager::setViewOnOSGViewer ( CameraDescription *  c,
osgViewer::Viewer *  viewer 
)
protected
bool agxQt::OsgCameraViewManager::storeCameraState ( agxCFG::ConfigScript *  cfg,
CameraDescription *  c 
)
protected

Stores the camera description in the in the current place in the configure script.

void agxQt::OsgCameraViewManager::storeCurrentView ( osgViewer::Viewer *  viewer)

Stores the current view in osg viewer.

bool agxQt::OsgCameraViewManager::storeViewsetAsCFGFile ( const agx::String &  filename)

Store the active configuration to a file.

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.

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.

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

Member Data Documentation

CameraDescriptionSetRef agxQt::OsgCameraViewManager::m_cameraSet
protected

Definition at line 255 of file CameraViewSet.h.

Referenced by getCameraDescriptionSet().

Mutex agx::Referenced::m_mutex
mutableprotectedinherited

Definition at line 240 of file Referenced.h.

ObserverContainer agx::Referenced::m_observers
mutableprotectedinherited

Definition at line 239 of file Referenced.h.

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: