mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-14 19:04:23 +02:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
18fc6cc3e2 | |||
9815f0bff2 | |||
805cbe921c | |||
d529055ea3 | |||
5d590b7c86 | |||
1003c7b56f | |||
820f967bd6 | |||
27632bf07e | |||
ee5b8fa333 | |||
7e42b57d73 | |||
292fc9b433 |
@ -1,4 +1,4 @@
|
|||||||
version: 5.0.{build}
|
version: 5.1.{build}
|
||||||
configuration: Release
|
configuration: Release
|
||||||
platform: Any CPU
|
platform: Any CPU
|
||||||
environment:
|
environment:
|
||||||
|
@ -4,7 +4,7 @@ KML, FIT, IGC and NMEA files.
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
* User-definable online maps.
|
* User-definable online maps.
|
||||||
* Offline maps (OziExplorer maps and TrekBuddy maps/atlases).
|
* Offline maps (OziExplorer maps, TrekBuddy maps/atlases, GeoTIFF images).
|
||||||
* Elevation, speed, heart rate, cadence, power and temperature graphs.
|
* Elevation, speed, heart rate, cadence, power and temperature graphs.
|
||||||
* Support for multiple tracks in one view.
|
* Support for multiple tracks in one view.
|
||||||
* Support for POI files.
|
* Support for POI files.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
TARGET = GPXSee
|
TARGET = GPXSee
|
||||||
VERSION = 5.0
|
VERSION = 5.1
|
||||||
QT += core \
|
QT += core \
|
||||||
gui \
|
gui \
|
||||||
network
|
network
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -5,7 +5,7 @@
|
|||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "5.0"
|
!define VERSION "5.1"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}.exe"
|
OutFile "GPXSee-${VERSION}.exe"
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
; The name of the installer
|
; The name of the installer
|
||||||
Name "GPXSee"
|
Name "GPXSee"
|
||||||
; Program version
|
; Program version
|
||||||
!define VERSION "5.0"
|
!define VERSION "5.1"
|
||||||
|
|
||||||
; The file to write
|
; The file to write
|
||||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||||
|
@ -62,12 +62,17 @@ ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
|||||||
_bottomMargin = new QDoubleSpinBox();
|
_bottomMargin = new QDoubleSpinBox();
|
||||||
_leftMargin = new QDoubleSpinBox();
|
_leftMargin = new QDoubleSpinBox();
|
||||||
_rightMargin = new QDoubleSpinBox();
|
_rightMargin = new QDoubleSpinBox();
|
||||||
QString us = (_export->units == Imperial) ? tr("in") : tr("mm");
|
QString us = (_export->units == Metric) ? tr("mm") : tr("in");
|
||||||
_topMargin->setSuffix(UNIT_SPACE + us);
|
_topMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
_bottomMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_leftMargin->setSuffix(UNIT_SPACE + us);
|
_leftMargin->setSuffix(UNIT_SPACE + us);
|
||||||
_rightMargin->setSuffix(UNIT_SPACE + us);
|
_rightMargin->setSuffix(UNIT_SPACE + us);
|
||||||
if (_export->units == Imperial) {
|
if (_export->units == Metric) {
|
||||||
|
_topMargin->setValue(_export->margins.top());
|
||||||
|
_bottomMargin->setValue(_export->margins.bottom());
|
||||||
|
_leftMargin->setValue(_export->margins.left());
|
||||||
|
_rightMargin->setValue(_export->margins.right());
|
||||||
|
} else {
|
||||||
_topMargin->setValue(_export->margins.top() * MM2IN);
|
_topMargin->setValue(_export->margins.top() * MM2IN);
|
||||||
_bottomMargin->setValue(_export->margins.bottom() * MM2IN);
|
_bottomMargin->setValue(_export->margins.bottom() * MM2IN);
|
||||||
_leftMargin->setValue(_export->margins.left() * MM2IN);
|
_leftMargin->setValue(_export->margins.left() * MM2IN);
|
||||||
@ -76,11 +81,6 @@ ExportDialog::ExportDialog(Export *exp, QWidget *parent)
|
|||||||
_bottomMargin->setSingleStep(0.1);
|
_bottomMargin->setSingleStep(0.1);
|
||||||
_leftMargin->setSingleStep(0.1);
|
_leftMargin->setSingleStep(0.1);
|
||||||
_rightMargin->setSingleStep(0.1);
|
_rightMargin->setSingleStep(0.1);
|
||||||
} else {
|
|
||||||
_topMargin->setValue(_export->margins.top());
|
|
||||||
_bottomMargin->setValue(_export->margins.bottom());
|
|
||||||
_leftMargin->setValue(_export->margins.left());
|
|
||||||
_rightMargin->setValue(_export->margins.right());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QGridLayout *marginsLayout = new QGridLayout();
|
QGridLayout *marginsLayout = new QGridLayout();
|
||||||
|
@ -2,6 +2,32 @@
|
|||||||
#include "common/coordinates.h"
|
#include "common/coordinates.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
|
||||||
|
static QString deg2DMS(double val)
|
||||||
|
{
|
||||||
|
int deg = val;
|
||||||
|
double r1 = val - deg;
|
||||||
|
|
||||||
|
int min = r1 * 60.0;
|
||||||
|
double r2 = r1 - (min / 60.0);
|
||||||
|
|
||||||
|
double sec = r2 * 3600.0;
|
||||||
|
|
||||||
|
return QString("%1°%2'%3\"").arg(deg).arg(min, 2, 10, QChar('0'))
|
||||||
|
.arg(sec, 4, 'f', 1, QChar('0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
static QString deg2DMM(double val)
|
||||||
|
{
|
||||||
|
int deg = val;
|
||||||
|
double r1 = val - deg;
|
||||||
|
|
||||||
|
double min = r1 * 60.0;
|
||||||
|
|
||||||
|
return QString("%1°%2'").arg(deg).arg(min, 6, 'f', 3, QChar('0'));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString Format::timeSpan(qreal time, bool full)
|
QString Format::timeSpan(qreal time, bool full)
|
||||||
{
|
{
|
||||||
unsigned h, m, s;
|
unsigned h, m, s;
|
||||||
@ -27,6 +53,13 @@ QString Format::distance(qreal value, Units units)
|
|||||||
else
|
else
|
||||||
return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE
|
return QString::number(value * M2MI, 'f', 1) + UNIT_SPACE
|
||||||
+ qApp->translate("Format", "mi");
|
+ qApp->translate("Format", "mi");
|
||||||
|
} else if (units == Nautical) {
|
||||||
|
if (value < NMIINM)
|
||||||
|
return QString::number(value * M2FT, 'f', 0) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "ft");
|
||||||
|
else
|
||||||
|
return QString::number(value * M2NMI, 'f', 1) + UNIT_SPACE
|
||||||
|
+ qApp->translate("Format", "nmi");
|
||||||
} else {
|
} else {
|
||||||
if (value < KMINM)
|
if (value < KMINM)
|
||||||
return QString::number(value, 'f', 0) + UNIT_SPACE
|
return QString::number(value, 'f', 0) + UNIT_SPACE
|
||||||
@ -47,11 +80,22 @@ QString Format::elevation(qreal value, Units units)
|
|||||||
+ qApp->translate("Format", "ft");
|
+ qApp->translate("Format", "ft");
|
||||||
}
|
}
|
||||||
|
|
||||||
QString Format::coordinates(const Coordinates &value)
|
QString Format::coordinates(const Coordinates &value, CoordinatesFormat type)
|
||||||
{
|
{
|
||||||
QChar yH = (value.lat() < 0) ? 'S' : 'N';
|
QChar yH = (value.lat() < 0) ? 'S' : 'N';
|
||||||
QChar xH = (value.lon() < 0) ? 'W' : 'E';
|
QChar xH = (value.lon() < 0) ? 'W' : 'E';
|
||||||
|
|
||||||
return QString::number(qAbs(value.lat()), 'f', 5) + yH + "," + QChar(0x00A0)
|
switch (type) {
|
||||||
+ QString::number(qAbs(value.lon()), 'f', 5) + xH;
|
case DegreesMinutes:
|
||||||
|
return deg2DMM(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
||||||
|
+ deg2DMM(qAbs(value.lon())) + xH;
|
||||||
|
break;
|
||||||
|
case DMS:
|
||||||
|
return deg2DMS(qAbs(value.lat())) + yH + "," + QChar(0x00A0)
|
||||||
|
+ deg2DMS(qAbs(value.lon())) + xH;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return QString::number(qAbs(value.lat()), 'f', 5) + yH + ","
|
||||||
|
+ QChar(0x00A0) + QString::number(qAbs(value.lon()), 'f', 5) + xH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,18 @@
|
|||||||
|
|
||||||
class Coordinates;
|
class Coordinates;
|
||||||
|
|
||||||
|
enum CoordinatesFormat {
|
||||||
|
DecimalDegrees,
|
||||||
|
DegreesMinutes,
|
||||||
|
DMS
|
||||||
|
};
|
||||||
|
|
||||||
namespace Format
|
namespace Format
|
||||||
{
|
{
|
||||||
QString timeSpan(qreal time, bool full = true);
|
QString timeSpan(qreal time, bool full = true);
|
||||||
QString distance(qreal value, Units units);
|
QString distance(qreal value, Units units);
|
||||||
QString elevation(qreal value, Units units);
|
QString elevation(qreal value, Units units);
|
||||||
QString coordinates(const Coordinates &value);
|
QString coordinates(const Coordinates &value, CoordinatesFormat type);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // FORMAT_H
|
#endif // FORMAT_H
|
||||||
|
@ -104,15 +104,7 @@ void GraphView::setYUnits(const QString &units)
|
|||||||
void GraphView::setXUnits()
|
void GraphView::setXUnits()
|
||||||
{
|
{
|
||||||
if (_graphType == Distance) {
|
if (_graphType == Distance) {
|
||||||
if (_units == Metric) {
|
if (_units == Imperial) {
|
||||||
if (bounds().width() < KMINM) {
|
|
||||||
_xUnits = tr("m");
|
|
||||||
_xScale = 1;
|
|
||||||
} else {
|
|
||||||
_xUnits = tr("km");
|
|
||||||
_xScale = M2KM;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (bounds().width() < MIINM) {
|
if (bounds().width() < MIINM) {
|
||||||
_xUnits = tr("ft");
|
_xUnits = tr("ft");
|
||||||
_xScale = M2FT;
|
_xScale = M2FT;
|
||||||
@ -120,6 +112,22 @@ void GraphView::setXUnits()
|
|||||||
_xUnits = tr("mi");
|
_xUnits = tr("mi");
|
||||||
_xScale = M2MI;
|
_xScale = M2MI;
|
||||||
}
|
}
|
||||||
|
} else if (_units == Nautical) {
|
||||||
|
if (bounds().width() < NMIINM) {
|
||||||
|
_xUnits = tr("ft");
|
||||||
|
_xScale = M2FT;
|
||||||
|
} else {
|
||||||
|
_xUnits = tr("nmi");
|
||||||
|
_xScale = M2NMI;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (bounds().width() < KMINM) {
|
||||||
|
_xUnits = tr("m");
|
||||||
|
_xScale = 1;
|
||||||
|
} else {
|
||||||
|
_xUnits = tr("km");
|
||||||
|
_xScale = M2KM;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (bounds().width() < MININS) {
|
if (bounds().width() < MININS) {
|
||||||
|
@ -40,7 +40,6 @@
|
|||||||
#include "filebrowser.h"
|
#include "filebrowser.h"
|
||||||
#include "cpuarch.h"
|
#include "cpuarch.h"
|
||||||
#include "graphtab.h"
|
#include "graphtab.h"
|
||||||
#include "format.h"
|
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
|
|
||||||
|
|
||||||
@ -373,6 +372,28 @@ void GUI::createActions()
|
|||||||
_imperialUnitsAction->setActionGroup(ag);
|
_imperialUnitsAction->setActionGroup(ag);
|
||||||
connect(_imperialUnitsAction, SIGNAL(triggered()), this,
|
connect(_imperialUnitsAction, SIGNAL(triggered()), this,
|
||||||
SLOT(setImperialUnits()));
|
SLOT(setImperialUnits()));
|
||||||
|
_nauticalUnitsAction = new QAction(tr("Nautical"), this);
|
||||||
|
_nauticalUnitsAction->setCheckable(true);
|
||||||
|
_nauticalUnitsAction->setActionGroup(ag);
|
||||||
|
connect(_nauticalUnitsAction, SIGNAL(triggered()), this,
|
||||||
|
SLOT(setNauticalUnits()));
|
||||||
|
ag = new QActionGroup(this);
|
||||||
|
ag->setExclusive(true);
|
||||||
|
_decimalDegreesAction = new QAction(tr("Decimal degrees (DD)"), this);
|
||||||
|
_decimalDegreesAction->setCheckable(true);
|
||||||
|
_decimalDegreesAction->setActionGroup(ag);
|
||||||
|
connect(_decimalDegreesAction, SIGNAL(triggered()), this,
|
||||||
|
SLOT(setDecimalDegrees()));
|
||||||
|
_degreesMinutesAction = new QAction(tr("Degrees and decimal minutes (DMM)"),
|
||||||
|
this);
|
||||||
|
_degreesMinutesAction->setCheckable(true);
|
||||||
|
_degreesMinutesAction->setActionGroup(ag);
|
||||||
|
connect(_degreesMinutesAction, SIGNAL(triggered()), this,
|
||||||
|
SLOT(setDegreesMinutes()));
|
||||||
|
_DMSAction = new QAction(tr("Degrees, minutes, seconds (DMS)"), this);
|
||||||
|
_DMSAction->setCheckable(true);
|
||||||
|
_DMSAction->setActionGroup(ag);
|
||||||
|
connect(_DMSAction, SIGNAL(triggered()), this, SLOT(setDMS()));
|
||||||
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)),
|
_fullscreenAction = new QAction(QIcon(QPixmap(FULLSCREEN_ICON)),
|
||||||
tr("Fullscreen mode"), this);
|
tr("Fullscreen mode"), this);
|
||||||
_fullscreenAction->setCheckable(true);
|
_fullscreenAction->setCheckable(true);
|
||||||
@ -463,6 +484,11 @@ void GUI::createMenus()
|
|||||||
QMenu *unitsMenu = settingsMenu->addMenu(tr("Units"));
|
QMenu *unitsMenu = settingsMenu->addMenu(tr("Units"));
|
||||||
unitsMenu->addAction(_metricUnitsAction);
|
unitsMenu->addAction(_metricUnitsAction);
|
||||||
unitsMenu->addAction(_imperialUnitsAction);
|
unitsMenu->addAction(_imperialUnitsAction);
|
||||||
|
unitsMenu->addAction(_nauticalUnitsAction);
|
||||||
|
QMenu *coordinatesMenu = settingsMenu->addMenu(tr("Coordinates format"));
|
||||||
|
coordinatesMenu->addAction(_decimalDegreesAction);
|
||||||
|
coordinatesMenu->addAction(_degreesMinutesAction);
|
||||||
|
coordinatesMenu->addAction(_DMSAction);
|
||||||
settingsMenu->addSeparator();
|
settingsMenu->addSeparator();
|
||||||
settingsMenu->addAction(_showToolbarsAction);
|
settingsMenu->addAction(_showToolbarsAction);
|
||||||
settingsMenu->addAction(_fullscreenAction);
|
settingsMenu->addAction(_fullscreenAction);
|
||||||
@ -1293,6 +1319,11 @@ void GUI::setUnits(Units units)
|
|||||||
updateStatusBarInfo();
|
updateStatusBarInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::setCoordinatesFormat(CoordinatesFormat format)
|
||||||
|
{
|
||||||
|
_mapView->setCoordinatesFormat(format);
|
||||||
|
}
|
||||||
|
|
||||||
void GUI::setGraphType(GraphType type)
|
void GUI::setGraphType(GraphType type)
|
||||||
{
|
{
|
||||||
_sliderPos = 0;
|
_sliderPos = 0;
|
||||||
@ -1437,11 +1468,15 @@ void GUI::writeSettings()
|
|||||||
if ((_movingTimeAction->isChecked() ? Moving : Total) !=
|
if ((_movingTimeAction->isChecked() ? Moving : Total) !=
|
||||||
TIME_TYPE_DEFAULT)
|
TIME_TYPE_DEFAULT)
|
||||||
settings.setValue(TIME_TYPE_SETTING, _movingTimeAction->isChecked()
|
settings.setValue(TIME_TYPE_SETTING, _movingTimeAction->isChecked()
|
||||||
? Moving : Total);
|
? Moving : Total);
|
||||||
if ((_imperialUnitsAction->isChecked() ? Imperial : Metric) !=
|
Units units = _imperialUnitsAction->isChecked() ? Imperial
|
||||||
UNITS_DEFAULT)
|
: _nauticalUnitsAction->isChecked() ? Nautical : Metric;
|
||||||
settings.setValue(UNITS_SETTING, _imperialUnitsAction->isChecked()
|
if (units != UNITS_DEFAULT)
|
||||||
? Imperial : Metric);
|
settings.setValue(UNITS_SETTING, units);
|
||||||
|
CoordinatesFormat format = _DMSAction->isChecked() ? DMS
|
||||||
|
: _degreesMinutesAction->isChecked() ? DegreesMinutes : DecimalDegrees;
|
||||||
|
if (format != COORDINATES_DEFAULT)
|
||||||
|
settings.setValue(COORDINATES_SETTING, format);
|
||||||
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
|
if (_showToolbarsAction->isChecked() != SHOW_TOOLBARS_DEFAULT)
|
||||||
settings.setValue(SHOW_TOOLBARS_SETTING,
|
settings.setValue(SHOW_TOOLBARS_SETTING,
|
||||||
_showToolbarsAction->isChecked());
|
_showToolbarsAction->isChecked());
|
||||||
@ -1601,6 +1636,7 @@ void GUI::writeSettings()
|
|||||||
|
|
||||||
void GUI::readSettings()
|
void GUI::readSettings()
|
||||||
{
|
{
|
||||||
|
int value;
|
||||||
QSettings settings(APP_NAME, APP_NAME);
|
QSettings settings(APP_NAME, APP_NAME);
|
||||||
|
|
||||||
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
settings.beginGroup(WINDOW_SETTINGS_GROUP);
|
||||||
@ -1610,20 +1646,27 @@ void GUI::readSettings()
|
|||||||
|
|
||||||
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
settings.beginGroup(SETTINGS_SETTINGS_GROUP);
|
||||||
if (settings.value(TIME_TYPE_SETTING, TIME_TYPE_DEFAULT).toInt()
|
if (settings.value(TIME_TYPE_SETTING, TIME_TYPE_DEFAULT).toInt()
|
||||||
== Moving) {
|
== Moving)
|
||||||
setTimeType(Moving);
|
_movingTimeAction->activate(QAction::Trigger);
|
||||||
_movingTimeAction->setChecked(true);
|
else
|
||||||
} else {
|
_totalTimeAction->activate(QAction::Trigger);
|
||||||
setTimeType(Total);
|
|
||||||
_totalTimeAction->setChecked(true);
|
value = settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt();
|
||||||
}
|
if (value == Imperial)
|
||||||
if (settings.value(UNITS_SETTING, UNITS_DEFAULT).toInt() == Imperial) {
|
_imperialUnitsAction->activate(QAction::Trigger);
|
||||||
setUnits(Imperial);
|
else if (value == Nautical)
|
||||||
_imperialUnitsAction->setChecked(true);
|
_nauticalUnitsAction->activate(QAction::Trigger);
|
||||||
} else {
|
else
|
||||||
setUnits(Metric);
|
_metricUnitsAction->activate(QAction::Trigger);
|
||||||
_metricUnitsAction->setChecked(true);
|
|
||||||
}
|
value = settings.value(COORDINATES_SETTING, COORDINATES_DEFAULT).toInt();
|
||||||
|
if (value == DMS)
|
||||||
|
_DMSAction->activate(QAction::Trigger);
|
||||||
|
else if (value == DegreesMinutes)
|
||||||
|
_degreesMinutesAction->activate(QAction::Trigger);
|
||||||
|
else
|
||||||
|
_decimalDegreesAction->activate(QAction::Trigger);
|
||||||
|
|
||||||
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
|
if (!settings.value(SHOW_TOOLBARS_SETTING, SHOW_TOOLBARS_DEFAULT).toBool())
|
||||||
showToolbars(false);
|
showToolbars(false);
|
||||||
else
|
else
|
||||||
@ -1867,7 +1910,8 @@ int GUI::mapIndex(const QString &name)
|
|||||||
|
|
||||||
Units GUI::units() const
|
Units GUI::units() const
|
||||||
{
|
{
|
||||||
return _imperialUnitsAction->isChecked() ? Imperial : Metric;
|
return _imperialUnitsAction->isChecked() ? Imperial
|
||||||
|
: _nauticalUnitsAction->isChecked() ? Nautical : Metric;
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal GUI::distance() const
|
qreal GUI::distance() const
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include "data/poi.h"
|
#include "data/poi.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
#include "timetype.h"
|
#include "timetype.h"
|
||||||
|
#include "format.h"
|
||||||
#include "exportdialog.h"
|
#include "exportdialog.h"
|
||||||
#include "optionsdialog.h"
|
#include "optionsdialog.h"
|
||||||
|
|
||||||
@ -73,8 +74,12 @@ private slots:
|
|||||||
void setMovingTime() {setTimeType(Moving);}
|
void setMovingTime() {setTimeType(Moving);}
|
||||||
void setMetricUnits() {setUnits(Metric);}
|
void setMetricUnits() {setUnits(Metric);}
|
||||||
void setImperialUnits() {setUnits(Imperial);}
|
void setImperialUnits() {setUnits(Imperial);}
|
||||||
|
void setNauticalUnits() {setUnits(Nautical);}
|
||||||
void setDistanceGraph() {setGraphType(Distance);}
|
void setDistanceGraph() {setGraphType(Distance);}
|
||||||
void setTimeGraph() {setGraphType(Time);}
|
void setTimeGraph() {setGraphType(Time);}
|
||||||
|
void setDecimalDegrees() {setCoordinatesFormat(DecimalDegrees);}
|
||||||
|
void setDegreesMinutes() {setCoordinatesFormat(DegreesMinutes);}
|
||||||
|
void setDMS() {setCoordinatesFormat(DMS);}
|
||||||
|
|
||||||
void sliderPositionChanged(qreal pos);
|
void sliderPositionChanged(qreal pos);
|
||||||
|
|
||||||
@ -111,6 +116,7 @@ private:
|
|||||||
Units units() const;
|
Units units() const;
|
||||||
void setTimeType(TimeType type);
|
void setTimeType(TimeType type);
|
||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
|
void setCoordinatesFormat(CoordinatesFormat format);
|
||||||
void setGraphType(GraphType type);
|
void setGraphType(GraphType type);
|
||||||
|
|
||||||
qreal distance() const;
|
qreal distance() const;
|
||||||
@ -165,6 +171,10 @@ private:
|
|||||||
QAction *_firstAction;
|
QAction *_firstAction;
|
||||||
QAction *_metricUnitsAction;
|
QAction *_metricUnitsAction;
|
||||||
QAction *_imperialUnitsAction;
|
QAction *_imperialUnitsAction;
|
||||||
|
QAction *_nauticalUnitsAction;
|
||||||
|
QAction *_decimalDegreesAction;
|
||||||
|
QAction *_degreesMinutesAction;
|
||||||
|
QAction *_DMSAction;
|
||||||
QAction *_totalTimeAction;
|
QAction *_totalTimeAction;
|
||||||
QAction *_movingTimeAction;
|
QAction *_movingTimeAction;
|
||||||
QAction *_nextMapAction;
|
QAction *_nextMapAction;
|
||||||
|
@ -49,6 +49,7 @@ MapView::MapView(Map *map, POI *poi, QWidget *parent)
|
|||||||
connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
|
||||||
|
|
||||||
_units = Metric;
|
_units = Metric;
|
||||||
|
_coordinatesFormat = DecimalDegrees;
|
||||||
_opacity = 1.0;
|
_opacity = 1.0;
|
||||||
_backgroundColor = Qt::white;
|
_backgroundColor = Qt::white;
|
||||||
_markerColor = Qt::red;
|
_markerColor = Qt::red;
|
||||||
@ -137,6 +138,7 @@ PathItem *MapView::addRoute(const Route &route)
|
|||||||
ri->setWidth(_routeWidth);
|
ri->setWidth(_routeWidth);
|
||||||
ri->setStyle(_routeStyle);
|
ri->setStyle(_routeStyle);
|
||||||
ri->setUnits(_units);
|
ri->setUnits(_units);
|
||||||
|
ri->setCoordinatesFormat(_coordinatesFormat);
|
||||||
ri->setVisible(_showRoutes);
|
ri->setVisible(_showRoutes);
|
||||||
ri->showWaypoints(_showRouteWaypoints);
|
ri->showWaypoints(_showRouteWaypoints);
|
||||||
ri->showWaypointLabels(_showWaypointLabels);
|
ri->showWaypointLabels(_showWaypointLabels);
|
||||||
@ -162,7 +164,7 @@ void MapView::addWaypoints(const QList<Waypoint> &waypoints)
|
|||||||
wi->setSize(_waypointSize);
|
wi->setSize(_waypointSize);
|
||||||
wi->setColor(_waypointColor);
|
wi->setColor(_waypointColor);
|
||||||
wi->showLabel(_showWaypointLabels);
|
wi->showLabel(_showWaypointLabels);
|
||||||
wi->setUnits(_units);
|
wi->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
wi->setVisible(_showWaypoints);
|
wi->setVisible(_showWaypoints);
|
||||||
wi->setDigitalZoom(_digitalZoom);
|
wi->setDigitalZoom(_digitalZoom);
|
||||||
_scene->addItem(wi);
|
_scene->addItem(wi);
|
||||||
@ -348,28 +350,49 @@ void MapView::addPOI(const QList<Waypoint> &waypoints)
|
|||||||
pi->showLabel(_showPOILabels);
|
pi->showLabel(_showPOILabels);
|
||||||
pi->setVisible(_showPOI);
|
pi->setVisible(_showPOI);
|
||||||
pi->setDigitalZoom(_digitalZoom);
|
pi->setDigitalZoom(_digitalZoom);
|
||||||
|
pi->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
_scene->addItem(pi);
|
_scene->addItem(pi);
|
||||||
|
|
||||||
_pois.insert(SearchPointer<Waypoint>(&(pi->waypoint())), pi);
|
_pois.insert(SearchPointer<Waypoint>(&(pi->waypoint())), pi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::setUnits(enum Units units)
|
void MapView::setUnits(Units units)
|
||||||
{
|
{
|
||||||
|
if (_units == units)
|
||||||
|
return;
|
||||||
|
|
||||||
_units = units;
|
_units = units;
|
||||||
|
|
||||||
_mapScale->setUnits(units);
|
_mapScale->setUnits(_units);
|
||||||
|
|
||||||
for (int i = 0; i < _tracks.count(); i++)
|
for (int i = 0; i < _tracks.count(); i++)
|
||||||
_tracks[i]->setUnits(units);
|
_tracks[i]->setUnits(_units);
|
||||||
for (int i = 0; i < _routes.count(); i++)
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
_routes[i]->setUnits(units);
|
_routes[i]->setUnits(_units);
|
||||||
for (int i = 0; i < _waypoints.size(); i++)
|
for (int i = 0; i < _waypoints.size(); i++)
|
||||||
_waypoints.at(i)->setUnits(units);
|
_waypoints.at(i)->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
|
|
||||||
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||||
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||||
it.value()->setUnits(units);
|
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MapView::setCoordinatesFormat(CoordinatesFormat format)
|
||||||
|
{
|
||||||
|
if (_coordinatesFormat == format)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_coordinatesFormat = format;
|
||||||
|
|
||||||
|
for (int i = 0; i < _waypoints.count(); i++)
|
||||||
|
_waypoints.at(i)->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
|
for (int i = 0; i < _routes.count(); i++)
|
||||||
|
_routes[i]->setCoordinatesFormat(_coordinatesFormat);
|
||||||
|
|
||||||
|
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
|
||||||
|
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
|
||||||
|
it.value()->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapView::clearMapCache()
|
void MapView::clearMapCache()
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
#include "data/waypoint.h"
|
#include "data/waypoint.h"
|
||||||
#include "searchpointer.h"
|
#include "searchpointer.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
#include "format.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
|
|
||||||
class Data;
|
class Data;
|
||||||
@ -34,12 +35,13 @@ public:
|
|||||||
void setPalette(const Palette &palette);
|
void setPalette(const Palette &palette);
|
||||||
void setPOI(POI *poi);
|
void setPOI(POI *poi);
|
||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
void setUnits(enum Units units);
|
|
||||||
|
|
||||||
void plot(QPainter *painter, const QRectF &target, qreal scale, bool hires);
|
void plot(QPainter *painter, const QRectF &target, qreal scale, bool hires);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
|
void setUnits(Units units);
|
||||||
|
void setMarkerColor(const QColor &color);
|
||||||
void setTrackWidth(int width);
|
void setTrackWidth(int width);
|
||||||
void setRouteWidth(int width);
|
void setRouteWidth(int width);
|
||||||
void setTrackStyle(Qt::PenStyle style);
|
void setTrackStyle(Qt::PenStyle style);
|
||||||
@ -52,7 +54,6 @@ public:
|
|||||||
void setBackgroundColor(const QColor &color);
|
void setBackgroundColor(const QColor &color);
|
||||||
void useOpenGL(bool use);
|
void useOpenGL(bool use);
|
||||||
void useAntiAliasing(bool use);
|
void useAntiAliasing(bool use);
|
||||||
void setMarkerColor(const QColor &color);
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showMap(bool show);
|
void showMap(bool show);
|
||||||
@ -65,6 +66,7 @@ public slots:
|
|||||||
void showWaypoints(bool show);
|
void showWaypoints(bool show);
|
||||||
void showRouteWaypoints(bool show);
|
void showRouteWaypoints(bool show);
|
||||||
void clearMapCache();
|
void clearMapCache();
|
||||||
|
void setCoordinatesFormat(CoordinatesFormat format);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updatePOI();
|
void updatePOI();
|
||||||
@ -108,6 +110,7 @@ private:
|
|||||||
POI *_poi;
|
POI *_poi;
|
||||||
Palette _palette;
|
Palette _palette;
|
||||||
Units _units;
|
Units _units;
|
||||||
|
CoordinatesFormat _coordinatesFormat;
|
||||||
|
|
||||||
qreal _opacity;
|
qreal _opacity;
|
||||||
QColor _backgroundColor;
|
QColor _backgroundColor;
|
||||||
|
@ -291,6 +291,9 @@ QWidget *OptionsDialog::createDataPage()
|
|||||||
if (_options->units == Imperial) {
|
if (_options->units == Imperial) {
|
||||||
_pauseSpeed->setValue(_options->pauseSpeed * MS2MIH);
|
_pauseSpeed->setValue(_options->pauseSpeed * MS2MIH);
|
||||||
_pauseSpeed->setSuffix(UNIT_SPACE + tr("mi/h"));
|
_pauseSpeed->setSuffix(UNIT_SPACE + tr("mi/h"));
|
||||||
|
} else if (_options->units == Nautical) {
|
||||||
|
_pauseSpeed->setValue(_options->pauseSpeed * MS2KN);
|
||||||
|
_pauseSpeed->setSuffix(UNIT_SPACE + tr("kn"));
|
||||||
} else {
|
} else {
|
||||||
_pauseSpeed->setValue(_options->pauseSpeed * MS2KMH);
|
_pauseSpeed->setValue(_options->pauseSpeed * MS2KMH);
|
||||||
_pauseSpeed->setSuffix(UNIT_SPACE + tr("km/h"));
|
_pauseSpeed->setSuffix(UNIT_SPACE + tr("km/h"));
|
||||||
@ -323,6 +326,9 @@ QWidget *OptionsDialog::createPOIPage()
|
|||||||
if (_options->units == Imperial) {
|
if (_options->units == Imperial) {
|
||||||
_poiRadius->setValue(_options->poiRadius / MIINM);
|
_poiRadius->setValue(_options->poiRadius / MIINM);
|
||||||
_poiRadius->setSuffix(UNIT_SPACE + tr("mi"));
|
_poiRadius->setSuffix(UNIT_SPACE + tr("mi"));
|
||||||
|
} else if (_options->units == Nautical) {
|
||||||
|
_poiRadius->setValue(_options->poiRadius / NMIINM);
|
||||||
|
_poiRadius->setSuffix(UNIT_SPACE + tr("nmi"));
|
||||||
} else {
|
} else {
|
||||||
_poiRadius->setValue(_options->poiRadius / KMINM);
|
_poiRadius->setValue(_options->poiRadius / KMINM);
|
||||||
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
|
_poiRadius->setSuffix(UNIT_SPACE + tr("km"));
|
||||||
@ -525,13 +531,15 @@ void OptionsDialog::accept()
|
|||||||
_options->powerFilter = _powerFilter->value();
|
_options->powerFilter = _powerFilter->value();
|
||||||
_options->outlierEliminate = _outlierEliminate->isChecked();
|
_options->outlierEliminate = _outlierEliminate->isChecked();
|
||||||
qreal pauseSpeed = (_options->units == Imperial)
|
qreal pauseSpeed = (_options->units == Imperial)
|
||||||
? _pauseSpeed->value() / MS2MIH : _pauseSpeed->value() / MS2KMH;
|
? _pauseSpeed->value() / MS2MIH : (_options->units == Nautical)
|
||||||
|
? _pauseSpeed->value() / MS2KN : _pauseSpeed->value() / MS2KMH;
|
||||||
if (qAbs(pauseSpeed - _options->pauseSpeed) > 0.01)
|
if (qAbs(pauseSpeed - _options->pauseSpeed) > 0.01)
|
||||||
_options->pauseSpeed = pauseSpeed;
|
_options->pauseSpeed = pauseSpeed;
|
||||||
_options->pauseInterval = _pauseInterval->value();
|
_options->pauseInterval = _pauseInterval->value();
|
||||||
|
|
||||||
qreal poiRadius = (_options->units == Imperial)
|
qreal poiRadius = (_options->units == Imperial)
|
||||||
? _poiRadius->value() * MIINM : _poiRadius->value() * KMINM;
|
? _poiRadius->value() * MIINM : (_options->units == Nautical)
|
||||||
|
? _poiRadius->value() * NMIINM : _poiRadius->value() * KMINM;
|
||||||
if (qAbs(poiRadius - _options->poiRadius) > 0.01)
|
if (qAbs(poiRadius - _options->poiRadius) > 0.01)
|
||||||
_options->poiRadius = poiRadius;
|
_options->poiRadius = poiRadius;
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ RouteItem::RouteItem(const Route &route, Map *map, QGraphicsItem *parent)
|
|||||||
|
|
||||||
_name = route.name();
|
_name = route.name();
|
||||||
_desc = route.description();
|
_desc = route.description();
|
||||||
|
_units = Metric;
|
||||||
|
_coordinatesFormat = DecimalDegrees;
|
||||||
|
|
||||||
setToolTip(toolTip(Metric));
|
setToolTip(toolTip(Metric));
|
||||||
}
|
}
|
||||||
@ -47,9 +49,38 @@ void RouteItem::setMap(Map *map)
|
|||||||
PathItem::setMap(map);
|
PathItem::setMap(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouteItem::setUnits(enum Units units)
|
void RouteItem::setUnits(Units units)
|
||||||
{
|
{
|
||||||
setToolTip(toolTip(units));
|
if (_units == units)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_units = units;
|
||||||
|
|
||||||
|
setToolTip(toolTip(_units));
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> childs = childItems();
|
||||||
|
for (int i = 0; i < childs.count(); i++) {
|
||||||
|
if (childs.at(i) != _marker) {
|
||||||
|
WaypointItem *wi = static_cast<WaypointItem*>(childs.at(i));
|
||||||
|
wi->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void RouteItem::setCoordinatesFormat(CoordinatesFormat format)
|
||||||
|
{
|
||||||
|
if (_coordinatesFormat == format)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_coordinatesFormat = format;
|
||||||
|
|
||||||
|
QList<QGraphicsItem *> childs = childItems();
|
||||||
|
for (int i = 0; i < childs.count(); i++) {
|
||||||
|
if (childs.at(i) != _marker) {
|
||||||
|
WaypointItem *wi = static_cast<WaypointItem*>(childs.at(i));
|
||||||
|
wi->setToolTipFormat(_units, _coordinatesFormat);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RouteItem::showWaypoints(bool show)
|
void RouteItem::showWaypoints(bool show)
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "data/route.h"
|
#include "data/route.h"
|
||||||
#include "pathitem.h"
|
#include "pathitem.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
#include "format.h"
|
||||||
|
|
||||||
class Map;
|
class Map;
|
||||||
|
|
||||||
@ -17,6 +18,7 @@ public:
|
|||||||
void setMap(Map *map);
|
void setMap(Map *map);
|
||||||
|
|
||||||
void setUnits(Units units);
|
void setUnits(Units units);
|
||||||
|
void setCoordinatesFormat(CoordinatesFormat format);
|
||||||
void showWaypoints(bool show);
|
void showWaypoints(bool show);
|
||||||
void showWaypointLabels(bool show);
|
void showWaypointLabels(bool show);
|
||||||
|
|
||||||
@ -25,6 +27,8 @@ private:
|
|||||||
|
|
||||||
QString _name;
|
QString _name;
|
||||||
QString _desc;
|
QString _desc;
|
||||||
|
Units _units;
|
||||||
|
CoordinatesFormat _coordinatesFormat;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // ROUTEITEM_H
|
#endif // ROUTEITEM_H
|
||||||
|
@ -82,6 +82,9 @@ QString ScaleItem::units() const
|
|||||||
if (_units == Imperial)
|
if (_units == Imperial)
|
||||||
return _scale ? qApp->translate("ScaleItem", "mi")
|
return _scale ? qApp->translate("ScaleItem", "mi")
|
||||||
: qApp->translate("ScaleItem", "ft");
|
: qApp->translate("ScaleItem", "ft");
|
||||||
|
else if (_units == Nautical)
|
||||||
|
return _scale ? qApp->translate("ScaleItem", "nmi")
|
||||||
|
: qApp->translate("ScaleItem", "ft");
|
||||||
else
|
else
|
||||||
return _scale ? qApp->translate("ScaleItem", "km")
|
return _scale ? qApp->translate("ScaleItem", "km")
|
||||||
: qApp->translate("ScaleItem", "m");
|
: qApp->translate("ScaleItem", "m");
|
||||||
@ -94,8 +97,18 @@ void ScaleItem::computeScale()
|
|||||||
if (_units == Imperial) {
|
if (_units == Imperial) {
|
||||||
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
if (_length >= MIINFT) {
|
if (_length >= MIINFT) {
|
||||||
_length = niceNum((res * M2FT * FT2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
_length = niceNum((res * M2MI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
_width = (_length / (res * M2FT * FT2MI));
|
_width = (_length / (res * M2MI));
|
||||||
|
_scale = true;
|
||||||
|
} else {
|
||||||
|
_width = (_length / (res * M2FT));
|
||||||
|
_scale = false;
|
||||||
|
}
|
||||||
|
} else if (_units == Nautical) {
|
||||||
|
_length = niceNum((res * M2FT * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
|
if (_length >= NMIINFT) {
|
||||||
|
_length = niceNum((res * M2NMI * SCALE_WIDTH) / SEGMENTS, 1);
|
||||||
|
_width = (_length / (res * M2NMI));
|
||||||
_scale = true;
|
_scale = true;
|
||||||
} else {
|
} else {
|
||||||
_width = (_length / (res * M2FT));
|
_width = (_length / (res * M2FT));
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
#define TIME_TYPE_DEFAULT Total
|
#define TIME_TYPE_DEFAULT Total
|
||||||
#define UNITS_SETTING "units"
|
#define UNITS_SETTING "units"
|
||||||
#define UNITS_DEFAULT (IMPERIAL_UNITS() ? Imperial : Metric)
|
#define UNITS_DEFAULT (IMPERIAL_UNITS() ? Imperial : Metric)
|
||||||
|
#define COORDINATES_SETTING "coordinates"
|
||||||
|
#define COORDINATES_DEFAULT DecimalDegrees
|
||||||
#define SHOW_TOOLBARS_SETTING "toolbar"
|
#define SHOW_TOOLBARS_SETTING "toolbar"
|
||||||
#define SHOW_TOOLBARS_DEFAULT true
|
#define SHOW_TOOLBARS_DEFAULT true
|
||||||
|
|
||||||
|
@ -79,12 +79,15 @@ void SpeedGraph::clear()
|
|||||||
|
|
||||||
void SpeedGraph::setYUnits(Units units)
|
void SpeedGraph::setYUnits(Units units)
|
||||||
{
|
{
|
||||||
if (units == Metric) {
|
if (units == Nautical) {
|
||||||
GraphView::setYUnits(tr("km/h"));
|
GraphView::setYUnits(tr("kn"));
|
||||||
setYScale(MS2KMH);
|
setYScale(MS2KN);
|
||||||
} else {
|
} else if (units == Imperial) {
|
||||||
GraphView::setYUnits(tr("mi/h"));
|
GraphView::setYUnits(tr("mi/h"));
|
||||||
setYScale(MS2MIH);
|
setYScale(MS2MIH);
|
||||||
|
} else {
|
||||||
|
GraphView::setYUnits(tr("km/h"));
|
||||||
|
setYScale(MS2KMH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,10 @@ SpeedGraphItem::SpeedGraphItem(const Graph &graph, GraphType type,
|
|||||||
QString SpeedGraphItem::toolTip() const
|
QString SpeedGraphItem::toolTip() const
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
qreal scale = (_units == Metric) ? MS2KMH : MS2MIH;
|
qreal scale = (_units == Imperial) ? MS2MIH : (_units == Nautical)
|
||||||
QString su = (_units == Metric) ? tr("km/h") : tr("mi/h");
|
? MS2KN : MS2KMH;
|
||||||
|
QString su = (_units == Imperial) ? tr("mi/h") : (_units == Nautical)
|
||||||
|
? tr("kn") : tr("km/h");
|
||||||
|
|
||||||
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 1)
|
tt.insert(tr("Maximum"), QString::number(max() * scale, 'f', 1)
|
||||||
+ UNIT_SPACE + su);
|
+ UNIT_SPACE + su);
|
||||||
|
@ -3,24 +3,29 @@
|
|||||||
|
|
||||||
enum Units {
|
enum Units {
|
||||||
Metric,
|
Metric,
|
||||||
Imperial
|
Imperial,
|
||||||
|
Nautical
|
||||||
};
|
};
|
||||||
|
|
||||||
#define M2KM 0.001000000000 // m -> km
|
#define M2KM 0.001000000000 // m -> km
|
||||||
#define M2MI 0.000621371192 // m -> mi
|
#define M2MI 0.000621371192 // m -> mi
|
||||||
|
#define M2NMI 0.000539956803 // m -> nmi
|
||||||
#define M2FT 3.280839900000 // m -> ft
|
#define M2FT 3.280839900000 // m -> ft
|
||||||
#define MS2KMH 3.600000000000 // m/s -> km/h
|
#define MS2KMH 3.600000000000 // m/s -> km/h
|
||||||
#define MS2MIH 2.236936290000 // m/s -> mi/h
|
#define MS2MIH 2.236936290000 // m/s -> mi/h
|
||||||
|
#define MS2KN 1.943844490000 // m/s -> kn
|
||||||
#define FT2MI 0.000189393939 // ft -> mi
|
#define FT2MI 0.000189393939 // ft -> mi
|
||||||
#define MM2IN 0.039370100000 // mm -> in
|
#define MM2IN 0.039370100000 // mm -> in
|
||||||
#define H2S 0.000277777778 // h -> s
|
#define H2S 0.000277777778 // h -> s
|
||||||
#define MIN2S 0.016666666667 // min -> s
|
#define MIN2S 0.016666666667 // min -> s
|
||||||
|
|
||||||
#define KMINM 1000.0 // 1 km in m
|
#define KMINM 1000.0 // 1 km in m
|
||||||
#define MIINFT 5280.0 // 1 mi in ft
|
#define MIINFT 5280.0 // 1 mi in ft
|
||||||
#define MIINM 1609.344 // 1 mi in m
|
#define NMIINFT 6076.11549 // 1 nm in ft
|
||||||
#define MININS 60.0 // 1 min in s
|
#define MIINM 1609.344 // 1 mi in m
|
||||||
#define HINS 3600.0 // 1 hins
|
#define NMIINM 1852.0 // 1 nmi in m
|
||||||
|
#define MININS 60.0 // 1 min in s
|
||||||
|
#define HINS 3600.0 // 1 hins
|
||||||
|
|
||||||
#define C2FS 1.8 // Celsius to Farenheit - scale
|
#define C2FS 1.8 // Celsius to Farenheit - scale
|
||||||
#define C2FO 32.0 // Celsius to Farenheit - offset
|
#define C2FO 32.0 // Celsius to Farenheit - offset
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "format.h"
|
|
||||||
#include "tooltip.h"
|
#include "tooltip.h"
|
||||||
#include "waypointitem.h"
|
#include "waypointitem.h"
|
||||||
|
|
||||||
@ -11,14 +10,14 @@
|
|||||||
#define FS(size) \
|
#define FS(size) \
|
||||||
((int)((qreal)size * 1.41))
|
((int)((qreal)size * 1.41))
|
||||||
|
|
||||||
QString WaypointItem::toolTip(Units units)
|
QString WaypointItem::toolTip(Units units, CoordinatesFormat format)
|
||||||
{
|
{
|
||||||
ToolTip tt;
|
ToolTip tt;
|
||||||
|
|
||||||
if (!_waypoint.name().isEmpty())
|
if (!_waypoint.name().isEmpty())
|
||||||
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
tt.insert(qApp->translate("WaypointItem", "Name"), _waypoint.name());
|
||||||
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
tt.insert(qApp->translate("WaypointItem", "Coordinates"),
|
||||||
Format::coordinates(_waypoint.coordinates()));
|
Format::coordinates(_waypoint.coordinates(), format));
|
||||||
if (!std::isnan(_waypoint.elevation()))
|
if (!std::isnan(_waypoint.elevation()))
|
||||||
tt.insert(qApp->translate("WaypointItem", "Elevation"),
|
tt.insert(qApp->translate("WaypointItem", "Elevation"),
|
||||||
Format::elevation(_waypoint.elevation(), units));
|
Format::elevation(_waypoint.elevation(), units));
|
||||||
@ -44,7 +43,7 @@ WaypointItem::WaypointItem(const Waypoint &waypoint, Map *map,
|
|||||||
updateShape();
|
updateShape();
|
||||||
|
|
||||||
setPos(map->ll2xy(waypoint.coordinates()));
|
setPos(map->ll2xy(waypoint.coordinates()));
|
||||||
setToolTip(toolTip(Metric));
|
setToolTip(toolTip(Metric, DecimalDegrees));
|
||||||
setCursor(Qt::ArrowCursor);
|
setCursor(Qt::ArrowCursor);
|
||||||
setAcceptHoverEvents(true);
|
setAcceptHoverEvents(true);
|
||||||
}
|
}
|
||||||
@ -108,6 +107,9 @@ void WaypointItem::paint(QPainter *painter,
|
|||||||
|
|
||||||
void WaypointItem::setSize(int size)
|
void WaypointItem::setSize(int size)
|
||||||
{
|
{
|
||||||
|
if (_size == size)
|
||||||
|
return;
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_size = size;
|
_size = size;
|
||||||
updateShape();
|
updateShape();
|
||||||
@ -115,17 +117,23 @@ void WaypointItem::setSize(int size)
|
|||||||
|
|
||||||
void WaypointItem::setColor(const QColor &color)
|
void WaypointItem::setColor(const QColor &color)
|
||||||
{
|
{
|
||||||
|
if (_color == color)
|
||||||
|
return;
|
||||||
|
|
||||||
_color = color;
|
_color = color;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointItem::setUnits(enum Units units)
|
void WaypointItem::setToolTipFormat(Units units, CoordinatesFormat format)
|
||||||
{
|
{
|
||||||
setToolTip(toolTip(units));
|
setToolTip(toolTip(units, format));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WaypointItem::showLabel(bool show)
|
void WaypointItem::showLabel(bool show)
|
||||||
{
|
{
|
||||||
|
if (_showLabel == show)
|
||||||
|
return;
|
||||||
|
|
||||||
prepareGeometryChange();
|
prepareGeometryChange();
|
||||||
_showLabel = show;
|
_showLabel = show;
|
||||||
updateShape();
|
updateShape();
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include "data/waypoint.h"
|
#include "data/waypoint.h"
|
||||||
#include "map/map.h"
|
#include "map/map.h"
|
||||||
#include "units.h"
|
#include "units.h"
|
||||||
|
#include "format.h"
|
||||||
|
|
||||||
class WaypointItem : public QGraphicsItem
|
class WaypointItem : public QGraphicsItem
|
||||||
{
|
{
|
||||||
@ -15,7 +16,7 @@ public:
|
|||||||
const Waypoint &waypoint() const {return _waypoint;}
|
const Waypoint &waypoint() const {return _waypoint;}
|
||||||
|
|
||||||
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
void setMap(Map *map) {setPos(map->ll2xy(_waypoint.coordinates()));}
|
||||||
void setUnits(Units units);
|
void setToolTipFormat(Units units, CoordinatesFormat format);
|
||||||
void setSize(int size);
|
void setSize(int size);
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
void showLabel(bool show);
|
void showLabel(bool show);
|
||||||
@ -31,7 +32,7 @@ private:
|
|||||||
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
|
||||||
|
|
||||||
void updateShape();
|
void updateShape();
|
||||||
QString toolTip(Units units);
|
QString toolTip(Units units, CoordinatesFormat format);
|
||||||
|
|
||||||
QPainterPath _shape;
|
QPainterPath _shape;
|
||||||
Waypoint _waypoint;
|
Waypoint _waypoint;
|
||||||
|
@ -43,11 +43,12 @@ static Coordinates molodensky(const Coordinates &c, const Datum &from,
|
|||||||
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
|
return Coordinates(c.lon() + rad2deg(dlon), c.lat() + rad2deg(dlat));
|
||||||
}
|
}
|
||||||
|
|
||||||
Datum::Datum(const Ellipsoid *ellipsoid, double dx, double dy,
|
Datum::Datum(const Ellipsoid *ellipsoid, double dx, double dy, double dz)
|
||||||
double dz) : _ellipsoid(ellipsoid), _dx(dx), _dy(dy), _dz(dz)
|
: _ellipsoid(ellipsoid), _dx(dx), _dy(dy), _dz(dz)
|
||||||
{
|
{
|
||||||
_WGS84 = (*_ellipsoid == *WGS84.ellipsoid() && _dx == WGS84.dx()
|
_WGS84 = (_ellipsoid->radius() == WGS84_RADIUS
|
||||||
&& _dy == WGS84.dy() && _dz == WGS84.dz()) ? true : false;
|
&& _ellipsoid->flattening() == WGS84_FLATTENING && _dx == 0.0
|
||||||
|
&& _dy == 0.0 && _dz == 0.0) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Coordinates Datum::toWGS84(const Coordinates &c) const
|
Coordinates Datum::toWGS84(const Coordinates &c) const
|
||||||
|
Reference in New Issue
Block a user