1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

LP-29 removed deprecated osgearthview plugin

This commit is contained in:
Philippe Renon 2015-09-05 00:26:53 +02:00
parent 1f09d36638
commit b9bb1b46f6
23 changed files with 0 additions and 1424 deletions

View File

@ -1,11 +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>
<description>Visualize UAV and the scene based on OpenSceneGraph and OsgEarth</description>
<url>http://www.openpilot.org</url>
<dependencyList>
<dependency name="Core" version="1.0.0"/>
<dependency name="UAVObjects" version="1.0.0"/>
</dependencyList>
</plugin>

View File

@ -1,6 +0,0 @@
LIBS += -losg -lOpenThreads -losgUtil -losgViewer -losgDB -losgQt -losgGA
#QMAKE_LFLAGS += -F/usr/local/lib
#LIBS += -framework OpenThreads -framework osg -framework osgUtil -framework osgViewer -framework osgDB -framework osgQt -framework osgGA
#LIBS += -framework CoreFoundation

View File

@ -1,2 +0,0 @@
LIBS += -losgEarth -losgEarthUtil -losgEarthQt

View File

@ -1,42 +0,0 @@
TEMPLATE = lib
TARGET = OsgEarthviewGadget
QT += opengl
include(../../plugin.pri)
include(../../plugins/coreplugin/coreplugin.pri)
include(osgearthview_dependencies.pri)
include(osg.pri)
include(osgearth.pri)
HEADERS += osgearthviewplugin.h \
osgviewerwidget.h
HEADERS += osgearthviewgadget.h
HEADERS += osgearthviewwidget.h
HEADERS += osgearthviewgadgetfactory.h
HEADERS += osgearthviewgadgetconfiguration.h
HEADERS += osgearthviewgadgetoptionspage.h
SOURCES += osgearthviewplugin.cpp \
osgviewerwidget.cpp
SOURCES += osgearthviewgadget.cpp
SOURCES += osgearthviewwidget.cpp
SOURCES += osgearthviewgadgetfactory.cpp
SOURCES += osgearthviewgadgetconfiguration.cpp
SOURCES += osgearthviewgadgetoptionspage.cpp
FORMS += osgearthviewgadgetoptionspage.ui \
osgearthview.ui
OTHER_FILES += OsgEarthviewGadget.pluginspec
RESOURCES += osgearthview.qrc

View File

@ -1,3 +0,0 @@
<RCC>
<qresource prefix="/pfd"/>
</RCC>

View File

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OsgEarthview</class>
<widget class="QWidget" name="OsgEarthview">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="OsgViewerWidget" name="widget" native="true"/>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>OsgViewerWidget</class>
<extends>QWidget</extends>
<header>osgviewerwidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,2 +0,0 @@
include(../../plugins/uavobjects/uavobjects.pri)
include(../../plugins/uavobjectutil/uavobjectutil.pri)

View File

@ -1,49 +0,0 @@
/********************************************************************************
* @file osgearthviewgadget.cpp
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "osgearthviewgadget.h"
#include "osgearthviewwidget.h"
#include "osgearthviewgadgetconfiguration.h"
OsgEarthviewGadget::OsgEarthviewGadget(QString classId, OsgEarthviewWidget *widget, QWidget *parent) :
IUAVGadget(classId, parent),
m_widget(widget)
{}
OsgEarthviewGadget::~OsgEarthviewGadget()
{
delete m_widget;
}
/*
This is called when a configuration is loaded, and updates the plugin's settings.
Careful: the plugin is already drawn before the loadConfiguration method is called the
first time, so you have to be careful not to assume all the plugin values are initialized
the first time you use them
*/
void OsgEarthviewGadget::loadConfiguration(IUAVGadgetConfiguration *config)
{
OsgEarthviewGadgetConfiguration *m = qobject_cast<OsgEarthviewGadgetConfiguration *>(config);
}

View File

