1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

Get the Osg Earth View plugin stub working

This commit is contained in:
James Cotton 2012-03-17 15:45:04 -05:00
parent b67a74a400
commit 19111dacd2
12 changed files with 137 additions and 51 deletions

View File

@ -1,4 +1,4 @@
<plugin name="OsgEarthview" version="1.0.0" compatVersion="1.0.0">
<plugin name="OsgEarthviewGadget" version="1.0.0" compatVersion="1.0.0">
<vendor>The OpenPilot Project</vendor>
<copyright>(C) 2012 The OpenPilot Project</copyright>
<license>The GNU Public License (GPL) Version 3</license>

View File

@ -1,10 +1,10 @@
TEMPLATE = lib
TARGET = PFDGadget
TARGET = OsgEarthviewGadget
QT += opengl
include(../../openpilotgcsplugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(pfd_dependencies.pri)
include(osgearthview_dependencies.pri)
include(osg.pri)
include(osgearth.pri)
@ -22,5 +22,7 @@ SOURCES += osgearthviewgadgetfactory.cpp
SOURCES += osgearthviewgadgetconfiguration.cpp
SOURCES += osgearthviewgadgetoptionspage.cpp
OTHER_FILES += OsgEarthview.pluginspec
FORMS += osgearthviewgadgetoptionspage.ui
OTHER_FILES += OsgEarthviewGadget.pluginspec
RESOURCES += osgearthview.qrc

View File

@ -1,5 +1,3 @@
<RCC>
<qresource prefix="/pfd">
<file>images/pfd-default.svg</file>
</qresource>
<qresource prefix="/pfd"/>
</RCC>

View File

@ -25,9 +25,9 @@
#include "osgearthviewgadget.h"
#include "osgearthviewwidget.h"
#include "osgearthviewconfiguration.h"
#include "osgearthviewgadgetconfiguration.h"
OsgEarthviewGadget::OsgEarthviewGadget(QString classId, OsgEarthviewGadgetWidget *widget, QWidget *parent) :
OsgEarthviewGadget::OsgEarthviewGadget(QString classId, OsgEarthviewWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
{

View File

@ -33,7 +33,7 @@
class IUAVGadget;
class QWidget;
class QString;
class OsgEarthviewGadgetWidget;
class OsgEarthviewWidget;
using namespace Core;
@ -48,7 +48,7 @@ public:
void loadConfiguration(IUAVGadgetConfiguration* config);
private:
OsgEarthviewGadgetWidget *m_widget;
OsgEarthviewWidget *m_widget;
};

View File

@ -54,5 +54,4 @@ IUAVGadgetConfiguration *OsgEarthviewGadgetConfiguration::clone()
*
*/
void OsgEarthviewGadgetConfiguration::saveConfig(QSettings* qSettings) const {
QString dialFile = Utils::PathUtils().RemoveDataPath(m_defaultDial);
}

View File

@ -42,7 +42,7 @@ OsgEarthviewGadgetFactory::~OsgEarthviewGadgetFactory()
Core::IUAVGadget* OsgEarthviewGadgetFactory::createGadget(QWidget *parent)
{
OsgEarthviewGadgetWidget* gadgetWidget = new OsgEarthviewGadgetWidget(parent);
OsgEarthviewWidget* gadgetWidget = new OsgEarthviewWidget(parent);
return new OsgEarthviewGadget(QString("OsgEarthviewGadget"), gadgetWidget, parent);
}

View File

@ -23,9 +23,9 @@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "pfdgadgetoptionspage.h"
#include "pfdgadgetconfiguration.h"
#include "ui_pfdgadgetoptionspage.h"
#include "osgearthviewgadgetoptionspage.h"
#include "osgearthviewgadgetconfiguration.h"
#include "ui_osgearthviewgadgetoptionspage.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavdataobject.h"
@ -35,33 +35,22 @@
#include <QtAlgorithms>
#include <QStringList>
PFDGadgetOptionsPage::PFDGadgetOptionsPage(PFDGadgetConfiguration *config, QObject *parent) :
OsgEarthviewGadgetOptionsPage::OsgEarthviewGadgetOptionsPage(OsgEarthviewGadgetConfiguration *config, QObject *parent) :
IOptionsPage(parent),
m_config(config)
{
}
//creates options page widget (uses the UI file)
QWidget *PFDGadgetOptionsPage::createPage(QWidget *parent)
QWidget *OsgEarthviewGadgetOptionsPage::createPage(QWidget *parent)
{
options_page = new Ui::PFDGadgetOptionsPage();
options_page = new Ui::OsgEarthviewGadgetOptionsPage();
//main widget
QWidget *optionsPageWidget = new QWidget;
//main layout
options_page->setupUi(optionsPageWidget);
// Restore the contents from the settings:
options_page->svgSourceFile->setExpectedKind(Utils::PathChooser::File);
options_page->svgSourceFile->setPromptDialogFilter(tr("SVG image (*.svg)"));
options_page->svgSourceFile->setPromptDialogTitle(tr("Choose SVG image"));
options_page->svgSourceFile->setPath(m_config->dialFile());
options_page->useOpenGL->setChecked(m_config->useOpenGL());
options_page->hqText->setChecked(m_config->getHqFonts());
options_page->smoothUpdates->setChecked(m_config->getBeSmooth());
return optionsPageWidget;
}
@ -71,16 +60,12 @@ QWidget *PFDGadgetOptionsPage::createPage(QWidget *parent)
* Saves the current values
*
*/
void PFDGadgetOptionsPage::apply()
{
m_config->setDialFile(options_page->svgSourceFile->path());
m_config->setUseOpenGL(options_page->useOpenGL->checkState());
m_config->setHqFonts(options_page->hqText->checkState());
m_config->setBeSmooth(options_page->smoothUpdates->checkState());
}
void PFDGadgetOptionsPage::finish()
void OsgEarthviewGadgetOptionsPage::apply()
{
}
void OsgEarthviewGadgetOptionsPage::finish()
{
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PFDGadgetOptionsPage</class>
<widget class="QWidget" name="PFDGadgetOptionsPage">
<class>OsgEarthviewGadgetOptionsPage</class>
<widget class="QWidget" name="OsgEarthviewGadgetOptionsPage">
<property name="geometry">
<rect>
<x>0</x>

View File

@ -25,14 +25,69 @@
#include "osgearthviewwidget.h"
#include <utils/stylehelper.h>
#include <utils/cachedsvgitem.h>
#include <iostream>
#include <QDebug>
#include <QPainter>
#include <QtOpenGL/QGLWidget>
#include <cmath>
#include <QtGui/QApplication>
#include <QLabel>
#include <QDebug>
OsgEarthviewWidget::OsgEarthviewWidget(QWidget *parent) : QGraphicsView(parent)
#include <QtCore/QTimer>
#include <QtGui/QApplication>
#include <QtGui/QGridLayout>
#include <osg/Notify>
#include <osg/PositionAttitudeTransform>
#include <osgUtil/Optimizer>
#include <osgGA/StateSetManipulator>
#include <osgGA/GUIEventHandler>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgEarth/MapNode>
#include <osgEarth/XmlUtils>
#include <osgEarth/Viewpoint>
#include <osgEarthSymbology/Color>
#include <osgEarthAnnotation/AnnotationRegistry>
#include <osgEarthAnnotation/AnnotationData>
#include <osgEarthAnnotation/Decluttering>
#include <osgEarthDrivers/kml/KML>
#include <osgEarthDrivers/ocean_surface/OceanSurface>
#include <osgEarthDrivers/cache_filesystem/FileSystemCache>
#include <osgEarthUtil/EarthManipulator>
#include <osgEarthUtil/AutoClipPlaneHandler>
#include <osgEarthUtil/Controls>
#include <osgEarthUtil/SkyNode>
#include <osgEarthUtil/LatLongFormatter>
#include <osgEarthUtil/MouseCoordsTool>
#include <osgEarthUtil/ObjectLocator>
using namespace osgEarth::Util;
using namespace osgEarth::Util::Controls;
using namespace osgEarth::Symbology;
using namespace osgEarth::Drivers;
using namespace osgEarth::Annotation;
#include <osgViewer/CompositeViewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgGA/TrackballManipulator>
#include <osgDB/ReadFile>
#include <osgQt/GraphicsWindowQt>
#include <iostream>
OsgEarthviewWidget::OsgEarthviewWidget(QWidget *parent) : QWidget(parent)
{
}

View File

@ -30,14 +30,55 @@
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavobject.h"
#include <QGraphicsView>
#include <QtSvg/QSvgRenderer>
#include <QtSvg/QGraphicsSvgItem>
#include <QFile>
#include <QTimer>
#include <osg/Notify>
#include <osg/PositionAttitudeTransform>
class OsgEarthviewWidget : public QGraphicsView
#include <osgDB/ReadFile>
#include <osgGA/StateSetManipulator>
#include <osgGA/TrackballManipulator>
#include <osgGA/GUIEventHandler>
#include <osgUtil/Optimizer>
#include <osgViewer/CompositeViewer>
#include <osgViewer/Viewer>
#include <osgViewer/ViewerEventHandlers>
#include <osgEarth/MapNode>
#include <osgEarth/XmlUtils>
#include <osgEarth/Viewpoint>
#include <osgEarthSymbology/Color>
#include <osgEarthAnnotation/AnnotationRegistry>
#include <osgEarthAnnotation/AnnotationData>
#include <osgEarthAnnotation/Decluttering>
#include <osgEarthDrivers/kml/KML>
#include <osgEarthDrivers/ocean_surface/OceanSurface>
#include <osgEarthDrivers/cache_filesystem/FileSystemCache>
#include <osgEarthUtil/EarthManipulator>
#include <osgEarthUtil/AutoClipPlaneHandler>
#include <osgEarthUtil/Controls>
#include <osgEarthUtil/SkyNode>
#include <osgEarthUtil/LatLongFormatter>
#include <osgEarthUtil/MouseCoordsTool>
#include <osgEarthUtil/ObjectLocator>
using namespace osgEarth::Util;
using namespace osgEarth::Util::Controls;
using namespace osgEarth::Symbology;
using namespace osgEarth::Drivers;
using namespace osgEarth::Annotation;
#include <osgQt/GraphicsWindowQt>
#include <iostream>
class OsgEarthviewWidget : public QWidget, public osgViewer::CompositeViewer
{
Q_OBJECT

View File

@ -192,6 +192,12 @@ plugin_uavobjectutil.depends = plugin_coreplugin
plugin_uavobjectutil.depends += plugin_uavobjects
SUBDIRS += plugin_uavobjectutil
# OSG Earth View plugin
plugin_osgearthview.subdir = osgearthview
plugin_osgearthview.depends = plugin_coreplugin
plugin_osgearthview.depends += plugin_uavobjects
SUBDIRS += plugin_osgearthview
# Magic Waypoint gadget
plugin_magicwaypoint.subdir = magicwaypoint
plugin_magicwaypoint.depends = plugin_coreplugin