mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
LP-536 Changes based on feedback to the PR:
- more professional looking toggle code. - change PRN font to Digital-7 - updated font size factor for SNR PRN text from .56 to .68 - moved a few class includes from the .h to the .cpp file & forward declared QGraphicsSvgItem class in flatearthwidget.h - hide marker before resize, display it again after resize. - corrected issue where marker was crawling to the south on continuous resizes. Instead of nudging the marker, added a proper forceUpdate parameter to the setPosition() function. - made sure that only one @author tag is present. - centered both flatEarth and constellation widgets in their boxes. - lowered resolution of the map image 1440 -> 1080 & used JPG instead of PNG. Size went from 1105KB on disk to 155KB on disk (PNG version for this resolution is 634KB). The resolution change has a minor impact on the level of detail seen in the zoomed view. - added margin for the SNR widget. Although I start to think the SNR widget isn't all that interesting. Removal may be an option. - Also removed gridLayout_2 from the top left, leftover from a test. - Delete scene in the widget destructor. I saw this was done in constellation widget, therefore did the same. I used NULL instead of 0. Looks more correct for pointers to me. What I didn't implement: - wider bars in the SNR widget when less than the max number of satellites are shown. Currently the total width of the SNR widget is limited to 850px. If we go wider with the current implementation, the text becomes too large. At this time, I don't have a good idea how to handle that.
This commit is contained in:
parent
557e728a00
commit
c0964cfdce
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @file flatearthwidget.cpp
|
||||
* @author The LibrePilot Team, http://www.librepilot.org Copyright (C) 2017.
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* Edouard Lafargue Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup FlatEarthWidget FlatEarth Widget Plugin
|
||||
@ -26,6 +26,8 @@
|
||||
*/
|
||||
|
||||
#include "flatearthwidget.h"
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
#include <math.h> /* fabs */
|
||||
|
||||
#define MARKER_SIZE 40.0
|
||||
@ -44,7 +46,7 @@ FlatEarthWidget::FlatEarthWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
|
||||
// Draw the earth
|
||||
earthScene = new QGraphicsScene(this);
|
||||
QPixmap earthpix(":/gpsgadget/images/flatEarth.png");
|
||||
QPixmap earthpix(":/gpsgadget/images/flatEarth.jpg");
|
||||
earthPixmapItem = earthScene->addPixmap(earthpix);
|
||||
this->setScene(earthScene);
|
||||
|
||||
@ -57,7 +59,10 @@ FlatEarthWidget::FlatEarthWidget(QWidget *parent) : QGraphicsView(parent)
|
||||
}
|
||||
|
||||
FlatEarthWidget::~FlatEarthWidget()
|
||||
{}
|
||||
{
|
||||
delete earthScene;
|
||||
earthScene = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Refresh the map on first showing
|
||||
@ -86,24 +91,20 @@ void FlatEarthWidget::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
|
||||
// toggle zoom state
|
||||
if (zoomedin) {
|
||||
zoomedin = false;
|
||||
} else {
|
||||
zoomedin = true;
|
||||
}
|
||||
// toggle zoom state and refresh the map
|
||||
zoomedin = !zoomedin;
|
||||
refreshMap();
|
||||
}
|
||||
|
||||
/*
|
||||
* Update the position of the marker on the map
|
||||
*/
|
||||
void FlatEarthWidget::setPosition(double lat, double lon)
|
||||
void FlatEarthWidget::setPosition(double lat, double lon, bool forceUpdate)
|
||||
{
|
||||
/* Only perform this expensive graphics operation if the position has changed enough
|
||||
to be visible on the map.
|
||||
to be visible on the map. Or if an update is requested by force.
|
||||
*/
|
||||
if (fabs(oldLat - lat) > 0.1 || fabs(oldLon - lon) > 0.1) {
|
||||
if (fabs(oldLat - lat) > 0.1 || fabs(oldLon - lon) > 0.1 || forceUpdate) {
|
||||
double wscale = this->sceneRect().width() / 360;
|
||||
double hscale = this->sceneRect().height() / 180;
|
||||
QPointF opd = QPointF((lon + 180) * wscale - marker->boundingRect().width() * marker->scale() / 2,
|
||||
@ -127,6 +128,9 @@ void FlatEarthWidget::refreshMap(void)
|
||||
double markerScale;
|
||||
|
||||
if (zoomedin) {
|
||||
// Hide the marker
|
||||
marker->setVisible(false);
|
||||
|
||||
// Zoom the map to it's native resolution
|
||||
this->resetTransform();
|
||||
|
||||
@ -136,14 +140,23 @@ void FlatEarthWidget::refreshMap(void)
|
||||
// Rescale the marker dimensions to keep the same appearance in both zoom levels
|
||||
markerScale = MARKER_SIZE / 100.0 * (double)this->rect().width() / (double)(earthPixmapItem->boundingRect().width());
|
||||
marker->setScale(markerScale);
|
||||
|
||||
// Show the marker again
|
||||
marker->setVisible(true);
|
||||
} else {
|
||||
// Hide the marker
|
||||
marker->setVisible(false);
|
||||
|
||||
// Fit the whole world
|
||||
this->fitInView(earthPixmapItem, Qt::KeepAspectRatio);
|
||||
|
||||
// Rescale the marker dimensions to keep the same appearance in both zoom levels
|
||||
markerScale = MARKER_SIZE / 100.0;
|
||||
marker->setScale(markerScale);
|
||||
|
||||
// Show the marker again
|
||||
marker->setVisible(true);
|
||||
}
|
||||
// force an update of the marker position by giving the position a nudge
|
||||
this->setPosition(oldLat - 0.2, oldLon);
|
||||
// force an update of the marker position
|
||||
this->setPosition(oldLat, oldLon, true);
|
||||
}
|
||||
|
@ -28,8 +28,7 @@
|
||||
#define FLATEARTHWIDGET_H_
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
class QGraphicsSvgItem;
|
||||
|
||||
class FlatEarthWidget : public QGraphicsView {
|
||||
Q_OBJECT
|
||||
@ -37,7 +36,7 @@ class FlatEarthWidget : public QGraphicsView {
|
||||
public:
|
||||
explicit FlatEarthWidget(QWidget *parent = 0);
|
||||
~FlatEarthWidget();
|
||||
void setPosition(double, double);
|
||||
void setPosition(double, double, bool forceUpdate = false);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @file gpsdisplaywidget.cpp
|
||||
* @author The LibrePilot Team, http://www.librepilot.org Copyright (C) 2017.
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* Edouard Lafargue Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||
|
@ -3,7 +3,7 @@
|
||||
*
|
||||
* @file gpsdisplaywidget.h
|
||||
* @author The LibrePilot Team, http://www.librepilot.org Copyright (C) 2017.
|
||||
* @author Edouard Lafargue Copyright (C) 2010.
|
||||
* Edouard Lafargue Copyright (C) 2010.
|
||||
* @addtogroup GCSPlugins GCS Plugins
|
||||
* @{
|
||||
* @addtogroup GPSGadgetPlugin GPS Gadget Plugin
|
||||
@ -33,9 +33,6 @@
|
||||
#include "gpsdisplaygadgetconfiguration.h"
|
||||
#include "gpsconstellationwidget.h"
|
||||
#include "uavobject.h"
|
||||
#include <QGraphicsView>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
||||
class Ui_GpsDisplayWidget;
|
||||
|
||||
|
@ -55,374 +55,370 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="infoVerticalLayout" stretch="0,0,0,0,0,0,0">
|
||||
<layout class="QVBoxLayout" name="infoVerticalLayout" stretch="0,0,0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="infoHorizontalLayout1" stretch="0,0,1,0,1,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="infoHorizontalLayout1" stretch="0,0,1,0,1,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
<widget class="QLabel" name="lat_label">
|
||||
<property name="text">
|
||||
<string>Coord:</string>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="lat_label">
|
||||
<property name="text">
|
||||
<string>Coord:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="coord_value">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="coord_value_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_23">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="infoHorizontalLayout2" stretch="0,0,1,0,0,0,0,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="speed_label">
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="speed_value">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_19">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bear_label">
|
||||
<property name="text">
|
||||
<string>Heading:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bear_value">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="alt_label">
|
||||
<property name="text">
|
||||
<string>Altitude (AMSL):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="coord_value_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>4</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line1">
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="coord_value">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="coord_value_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_23">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="infoHorizontalLayout2" stretch="0,0,1,0,0,0,0,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="speed_label">
|
||||
<property name="text">
|
||||
<string>Speed:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="speed_value">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_19">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bear_label">
|
||||
<property name="text">
|
||||
<string>Heading:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="bear_value">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="alt_label">
|
||||
<property name="text">
|
||||
<string>Altitude (AMSL):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="coord_value_3">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unknown</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>6</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>4</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line1">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="1" column="1" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
|
||||
<widget class="GpsConstellationWidget" name="gpsSky">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>400</height>
|
||||
<width>600</width>
|
||||
<height>600</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
@ -448,7 +444,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="0" alignment="Qt::AlignHCenter|Qt::AlignVCenter">
|
||||
<widget class="FlatEarthWidget" name="flatEarth">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
|
@ -20,7 +20,7 @@ GpsSnrWidget::GpsSnrWidget(QWidget *parent) :
|
||||
|
||||
satTexts[i] = new QGraphicsSimpleTextItem("###", boxes[i]);
|
||||
satTexts[i]->setBrush(QColor("Black"));
|
||||
satTexts[i]->setFont(QFont("Arial"));
|
||||
satTexts[i]->setFont(QFont("Digital-7"));
|
||||
|
||||
satSNRs[i] = new QGraphicsSimpleTextItem("##", boxes[i]);
|
||||
satSNRs[i]->setBrush(QColor("Black"));
|
||||
@ -69,6 +69,7 @@ void GpsSnrWidget::updateSat(int index, int prn, int elevation, int azimuth, int
|
||||
}
|
||||
|
||||
#define PRN_TEXTAREA_HEIGHT 20
|
||||
#define SIDE_MARGIN 15
|
||||
|
||||
void GpsSnrWidget::drawSat(int index)
|
||||
{
|
||||
@ -80,8 +81,6 @@ void GpsSnrWidget::drawSat(int index)
|
||||
const int prn = satellites[index][0];
|
||||
const int snr = satellites[index][3];
|
||||
if (prn && snr) {
|
||||
boxes[index]->show();
|
||||
|
||||
// When using integer values, width and height are the
|
||||
// box width and height, but the left and bottom borders are drawn on the box,
|
||||
// and the top and right borders are drawn just next to the box.
|
||||
@ -90,14 +89,21 @@ void GpsSnrWidget::drawSat(int index)
|
||||
|
||||
// Casting to int rounds down, which is what I want.
|
||||
// Minus 2 to allow a pixel of white left and right.
|
||||
int availableWidth = (int)((scene->width() - 2) / MAX_SATELLITES);
|
||||
int availableWidth = (int)((scene->width() - 2 - 2 * SIDE_MARGIN) / MAX_SATELLITES);
|
||||
|
||||
// 2 pixels, one on each side.
|
||||
// If there is no space, don't draw anything.
|
||||
if (availableWidth <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
boxes[index]->show();
|
||||
|
||||
// 2 pixels extra one on each side.
|
||||
qreal width = availableWidth - 2;
|
||||
// SNR = 1-99 (0 is special)..
|
||||
qreal height = int(((scene->height() - PRN_TEXTAREA_HEIGHT) / 99) * snr + 0.5);
|
||||
// 1 for showing a pixel of white to the left.
|
||||
qreal x = availableWidth * index + 1;
|
||||
// 1 for showing a pixel of white extra to the left.
|
||||
qreal x = availableWidth * index + 1 + SIDE_MARGIN;
|
||||
// Rember, 0 is at the top.
|
||||
qreal y = scene->height() - height - PRN_TEXTAREA_HEIGHT;
|
||||
// Compensate for the extra pixel for the border.
|
||||
@ -136,7 +142,7 @@ void GpsSnrWidget::drawSat(int index)
|
||||
// Reposition PRN numbers below the bar and rescale
|
||||
QTransform matrix;
|
||||
// rescale based on the textRect height because it depends less on the number of digits:
|
||||
qreal scale = 0.56 * (boxRect.width() / textRect.height());
|
||||
qreal scale = 0.68 * (boxRect.width() / textRect.height());
|
||||
matrix.translate(boxRect.width() / 2, boxRect.height());
|
||||
matrix.scale(scale, scale);
|
||||
matrix.translate(-textRect.width() / 2, 0);
|
||||
|
BIN
ground/gcs/src/plugins/gpsdisplay/images/flatEarth.jpg
Normal file
BIN
ground/gcs/src/plugins/gpsdisplay/images/flatEarth.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 155 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.1 MiB |
@ -1,7 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/gpsgadget">
|
||||
<file>images/gpsEarth.svg</file>
|
||||
<file>images/flatEarth.png</file>
|
||||
<file>images/flatEarth.jpg</file>
|
||||
<file>images/marker.svg</file>
|
||||
<file>font/digital-7.ttf</file>
|
||||
</qresource>
|
||||
|
Loading…
x
Reference in New Issue
Block a user