Debian Codegraph @

utils/fgviewer/HLAViewerFederate.hxx

raw symbols SCIP
1 // Copyright (C) 2009 - 2012 Mathias Froehlich - [email protected]
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Library General Public
5 // License as published by the Free Software Foundation; either
6 // version 2 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Library 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 //
17
18 #ifndef HLAViewerFederate_hxx
19 #define HLAViewerFederate_hxx
20
21 #include <osg/ref_ptr>
22 #include <osg/observer_ptr>
23 #include <osg/Group>
24 #include <osg/Node>
25 #include <osgDB/Options>
26
27 #include <simgear/hla/HLAFederate.hxx>
28
29 #include "HLASceneObjectClass.hxx"
30 #include "HLAView.hxx"
31 #include "HLAViewClass.hxx"
32 #include "HLAPerspectiveViewer.hxx"
33 #include "HLAPerspectiveViewerClass.hxx"
34 #include "HLAMPAircraftClass.hxx"
35
36 namespace fgviewer {
37
38 class Viewer;
39
40 class HLAViewerFederate : public simgear::HLAFederate {
41 public:
42 HLAViewerFederate();
43 virtual ~HLAViewerFederate();
44
45 const HLAPerspectiveViewer* getViewer() const;
46 HLAPerspectiveViewer* getViewer();
47 void setViewer(HLAPerspectiveViewer* viewer);
48
49 const HLAView* getView() const;
50 HLAView* getView();
51 void setView(HLAView* view);
52
53 virtual simgear::HLAObjectClass* createObjectClass(const std::string& name);
54
55 virtual bool init();
56 virtual bool update();
57 virtual bool shutdown();
58
59 /// The node containing all the dynamic models attached to this viewer
60 osg::Node* getDynamicModelNode();
61 void addDynamicModel(osg::Node* node);
62 void removeDynamicModel(osg::Node* node);
63
64 /// Dynamic models use this options struct for loading/paging
65 osg::ref_ptr<const osgDB::Options> getReaderWriterOptions() const;
66
67 /// Called by the viewer.
68 void attachToViewer(Viewer* viewer);
69
70 /// Temporary application management
71 void insertView(HLAView* view);
72 void eraseView(HLAView* view);
73
74 private:
75 /// Explicitly known object classes
76 SGSharedPtr<HLAPerspectiveViewerClass> _perspectiveViewerClass;
77 SGSharedPtr<HLAViewClass> _viewClass;
78
79 /// The perspective viewer of this viewer federate. FIXME: also allow orthographic viewers for instruments!
80 SGSharedPtr<HLAPerspectiveViewer> _perspectiveViewer;
81
82 /// The default absolute view
83 SGSharedPtr<HLAView> _defaultView;
84
85 /// A list of all available views
86 typedef std::list<SGSharedPtr<HLAView> > ViewList;
87 ViewList _viewList;
88
89 /// The openscenegraphs side of this component
90 osg::ref_ptr<osg::Group> _group;
91
92 /// The backward reference to the viewer
93 osg::observer_ptr<Viewer> _viewer;
94 };
95
96 } // namespace fgviewer
97
98 #endif