mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
Added the makings of a waypoint editor on the new map plug-in.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@885 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
4f4c04d16b
commit
9e8c4f26e4
@ -9,14 +9,17 @@ HEADERS += opmapplugin.h \
|
||||
opmapgadgetfactory.h \
|
||||
opmapgadgetconfiguration.h \
|
||||
opmapgadget.h \
|
||||
opmapgadgetwidget.h
|
||||
opmapgadgetwidget.h \
|
||||
opmap_waypointeditor_dialog.h
|
||||
SOURCES += opmapplugin.cpp \
|
||||
opmapgadgetwidget.cpp \
|
||||
opmapgadgetoptionspage.cpp \
|
||||
opmapgadgetfactory.cpp \
|
||||
opmapgadgetconfiguration.cpp \
|
||||
opmapgadget.cpp
|
||||
opmapgadget.cpp \
|
||||
opmap_waypointeditor_dialog.cpp
|
||||
OTHER_FILES += OPMapGadget.pluginspec
|
||||
FORMS += opmapgadgetoptionspage.ui \
|
||||
opmap_widget.ui
|
||||
opmap_widget.ui \
|
||||
opmap_waypointeditor_dialog.ui
|
||||
RESOURCES += opmap.qrc
|
||||
|
57
ground/src/plugins/opmap/opmap_waypointeditor_dialog.cpp
Normal file
57
ground/src/plugins/opmap/opmap_waypointeditor_dialog.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file opmap_waypointeditor_dialog.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup opmap
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 "opmap_waypointeditor_dialog.h"
|
||||
#include "ui_opmap_waypointeditor_dialog.h"
|
||||
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
|
||||
opmap_waypointeditor_dialog::opmap_waypointeditor_dialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::opmap_waypointeditor_dialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setWindowFlags(Qt::Dialog);
|
||||
}
|
||||
|
||||
opmap_waypointeditor_dialog::~opmap_waypointeditor_dialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void opmap_waypointeditor_dialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
54
ground/src/plugins/opmap/opmap_waypointeditor_dialog.h
Normal file
54
ground/src/plugins/opmap/opmap_waypointeditor_dialog.h
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file opmap_waypointeditor_dialog.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup opmap
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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 OPMAP_WAYPOINTEDITOR_DIALOG_H
|
||||
#define OPMAP_WAYPOINTEDITOR_DIALOG_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QMenu>
|
||||
#include <QtGui/QDialog>
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/positionactual.h"
|
||||
|
||||
namespace Ui {
|
||||
class opmap_waypointeditor_dialog;
|
||||
}
|
||||
|
||||
class opmap_waypointeditor_dialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
opmap_waypointeditor_dialog(QWidget *parent = 0);
|
||||
~opmap_waypointeditor_dialog();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::opmap_waypointeditor_dialog *ui;
|
||||
};
|
||||
|
||||
#endif // OPMAP_WAYPOINTEDITOR_DIALOG_H
|
138
ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui
Normal file
138
ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui
Normal file
@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>opmap_waypointeditor_dialog</class>
|
||||
<widget class="QDialog" name="opmap_waypointeditor_dialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>399</width>
|
||||
<height>359</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>260</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>OpenPilot GCS Waypoint Editor</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="../coreplugin/core.qrc">
|
||||
<normaloff>:/core/images/openpilot_logo_128.png</normaloff>:/core/images/openpilot_logo_128.png</iconset>
|
||||
</property>
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxWaypointHeightAndTimeline">
|
||||
<property name="title">
|
||||
<string>Graphical waypoint Height and Timeline</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGraphicsView" name="graphicsViewWaypointHeightAndTimeline"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBoxWaypoints">
|
||||
<property name="title">
|
||||
<string>Waypoints</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QTableWidget" name="tableWidgetWaypoints">
|
||||
<property name="dragEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="showGrid">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Num</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Latitude</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Longitude</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Height</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Relative Time</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../coreplugin/core.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>opmap_waypointeditor_dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>opmap_waypointeditor_dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@ -112,7 +112,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../coreplugin/core.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/core/images/prev.png</normaloff>:/core/images/prev.png</iconset>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
@ -144,7 +144,7 @@ color: rgb(255, 255, 255);
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../coreplugin/core.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/core/images/find.png</normaloff>:/core/images/find.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -184,7 +184,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/gcs.png</normaloff>:/opmap/images/gcs.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -214,7 +214,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/uav.png</normaloff>:/opmap/images/uav.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -257,7 +257,37 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/waypoint.png</normaloff>:/opmap/images/waypoint.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="autoRepeat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="autoRaise">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonWaypointEditor">
|
||||
<property name="toolTip">
|
||||
<string>Opens the waypoint editor</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(71, 71, 71, 0);
|
||||
color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/waypoint.png</normaloff>:/opmap/images/waypoint.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -297,7 +327,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/minus.png</normaloff>:/opmap/images/minus.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -328,7 +358,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/plus.png</normaloff>:/opmap/images/plus.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -515,7 +545,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/home.png</normaloff>:/opmap/images/home.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -545,7 +575,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/hold.png</normaloff>:/opmap/images/hold.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -572,7 +602,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="opmap.qrc">
|
||||
<iconset>
|
||||
<normaloff>:/opmap/images/go.png</normaloff>:/opmap/images/go.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
@ -833,9 +863,6 @@ border: none;
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../coreplugin/core.qrc"/>
|
||||
<include location="opmap.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QVBoxLayout>
|
||||
#include <QDir>
|
||||
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
|
||||
// *************************************************************************************
|
||||
@ -43,6 +44,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
m_widget = NULL;
|
||||
m_map = NULL;
|
||||
waypoint_editor = NULL;
|
||||
|
||||
setMouseTracking(true);
|
||||
|
||||
@ -124,6 +126,11 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
layout->addWidget(m_map);
|
||||
m_widget->mapWidget->setLayout(layout);
|
||||
|
||||
// **************
|
||||
// create the waypoint editor dialog
|
||||
|
||||
waypoint_editor = new opmap_waypointeditor_dialog(this);
|
||||
|
||||
// **************
|
||||
// create the user controls overlayed onto the map
|
||||
|
||||
@ -150,6 +157,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
OPMapGadgetWidget::~OPMapGadgetWidget()
|
||||
{
|
||||
if (waypoint_editor) delete waypoint_editor;
|
||||
if (m_map) delete m_map;
|
||||
if (m_widget) delete m_widget;
|
||||
}
|
||||
@ -461,43 +469,6 @@ void OPMapGadgetWidget::on_toolButtonZoomM_clicked()
|
||||
zoomOut();
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_pushButtonGeoFenceM_clicked()
|
||||
{
|
||||
if (m_widget)
|
||||
{
|
||||
// int geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value();
|
||||
// int step = m_widget->spinBoxGeoFenceDistance->singleStep();
|
||||
// m_widget->spinBoxGeoFenceDistance->setValue(geo_fence_distance - step);
|
||||
|
||||
// geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value();
|
||||
|
||||
|
||||
|
||||
// to do
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_pushButtonGeoFenceP_clicked()
|
||||
{
|
||||
if (m_widget)
|
||||
{
|
||||
// int geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value();
|
||||
// int step = m_widget->spinBoxGeoFenceDistance->singleStep();
|
||||
// m_widget->spinBoxGeoFenceDistance->setValue(geo_fence_distance + step);
|
||||
|
||||
// geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value();
|
||||
|
||||
|
||||
// to do
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_toolButtonFlightControlsShowHide_clicked()
|
||||
{
|
||||
if (m_widget)
|
||||
@ -538,6 +509,12 @@ void OPMapGadgetWidget::on_toolButtonGo_clicked()
|
||||
{
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::on_toolButtonWaypointEditor_clicked()
|
||||
{
|
||||
if (waypoint_editor)
|
||||
waypoint_editor->show();
|
||||
}
|
||||
|
||||
// *************************************************************************************
|
||||
// public functions
|
||||
|
||||
@ -938,7 +915,8 @@ void OPMapGadgetWidget::on_followUAVheadingAct_toggled(bool checked)
|
||||
|
||||
void OPMapGadgetWidget::openWayPointEditor()
|
||||
{
|
||||
// to do
|
||||
if (waypoint_editor)
|
||||
waypoint_editor->show();
|
||||
}
|
||||
|
||||
void OPMapGadgetWidget::addWayPoint()
|
||||
|
@ -29,11 +29,15 @@
|
||||
#define OPMAP_GADGETWIDGET_H_
|
||||
|
||||
#include "opmapcontrol/opmapcontrol.h"
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QMenu>
|
||||
|
||||
#include "uavobjects/uavobjectmanager.h"
|
||||
#include "uavobjects/positionactual.h"
|
||||
|
||||
#include "opmap_waypointeditor_dialog.h"
|
||||
|
||||
namespace Ui {
|
||||
class OPMap_Widget;
|
||||
}
|
||||
@ -75,12 +79,11 @@ private slots:
|
||||
void on_toolButtonFindPlace_clicked();
|
||||
void on_toolButtonZoomM_clicked();
|
||||
void on_toolButtonZoomP_clicked();
|
||||
void on_pushButtonGeoFenceM_clicked();
|
||||
void on_pushButtonGeoFenceP_clicked();
|
||||
void on_toolButtonFlightControlsShowHide_clicked();
|
||||
void on_toolButtonMapHome_clicked();
|
||||
void on_toolButtonMapUAV_clicked();
|
||||
void on_horizontalSliderZoom_sliderMoved(int position);
|
||||
void on_toolButtonWaypointEditor_clicked();
|
||||
|
||||
void on_toolButtonHome_clicked();
|
||||
void on_toolButtonHoldPosition_clicked();
|
||||
@ -146,6 +149,8 @@ private:
|
||||
|
||||
mapcontrol::OPMapWidget *m_map;
|
||||
|
||||
opmap_waypointeditor_dialog *waypoint_editor;
|
||||
|
||||
QPushButton * createTransparentButton(QWidget *parent, QString text, QString icon);
|
||||
void createMapOverlayUserControls();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user