@ -1,57 +0,0 @@
/********************************************************************************
*
* @file osgearthviewgadget.h
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OSGEARTHVIEWGADGET_H_
#define OSGEARTHVIEWGADGET_H_
#include <coreplugin/iuavgadget.h>
#include "osgearthviewwidget.h"
class IUAVGadget;
class QWidget;
class QString;
class OsgEarthviewWidget;
using namespace Core;
class OsgEarthviewGadget : public Core::IUAVGadget {
Q_OBJECT
public:
OsgEarthviewGadget(QString classId, OsgEarthviewWidget *widget, QWidget *parent = 0);
~OsgEarthviewGadget();
QWidget *widget()
{
return m_widget;
}
void loadConfiguration(IUAVGadgetConfiguration *config);
private:
OsgEarthviewWidget *m_widget;
};
#endif // OSGEARTHVIEWGADGET_H_

View File

@ -1,56 +0,0 @@
/********************************************************************************
* @file osgearthviewgadgetconfiguration.cpp
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "osgearthviewgadgetconfiguration.h"
#include "utils/pathutils.h"
/**
* Loads a saved configuration or defaults if non exist.
*
*/
OsgEarthviewGadgetConfiguration::OsgEarthviewGadgetConfiguration(QString classId, QSettings *qSettings, QObject *parent) :
IUAVGadgetConfiguration(classId, parent)
{
Q_UNUSED(qSettings);
// if a saved configuration exists load it
if (qSettings != 0) {}
}
/**
* Clones a configuration.
*
*/
IUAVGadgetConfiguration *OsgEarthviewGadgetConfiguration::clone()
{
OsgEarthviewGadgetConfiguration *m = new OsgEarthviewGadgetConfiguration(this->classId());
return m;
}
/**
* Saves a configuration.
*
*/
void OsgEarthviewGadgetConfiguration::saveConfig(QSettings *qSettings) const {}

View File

