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

Added mouse Lat/Lon to the new maps temporary control panel

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@824 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-06-19 22:16:10 +00:00 committed by pip
parent 5bc48dd92e
commit 3ea868a253
3 changed files with 301 additions and 123 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>350</width>
<height>702</height>
<width>349</width>
<height>378</height>
</rect>
</property>
<property name="sizePolicy">
@ -40,7 +40,7 @@
<string>OPMap Control Panel</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(215, 215, 215, 255), stop:1 rgba(190, 190, 190, 255));
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(64, 64, 64, 255), stop:1 rgba(78, 78, 78, 255));
</string>
</property>
<widget class="QWidget" name="layoutWidget">
@ -48,8 +48,8 @@
<rect>
<x>0</x>
<y>10</y>
<width>346</width>
<height>691</height>
<width>341</width>
<height>366</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -60,21 +60,21 @@
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>5</number>
<number>0</number>
</property>
<property name="topMargin">
<number>10</number>
<number>2</number>
</property>
<property name="rightMargin">
<number>5</number>
<number>0</number>
</property>
<property name="bottomMargin">
<number>5</number>
<number>10</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_8">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="labelStatus">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@ -83,86 +83,22 @@
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<pointsize>9</pointsize>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<kerning>true</kerning>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(80, 80, 80, 255));
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Map Type </string>
<string>labelStatus</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(200, 200, 200, 255));</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonReload">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(160, 160, 160, 255), stop:1 rgba(180, 180, 180, 255));</string>
</property>
<property name="text">
<string>Reload</string>
</property>
<property name="iconSize">
<size>
<width>12</width>
<height>12</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
@ -170,6 +106,12 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="leftMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
@ -187,7 +129,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255, 200);</string>
</property>
<property name="text">
<string>Find Place </string>
@ -206,7 +149,7 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(200, 200, 200, 255));</string>
<string notr="true">background-color: rgba(255, 255, 255, 64);</string>
</property>
</widget>
</item>
@ -244,7 +187,9 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);
</string>
</property>
<property name="text">
<string>GeoCoderStatusCode</string>
@ -258,6 +203,12 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="leftMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label_13">
<property name="sizePolicy">
@ -275,7 +226,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255, 200);</string>
</property>
<property name="text">
<string>Home Geo Fence Distance</string>
@ -294,6 +246,10 @@
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="frame">
<bool>false</bool>
</property>
@ -333,7 +289,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Meters</string>
@ -386,6 +343,15 @@
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton {
border-color: rgba(0, 0, 0, 0);
}
QPushButton:hover {
background-color: qradialgradient(spread:pad, cx:0.5, cy:0.5, radius:0.1, fx:0.5, fy:0.5, stop:0 rgba(255, 0, 0, 255), stop:0.479904 rgba(255, 0, 0, 255), stop:0.522685 rgba(255, 255, 255, 255), stop:1 rgba(255, 255, 255, 0));
}
</string>
</property>
<property name="text">
<string/>
</property>
@ -402,6 +368,12 @@
<property name="autoRepeat">
<bool>true</bool>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
<property name="default">
<bool>false</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
@ -411,6 +383,12 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
@ -428,7 +406,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255, 200);</string>
</property>
<property name="text">
<string>Rotate</string>
@ -454,7 +433,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Rotate</string>
@ -604,7 +584,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255, 200);</string>
</property>
<property name="text">
<string>Zoom</string>
@ -630,7 +611,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Zoom</string>
@ -702,6 +684,12 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<property name="leftMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="font">
@ -715,7 +703,8 @@
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>ShowGridLines</string>
@ -738,7 +727,8 @@
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>UseOpenGL</string>
@ -756,6 +746,10 @@
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 127);</string>
</property>
<property name="title">
<string>Way Points</string>
</property>
@ -780,6 +774,12 @@
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<property name="leftMargin">
<number>5</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
@ -872,19 +872,69 @@
</layout>
</item>
<item>
<widget class="QListView" name="listViewWayPoints">
<property name="font">
<font>
<weight>50</weight>
<bold>false</bold>
</font>
<widget class="QTableWidget" name="tableWidgetWayPoints">
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(180, 180, 180, 255), stop:1 rgba(200, 200, 200, 255));</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(0, 0, 0);
</string>
</property>
<property name="frameShape">
<enum>QFrame::WinPanel</enum>
<enum>QFrame::NoFrame</enum>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="showGrid">
<bool>false</bool>
</property>
<property name="gridStyle">
<enum>Qt::DotLine</enum>
</property>
<property name="wordWrap">
<bool>false</bool>
</property>
<property name="rowCount">
<number>0</number>
</property>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderStretchLastSection">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Num</string>
</property>
<property name="textAlignment">
<set>AlignLeft|AlignVCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Latitude</string>
</property>
</column>
<column>
<property name="text">
<string>Longitude</string>
</property>
</column>
</widget>
</item>
</layout>
@ -892,6 +942,18 @@
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18">
<property name="leftMargin">
<number>5</number>
</property>
<property name="topMargin">
<number>1</number>
</property>
<property name="rightMargin">
<number>5</number>
</property>
<property name="bottomMargin">
<number>1</number>
</property>
<item>
<widget class="QLabel" name="label_14">
<property name="sizePolicy">
@ -908,7 +970,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255, 200);</string>
</property>
<property name="text">
<string>Map Progress </string>
@ -934,7 +997,8 @@
</font>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgba(255, 255, 255, 0);</string>
<string notr="true">background-color: rgba(255, 255, 255, 0);
color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>Tiles</string>
@ -952,18 +1016,72 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>16</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>10</height>
</size>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(83, 83, 83);</string>
</property>
<property name="value">
<number>0</number>
</property>
<property name="textVisible">
<bool>false</bool>
</property>
<property name="invertedAppearance">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonReload">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="cursor">
<cursorShape>OpenHandCursor</cursorShape>
</property>
<property name="mouseTracking">
<bool>true</bool>
</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>Reload</string>
</property>
<property name="iconSize">
<size>
<width>12</width>
<height>12</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>

