1 /********************************************************************************
2 * @file osgviewerwidget.h
3 * @author The OpenPilot Team Copyright (C) 2012.
4 * @addtogroup GCSPlugins GCS Plugins
6 * @addtogroup OsgEarthview Plugin
8 * @brief Osg Earth view of UAV
9 *****************************************************************************/
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #ifndef OSGVIEWERWIDGET_H
27 #define OSGVIEWERWIDGET_H
31 #include "osgearthviewgadgetconfiguration.h"
32 #include "extensionsystem/pluginmanager.h"
33 #include "uavobjectmanager.h"
34 #include "uavobject.h"
39 #include <osg/PositionAttitudeTransform>
41 #include <osgDB/ReadFile>
43 #include <osgGA/StateSetManipulator>
44 #include <osgGA/TrackballManipulator>
45 #include <osgGA/GUIEventHandler>
47 #include <osgUtil/Optimizer>
49 #include <osgViewer/CompositeViewer>
50 #include <osgViewer/Viewer>
51 #include <osgViewer/ViewerEventHandlers>
53 #include <osgEarth/MapNode>
54 #include <osgEarth/XmlUtils>
55 #include <osgEarth/Viewpoint>
57 #include <osgEarthSymbology/Color>
59 #include <osgEarthAnnotation/AnnotationRegistry>
60 #include <osgEarthAnnotation/AnnotationData>
61 #include <osgEarthAnnotation/Decluttering>
63 #include <osgEarthDrivers/kml/KML>
64 #include <osgEarthDrivers/ocean_surface/OceanSurface>
65 #include <osgEarthDrivers/cache_filesystem/FileSystemCache>
67 #include <osgEarthUtil/EarthManipulator>
68 #include <osgEarthUtil/AutoClipPlaneHandler>
69 #include <osgEarthUtil/Controls>
70 #include <osgEarthUtil/SkyNode>
71 #include <osgEarthUtil/LatLongFormatter>
72 #include <osgEarthUtil/MouseCoordsTool>
73 #include <osgEarthUtil/ObjectLocator>
75 using namespace osgEarth::Util
;
76 using namespace osgEarth::Util::Controls
;
77 using namespace osgEarth::Symbology
;
78 using namespace osgEarth::Drivers
;
79 using namespace osgEarth::Annotation
;
81 #include <osgQt/GraphicsWindowQt>
85 class OsgViewerWidget
: public QWidget
, public osgViewer::CompositeViewer
{
88 explicit OsgViewerWidget(QWidget
*parent
= 0);
95 void paintEvent(QPaintEvent
*event
);
97 /* Create a osgQt::GraphicsWindowQt to add to the widget */
98 QWidget
*createViewWidget(osg::Camera
*camera
, osg::Node
*scene
);
100 /* Create an osg::Camera which sets up the OSG view */
101 osg::Camera
*createCamera(int x
, int y
, int w
, int h
, const std::string
& name
, bool windowDecoration
);
103 /* Get the model to render */
104 osg::Node
*createAirplane();
106 private: /* Private variables */
108 EarthManipulator
*manip
;
109 osgEarth::Util::ObjectLocatorNode
*uavPos
;
110 osg::MatrixTransform
*uavAttitudeAndScale
;
111 osgEarth::MapNode
*mapNode
;
115 #endif // OSGVIEWERWIDGET_H