mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
UAV location added to lower statusbar on the new map plug-in.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@881 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
3d8290c3a1
commit
c498611c60
@ -85,7 +85,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutWidget_8">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
@ -121,20 +121,14 @@ color: rgb(255, 255, 255);</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonFindPlace">
|
||||
@ -168,20 +162,14 @@ color: rgb(255, 255, 255);
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonMapHome">
|
||||
@ -247,20 +235,14 @@ color: rgb(255, 255, 255);</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonAddWaypoint">
|
||||
@ -293,20 +275,14 @@ color: rgb(255, 255, 255);</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonZoomM">
|
||||
@ -386,6 +362,9 @@ color: rgb(255, 255, 255);</string>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Zoom level</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background-color: rgba(255, 255, 255, 0);
|
||||
color: rgb(255, 255, 255);</string>
|
||||
@ -404,6 +383,16 @@ color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
@ -417,6 +406,16 @@ color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_8">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonReload">
|
||||
<property name="sizePolicy">
|
||||
@ -488,7 +487,16 @@ color: rgb(255, 255, 255);</string>
|
||||
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(120, 120, 120, 255), stop:1 rgba(68, 68, 68, 255));</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="margin">
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
@ -524,6 +532,16 @@ color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_9">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonHoldPosition">
|
||||
<property name="toolTip">
|
||||
@ -551,6 +569,16 @@ color: rgb(255, 255, 255);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_10">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButtonGo">
|
||||
<property name="toolTip">
|
||||
@ -644,7 +672,7 @@ color: rgb(255, 255, 255);</string>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
@ -655,10 +683,10 @@ color: rgb(255, 255, 255);</string>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="layoutWidgetStatusBar">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>8</number>
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>8</number>
|
||||
@ -696,20 +724,14 @@ background-color: rgba(255, 255, 255, 0);</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<widget class="Line" name="line">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelMousePos">
|
||||
@ -743,6 +765,16 @@ background-color: rgba(255, 255, 255, 0);</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
|
@ -133,12 +133,12 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
// create the desired timers
|
||||
|
||||
m_updateTimer = new QTimer();
|
||||
m_updateTimer->setInterval(250);
|
||||
m_updateTimer->setInterval(200);
|
||||
connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updatePosition()));
|
||||
m_updateTimer->start();
|
||||
|
||||
m_statusUpdateTimer = new QTimer();
|
||||
m_statusUpdateTimer->setInterval(100);
|
||||
m_statusUpdateTimer->setInterval(200);
|
||||
connect(m_statusUpdateTimer, SIGNAL(timeout()), this, SLOT(updateMousePos()));
|
||||
m_statusUpdateTimer->start();
|
||||
|
||||
@ -305,15 +305,24 @@ void OPMapGadgetWidget::keyPressEvent(QKeyEvent* event)
|
||||
|
||||
void OPMapGadgetWidget::updatePosition()
|
||||
{
|
||||
PositionActual::DataFields data = m_positionActual->getData(); // get current UAV data
|
||||
PositionActual::DataFields data = m_positionActual->getData(); // get current UAV data
|
||||
internals::PointLatLng uav_pos = internals::PointLatLng(data.Latitude, data.Longitude); // current UAV position
|
||||
double uav_heading = data.Heading; // current UAV heading
|
||||
double uav_height_feet = data.Altitude * 3.2808399; // current UAV height
|
||||
double uav_ground_speed = data.Groundspeed; // current UAV ground speed
|
||||
|
||||
// display the UAV lat/lon position
|
||||
QString str = " lat:" + QString::number(uav_pos.Lat(), 'f', 6) +
|
||||
" lon:" + QString::number(uav_pos.Lng(), 'f', 6) +
|
||||
" " + QString::number(uav_heading, 'f', 1) + "deg" +
|
||||
" " + QString::number(uav_height_feet, 'f', 1) + "feet" +
|
||||
" " + QString::number(uav_ground_speed, 'f', 1) + "mph";
|
||||
if (m_widget) m_widget->labelMapPos->setText(str);
|
||||
|
||||
if (m_map && followUAVpositionAct && followUAVheadingAct)
|
||||
{
|
||||
if (followUAVpositionAct->isChecked())
|
||||
{
|
||||
internals::PointLatLng uav_pos = internals::PointLatLng(data.Latitude, data.Longitude); // current UAV position
|
||||
double uav_heading = data.Heading;
|
||||
|
||||
internals::PointLatLng map_pos = m_map->CurrentPosition(); // current MAP position
|
||||
double map_heading = m_map->Rotate();
|
||||
|
||||
@ -339,10 +348,8 @@ void OPMapGadgetWidget::updateMousePos()
|
||||
{ // the mouse has moved
|
||||
mouse_lat_lon = lat_lon;
|
||||
|
||||
QString coord_str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 6) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 6);
|
||||
|
||||
statusLabel.setText(coord_str);
|
||||
if (m_widget) m_widget->labelMousePos->setText(coord_str);
|
||||
QString str = " " + QString::number(mouse_lat_lon.Lat(), 'f', 6) + " " + QString::number(mouse_lat_lon.Lng(), 'f', 6);
|
||||
if (m_widget) m_widget->labelMousePos->setText(str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -392,7 +399,7 @@ void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point)
|
||||
if (m_widget)
|
||||
{
|
||||
QString coord_str = " " + QString::number(point.Lat(), 'f', 6) + " " + QString::number(point.Lng(), 'f', 6) + " ";
|
||||
m_widget->labelMapPos->setText(coord_str);
|
||||
// m_widget->labelMapPos->setText(coord_str);
|
||||
}
|
||||
}
|
||||
|
||||
@ -671,7 +678,7 @@ void OPMapGadgetWidget::createMapOverlayUserControls()
|
||||
overlay_layout_h2->setMargin(0);
|
||||
overlay_layout_h2->setSpacing(4);
|
||||
overlay_layout_h2->addStretch(0);
|
||||
overlay_layout_h2->addWidget(&statusLabel);
|
||||
// overlay_layout_h2->addWidget(&statusLabel);
|
||||
overlay_layout_h2->addStretch(0);
|
||||
|
||||
overlay_layout_v1->addSpacing(10);
|
||||
|
@ -139,8 +139,6 @@ private:
|
||||
|
||||
internals::PointLatLng mouse_lat_lon;
|
||||
|
||||
QLabel statusLabel;
|
||||
|
||||
QTimer *m_updateTimer;
|
||||
QTimer *m_statusUpdateTimer;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user