1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

GCS/OPMap- handles home icon doubleclick.

Visual changes to the waypoint editor.
This commit is contained in:
PT_Dreamer 2012-06-24 20:05:27 +01:00
parent b84af5c338
commit 55af80ffaf
4 changed files with 108 additions and 79 deletions

View File

@ -35,5 +35,6 @@
<file>images/plus3.png</file>
<file>images/forward_alt.png</file>
<file>images/star.png</file>
<file>images/down_alt.png</file>
</qresource>
</RCC>

View File

@ -13,7 +13,7 @@
<x>0</x>
<y>0</y>
<width>606</width>
<height>375</height>
<height>387</height>
</rect>
</property>
<property name="sizePolicy">
@ -83,30 +83,7 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Altitude </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="6" column="3">
<widget class="QLabel" name="label_6">
<property name="text">
<string>meters</string>
</property>
</widget>
</item>
<item row="8" column="0">
<item row="11" column="0">
<widget class="QLabel" name="label_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@ -122,7 +99,7 @@
</property>
</widget>
</item>
<item row="8" column="2" colspan="2">
<item row="11" column="2" colspan="2">
<widget class="QLineEdit" name="lineEditDescription"/>
</item>
<item row="2" column="2">
@ -157,16 +134,6 @@
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBoxAltitude">
<property name="minimum">
<double>-5000.000000000000000</double>
</property>
<property name="maximum">
<double>5000.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="lbDegLong">
<property name="text">
@ -197,28 +164,28 @@
</property>
</widget>
</item>
<item row="4" column="2">
<item row="6" column="2">
<widget class="QSpinBox" name="spinBoxDistance">
<property name="maximum">
<number>999999999</number>
</property>
</widget>
</item>
<item row="4" column="3">
<item row="6" column="3">
<widget class="QLabel" name="lbDistanceMeters">
<property name="text">
<string>meters</string>
</property>
</widget>
</item>
<item row="5" column="3">
<item row="7" column="3">
<widget class="QLabel" name="lbBearingDeg">
<property name="text">
<string>degrees</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="7" column="0">
<widget class="QLabel" name="lbBearing">
<property name="text">
<string>Bearing </string>
@ -228,14 +195,14 @@
</property>
</widget>
</item>
<item row="5" column="2">
<item row="7" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBoxBearing">
<property name="maximum">
<double>360.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="6" column="0">
<widget class="QLabel" name="lbDistance">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
@ -285,7 +252,7 @@
</property>
</widget>
</item>
<item row="7" column="0">
<item row="10" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Velocity </string>
@ -295,9 +262,62 @@
</property>
</widget>
</item>
<item row="7" column="2">
<item row="10" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBoxVelocity"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Altitude </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBoxAltitude">
<property name="minimum">
<double>-5000.000000000000000</double>
</property>
<property name="maximum">
<double>5000.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="label_6">
<property name="text">
<string>meters</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Relative altitude </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="8" column="2">
<widget class="QDoubleSpinBox" name="doubleSpinBoxRelativeAltitude"/>
</item>
<item row="8" column="3">
<widget class="QLabel" name="label_9">
<property name="text">
<string>meters</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -161,6 +161,8 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_map->Home->SetSafeArea(safe_area_radius_list[0]); // set radius (meters)
m_map->Home->SetShowSafeArea(true); // show the safe area
if(m_map->Home)
connect(m_map->Home,SIGNAL(homedoubleclick(HomeItem*)),this,SLOT(onHomeDoubleClick(HomeItem*)));
m_map->UAV->SetTrailTime(uav_trail_time_list[0]); // seconds
m_map->UAV->SetTrailDistance(uav_trail_distance_list[1]); // meters
@ -213,39 +215,16 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
if(m_map->GPS)
m_map->GPS->SetUAVPos(m_home_position.coord, 0.0); // set the UAV position
qDebug()<<"here0";
model=new flightDataModel(this);
qDebug()<<"here1";
table=new pathPlanner();
qDebug()<<"here2";
selectionModel=new QItemSelectionModel(model);
qDebug()<<"here3";
proxy=new modelMapProxy(this,m_map,model,selectionModel);
qDebug()<<"here4";
mapProxy=new modelMapProxy(this,m_map,model,selectionModel);
table->setModel(model,selectionModel);
qDebug()<<"here5";
table->show();
qDebug()<<"here6";
waypoint_edit_dialog=new opmap_edit_waypoint_dialog(NULL,model,selectionModel);
qDebug()<<"here7";
UAVProxy=new modelUavoProxy(this,model);
connect(table,SIGNAL(sendPathPlanToUAV()),UAVProxy,SLOT(modelToObjects()));
connect(table,SIGNAL(receivePathPlanFromUAV()),UAVProxy,SLOT(objectsToModel()));
/*
distBearing db;
db.distance=100;
db.bearing=0;
WayPointItem * p1=m_map->WPCreate(db,10,"aaa");
db.distance=100;
db.bearing=45;
WayPointItem * p2=m_map->WPCreate(db,10,"bbb");
m_map->WPCircleCreate(p2,p1,true);
t_waypoint *wp = new t_waypoint;
wp->map_wp_item=p1;
m_waypoint_list.append(wp);
wp=new t_waypoint;
wp->map_wp_item=p2;
m_waypoint_list.append(wp);
*/
magicWayPoint=m_map->magicWPCreate();
magicWayPoint->setVisible(false);
@ -310,6 +289,18 @@ OPMapGadgetWidget::~OPMapGadgetWidget()
delete m_map;
m_map = NULL;
}
if(model)
delete model;
if(table)
delete table;
if(selectionModel)
delete selectionModel;
if(mapProxy)
delete mapProxy;
if(waypoint_edit_dialog)
delete waypoint_edit_dialog;
if(UAVProxy)
delete UAVProxy;
}
// *************************************************************************************
@ -530,6 +521,12 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event)
// ****************
}
void OPMapGadgetWidget::closeEvent(QCloseEvent *event)
{
table->close();
QWidget::closeEvent(event);
}
// *************************************************************************************
// timer signals
@ -1295,7 +1292,6 @@ void OPMapGadgetWidget::createActions()
wayPointEditorAct = new QAction(tr("&Waypoint editor"), this);
wayPointEditorAct->setShortcut(tr("Ctrl+W"));
wayPointEditorAct->setStatusTip(tr("Open the waypoint editor"));
wayPointEditorAct->setEnabled(true); // temporary
connect(wayPointEditorAct, SIGNAL(triggered()), this, SLOT(onOpenWayPointEditorAct_triggered()));
addWayPointActFromContextMenu = new QAction(tr("&Add waypoint"), this);
@ -1702,7 +1698,7 @@ void OPMapGadgetWidget::onUAVTrailDistanceActGroup_triggered(QAction *action)
void OPMapGadgetWidget::onOpenWayPointEditorAct_triggered()
{
//TODO
table->show();
}
void OPMapGadgetWidget::onAddWayPointAct_triggeredFromContextMenu()
{
@ -1722,7 +1718,7 @@ void OPMapGadgetWidget::onAddWayPointAct_triggered(internals::PointLatLng coord)
return;
// m_map->WPCreate(coord, 0, "");
proxy->createWayPoint(coord);
mapProxy->createWayPoint(coord);
//wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker1.png"));
//wp->map_wp_item->picture.load(QString::fromUtf8(":/opmap/images/waypoint_marker2.png"));
@ -1748,7 +1744,6 @@ void OPMapGadgetWidget::onEditWayPointAct_triggered()
return;
waypoint_edit_dialog->editWaypoint(m_mouse_waypoint);
m_mouse_waypoint = NULL;
}
@ -1788,7 +1783,7 @@ void OPMapGadgetWidget::onDeleteWayPointAct_triggered()
if (!m_mouse_waypoint)
return;
proxy->deleteWayPoint(m_mouse_waypoint->Number());
mapProxy->deleteWayPoint(m_mouse_waypoint->Number());
}
void OPMapGadgetWidget::onClearWayPointsAct_triggered()
@ -1799,7 +1794,7 @@ void OPMapGadgetWidget::onClearWayPointsAct_triggered()
if (m_map_mode != Normal_MapMode)
return;
proxy->deleteAll();
mapProxy->deleteAll();
}
@ -2117,3 +2112,8 @@ void OPMapGadgetWidget::on_tbFind_clicked()
m_widget->leFind->setPalette(pal);
}
}
void OPMapGadgetWidget::onHomeDoubleClick(HomeItem *)
{
new homeEditor(m_map->Home,this);
}