@ -1,45 +0,0 @@
/********************************************************************************
*
* @file osgearthviewgadgetconfiguration.h
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OSGEARTHVIEWGADGETCONFIGURATION_H
#define OSGEARTHVIEWGADGETCONFIGURATION_H
#include <coreplugin/iuavgadgetconfiguration.h>
using namespace Core;
class OsgEarthviewGadgetConfiguration : public IUAVGadgetConfiguration {
Q_OBJECT
public:
explicit OsgEarthviewGadgetConfiguration(QString classId, QSettings *qSettings = 0, QObject *parent = 0);
void saveConfig(QSettings *settings) const;
IUAVGadgetConfiguration *clone();
private:
};
#endif // OSGEARTHVIEWGADGETCONFIGURATION_H

View File

@ -1,56 +0,0 @@
/********************************************************************************
* @file osgearthviewgadgetfactory.cpp
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "osgearthviewgadgetfactory.h"
#include "osgearthviewwidget.h"
#include "osgearthviewgadget.h"
#include "osgearthviewgadgetconfiguration.h"
#include "osgearthviewgadgetoptionspage.h"
#include <coreplugin/iuavgadget.h>
OsgEarthviewGadgetFactory::OsgEarthviewGadgetFactory(QObject *parent) :
IUAVGadgetFactory(QString("OsgEarthviewGadget"),
tr("Osg Earth View"),
parent)
{}
OsgEarthviewGadgetFactory::~OsgEarthviewGadgetFactory()
{}
Core::IUAVGadget *OsgEarthviewGadgetFactory::createGadget(QWidget *parent)
{
OsgEarthviewWidget *gadgetWidget = new OsgEarthviewWidget(parent);
return new OsgEarthviewGadget(QString("OsgEarthviewGadget"), gadgetWidget, parent);
}
IUAVGadgetConfiguration *OsgEarthviewGadgetFactory::createConfiguration(QSettings *qSettings)
{
return new OsgEarthviewGadgetConfiguration(QString("OsgEarthviewGadget"), qSettings);
}
IOptionsPage *OsgEarthviewGadgetFactory::createOptionsPage(IUAVGadgetConfiguration *config)
{
return new OsgEarthviewGadgetOptionsPage(qobject_cast<OsgEarthviewGadgetConfiguration *>(config));
}

View File

@ -1,51 +0,0 @@
/**
******************************************************************************
* @file osgearthviewgadgetfactory.h
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief The Primary Flight Display Gadget
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OSGEARTHVIEWGADGETFACTORY_H_
#define OSGEARTHVIEWGADGETFACTORY_H_
#include <coreplugin/iuavgadgetfactory.h>
namespace Core {
class IUAVGadget;
class IUAVGadgetFactory;
}
using namespace Core;
class OsgEarthviewGadgetFactory : public IUAVGadgetFactory {
Q_OBJECT
public:
OsgEarthviewGadgetFactory(QObject *parent = 0);
~OsgEarthviewGadgetFactory();
Core::IUAVGadget *createGadget(QWidget *parent);
IUAVGadgetConfiguration *createConfiguration(QSettings *qSettings);
IOptionsPage *createOptionsPage(IUAVGadgetConfiguration *config);
};
#endif // OSGEARTHVIEWGADGETFACTORY_H_

View File

@ -1,66 +0,0 @@
/********************************************************************************
* @file osgearthviewgadgetoptions.cpp
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "osgearthviewgadgetoptionspage.h"
#include "osgearthviewgadgetconfiguration.h"
#include "ui_osgearthviewgadgetoptionspage.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavdataobject.h"
#include <QFileDialog>
#include <QtAlgorithms>
#include <QStringList>
OsgEarthviewGadgetOptionsPage::OsgEarthviewGadgetOptionsPage(OsgEarthviewGadgetConfiguration *config, QObject *parent) :
IOptionsPage(parent),
m_config(config)
{}
// creates options page widget (uses the UI file)
QWidget *OsgEarthviewGadgetOptionsPage::createPage(QWidget *parent)
{
options_page = new Ui::OsgEarthviewGadgetOptionsPage();
// main widget
QWidget *optionsPageWidget = new QWidget;
// main layout
options_page->setupUi(optionsPageWidget);
return optionsPageWidget;
}
/**
* Called when the user presses apply or OK.
*
* Saves the current values
*
*/
void OsgEarthviewGadgetOptionsPage::apply()
{}
void OsgEarthviewGadgetOptionsPage::finish()
{}

View File

