Debian Codegraph @

src/Viewer/WindowSystemAdapter.cxx

raw symbols SCIP
1 // Copyright (C) 2008 Tim Moore
2 //
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License as
5 // published by the Free Software Foundation; either version 2 of the
6 // License, or (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful, but
9 // WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 #ifdef HAVE_CONFIG_H
17 # include <config.h>
18 #endif
19
20 #include<algorithm>
21 #include <functional>
22
23 #include "CameraGroup.hxx"
24 #include "WindowSystemAdapter.hxx"
25
26 #include <osg/Camera>
27 #include <osg/GraphicsContext>
28 #include <osg/Viewport>
29
30 using namespace osg;
31 using namespace std;
32
33 namespace flightgear
34 {
35 ref_ptr<WindowSystemAdapter> WindowSystemAdapter::_wsa;
36
37 void GraphicsContextOperation::operator()(GraphicsContext* gc)
38 {
39 run(gc);
40 ++done;
41 }
42
43 WindowSystemAdapter::WindowSystemAdapter() :
44 _nextWindowID(0)
45 {
46 }
47
48 GraphicsWindow*
49 WindowSystemAdapter::registerWindow(GraphicsContext* gc,
50 const string& windowName)
51 {
52 GraphicsWindow* window = new GraphicsWindow(gc, windowName,
53 _nextWindowID++);
54 windows.push_back(window);
55 return window;
56 }
57
58 GraphicsWindow* WindowSystemAdapter::findWindow(const string& name)
59 {
60 for (WindowVector::iterator iter = windows.begin(), e = windows.end();
61 iter != e;
62 ++iter) {
63 if ((*iter)->name == name)
64 return iter->get();
65 }
66 return 0;
67 }
68 }