View File

@ -45,6 +45,8 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
m_follow_uav = false;
setMouseTracking(true);
// **************
// Get required UAVObjects
@ -87,14 +89,20 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
// **************
// set the user control options
controlpanel_ui->comboBox->addItems(mapcontrol::Helper::MapTypes());
controlpanel_ui->comboBox->setCurrentIndex(mapcontrol::Helper::MapTypes().indexOf("GoogleHybrid"));
controlpanel_ui->labelZoom->setText(" " + QString::number(map->Zoom()));
controlpanel_ui->labelRotate->setText(" " + QString::number(map->Rotate()));
controlpanel_ui->labelNumTilesToLoad->setText(" 0");
// controlpanel_ui->labelNumTilesToLoad->setText(" 0");
controlpanel_ui->labelNumTilesToLoad->setText("");
controlpanel_ui->labelStatus->setText("");
controlpanel_ui->progressBarMap->setMaximum(1);
// **************
// for fetching a contiuous mouse position
map->SetFollowMouse(true);
// receive map zoom changes
connect(map, SIGNAL(zoomChanged(double)), this, SLOT(zoomChanged(double)));
@ -133,6 +141,11 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent)
connect(m_updateTimer, SIGNAL(timeout()), this, SLOT(updatePosition()));
m_updateTimer->start();
m_statusUpdateTimer = new QTimer();
m_statusUpdateTimer->setInterval(40);
connect(m_statusUpdateTimer, SIGNAL(timeout()), this, SLOT(statusUpdate()));
m_statusUpdateTimer->start();
// **************
}
@ -147,6 +160,32 @@ OPMapGadgetWidget::~OPMapGadgetWidget()
// *************************************************************************************
void OPMapGadgetWidget::resizeEvent(QResizeEvent *event)
{
// if (map) map->resize(QSize(width(), height()));
update();
QWidget::resizeEvent(event);
}
void OPMapGadgetWidget::mouseMoveEvent(QMouseEvent *event)
{
if (map)
{
// fetch the current latitude and longitude for the current mouse position
// mouse_lat_lon = map->currentMousePosition();
// QString coord_str = "lat " + QString::number(lat_lon.Lat(), 'f', 6) + ", lon " + QString::number(lat_lon.Lng(), 'f', 6);
// controlpanel_ui->labelStatus->setText(coord_str);
}
if (event->buttons() & Qt::LeftButton)
{
QPoint pos = event->pos();
}
}
// *************************************************************************************
void OPMapGadgetWidget::zoomIn()
{
if (map)
@ -222,13 +261,20 @@ void OPMapGadgetWidget::updatePosition()
}
}
// *************************************************************************************
void OPMapGadgetWidget::resizeEvent(QResizeEvent *event)
void OPMapGadgetWidget::statusUpdate()
{
// if (map) map->resize(QSize(width(), height()));
update();
QWidget::resizeEvent(event);
// fetch the current latitude and longitude for the current mouse position
internals::PointLatLng lat_lon = map->currentMousePosition();
if (mouse_lat_lon != lat_lon)
{
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);
controlpanel_ui->labelStatus->setText(coord_str);
}
}
// *************************************************************************************
@ -286,7 +332,11 @@ void OPMapGadgetWidget::zoomChanged(double zoom)
void OPMapGadgetWidget::OnTilesStillToLoad(int number)
{
controlpanel_ui->labelNumTilesToLoad->setText(" " + QString::number(number));
if (controlpanel_ui->progressBarMap->maximum() < number)
controlpanel_ui->progressBarMap->setMaximum(number);
controlpanel_ui->progressBarMap->setValue(controlpanel_ui->progressBarMap->maximum() - number);
// controlpanel_ui->labelNumTilesToLoad->setText(" " + QString::number(number));
}
// *************************************************************************************
@ -297,13 +347,6 @@ void OPMapGadgetWidget::on_checkBox_clicked(bool checked)
map->SetShowTileGridLines(checked);
}
void OPMapGadgetWidget::on_comboBox_currentIndexChanged(QString value)
{
if (map)
if (map->isStarted())
map->SetMapType(mapcontrol::Helper::MapTypeFromString(value));
}
void OPMapGadgetWidget::on_pushButtonGO_clicked()
{
if (map)
@ -439,16 +482,16 @@ void OPMapGadgetWidget::createMapOverlayUserControls()
// zoomin->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
connect(zoomin, SIGNAL(clicked(bool)), this, SLOT(zoomIn()));
// statusLabel.font().setPointSize(20);
// add zoom buttons to the layout of the MapControl
QVBoxLayout* overlay_layout_v1 = new QVBoxLayout;
overlay_layout_v1->setMargin(4);
overlay_layout_v1->setSpacing(4);
overlay_layout_v1->addSpacing(10);
QHBoxLayout* overlay_layout_h1 = new QHBoxLayout;
overlay_layout_h1->setMargin(0);
overlay_layout_h1->setSpacing(4);
overlay_layout_h1->addSpacing(10);
// overlay_layout_h1->addWidget(gcsButton);
// overlay_layout_h1->addWidget(uavButton);
// overlay_layout_h1->addSpacing(10);
@ -456,8 +499,18 @@ void OPMapGadgetWidget::createMapOverlayUserControls()
overlay_layout_h1->addWidget(zoomin);
overlay_layout_h1->addStretch(0);
QHBoxLayout* overlay_layout_h2 = new QHBoxLayout;
overlay_layout_h2->setMargin(0);
overlay_layout_h2->setSpacing(4);
overlay_layout_h2->addStretch(0);
overlay_layout_h2->addWidget(&statusLabel);
overlay_layout_h2->addStretch(0);
overlay_layout_v1->addSpacing(10);
overlay_layout_v1->addLayout(overlay_layout_h1);
overlay_layout_v1->addStretch(0);
// overlay_layout_v1->addLayout(overlay_layout_h2);
overlay_layout_v1->addSpacing(10);
map->setLayout(overlay_layout_v1);
}

View File

@ -55,17 +55,19 @@ public slots:
protected:
void resizeEvent(QResizeEvent *event);
void mouseMoveEvent(QMouseEvent *event);
void keyPressEvent(QKeyEvent* event);
private slots:
void updatePosition();
void updatePosition();
void statusUpdate();
void zoomIn();
void zoomOut();
// control panel slots
void on_checkBox_clicked(bool checked);
void on_comboBox_currentIndexChanged(QString );
void on_pushButtonGO_clicked();
void on_pushButtonReload_clicked();
void on_pushButtonRR_clicked();
@ -85,7 +87,12 @@ private:
double m_heading; // uav heading
internals::PointLatLng mouse_lat_lon;
QLabel statusLabel;
QTimer *m_updateTimer;
QTimer *m_statusUpdateTimer;
PositionActual *m_positionActual;