root/juggler/branches/1.0/Kernel/vjDisplay.cpp

Revision 8789, 4.2 kB (checked in by patrickh, 7 years ago)

Copyright update.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998, 1999, 2000, 2001, 2002
4  *   by Iowa State University
5  *
6  * Original Authors:
7  *   Allen Bierbaum, Christopher Just,
8  *   Patrick Hartling, Kevin Meinert,
9  *   Carolina Cruz-Neira, Albert Baker
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Library General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Library General Public License for more details.
20  *
21  * You should have received a copy of the GNU Library General Public
22  * License along with this library; if not, write to the
23  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24  * Boston, MA 02111-1307, USA.
25  *
26  * -----------------------------------------------------------------
27  * File:          $RCSfile$
28  * Date modified: $Date$
29  * Version:       $Revision$
30  * -----------------------------------------------------------------
31  *
32  *************** <auto-copyright.pl END do not edit this line> ***************/
33
34
35 #include <vjConfig.h>
36 #include <Kernel/vjDebug.h>
37
38 #include <Kernel/vjDisplay.h>
39 #include <Kernel/vjKernel.h>
40
41
42 void vjDisplay::config(vjConfigChunk* chunk)
43 {
44    vjASSERT(chunk != NULL);
45
46    // -- Get config info from chunk -- //
47     int originX = chunk->getProperty("origin", 0);
48     int originY = chunk->getProperty("origin", 1);
49     int sizeX   = chunk->getProperty("size", 0);
50     int sizeY   = chunk->getProperty("size", 1);
51     std::string name  = chunk->getProperty("name");
52     mBorder     = chunk->getProperty("border");
53     int pipe    = chunk->getProperty("pipe");
54     mView    = (vjDisplay::DisplayView)(int)chunk->getProperty("view");
55     mActive  = chunk->getProperty("active");
56
57     mLatencyMeasure = new vjPerfDataBuffer ("Head Latency " + name, 500, 4);
58     vjKernel::instance()->getEnvironmentManager()->addPerfDataBuffer (mLatencyMeasure);
59
60     // -- Check for error in configuration -- //
61     // NOTE: If there are errors, set them to some default value
62    if(sizeX <= 0)
63    {
64       vjDEBUG(vjDBG_DISP_MGR,2) << "WARNING: window sizeX set to: " << sizeX
65                                 << ".  Setting to 10." << std::endl
66                                 << vjDEBUG_FLUSH;
67       sizeX = 10;
68    }
69
70    if(sizeY <= 0)
71    {
72       vjDEBUG(vjDBG_DISP_MGR,2) << "WARNING: window sizeY set to: " << sizeY
73                                 << ".  Setting to 10." << std::endl
74                                 << vjDEBUG_FLUSH;
75       sizeY = 10;
76    }
77
78    if(pipe < 0)
79    {
80       vjDEBUG(vjDBG_DISP_MGR,2) << "WARNING: pipe was negative, pipe set to: " << pipe << ".  Setting to 0.\n" << vjDEBUG_FLUSH;
81       pipe = 0;
82    }
83
84       // -- Set local window attributes --- //
85     setOriginAndSize(originX, originY, sizeX, sizeY);
86
87     // Get the user for this display
88     std::string user_name = chunk->getProperty("user");
89     mUser = vjKernel::instance()->getUser(user_name);
90
91     if(NULL == mUser)
92     {
93        vjDEBUG(vjDBG_ERROR,0) << clrOutNORM(clrRED, "ERROR:") << " User not found named: "
94                               << user_name.c_str() << std::endl
95                               << vjDEBUG_FLUSH;
96       vjASSERT(false);
97     }
98
99     setName(name);
100     setPipe(pipe);
101
102     mDisplayChunk = chunk;        // Save the chunk for later use
103 }
104
105
106     // ---- FRIEND FUNCTIONS ---- //
107 //! PRE: disp != NULL
108 //+      disp->mUser != NULL
109 std::ostream& vjDisplay::outStream(std::ostream& out)
110 {
111    vjASSERT(mUser != NULL);
112
113     out << std::setw(15) << mName.c_str() << std::endl
114         << "  org:" << _xo << ", " << _yo
115         << "  sz:" << _xs << ", " << _ys
116         << "  p:" << mPipe
117         << "  view:" << ((mView == vjDisplay::LEFT_EYE) ? "Left" : ((mView==vjDisplay::RIGHT_EYE)?"Right" : "Stereo") )
118         << "  act:" << (mActive ? "Y" : "N")
119         << "  usr:" << mUser->getName().c_str();
120
121     return out;
122 }
123
124
125 std::ostream& operator<<(std::ostream& out,  vjDisplay& disp)
126 {
127    return disp.outStream(out);
128 }
Note: See TracBrowser for help on using the browser.