@ -1,64 +0,0 @@
/**
******************************************************************************
*
* @file osgearthviewgadgetoptionspage.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin Primary Flight Display Plugin
* @{
* @brief The Primary Flight Display Gadget
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OSGEARTHVIEWGADGETOPTIONSPAGE_H
#define OSGEARTHVIEWGADGETOPTIONSPAGE_H
#include "coreplugin/dialogs/ioptionspage.h"
#include "QString"
#include <QStringList>
#include <QDebug>
namespace Core {
class IUAVGadgetConfiguration;
}
class OsgEarthviewGadgetConfiguration;
namespace Ui {
class OsgEarthviewGadgetOptionsPage;
}
using namespace Core;
class OsgEarthviewGadgetOptionsPage : public IOptionsPage {
Q_OBJECT
public:
explicit OsgEarthviewGadgetOptionsPage(OsgEarthviewGadgetConfiguration *config, QObject *parent = 0);
QWidget *createPage(QWidget *parent);
void apply();
void finish();
private:
Ui::OsgEarthviewGadgetOptionsPage *options_page;
OsgEarthviewGadgetConfiguration *m_config;
private slots:
};
#endif // OSGEARTHVIEWGADGETOPTIONSPAGE_H

View File

@ -1,126 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OsgEarthviewGadgetOptionsPage</class>
<widget class="QWidget" name="OsgEarthviewGadgetOptionsPage">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>529</width>
<height>271</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
<property name="spacing">
<number>10</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetMaximumSize</enum>
</property>
<property name="bottomMargin">
<number>10</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>PFD SVG: </string>
</property>
</widget>
</item>
<item>
<widget class="Utils::PathChooser" name="svgSourceFile" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QCheckBox" name="useOpenGL">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Use OpenGL for rendering</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="hqText">
<property name="text">
<string>High Quality text (OpenGL)</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="smoothUpdates">
<property name="text">
<string>Smooth updates</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header>utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -1,66 +0,0 @@
/********************************************************************************
* @file osgearthviewplugin.cpp
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "osgearthviewplugin.h"
#include "osgearthviewgadgetfactory.h"
#include <QDebug>
#include <QtPlugin>
#include <QStringList>
#include <extensionsystem/pluginmanager.h>
#include <osgQt/GraphicsWindowQt>
OsgEarthviewPlugin::OsgEarthviewPlugin()
{
// Do nothing
}
OsgEarthviewPlugin::~OsgEarthviewPlugin()
{
// Do nothing
}
bool OsgEarthviewPlugin::initialize(const QStringList & args, QString *errMsg)
{
Q_UNUSED(args);
Q_UNUSED(errMsg);
mf = new OsgEarthviewGadgetFactory(this);
addAutoReleasedObject(mf);
osgQt::initQtWindowingSystem();
return true;
}
void OsgEarthviewPlugin::extensionsInitialized()
{
// Do nothing
}
void OsgEarthviewPlugin::shutdown()
{
// Do nothing
}

View File

@ -1,50 +0,0 @@
/**
******************************************************************************
*
* @file pfdplugin.h
* @author Edouard Lafargue Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OPMapPlugin Primary Flight Display Plugin
* @{
* @brief The Primary Flight Display Gadget
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OSGEARTHVIEWPLUGIN_H_
#define OSGEARTHVIEWPLUGIN_H_
#include <extensionsystem/iplugin.h>
class OsgEarthviewGadgetFactory;
class OsgEarthviewPlugin : public ExtensionSystem::IPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID "OpenPilot.OsgEarthview")
public:
OsgEarthviewPlugin();
~OsgEarthviewPlugin();
void extensionsInitialized();
bool initialize(const QStringList & arguments, QString *errorString);
void shutdown();
private:
OsgEarthviewGadgetFactory *mf;
};
#endif /* PFDPLUGIN_H_ */

View File

@ -1,121 +0,0 @@
/********************************************************************************
* @file osgearthviewwidget.cpp
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin Widget
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "osgearthviewwidget.h"
#include <utils/stylehelper.h>
#include <iostream>
#include <QDebug>
#include <QPainter>
#include <QtOpenGL/QGLWidget>
#include <cmath>
#include <QtWidgets/QApplication>
#include <QLabel>
#include <QDebug>
#include <QtCore/QTimer>
#include <QtWidgets/QApplication>
#include <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>
#include "ui_osgearthview.h"
#include "utils/stylehelper.h"
#include "utils/homelocationutil.h"
#include "utils/worldmagmodel.h"
#include "utils/coordinateconversions.h"
#include "attitudestate.h"
#include "homelocation.h"
#include "positionstate.h"
using namespace Utils;
OsgEarthviewWidget::OsgEarthviewWidget(QWidget *parent) : QWidget(parent)
{
m_widget = new Ui_OsgEarthview();
m_widget->setupUi(this);
/*viewWidget = new OsgViewerWidget(this);
viewWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setLayout(new QVBoxLayout());
layout()->addWidget(viewWidget);*/
}
OsgEarthviewWidget::~OsgEarthviewWidget()
{}
void OsgEarthviewWidget::paintEvent(QPaintEvent *event)
{}
void OsgEarthviewWidget::resizeEvent(QResizeEvent *event)
{}

View File

