mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-05 21:52:10 +01:00
Import stub for the Osg Earthview Plugin
This commit is contained in:
parent
c988685293
commit
b67a74a400
@ -0,0 +1,11 @@
|
|||||||
|
<plugin name="OsgEarthview" 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>
|
6
ground/openpilotgcs/src/plugins/osgearthview/osg.pri
Normal file
6
ground/openpilotgcs/src/plugins/osgearthview/osg.pri
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
|
||||||
|
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
|
@ -0,0 +1,2 @@
|
|||||||
|
|
||||||
|
LIBS += -losgEarth -losgEarthUtil -losgEarthQt
|
@ -0,0 +1,26 @@
|
|||||||
|
TEMPLATE = lib
|
||||||
|
TARGET = PFDGadget
|
||||||
|
|
||||||
|
QT += opengl
|
||||||
|
include(../../openpilotgcsplugin.pri)
|
||||||
|
include(../../plugins/coreplugin/coreplugin.pri)
|
||||||
|
include(pfd_dependencies.pri)
|
||||||
|
include(osg.pri)
|
||||||
|
include(osgearth.pri)
|
||||||
|
|
||||||
|
HEADERS += osgearthviewplugin.h
|
||||||
|
HEADERS += osgearthviewgadget.h
|
||||||
|
HEADERS += osgearthviewwidget.h
|
||||||
|
HEADERS += osgearthviewgadgetfactory.h
|
||||||
|
HEADERS += osgearthviewgadgetconfiguration.h
|
||||||
|
HEADERS += osgearthviewgadgetoptionspage.h
|
||||||
|
|
||||||
|
SOURCES += osgearthviewplugin.cpp
|
||||||
|
SOURCES += osgearthviewgadget.cpp
|
||||||
|
SOURCES += osgearthviewwidget.cpp
|
||||||
|
SOURCES += osgearthviewgadgetfactory.cpp
|
||||||
|
SOURCES += osgearthviewgadgetconfiguration.cpp
|
||||||
|
SOURCES += osgearthviewgadgetoptionspage.cpp
|
||||||
|
|
||||||
|
OTHER_FILES += OsgEarthview.pluginspec
|
||||||
|
RESOURCES += osgearthview.qrc
|
@ -0,0 +1,5 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/pfd">
|
||||||
|
<file>images/pfd-default.svg</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
@ -0,0 +1 @@
|
|||||||
|
include(../../plugins/uavobjects/uavobjects.pri)
|
@ -0,0 +1,50 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* @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 "osgearthviewconfiguration.h"
|
||||||
|
|
||||||
|
OsgEarthviewGadget::OsgEarthviewGadget(QString classId, OsgEarthviewGadgetWidget *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);
|
||||||
|
}
|
@ -0,0 +1,55 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
*
|
||||||
|
* @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 OsgEarthviewGadgetWidget;
|
||||||
|
|
||||||
|
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:
|
||||||
|
OsgEarthviewGadgetWidget *m_widget;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // OSGEARTHVIEWGADGET_H_
|
@ -0,0 +1,58 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* @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 {
|
||||||
|
QString dialFile = Utils::PathUtils().RemoveDataPath(m_defaultDial);
|
||||||
|
}
|
@ -0,0 +1,46 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
*
|
||||||
|
* @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
|
@ -0,0 +1,58 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* @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)
|
||||||
|
{
|
||||||
|
OsgEarthviewGadgetWidget* gadgetWidget = new OsgEarthviewGadgetWidget(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));
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
|
||||||
|
* @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_
|
@ -0,0 +1,86 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* @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 "pfdgadgetoptionspage.h"
|
||||||
|
#include "pfdgadgetconfiguration.h"
|
||||||
|
#include "ui_pfdgadgetoptionspage.h"
|
||||||
|
#include "extensionsystem/pluginmanager.h"
|
||||||
|
#include "uavobjectmanager.h"
|
||||||
|
#include "uavdataobject.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QtAlgorithms>
|
||||||
|
#include <QStringList>
|
||||||
|
|
||||||
|
PFDGadgetOptionsPage::PFDGadgetOptionsPage(PFDGadgetConfiguration *config, QObject *parent) :
|
||||||
|
IOptionsPage(parent),
|
||||||
|
m_config(config)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
//creates options page widget (uses the UI file)
|
||||||
|
QWidget *PFDGadgetOptionsPage::createPage(QWidget *parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
options_page = new Ui::PFDGadgetOptionsPage();
|
||||||
|
//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;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the user presses apply or OK.
|
||||||
|
*
|
||||||
|
* 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()
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @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
|
@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>PFDGadgetOptionsPage</class>
|
||||||
|
<widget class="QWidget" name="PFDGadgetOptionsPage">
|
||||||
|
<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>
|
@ -0,0 +1,64 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* @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>
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OsgEarthviewPlugin::extensionsInitialized()
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
void OsgEarthviewPlugin::shutdown()
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
Q_EXPORT_PLUGIN(OsgEarthviewPlugin)
|
||||||
|
|
@ -0,0 +1,47 @@
|
|||||||
|
/**
|
||||||
|
******************************************************************************
|
||||||
|
*
|
||||||
|
* @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
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OsgEarthviewPlugin();
|
||||||
|
~OsgEarthviewPlugin();
|
||||||
|
|
||||||
|
void extensionsInitialized();
|
||||||
|
bool initialize(const QStringList & arguments, QString * errorString);
|
||||||
|
void shutdown();
|
||||||
|
private:
|
||||||
|
OsgEarthviewGadgetFactory *mf;
|
||||||
|
};
|
||||||
|
#endif /* PFDPLUGIN_H_ */
|
@ -0,0 +1,53 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* @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 <utils/cachedsvgitem.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <QDebug>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QtOpenGL/QGLWidget>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
OsgEarthviewWidget::OsgEarthviewWidget(QWidget *parent) : QGraphicsView(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
OsgEarthviewWidget::~OsgEarthviewWidget()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OsgEarthviewWidget::paint()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OsgEarthviewWidget::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void OsgEarthviewWidget::resizeEvent(QResizeEvent *event)
|
||||||
|
{
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
/********************************************************************************
|
||||||
|
* @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 "osgearthviewgadgetconfiguration.h"
|
||||||
|
#include "extensionsystem/pluginmanager.h"
|
||||||
|
#include "uavobjectmanager.h"
|
||||||
|
#include "uavobject.h"
|
||||||
|
#include <QGraphicsView>
|
||||||
|
#include <QtSvg/QSvgRenderer>
|
||||||
|
#include <QtSvg/QGraphicsSvgItem>
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
|
class OsgEarthviewWidget : public QGraphicsView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
OsgEarthviewWidget(QWidget *parent = 0);
|
||||||
|
~OsgEarthviewWidget();
|
||||||
|
void paint();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent *event);
|
||||||
|
void resizeEvent(QResizeEvent *event);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
};
|
||||||
|
#endif /* OSGEARTHVIEWWIDGET_H_ */
|
Loading…
x
Reference in New Issue
Block a user