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

Adding a waypoint treeview onto the left hand edge of the the new map plug-in.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@891 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-06-25 16:18:33 +00:00 committed by pip
parent dbf897245c
commit cdd3e305b0
12 changed files with 570 additions and 199 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -5,11 +5,11 @@
<file>images/go.png</file>
<file>images/home.png</file>
<file>images/hover.png</file>
<file>images/hold.png</file>
<file>images/uav.png</file>
<file>images/gcs.png</file>
<file>images/plus.png</file>
<file>images/minus.png</file>
<file>images/waypoint.png</file>
<file>images/hold.png</file>
</qresource>
</RCC>

View File

@ -26,6 +26,7 @@
*/
#include <QPainter>
#include <QGraphicsSceneDragDropEvent>
#include "opmap_waypointeditor_dialog.h"
#include "ui_opmap_waypointeditor_dialog.h"
@ -33,24 +34,35 @@
#include "extensionsystem/pluginmanager.h"
// ***************************************************************
// Waypoint object
Waypoint::Waypoint()
WaypointItem::WaypointItem(QString name, double latitude, double longitude, double height, int time, int hold) :
waypoint_name(name),
latitude_degress(latitude),
longitude_degress(longitude),
height_feet(height),
time_seconds(time),
hold_seconds(hold)
{
setToolTip(waypoint_name);
setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
}
QRectF Waypoint::boundingRect() const
QRectF WaypointItem::boundingRect() const
{
return QRectF(-6, -10, 12, 20);
}
QPainterPath Waypoint::shape() const
QPainterPath WaypointItem::shape() const
{
QPainterPath path;
path.addEllipse(QPointF(0, 0), 6, 10);
return path;
}
void Waypoint::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
void WaypointItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
painter->setPen(Qt::black);
painter->setBrush(QColor(255, 0, 0, 128));
@ -58,6 +70,44 @@ QPainterPath Waypoint::shape() const
}
// ***************************************************************
// Scene object
OurScene::OurScene(QObject *parent) : QGraphicsScene(parent)
{
movingItem = 0;
}
void OurScene::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QPointF mousePos(event->buttonDownScenePos(Qt::LeftButton).x(), event->buttonDownScenePos(Qt::LeftButton).y());
movingItem = itemAt(mousePos.x(), mousePos.y());
if (movingItem != 0 && event->button() == Qt::LeftButton)
{
oldPos = movingItem->pos();
}
clearSelection();
QGraphicsScene::mousePressEvent(event);
}
void OurScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
if (movingItem != 0 && event->button() == Qt::LeftButton)
{
if (oldPos != movingItem->pos())
emit itemMoved(qgraphicsitem_cast<WaypointItem *>(movingItem), oldPos);
movingItem = 0;
}
QGraphicsScene::mouseReleaseEvent(event);
}
// ***************************************************************
// main dialogue
opmap_waypointeditor_dialog::opmap_waypointeditor_dialog(QWidget *parent) :
QDialog(parent),
@ -68,37 +118,27 @@ opmap_waypointeditor_dialog::opmap_waypointeditor_dialog(QWidget *parent) :
view = ui->graphicsViewWaypointHeightAndTimeline;
scene = new QGraphicsScene(0, 0, 1800, 1000);
scene = new OurScene();
scene->setSceneRect(QRect(0, 0, 1800, 500));
view->setScene(scene);
view->setRenderHint(QPainter::HighQualityAntialiasing);
//view->setDragMode(QGraphicsView::ScrollHandDrag);
undoStack = new QUndoStack();
connect(scene, SIGNAL(itemMoved(WaypointItem *, const QPointF &)), this, SLOT(itemMoved(WaypointItem *, const QPointF &)));
// *****
// test
Waypoint *waypoint1 = new Waypoint;
WaypointItem *waypoint1 = new WaypointItem(tr("Waypoint 1"), 0, 0, 10, 5, 10);
waypoint1->setPos(scene->width() / 2, scene->height() / 2);
waypoint1->setFlag(QGraphicsItem::ItemIsMovable, true);
waypoint1->setFlag(QGraphicsItem::ItemIsSelectable, true);
waypoint1->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
waypoint1->setToolTip(tr("Waypoint 1"));
scene->addItem(waypoint1);
Waypoint *waypoint2 = new Waypoint;
WaypointItem *waypoint2 = new WaypointItem(tr("Waypoint 2"), 0, 0, 50, 8, 5);
waypoint2->setPos(scene->width() / 2 + 30, scene->height() / 2);
waypoint2->setFlag(QGraphicsItem::ItemIsMovable);
waypoint2->setFlag(QGraphicsItem::ItemIsSelectable, true);
waypoint2->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
waypoint2->setToolTip(tr("Waypoint 2"));
scene->addItem(waypoint2);
Waypoint *waypoint3 = new Waypoint;
WaypointItem *waypoint3 = new WaypointItem(tr("Waypoint 3"), 0, 0, 100, 8, 5);
waypoint3->setPos(scene->width() / 2 + 60, scene->height() / 2);
waypoint3->setFlag(QGraphicsItem::ItemIsMovable);
waypoint3->setFlag(QGraphicsItem::ItemIsSelectable, true);
waypoint3->setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
waypoint3->setToolTip(tr("Waypoint 3"));
scene->addItem(waypoint3);
// *****
@ -120,3 +160,10 @@ void opmap_waypointeditor_dialog::changeEvent(QEvent *e)
break;
}
}
void opmap_waypointeditor_dialog::itemMoved(WaypointItem *movedItem, const QPointF &oldPosition)
{
// undoStack->push(new MoveCommand(movedItem, oldPosition));
}
// ***************************************************************

