Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

vrj::DisplayManager Class Reference

Singleton Container class for all Displays. More...

#include <DisplayManager.h>

Collaboration diagram for vrj::DisplayManager:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual bool configAdd (jccl::ConfigElementPtr element)
 Adds the element to the configuration. More...

virtual bool configRemove (jccl::ConfigElementPtr element)
 Removes the element from the current configuration. More...

virtual bool configCanHandle (jccl::ConfigElementPtr element)
 Is it a display configuration element? More...

virtual void updateProjections (const float scaleFactor)
 This function is used to update all managed projections at once. More...

void setDrawManager (DrawManager *drawMgr)
 Sets the Draw Manager that the system is running. More...

std::vector< vrj::Display * > getActiveDisplays ()
 Returns a list of the current displays. More...

std::vector< vrj::Display * > getInActiveDisplays ()
 Returns list of inactive displays. More...

std::vector< vrj::Display * > getAllDisplays ()
 Returns list of all displays (inactive and active). More...

jccl::ConfigElementPtr getDisplaySystemElement ()

Public Attributes

std::vector< vrj::Display * > mActiveDisplays
 List of currently active displays. More...

std::vector< vrj::Display * > mInactiveDisplays
 List of currently inactive displays. More...


Protected Methods

 DisplayManager ()
virtual ~DisplayManager ()
 DisplayManager (const DisplayManager &o)
void operator= (const DisplayManager &o)
 vprSingletonHeader (DisplayManager)

Protected Attributes

DrawManagermDrawManager
 The current Draw Manager to communicate with. More...

jccl::ConfigElementPtr mDisplaySystemElement
 Config element for the displaySystem. More...


Detailed Description

Singleton Container class for all Displays.

PURPOSE: This class is responsible for holding the data about display aspects of the application. The display object are window/system independant this class is in charge of holding all the display data and keeping it current. This includes updating projections, adding/deleting new displays, etc.

Date:
9-7-97

Definition at line 64 of file DisplayManager.h.


Constructor & Destructor Documentation

vrj::DisplayManager::DisplayManager   [inline, protected]
 

Definition at line 183 of file DisplayManager.h.

00183                     : mDrawManager(NULL)
00184    {
00185        ;
00186    }

virtual vrj::DisplayManager::~DisplayManager   [inline, protected, virtual]
 

Definition at line 188 of file DisplayManager.h.

00189    {;}

vrj::DisplayManager::DisplayManager const DisplayManager &    o [inline, protected]
 

Definition at line 191 of file DisplayManager.h.

00192       : jccl::ConfigElementHandler()
00193    {
00194       ;
00195    }


Member Function Documentation

bool vrj::DisplayManager::configAdd jccl::ConfigElementPtr    element [virtual]
 

Adds the element to the configuration.

Precondition:
configCanHandle(element) == true

Definition at line 106 of file DisplayManager.cpp.

References configCanHandle, and mDisplaySystemElement.

00107 {
00108    vprASSERT(configCanHandle(element));
00109 
00110    const std::string element_type(element->getID());
00111 
00112    if(   (element_type == std::string("surfaceDisplay"))
00113       || (element_type == std::string("simDisplay")) )
00114    {
00115       vprDEBUG(vprDBG_ALL, vprDBG_CRITICAL_LVL)
00116          << "Element of type: " << element_type
00117          << " is no longer supported.  Use display_window type instead.\n"
00118          << vprDEBUG_FLUSH;
00119       return false;
00120    }
00121    else if( (element_type == std::string("display_window")))
00122    {
00123       return configAddDisplay(element);
00124    }
00125    else if(element_type == std::string("display_system"))
00126    {
00127       // XXX: Put signal here to tell draw manager to lookup new stuff
00128       mDisplaySystemElement = element; // Keep track of the display system element
00129       return true;                     // We successfully configured.
00130                                        // This tell processPending to add it to the active config
00131    }
00132 
00133    return false;
00134 }

bool vrj::DisplayManager::configRemove jccl::ConfigElementPtr    element [virtual]
 

Removes the element from the current configuration.

Precondition:
configCanHandle(element) == true

Definition at line 140 of file DisplayManager.cpp.

References configCanHandle, and mDisplaySystemElement.

00141 {
00142    vprASSERT(configCanHandle(element));
00143 
00144    const std::string element_type(element->getID());
00145 
00146    if(  (element_type == std::string("surfaceDisplay"))
00147      || (element_type == std::string("simDisplay")) )
00148    {
00149       vprDEBUG(vprDBG_ALL, vprDBG_CRITICAL_LVL)
00150          << "Element of type: " << element_type
00151          << " is no longer supported.  Use display_window type instead.\n"
00152          << vprDEBUG_FLUSH;
00153       return false;
00154    }
00155    else if(element_type == std::string("display_window"))
00156    {
00157       return configRemoveDisplay(element);
00158    }
00159    else if(element_type == std::string("display_system"))
00160    {
00161       // XXX: Put signal here to tell draw manager to lookup new stuff
00162       mDisplaySystemElement.reset();   // Keep track of the display system element
00163       return true;                     // We successfully configured.
00164                                        // This tell processPending to remove it to the active config
00165    }
00166    else
00167    { return false; }
00168 
00169 }

bool vrj::DisplayManager::configCanHandle jccl::ConfigElementPtr    element [virtual]
 

Is it a display configuration element?

Returns:
true if we can handle it, false if we can't.

Definition at line 177 of file DisplayManager.cpp.

Referenced by configAdd, and configRemove.