View File

@ -34,6 +34,7 @@
#include "flightdatamodel.h"
#include "pathplanner.h"
#include "modelmapproxy.h"
#include "modeluavoproxy.h"
#include <QtGui/QWidget>
#include <QtGui/QMenu>
@ -59,6 +60,8 @@
#include <QItemSelectionModel>
#include "opmap_edit_waypoint_dialog.h"
#include "homeeditor.h"
// ******************************************************
namespace Ui
@ -124,6 +127,7 @@ protected:
void resizeEvent(QResizeEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
void closeEvent(QCloseEvent *);
private slots:
void wpDoubleClickEvent(WayPointItem *wp);
void updatePosition();
@ -202,7 +206,7 @@ private slots:
void onMaxUpdateRateActGroup_triggered(QAction *action);
void onChangeDefaultLocalAndZoom();
void on_tbFind_clicked();
void onHomeDoubleClick(HomeItem*);
private:
// *****
@ -244,6 +248,10 @@ private:
mapcontrol::WayPointItem *m_mouse_waypoint;
modelUavoProxy * UAVProxy;
QMutex m_map_mutex;
bool m_telemetry_connected;
@ -334,7 +342,7 @@ private:
flightDataModel * model;
pathPlanner * table;
modelMapProxy * proxy;
modelMapProxy * mapProxy;
QItemSelectionModel * selectionModel;
};