View File

@ -34,6 +34,7 @@
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsItem>
#include <QUndoStack>
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/positionactual.h"
@ -43,18 +44,21 @@ namespace Ui {
}
// ***************************************************************
// Waypoint object
class Waypoint : public QObject, public QGraphicsItem
class WaypointItem : public QObject, public QGraphicsItem
{
Q_OBJECT
public:
Waypoint();
WaypointItem(QString name = "", double latitude = 0, double longitude = 0, double height_feet = 0, int time_seconds = 0, int hold_seconds = 0);
QString waypoint_name;
double latitude_degress;
double longitude_degress;
double height_feet;
double relative_time_seconds;
int time_seconds;
int hold_seconds;
QRectF boundingRect() const;
QPainterPath shape() const;
@ -64,14 +68,33 @@ class Waypoint : public QObject, public QGraphicsItem
// void timerEvent(QTimerEvent *event);
private:
// qreal angle;
// qreal speed;
// qreal mouseEyeDirection;
// QColor color;
};
// ***************************************************************
class OurScene : public QGraphicsScene
{
Q_OBJECT
public:
OurScene(QObject *parent = 0);
signals:
void itemMoved(WaypointItem *movedItem, const QPointF &movedFromPosition);
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private:
QGraphicsItem *movingItem;
QPointF oldPos;
};
// ***************************************************************
// main dialog widget
class opmap_waypointeditor_dialog : public QDialog
{
Q_OBJECT
@ -79,6 +102,9 @@ public:
opmap_waypointeditor_dialog(QWidget *parent = 0);
~opmap_waypointeditor_dialog();
public slots:
void itemMoved(WaypointItem *movedDiagram, const QPointF &moveStartPosition);
protected:
void changeEvent(QEvent *e);
@ -86,6 +112,8 @@ private:
QGraphicsView *view;
QGraphicsScene *scene;
QUndoStack *undoStack;
Ui::opmap_waypointeditor_dialog *ui;
};

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>399</width>
<height>345</height>
<width>561</width>
<height>511</height>
</rect>
</property>
<property name="sizePolicy">
@ -32,92 +32,157 @@
<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="minimumSize">
<size>
<width>0</width>
<height>130</height>
</size>
</property>
<property name="title">
<string>Waypoints</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QTableWidget" name="tableWidgetWaypoints">
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QSplitter" name="splitter">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="opaqueResize">
<bool>true</bool>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QGroupBox" name="groupBoxWaypoints">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>130</height>
</size>
</property>
<property name="dragEnabled">
<property name="title">
<string>Waypoints</string>
</property>
<property name="flat">
<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>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
</column>
<column>
<property name="text">
<string>Latitude</string>
<property name="rightMargin">
<number>0</number>
</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>Time</string>
</property>
</column>
<column>
<property name="text">
<string>Pause Time</string>
</property>
</column>
<item row="0" column="0">
<widget class="QTableWidget" name="tableWidgetWaypoints">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<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>Time</string>
</property>
</column>
<column>
<property name="text">
<string>Pause Time</string>
</property>
</column>
</widget>
</item>
</layout>
</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>
<widget class="QGroupBox" name="groupBoxHeightAndTimeline">
<property name="title">
<string>Height and Timeline</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QGraphicsView" name="graphicsViewWaypointHeightAndTimeline">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>50</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(191, 191, 191);</string>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="renderHints">
<set>QPainter::Antialiasing|QPainter::HighQualityAntialiasing|QPainter::TextAntialiasing</set>
</property>
</widget>
</item>
</layout>
</widget>
</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>
</item>
</layout>
</widget>