@ -1,102 +0,0 @@
/********************************************************************************
* @file osgearthviewwidget.h
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OSGEARTHVIEWWIDGET_H_
#define OSGEARTHVIEWWIDGET_H_
#include "osgviewerwidget.h"
#include "osgearthviewgadgetconfiguration.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavobject.h"
#include <QTimer>
#include <osg/Notify>
#include <osg/PositionAttitudeTransform>
#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 Ui_OsgEarthview;
class OsgEarthviewWidget : public QWidget {
Q_OBJECT
public:
OsgEarthviewWidget(QWidget *parent = 0);
~OsgEarthviewWidget();
public slots:
protected: /* Protected methods */
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
OsgViewerWidget *viewWidget;
Ui_OsgEarthview *m_widget;
};
#endif /* OSGEARTHVIEWWIDGET_H_ */

View File

@ -1,293 +0,0 @@
/********************************************************************************
* @file osgviewerwidget.cpp
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin Widget
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "osgviewerwidget.h"
#include "osgearthviewwidget.h"
#include <utils/stylehelper.h>
#include <iostream>
#include <QDebug>
#include <QPainter>
#include <QtOpenGL/QGLWidget>
#include <cmath>
#include <QtWidgets/QApplication>
#include <QLabel>
#include <QDebug>
#include <QtCore/QTimer>
#include <QtWidgets/QApplication>
#include <QGridLayout>
#include <osg/Notify>
#include <osg/PositionAttitudeTransform>
#include <osgUtil/Optimizer>
#include <osgGA/StateSetManipulator>
#include <osgGA/GUIEventHandler>
#include <osgGA/NodeTrackerManipulator>
#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>
#include "utils/stylehelper.h"
#include "utils/homelocationutil.h"
#include "utils/worldmagmodel.h"
#include "utils/coordinateconversions.h"
#include "attitudestate.h"
#include "gpspositionsensor.h"
#include "homelocation.h"
#include "positionstate.h"
#include "systemsettings.h"
using namespace Utils;
OsgViewerWidget::OsgViewerWidget(QWidget *parent) : QWidget(parent)
{
setThreadingModel(osgViewer::ViewerBase::CullThreadPerCameraDrawThreadPerContext);
setAttribute(Qt::WA_PaintOnScreen, true);
osg::Group *root = new osg::Group;
osg::Node *earth = osgDB::readNodeFile("/Users/Cotton/Programming/osg/osgearth/tests/boston.earth");
mapNode = osgEarth::MapNode::findMapNode(earth);
if (!mapNode) {
qDebug() << "Uhoh";
}
root->addChild(earth);
osg::Node *airplane = createAirplane();
uavPos = new osgEarth::Util::ObjectLocatorNode(mapNode->getMap());
uavPos->getLocator()->setPosition(osg::Vec3d(-71.100549, 42.349273, 150));
uavPos->addChild(airplane);
root->addChild(uavPos);
osgUtil::Optimizer optimizer;
optimizer.optimize(root);
QWidget *viewWidget = createViewWidget(createCamera(0, 0, 200, 200, "Earth", false), root);
viewWidget->show();
setLayout(new QVBoxLayout(this));
viewWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layout()->addWidget(viewWidget);
connect(&_timer, SIGNAL(timeout()), this, SLOT(update()));
_timer.start(10);
}
OsgViewerWidget::~OsgViewerWidget()
{}
QWidget *OsgViewerWidget::createViewWidget(osg::Camera *camera, osg::Node *scene)
{
osgViewer::View *view = new osgViewer::View;
view->setCamera(camera);
addView(view);
view->setSceneData(scene);
view->addEventHandler(new osgViewer::StatsHandler);
view->getDatabasePager()->setDoPreCompile(true);
manip = new EarthManipulator();
view->setCameraManipulator(manip);
// osgGA::NodeTrackerManipulator *camTracker = new osgGA::NodeTrackerManipulator();
// camTracker->setTrackNode(uavPos);
// camTracker->setMinimumDistance(0.0001f);
// camTracker->setDistance(0.001f);
// camTracker->setTrackerMode(osgGA::NodeTrackerManipulator::NODE_CENTER);
// view->setCameraManipulator(camTracker);
Grid *grid = new Grid();
grid->setControl(0, 0, new LabelControl("OpenPilot"));
ControlCanvas::get(view, true)->addControl(grid);
// zoom to a good startup position
manip->setViewpoint(Viewpoint(-71.100549, 42.349273, 0, 24.261, -21.6, 350.0), 5.0);
// manip->setViewpoint( Viewpoint(-71.100549, 42.349273, 0, 24.261, -81.6, 650.0), 5.0 );
// manip->setHomeViewpoint(Viewpoint("Boston", osg::Vec3d(-71.0763, 42.34425, 0), 24.261, -21.6, 3450.0));
manip->setTetherNode(uavPos);
osgQt::GraphicsWindowQt *gw = dynamic_cast<osgQt::GraphicsWindowQt *>(camera->getGraphicsContext());
return gw ? gw->getGLWidget() : NULL;
}
osg::Camera *OsgViewerWidget::createCamera(int x, int y, int w, int h, const std::string & name = "", bool windowDecoration = false)
{
osg::DisplaySettings *ds = osg::DisplaySettings::instance().get();
osg::ref_ptr<osg::GraphicsContext::Traits> traits = new osg::GraphicsContext::Traits;
traits->windowName = name;
traits->windowDecoration = windowDecoration;
traits->x = x;
traits->y = y;
traits->width = w;
traits->height = h;
traits->doubleBuffer = true;
traits->alpha = ds->getMinimumNumAlphaBits();
traits->stencil = ds->getMinimumNumStencilBits();
traits->sampleBuffers = ds->getMultiSamples();
traits->samples = ds->getNumMultiSamples();
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
camera->setGraphicsContext(new osgQt::GraphicsWindowQt(traits.get()));
camera->setClearColor(osg::Vec4(0.2, 0.2, 0.6, 1.0));
camera->setViewport(new osg::Viewport(0, 0, traits->width, traits->height));
camera->setProjectionMatrixAsPerspective(
30.0f, static_cast<double>(traits->width) / static_cast<double>(traits->height), 1.0f, 10000.0f);
return camera.release();
}
osg::Node *OsgViewerWidget::createAirplane()
{
osg::Group *model = new osg::Group;
osg::Node *uav;
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
UAVObjectManager *objMngr = pm->getObject<UAVObjectManager>();
Q_ASSERT(objMngr);
SystemSettings *systemSettingsObj = SystemSettings::GetInstance(objMngr);
SystemSettings::DataFields systemSettings = systemSettingsObj->getData();
qDebug() << "Frame type:" << systemSettingsObj->getField("AirframeType")->getValue().toString();
// Get model that matches airframe type
switch (systemSettings.AirframeType) {
case SystemSettings::AIRFRAMETYPE_FIXEDWING:
case SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON:
case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL:
uav = osgDB::readNodeFile("/Users/Cotton/Programming/OpenPilot/artwork/3D Model/planes/Easystar/easystar.3ds");
break;
default:
uav = osgDB::readNodeFile("/Users/Cotton/Programming/OpenPilot/artwork/3D Model/multi/joes_cnc/J14-QT_+.3DS");
}
if (uav) {
uavAttitudeAndScale = new osg::MatrixTransform();
uavAttitudeAndScale->setMatrix(osg::Matrixd::scale(0.2e0, 0.2e0, 0.2e0));
// Apply a rotation so model is NED before any other rotations
osg::MatrixTransform *rotateModelNED = new osg::MatrixTransform();
rotateModelNED->setMatrix(osg::Matrixd::scale(0.05e0, 0.05e0, 0.05e0) * osg::Matrixd::rotate(M_PI, osg::Vec3d(0, 0, 1)));
rotateModelNED->addChild(uav);
uavAttitudeAndScale->addChild(rotateModelNED);
model->addChild(uavAttitudeAndScale);
} else {
qDebug() << "Bad model file";
}
return model;
}
void OsgViewerWidget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objMngr = pm->getObject<UAVObjectManager>();
PositionState *positionStateObj = PositionState::GetInstance(objMngr);
PositionState::DataFields positionState = positionStateObj->getData();
double NED[3] = { positionState.North, positionState.East, positionState.Down };
bool positionStateUpdate = true;
if (positionStateUpdate) {
HomeLocation *homeLocationObj = HomeLocation::GetInstance(objMngr);
HomeLocation::DataFields homeLocation = homeLocationObj->getData();
double homeLLA[3] = { homeLocation.Latitude / 10.0e6, homeLocation.Longitude / 10.0e6, homeLocation.Altitude };
double LLA[3];
CoordinateConversions().NED2LLA_HomeLLA(homeLLA, NED, LLA);
uavPos->getLocator()->setPosition(osg::Vec3d(LLA[1], LLA[0], LLA[2])); // Note this takes longtitude first
} else {
GPSPositionSensor *gpsPosObj = GPSPositionSensor::GetInstance(objMngr);
GPSPositionSensor::DataFields gpsPos = gpsPosObj->getData();
uavPos->getLocator()->setPosition(osg::Vec3d(gpsPos.Longitude / 10.0e6, gpsPos.Latitude / 10.0e6, gpsPos.Altitude));
}
// Set the attitude (reverse the attitude)
AttitudeState *attitudeStateObj = AttitudeState::GetInstance(objMngr);
AttitudeState::DataFields attitudeState = attitudeStateObj->getData();
osg::Quat quat(attitudeState.q2, attitudeState.q3, attitudeState.q4, attitudeState.q1);
// Have to rotate the axes from OP NED frame to OSG frame (X east, Y north, Z down)
double angle;
osg::Vec3d axis;
quat.getRotate(angle, axis);
quat.makeRotate(angle, osg::Vec3d(axis[1], axis[0], -axis[2]));
osg::Matrixd rot = osg::Matrixd::rotate(quat);
uavAttitudeAndScale->setMatrix(rot);
frame();
}

View File

@ -1,115 +0,0 @@
/********************************************************************************
* @file osgviewerwidget.h
* @author The OpenPilot Team Copyright (C) 2012.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup OsgEarthview Plugin
* @{
* @brief Osg Earth view of UAV
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef OSGVIEWERWIDGET_H
#define OSGVIEWERWIDGET_H
#include <QWidget>
#include "osgearthviewgadgetconfiguration.h"
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavobject.h"
#include <QTimer>
#include <osg/Notify>
#include <osg/PositionAttitudeTransform>
#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 OsgViewerWidget : public QWidget, public osgViewer::CompositeViewer {
Q_OBJECT
public:
explicit OsgViewerWidget(QWidget *parent = 0);
~OsgViewerWidget();
signals:
public slots:
protected:
void paintEvent(QPaintEvent *event);
/* Create a osgQt::GraphicsWindowQt to add to the widget */
QWidget *createViewWidget(osg::Camera *camera, osg::Node *scene);
/* Create an osg::Camera which sets up the OSG view */
osg::Camera *createCamera(int x, int y, int w, int h, const std::string & name, bool windowDecoration);
/* Get the model to render */
osg::Node *createAirplane();
private: /* Private variables */
QTimer _timer;
EarthManipulator *manip;
osgEarth::Util::ObjectLocatorNode *uavPos;
osg::MatrixTransform *uavAttitudeAndScale;
osgEarth::MapNode *mapNode;
};
#endif // OSGVIEWERWIDGET_H

View File

@ -206,15 +206,6 @@ plugin_uavobjectutil.depends = plugin_coreplugin
plugin_uavobjectutil.depends += plugin_uavobjects
SUBDIRS += plugin_uavobjectutil
# OSG Earth View plugin
OSG {
plugin_osgearthview.subdir = osgearthview
plugin_osgearthview.depends = plugin_coreplugin
plugin_osgearthview.depends += plugin_uavobjects
plugin_osgearthview.depends += plugin_uavobjectwidgetutils
SUBDIRS += plugin_osgearthview
}
# Magic Waypoint gadget
plugin_magicwaypoint.subdir = magicwaypoint
plugin_magicwaypoint.depends = plugin_coreplugin