00178 {
00179    return (    (element->getID() == std::string("surfaceDisplay"))
00180             || (element->getID() == std::string("simDisplay"))
00181             || (element->getID() == std::string("display_system"))
00182             || (element->getID() == std::string("display_window"))
00183            );
00184 }

void vrj::DisplayManager::updateProjections const float    scaleFactor [virtual]
 

This function is used to update all managed projections at once.

Parameters:
scaleFactor  - Current scale factor for position data

Definition at line 349 of file DisplayManager.cpp.

References mActiveDisplays, and mInactiveDisplays.

00350 {
00351    // for (all displays) update the projections
00352    for (std::vector<Display*>::iterator i = mActiveDisplays.begin(); i != mActiveDisplays.end(); i++)
00353       (*i)->updateProjections(scaleFactor);
00354 
00355    for (std::vector<Display*>::iterator j = mInactiveDisplays.begin(); j != mInactiveDisplays.end(); j++)
00356       (*j)->updateProjections(scaleFactor);
00357 }

void vrj::DisplayManager::setDrawManager DrawManager   drawMgr
 

Sets the Draw Manager that the system is running.

We need to know this in order to notify the Draw Manager of any display changes.

Postcondition:
Draw Manager is notified of any displays currently configured.

Definition at line 85 of file DisplayManager.cpp.

References mActiveDisplays, mDrawManager, and vrjDBG_DISP_MGR.

00086 {
00087    vprDEBUG(vrjDBG_DISP_MGR, vprDBG_STATE_LVL) << "vjDisplayManager: Setting draw manager.\n" << vprDEBUG_FLUSH;
00088 
00089    // set the draw manager
00090    mDrawManager = drawMgr;
00091 
00092    // Alert the draw manager about all the active windows currently configured
00093    if(mDrawManager != NULL)
00094    {
00095       for(unsigned int i=0;i<mActiveDisplays.size();i++)
00096       {
00097          mDrawManager->addDisplay(mActiveDisplays[i]);
00098       }
00099    }
00100 }

std::vector<vrj::Display*> vrj::DisplayManager::getActiveDisplays   [inline]
 

Returns a list of the current displays.

Note:
DO NOT EDIT THE DISPLAYS

Definition at line 106 of file DisplayManager.h.

00107    { return mActiveDisplays;}

std::vector<vrj::Display*> vrj::DisplayManager::getInActiveDisplays   [inline]
 

Returns list of inactive displays.

Note:
DO NOT EDIT THE DISPLAYS

Definition at line 113 of file DisplayManager.h.

00114    { return mInactiveDisplays;}

std::vector< Display * > vrj::DisplayManager::getAllDisplays  
 

Returns list of all displays (inactive and active).

Note:
DO NOT EDIT THE DISPLAYS

Definition at line 51 of file DisplayManager.cpp.

References mActiveDisplays, and mInactiveDisplays.

00052 {
00053    std::vector<Display*> ret_val;
00054    ret_val.insert(ret_val.end(), mActiveDisplays.begin(), mActiveDisplays.end());
00055    ret_val.insert(ret_val.end(), mInactiveDisplays.begin(), mInactiveDisplays.end());
00056    return ret_val;
00057 }

jccl::ConfigElementPtr vrj::DisplayManager::getDisplaySystemElement  
 

Definition at line 59 of file DisplayManager.cpp.

References mDisplaySystemElement.

00060 {
00061    if ( mDisplaySystemElement.get() == NULL )
00062    {
00063       jccl::ConfigManager* cfg_mgr = jccl::ConfigManager::instance();
00064 
00065       cfg_mgr->lockActive();
00066       {
00067          std::vector<jccl::ConfigElementPtr>::iterator i;
00068          for(i=cfg_mgr->getActiveBegin(); i != cfg_mgr->getActiveEnd();++i)
00069          {
00070             if( (*i)->getID() == std::string("display_system") )
00071             {
00072                mDisplaySystemElement = *i;
00073                break;         // This guarantees that we get the first displaySystem element.
00074             }
00075          }
00076       }
00077       cfg_mgr->unlockActive();
00078 
00079 //      vprASSERT(mDisplaySystemElement.get() != NULL && "No Display Manager config element found!");
00080    }
00081 
00082    return mDisplaySystemElement;
00083 }

void vrj::DisplayManager::operator= const DisplayManager &    o [inline, protected]
 

Definition at line 197 of file DisplayManager.h.

00197 {;}

vrj::DisplayManager::vprSingletonHeader DisplayManager    [protected]
 


Member Data Documentation

std::vector<vrj::Display*> vrj::DisplayManager::mActiveDisplays
 

List of currently active displays.

Definition at line 173 of file DisplayManager.h.

Referenced by getAllDisplays, setDrawManager, and updateProjections.

std::vector<vrj::Display*> vrj::DisplayManager::mInactiveDisplays
 

List of currently inactive displays.

Definition at line 174 of file DisplayManager.h.

Referenced by getAllDisplays, and updateProjections.

DrawManager* vrj::DisplayManager::mDrawManager [protected]
 

The current Draw Manager to communicate with.

Definition at line 177 of file DisplayManager.h.

Referenced by setDrawManager.

jccl::ConfigElementPtr vrj::DisplayManager::mDisplaySystemElement [protected]
 

Config element for the displaySystem.

Definition at line 178 of file DisplayManager.h.

Referenced by configAdd, configRemove, and getDisplaySystemElement.


The documentation for this class was generated from the following files:
Generated on Sun May 2 15:11:06 2004 for VR Juggler by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002