View File

@ -94,7 +94,7 @@
<number>8</number>
</property>
<item>
<widget class="QToolButton" name="toolButtonFlightControlsShowHide">
<widget class="QToolButton" name="toolButtonWaypointsTreeViewShowHide">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -102,7 +102,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>Show/Hide Flight Controls</string>
<string>Show/Hide Waypoint Treeview</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);
@ -112,7 +112,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/core/images/prev.png</normaloff>:/core/images/prev.png</iconset>
</property>
<property name="autoRaise">
@ -121,7 +121,7 @@ color: rgb(255, 255, 255);</string>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<widget class="Line" name="line_9">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
@ -144,7 +144,7 @@ color: rgb(255, 255, 255);
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="../coreplugin/core.qrc">
<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>
<iconset resource="opmap.qrc">
<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>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/uav.png</normaloff>:/opmap/images/uav.png</iconset>
</property>
<property name="iconSize">
@ -257,7 +257,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/waypoint.png</normaloff>:/opmap/images/waypoint.png</iconset>
</property>
<property name="iconSize">
@ -287,7 +287,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/waypoint.png</normaloff>:/opmap/images/waypoint.png</iconset>
</property>
<property name="iconSize">
@ -327,7 +327,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/minus.png</normaloff>:/opmap/images/minus.png</iconset>
</property>
<property name="iconSize">
@ -358,7 +358,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/plus.png</normaloff>:/opmap/images/plus.png</iconset>
</property>
<property name="iconSize">
@ -478,6 +478,43 @@ background-color: rgba(255, 255, 255, 0);</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButtonFlightControlsShowHide">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show/Hide Flight Controls</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../coreplugin/core.qrc">
<normaloff>:/core/images/next.png</normaloff>:/core/images/next.png</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -486,10 +523,109 @@ background-color: rgba(255, 255, 255, 0);</string>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayoutCenter">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing">
<number>0</number>
</property>
<item>
<widget class="QSplitter" name="splitter">
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255));</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="handleWidth">
<number>5</number>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QTreeView" name="treeViewWaypoints">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>600</width>
<height>16777215</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255));
color: rgb(255, 255, 255);
QTreeView::branch:has-children:!has-siblings:closed, QTreeView::branch:closed:has-children:has-siblings {
border-image: none;
image: url(branch-closed.png);
}
QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-children:has-siblings {
border-image: none;
image: url(branch-open.png);
}</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="tabKeyNavigation">
<bool>true</bool>
</property>
<property name="animated">
<bool>true</bool>
</property>
<property name="headerHidden">
<bool>true</bool>
</property>
</widget>
<widget class="QWidget" name="mapWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QWidget" name="widgetFlightControls" native="true">
<property name="sizePolicy">
@ -500,13 +636,13 @@ background-color: rgba(255, 255, 255, 0);</string>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<width>87</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<width>87</width>
<height>16777215</height>
</size>
</property>
@ -514,7 +650,8 @@ background-color: rgba(255, 255, 255, 0);</string>
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255));</string>
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255));
color: rgb(255, 255, 255);</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<property name="leftMargin">
@ -545,7 +682,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/home.png</normaloff>:/opmap/images/home.png</iconset>
</property>
<property name="iconSize">
@ -575,7 +712,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/hold.png</normaloff>:/opmap/images/hold.png</iconset>
</property>
<property name="iconSize">
@ -602,7 +739,7 @@ color: rgb(255, 255, 255);</string>
<string/>
</property>
<property name="icon">
<iconset>
<iconset resource="opmap.qrc">
<normaloff>:/opmap/images/go.png</normaloff>:/opmap/images/go.png</iconset>
</property>
<property name="iconSize">
@ -619,25 +756,6 @@ color: rgb(255, 255, 255);</string>
</layout>
</widget>
</item>
<item>
<widget class="QWidget" name="mapWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>false</bool>
</property>
<property name="acceptDrops">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(0, 0, 0);</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -863,6 +981,9 @@ border: none;
</item>
</layout>
</widget>
<resources/>
<resources>
<include location="../coreplugin/core.qrc"/>
<include location="opmap.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -35,36 +35,13 @@
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Map provider </string>
<string>Map type </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Default latitude </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="latitudeSpinBox">
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-90.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_4">
<property name="text">
@ -88,7 +65,46 @@
</property>
</widget>
</item>
<item row="0" column="2">
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxShowGrid">
<property name="enabled">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Show Grid</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QCheckBox" name="checkBoxOpenGL">
<property name="enabled">
<bool>false</bool>
</property>
<property name="layoutDirection">
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>OpenGL</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QDoubleSpinBox" name="latitudeSpinBox">
<property name="decimals">
<number>8</number>
</property>
<property name="minimum">
<double>-90.000000000000000</double>
</property>
<property name="maximum">
<double>90.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Default zoom </string>
@ -98,36 +114,26 @@
</property>
</widget>
</item>
<item row="0" column="3">
<item row="0" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Default latitude </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="zoomSpinBox">
<property name="maximum">
<number>18</number>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QCheckBox" name="checkBoxShowGrid">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Show Grid</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QCheckBox" name="checkBoxUseOpenGL">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Use OpenGL</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="7" column="0">
<item row="8" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -166,7 +172,7 @@
<item row="0" column="4">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Access Mode </string>
<string>Access mode </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
@ -184,6 +190,9 @@
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Use memory caching</string>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
}
@ -198,7 +207,7 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/
</string>
</property>
<property name="text">
<string> Use Memory Cache </string>
<string> Memory Cache </string>
</property>
<property name="checkable">
<bool>true</bool>
@ -222,6 +231,9 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Restore default server and cache settings</string>
</property>
<property name="text">
<string> Default </string>
</property>
@ -259,7 +271,7 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<width>30</width>
<height>20</height>
</size>
</property>

