root/juggler/tags/1.0.5/Kernel/vjDisplay.cpp

Revision 7539, 4.2 kB (checked in by anonymous, 7 years ago)

This commit was manufactured by cvs2svn to create tag
'RELENG_1_0_5_RELEASE'.

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