View File

@ -45,6 +45,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_widget = NULL;
m_map = NULL;
waypoint_editor = NULL;
wayPoint_treeView_model = NULL;
setMouseTracking(true);
@ -88,7 +89,10 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_widget->progressBarMap->setMaximum(1);
m_widget->widgetFlightControls->setVisible(false);
m_widget->toolButtonFlightControlsShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/next.png")));
m_widget->toolButtonFlightControlsShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/prev.png")));
m_widget->treeViewWaypoints->setVisible(false);
m_widget->toolButtonWaypointsTreeViewShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/next.png")));
// **************
// map stuff
@ -131,6 +135,69 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
waypoint_editor = new opmap_waypointeditor_dialog(this);
// **************
/*
// test
wayPoint_treeView_model = new QStandardItemModel(5, 2);
for (int r = 0; r < 5; r++)
{
for (int c = 0; c < 2; c++)
{
QStandardItem *item = new QStandardItem(QString("Row:%0, Column:%1").arg(r).arg(c));
if (c == 0)
{
for (int i = 0; i < 3; i++)
{
QStandardItem *child = new QStandardItem(QString("Item %0").arg(i));
child->setEditable(false);
item->appendRow(child);
}
}
wayPoint_treeView_model->setItem(r, c, item);
}
}
wayPoint_treeView_model->setHorizontalHeaderItem(0, new QStandardItem("Foo"));
wayPoint_treeView_model->setHorizontalHeaderItem(1, new QStandardItem("Bar-Baz"));
m_widget->treeViewWaypoints->setModel(wayPoint_treeView_model);
*/
// test
wayPoint_treeView_model = new QStandardItemModel();
for (int r = 0; r < 5; r++)
{
// waypoint group
QStandardItem *item = new QStandardItem(QString("UK waypoint group %0").arg(r));
// add the way points
for (int i = 1; i < 5; i++)
{
QStandardItem *child = new QStandardItem(QIcon(QString::fromUtf8(":/opmap/images/waypoint.png")), QString("Waypoint %0").arg(i));
child->setEditable(false);
item->appendRow(child);
}
wayPoint_treeView_model->appendRow(item);
}
// wayPoint_treeView_model->setHorizontalHeaderItem(0, new QStandardItem("Waypoint list"));
m_widget->treeViewWaypoints->setModel(wayPoint_treeView_model);
// **************
// create the user controls overlayed onto the map
@ -157,6 +224,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
OPMapGadgetWidget::~OPMapGadgetWidget()
{
if (wayPoint_treeView_model) delete wayPoint_treeView_model;
if (waypoint_editor) delete waypoint_editor;
if (m_map) delete m_map;
if (m_widget) delete m_widget;
@ -469,6 +537,19 @@ void OPMapGadgetWidget::on_toolButtonZoomM_clicked()
zoomOut();
}
void OPMapGadgetWidget::on_toolButtonWaypointsTreeViewShowHide_clicked()
{
if (m_widget)
{
m_widget->treeViewWaypoints->setVisible(!m_widget->treeViewWaypoints->isVisible());
if (m_widget->treeViewWaypoints->isVisible())
m_widget->toolButtonWaypointsTreeViewShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/prev.png")));
else
m_widget->toolButtonWaypointsTreeViewShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/next.png")));
}
}
void OPMapGadgetWidget::on_toolButtonFlightControlsShowHide_clicked()
{
if (m_widget)
@ -476,9 +557,9 @@ void OPMapGadgetWidget::on_toolButtonFlightControlsShowHide_clicked()
m_widget->widgetFlightControls->setVisible(!m_widget->widgetFlightControls->isVisible());
if (m_widget->widgetFlightControls->isVisible())
m_widget->toolButtonFlightControlsShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/prev.png")));
else
m_widget->toolButtonFlightControlsShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/next.png")));
else
m_widget->toolButtonFlightControlsShowHide->setIcon(QIcon(QString::fromUtf8(":/core/images/prev.png")));
}
}
@ -515,6 +596,16 @@ void OPMapGadgetWidget::on_toolButtonWaypointEditor_clicked()
waypoint_editor->show();
}
void OPMapGadgetWidget::on_treeViewWaypoints_clicked(QModelIndex index)
{
if (!wayPoint_treeView_model) return;
QStandardItem *item = wayPoint_treeView_model->itemFromIndex(index);
if (!item) return;
// Do something with the item ...
}
// *************************************************************************************
// public functions

View File

@ -32,6 +32,7 @@
#include <QtGui/QWidget>
#include <QtGui/QMenu>
#include <QStandardItemModel>
#include "uavobjects/uavobjectmanager.h"
#include "uavobjects/positionactual.h"
@ -80,12 +81,15 @@ private slots:
void on_toolButtonFindPlace_clicked();
void on_toolButtonZoomM_clicked();
void on_toolButtonZoomP_clicked();
void on_toolButtonWaypointsTreeViewShowHide_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_treeViewWaypoints_clicked(QModelIndex index);
void on_toolButtonHome_clicked();
void on_toolButtonHoldPosition_clicked();
void on_toolButtonGo_clicked();
@ -155,6 +159,9 @@ private:
QPushButton * createTransparentButton(QWidget *parent, QString text, QString icon);
void createMapOverlayUserControls();
QStandardItemModel *wayPoint_treeView_model;
void createActions();
QAction *closeAct;