1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-03 22:39:15 +02:00

Compare commits

..

38 Commits
4.16 ... 4.18

Author SHA1 Message Date
5e74642dc8 Version++ 2018-01-06 21:53:13 +01:00
b1d1cae9dd Added support for negative altitude values.
Fixes #46
2018-01-06 21:51:07 +01:00
de2278ba04 Update gpxsee_sv.ts (#44)
New strings translated
2018-01-05 09:34:40 +01:00
e90f152432 Report correct file in error message 2018-01-05 00:06:07 +01:00
8deab1c9ca 6 + the leading A of course... 2018-01-04 17:36:22 +01:00
51e0f9a9c6 A records must only be >= 6, not 9
Fixes #42
2018-01-01 20:59:25 +01:00
e330abe180 Report the correct file on error 2017-12-23 11:10:39 +01:00
53a4b45b7b Fixed broken scene centering in some resize cases 2017-12-07 21:05:00 +01:00
53229681d2 Translations update 2017-12-03 16:52:12 +01:00
b2df7d207f Version++ 2017-12-03 14:21:52 +01:00
1ff2162811 Added the "always show map" option 2017-12-03 14:18:41 +01:00
0f10c7596b Removed some more unneeded code 2017-12-03 13:37:18 +01:00
4cc3bc28e2 Do not clear the image cache between files 2017-12-03 13:07:52 +01:00
3ce1918645 Speed up the osx build 2017-12-03 12:11:54 +01:00
d70f0cf9e0 Added missing QT path on OS X 2017-12-03 12:05:21 +01:00
34c5ba4669 Fixed typos 2017-12-03 11:52:41 +01:00
afbb8c3284 Added Travis CI OS X build 2017-12-03 11:20:30 +01:00
5bdc263cda Moved all the map bounds checking where it belongs 2017-12-03 10:41:07 +01:00
179f2f1451 Removed obsolete code 2017-12-03 10:24:24 +01:00
92e772a02b Fixed some corner case map drawing issues 2017-12-03 10:17:29 +01:00
cbdfe4c105 Added slider/marker color setting 2017-12-03 00:36:52 +01:00
a20a268975 includes cleanup 2017-12-02 20:33:29 +01:00
48e972f920 Include paths unification 2017-12-02 20:28:53 +01:00
c38f50538e Do not use the alpha channel for graphs 2017-12-02 18:24:44 +01:00
53147b5e6e Code cleanup 2017-12-01 22:24:04 +01:00
6c6e384862 Some more code cleanup 2017-12-01 21:27:12 +01:00
90b780a444 Code cleanup 2017-12-01 20:52:34 +01:00
56d1ac7ff2 Fixed broken zoom handling 2017-12-01 19:54:04 +01:00
00acd48009 Fixed some more track display corner cases + refactoring 2017-12-01 00:22:16 +01:00
e30078a63e Code cleanup 2017-11-27 23:50:55 +01:00
51c0c31838 Fixed broken map scale computation 2017-11-27 08:48:37 +01:00
bc218c9f65 Moved the datums initialization where it belongs 2017-11-26 22:52:50 +01:00
56e4c80999 Project structure refactoring 2017-11-26 18:54:03 +01:00
443b916301 Optimization 2017-11-19 23:01:17 +01:00
8675a0e945 Made the Lambert azimuthal equal-area projection naming consistent with other projections namings 2017-11-14 23:30:25 +01:00
0894fb0ddf Added support for Lambert Azimuthal Equal Area projections 2017-11-14 22:17:59 +01:00
73e15f8f11 Includes cleanup 2017-11-14 22:17:09 +01:00
0fe7843e52 Added debug output for tiles 2017-11-14 22:15:46 +01:00
190 changed files with 2159 additions and 1780 deletions

View File

@ -1,4 +1,4 @@
version: 4.16.{build}
version: 4.18.{build}
configuration: Release
platform: Any CPU
environment:

View File

@ -1,9 +1,18 @@
language: c++
os:
- linux
- osx
before_install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get -qq update; fi
install:
- sudo apt-get install libqt4-dev
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install qt; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install libqt4-dev; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then PATH=/usr/local/opt/qt/bin/:${PATH}; fi
- lrelease gpxsee.pro
- qmake gpxsee.pro
- make

View File

@ -1,5 +1,5 @@
TARGET = GPXSee
VERSION = 4.16
VERSION = 4.18
QT += core \
gui \
network
@ -7,179 +7,182 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
greaterThan(QT_MAJOR_VERSION, 4): QT += printsupport
lessThan(QT_VERSION, 5.4): QT += opengl
macx: QT += opengl
INCLUDEPATH += ./src
HEADERS += src/config.h \
src/icons.h \
src/gui.h \
src/poi.h \
src/rtree.h \
src/axisitem.h \
src/keys.h \
src/slideritem.h \
src/markeritem.h \
src/infoitem.h \
src/elevationgraph.h \
src/speedgraph.h \
src/sliderinfoitem.h \
src/filebrowser.h \
src/map.h \
src/onlinemap.h \
src/downloader.h \
src/units.h \
src/scaleitem.h \
src/waypoint.h \
src/track.h \
src/graphview.h \
src/trackpoint.h \
src/waypointitem.h \
src/palette.h \
src/heartrategraph.h \
src/range.h \
src/cpuarch.h \
src/settings.h \
src/app.h \
src/trackinfo.h \
src/exportdialog.h \
src/fileselectwidget.h \
src/margins.h \
src/temperaturegraph.h \
src/graphtab.h \
src/misc.h \
src/trackitem.h \
src/tooltip.h \
src/route.h \
src/routeitem.h \
src/graphitem.h \
src/graph.h \
src/pathitem.h \
src/pathview.h \
src/griditem.h \
src/data.h \
src/gpxparser.h \
src/tcxparser.h \
src/parser.h \
src/csvparser.h \
src/coordinates.h \
src/tile.h \
src/rd.h \
src/wgs84.h \
src/kmlparser.h \
src/trackdata.h \
src/routedata.h \
src/fitparser.h \
src/format.h \
src/path.h \
src/assert.h \
src/cadencegraph.h \
src/powergraph.h \
src/igcparser.h \
src/nmeaparser.h \
src/optionsdialog.h \
src/colorbox.h \
src/stylecombobox.h \
src/opengl.h \
src/timetype.h \
src/emptymap.h \
src/offlinemap.h \
src/matrix.h \
src/tar.h \
src/atlas.h \
src/projection.h \
src/mercator.h \
src/transversemercator.h \
src/latlon.h \
src/utm.h \
src/lambertconic.h \
src/ellipsoid.h \
src/ozf.h \
src/datum.h \
src/maplist.h \
src/albersequal.h \
src/oddspinbox.h \
src/rectc.h \
src/searchpointer.h \
src/percentslider.h \
src/elevationgraphitem.h \
src/speedgraphitem.h \
src/heartrategraphitem.h \
src/temperaturegraphitem.h \
src/cadencegraphitem.h \
src/powergraphitem.h
src/common/staticassert.h \
src/common/coordinates.h \
src/common/range.h \
src/common/rectc.h \
src/common/wgs84.h \
src/GUI/app.h \
src/GUI/icons.h \
src/GUI/gui.h \
src/GUI/axisitem.h \
src/GUI/keys.h \
src/GUI/slideritem.h \
src/GUI/markeritem.h \
src/GUI/infoitem.h \
src/GUI/elevationgraph.h \
src/GUI/speedgraph.h \
src/GUI/sliderinfoitem.h \
src/GUI/filebrowser.h \
src/GUI/units.h \
src/GUI/scaleitem.h \
src/GUI/graphview.h \
src/GUI/waypointitem.h \
src/GUI/palette.h \
src/GUI/heartrategraph.h \
src/GUI/trackinfo.h \
src/GUI/exportdialog.h \
src/GUI/fileselectwidget.h \
src/GUI/margins.h \
src/GUI/temperaturegraph.h \
src/GUI/graphtab.h \
src/GUI/trackitem.h \
src/GUI/tooltip.h \
src/GUI/routeitem.h \
src/GUI/graphitem.h \
src/GUI/pathitem.h \
src/GUI/griditem.h \
src/GUI/format.h \
src/GUI/cadencegraph.h \
src/GUI/powergraph.h \
src/GUI/optionsdialog.h \
src/GUI/colorbox.h \
src/GUI/stylecombobox.h \
src/GUI/opengl.h \
src/GUI/timetype.h \
src/GUI/percentslider.h \
src/GUI/elevationgraphitem.h \
src/GUI/speedgraphitem.h \
src/GUI/heartrategraphitem.h \
src/GUI/temperaturegraphitem.h \
src/GUI/cadencegraphitem.h \
src/GUI/powergraphitem.h \
src/GUI/oddspinbox.h \
src/GUI/settings.h \
src/GUI/nicenum.h \
src/GUI/cpuarch.h \
src/GUI/searchpointer.h \
src/GUI/mapview.h \
src/map/projection.h \
src/map/ellipsoid.h \
src/map/datum.h \
src/map/mercator.h \
src/map/transversemercator.h \
src/map/latlon.h \
src/map/utm.h \
src/map/lambertconic.h \
src/map/lambertazimuthal.h \
src/map/albersequal.h \
src/map/map.h \
src/map/maplist.h \
src/map/onlinemap.h \
src/map/downloader.h \
src/map/tile.h \
src/map/emptymap.h \
src/map/offlinemap.h \
src/map/tar.h \
src/map/ozf.h \
src/map/atlas.h \
src/map/matrix.h \
src/map/misc.h \
src/data/graph.h \
src/data/poi.h \
src/data/waypoint.h \
src/data/track.h \
src/data/route.h \
src/data/trackpoint.h \
src/data/data.h \
src/data/parser.h \
src/data/trackdata.h \
src/data/routedata.h \
src/data/path.h \
src/data/rtree.h \
src/data/gpxparser.h \
src/data/tcxparser.h \
src/data/csvparser.h \
src/data/kmlparser.h \
src/data/fitparser.h \
src/data/igcparser.h \
src/data/nmeaparser.h \
src/data/str2int.h
SOURCES += src/main.cpp \
src/gui.cpp \
src/poi.cpp \
src/axisitem.cpp \
src/slideritem.cpp \
src/markeritem.cpp \
src/infoitem.cpp \
src/elevationgraph.cpp \
src/speedgraph.cpp \
src/sliderinfoitem.cpp \
src/filebrowser.cpp \
src/onlinemap.cpp \
src/downloader.cpp \
src/scaleitem.cpp \
src/track.cpp \
src/graphview.cpp \
src/waypointitem.cpp \
src/palette.cpp \
src/heartrategraph.cpp \
src/range.cpp \
src/app.cpp \
src/trackinfo.cpp \
src/exportdialog.cpp \
src/fileselectwidget.cpp \
src/temperaturegraph.cpp \
src/trackpoint.cpp \
src/misc.cpp \
src/waypoint.cpp \
src/trackitem.cpp \
src/tooltip.cpp \
src/route.cpp \
src/routeitem.cpp \
src/graphitem.cpp \
src/pathitem.cpp \
src/pathview.cpp \
src/griditem.cpp \
src/data.cpp \
src/gpxparser.cpp \
src/tcxparser.cpp \
src/csvparser.cpp \
src/coordinates.cpp \
src/kmlparser.cpp \
src/fitparser.cpp \
src/format.cpp \
src/graph.cpp \
src/cadencegraph.cpp \
src/powergraph.cpp \
src/igcparser.cpp \
src/path.cpp \
src/nmeaparser.cpp \
src/optionsdialog.cpp \
src/colorbox.cpp \
src/stylecombobox.cpp \
src/emptymap.cpp \
src/offlinemap.cpp \
src/matrix.cpp \
src/tar.cpp \
src/atlas.cpp \
src/mercator.cpp \
src/transversemercator.cpp \
src/utm.cpp \
src/lambertconic.cpp \
src/ellipsoid.cpp \
src/ozf.cpp \
src/datum.cpp \
src/maplist.cpp \
src/albersequal.cpp \
src/oddspinbox.cpp \
src/rectc.cpp \
src/percentslider.cpp \
src/elevationgraphitem.cpp \
src/speedgraphitem.cpp \
src/heartrategraphitem.cpp \
src/temperaturegraphitem.cpp \
src/cadencegraphitem.cpp \
src/powergraphitem.cpp
src/common/coordinates.cpp \
src/common/rectc.cpp \
src/common/range.cpp \
src/GUI/app.cpp \
src/GUI/gui.cpp \
src/GUI/axisitem.cpp \
src/GUI/slideritem.cpp \
src/GUI/markeritem.cpp \
src/GUI/infoitem.cpp \
src/GUI/elevationgraph.cpp \
src/GUI/speedgraph.cpp \
src/GUI/sliderinfoitem.cpp \
src/GUI/filebrowser.cpp \
src/GUI/scaleitem.cpp \
src/GUI/graphview.cpp \
src/GUI/waypointitem.cpp \
src/GUI/palette.cpp \
src/GUI/heartrategraph.cpp \
src/GUI/trackinfo.cpp \
src/GUI/exportdialog.cpp \
src/GUI/fileselectwidget.cpp \
src/GUI/temperaturegraph.cpp \
src/GUI/trackitem.cpp \
src/GUI/tooltip.cpp \
src/GUI/routeitem.cpp \
src/GUI/graphitem.cpp \
src/GUI/pathitem.cpp \
src/GUI/griditem.cpp \
src/GUI/format.cpp \
src/GUI/cadencegraph.cpp \
src/GUI/powergraph.cpp \
src/GUI/optionsdialog.cpp \
src/GUI/colorbox.cpp \
src/GUI/stylecombobox.cpp \
src/GUI/oddspinbox.cpp \
src/GUI/percentslider.cpp \
src/GUI/elevationgraphitem.cpp \
src/GUI/speedgraphitem.cpp \
src/GUI/heartrategraphitem.cpp \
src/GUI/temperaturegraphitem.cpp \
src/GUI/cadencegraphitem.cpp \
src/GUI/powergraphitem.cpp \
src/GUI/nicenum.cpp \
src/GUI/mapview.cpp \
src/map/maplist.cpp \
src/map/onlinemap.cpp \
src/map/downloader.cpp \
src/map/emptymap.cpp \
src/map/offlinemap.cpp \
src/map/tar.cpp \
src/map/atlas.cpp \
src/map/ozf.cpp \
src/map/matrix.cpp \
src/map/ellipsoid.cpp \
src/map/datum.cpp \
src/map/projection.cpp \
src/map/mercator.cpp \
src/map/transversemercator.cpp \
src/map/utm.cpp \
src/map/lambertconic.cpp \
src/map/albersequal.cpp \
src/map/lambertazimuthal.cpp \
src/data/data.cpp \
src/data/poi.cpp \
src/data/track.cpp \
src/data/route.cpp \
src/data/path.cpp \
src/data/gpxparser.cpp \
src/data/tcxparser.cpp \
src/data/csvparser.cpp \
src/data/kmlparser.cpp \
src/data/fitparser.cpp \
src/data/igcparser.cpp \
src/data/nmeaparser.cpp \
src/data/str2int.cpp
RESOURCES += gpxsee.qrc
TRANSLATIONS = lang/gpxsee_cs.ts \
lang/gpxsee_sv.ts \

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

View File

@ -5,7 +5,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "4.16"
!define VERSION "4.18"
; The file to write
OutFile "GPXSee-${VERSION}.exe"

View File

@ -5,7 +5,7 @@
; The name of the installer
Name "GPXSee"
; Program version
!define VERSION "4.16"
!define VERSION "4.18"
; The file to write
OutFile "GPXSee-${VERSION}_x64.exe"

109
src/GUI/app.cpp Normal file
View File

@ -0,0 +1,109 @@
#include <QtGlobal>
#include <QTranslator>
#include <QLocale>
#include <QFileOpenEvent>
#include <QNetworkProxyFactory>
#include <QLibraryInfo>
#include "map/onlinemap.h"
#include "map/downloader.h"
#include "map/ellipsoid.h"
#include "map/datum.h"
#include "opengl.h"
#include "gui.h"
#include "config.h"
#include "app.h"
App::App(int &argc, char **argv) : QApplication(argc, argv),
_argc(argc), _argv(argv)
{
QTranslator *gpxsee = new QTranslator(this);
QString locale = QLocale::system().name();
gpxsee->load(QString(":/lang/gpxsee_") + locale);
installTranslator(gpxsee);
QTranslator *qt = new QTranslator(this);
qt->load(QLocale::system(), "qt", "_", QLibraryInfo::location(
QLibraryInfo::TranslationsPath));
installTranslator(qt);
#ifdef Q_OS_MAC
setAttribute(Qt::AA_DontShowIconsInMenus);
#endif // Q_OS_MAC
QNetworkProxyFactory::setUseSystemConfiguration(true);
OnlineMap::setDownloader(new Downloader(this));
OPENGL_SET_SAMPLES(4);
loadDatums();
_gui = new GUI();
}
App::~App()
{
delete _gui;
}
void App::run()
{
_gui->show();
for (int i = 1; i < _argc; i++)
_gui->openFile(QString::fromLocal8Bit(_argv[i]));
exec();
}
bool App::event(QEvent *event)
{
if (event->type() == QEvent::FileOpen) {
QFileOpenEvent *e = static_cast<QFileOpenEvent *>(event);
return _gui->openFile(e->file());
}
return QApplication::event(event);
}
void App::loadDatums()
{
QString ef, df;
bool ok = false;
if (QFile::exists(USER_ELLIPSOID_FILE))
ef = USER_ELLIPSOID_FILE;
else if (QFile::exists(GLOBAL_ELLIPSOID_FILE))
ef = GLOBAL_ELLIPSOID_FILE;
else
qWarning("No ellipsoids file found.");
if (QFile::exists(USER_DATUM_FILE))
df = USER_DATUM_FILE;
else if (QFile::exists(GLOBAL_DATUM_FILE))
df = GLOBAL_DATUM_FILE;
else
qWarning("No datums file found.");
if (!ef.isNull() && !df.isNull()) {
if (!Ellipsoid::loadList(ef)) {
if (Ellipsoid::errorLine())
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
Ellipsoid::errorLine(), qPrintable(Ellipsoid::errorString()));
else
qWarning("%s: %s", qPrintable(ef), qPrintable(
Ellipsoid::errorString()));
} else {
if (!Datum::loadList(df)) {
if (Datum::errorLine())
qWarning("%s: parse error on line %d: %s", qPrintable(df),
Datum::errorLine(), qPrintable(Datum::errorString()));
else
qWarning("%s: %s", qPrintable(df), qPrintable(
Datum::errorString()));
} else
ok = true;
}
}
if (!ok)
qWarning("Maps based on a datum different from WGS84 won't work.");
}

View File

@ -18,6 +18,8 @@ protected:
bool event(QEvent *event);
private:
void loadDatums();
int &_argc;
char **_argv;
GUI *_gui;

View File

@ -1,7 +1,7 @@
#include <cmath>
#include <QPainter>
#include "config.h"
#include "misc.h"
#include "nicenum.h"
#include "axisitem.h"

View File

@ -2,7 +2,7 @@
#define AXISITEM_H
#include <QGraphicsItem>
#include "range.h"
#include "common/range.h"
class AxisItem : public QGraphicsItem
{

View File

@ -1,4 +1,4 @@
#include "data.h"
#include "data/data.h"
#include "cadencegraphitem.h"
#include "cadencegraph.h"

View File

@ -1,6 +1,6 @@
#include <cmath>
#include "data/data.h"
#include "config.h"
#include "data.h"
#include "tooltip.h"
#include "elevationgraphitem.h"
#include "elevationgraph.h"

View File

@ -1,5 +1,5 @@
#include <QApplication>
#include "coordinates.h"
#include "common/coordinates.h"
#include "format.h"
QString Format::timeSpan(qreal time, bool full)

View File

@ -3,8 +3,8 @@
#include <QGraphicsObject>
#include <QPen>
#include "data/graph.h"
#include "units.h"
#include "graph.h"
class GraphItem : public QGraphicsObject
{

View File

@ -3,6 +3,7 @@
#include <QMouseEvent>
#include <QPaintEngine>
#include <QPaintDevice>
#include "data/graph.h"
#include "opengl.h"
#include "config.h"
#include "axisitem.h"
@ -10,7 +11,6 @@
#include "sliderinfoitem.h"
#include "infoitem.h"
#include "griditem.h"
#include "graph.h"
#include "graphitem.h"
#include "pathitem.h"
#include "format.h"
@ -181,9 +181,12 @@ void GraphView::showSliderInfo(bool show)
void GraphView::addGraph(GraphItem *graph, PathItem *path, int id)
{
QColor color(_palette.nextColor());
color.setAlpha(255);
graph->setUnits(_units);
graph->setId(id);
graph->setColor(_palette.nextColor());
graph->setColor(color);
graph->setWidth(_width);
connect(this, SIGNAL(sliderPositionChanged(qreal)), graph,
@ -458,8 +461,11 @@ void GraphView::setPalette(const Palette &palette)
_palette = palette;
_palette.reset();
for (int i = 0; i < _graphs.count(); i++)
_graphs.at(i)->setColor(_palette.nextColor());
for (int i = 0; i < _graphs.count(); i++) {
QColor color(_palette.nextColor());
color.setAlpha(255);
_graphs.at(i)->setColor(color);
}
}
void GraphView::setGraphWidth(int width)
@ -484,3 +490,9 @@ void GraphView::useAntiAliasing(bool use)
{
setRenderHint(QPainter::Antialiasing, use);
}
void GraphView::setSliderColor(const QColor &color)
{
_slider->setColor(color);
_sliderInfo->setColor(color);
}

View File

@ -4,7 +4,7 @@
#include <QGraphicsView>
#include <QList>
#include <QSet>
#include "graph.h"
#include "data/graph.h"
#include "palette.h"
#include "units.h"
@ -38,6 +38,7 @@ public:
void useAntiAliasing(bool use);
void setSliderPosition(qreal pos);
void setSliderColor(const QColor &color);
signals:
void sliderPositionChanged(qreal);

View File

@ -22,23 +22,20 @@
#include <QMimeData>
#include <QUrl>
#include <QPixmapCache>
#include "data/data.h"
#include "map/maplist.h"
#include "map/emptymap.h"
#include "config.h"
#include "icons.h"
#include "keys.h"
#include "settings.h"
#include "data.h"
#include "ellipsoid.h"
#include "datum.h"
#include "map.h"
#include "maplist.h"
#include "emptymap.h"
#include "elevationgraph.h"
#include "speedgraph.h"
#include "heartrategraph.h"
#include "temperaturegraph.h"
#include "cadencegraph.h"
#include "powergraph.h"
#include "pathview.h"
#include "mapview.h"
#include "trackinfo.h"
#include "filebrowser.h"
#include "cpuarch.h"
@ -49,11 +46,10 @@
GUI::GUI()
{
loadDatums();
loadMaps();
loadPOIs();
createPathView();
createMapView();
createGraphTabs();
createStatusBar();
createActions();
@ -65,7 +61,7 @@ GUI::GUI()
QSplitter *splitter = new QSplitter();
splitter->setOrientation(Qt::Vertical);
splitter->setChildrenCollapsible(false);
splitter->addWidget(_pathView);
splitter->addWidget(_mapView);
splitter->addWidget(_graphTabWidget);
splitter->setContentsMargins(0, 0, 0, 0);
splitter->setStretchFactor(0, 255);
@ -87,11 +83,11 @@ GUI::GUI()
_sliderPos = 0;
updateGraphTabs();
updatePathView();
updateStatusBarInfo();
readSettings();
updateGraphTabs();
updateMapView();
updateStatusBarInfo();
}
GUI::~GUI()
@ -102,50 +98,6 @@ GUI::~GUI()
}
}
void GUI::loadDatums()
{
QString ef, df;
bool ok = false;
if (QFile::exists(USER_ELLIPSOID_FILE))
ef = USER_ELLIPSOID_FILE;
else if (QFile::exists(GLOBAL_ELLIPSOID_FILE))
ef = GLOBAL_ELLIPSOID_FILE;
else
qWarning("No ellipsoids file found.");
if (QFile::exists(USER_DATUM_FILE))
df = USER_DATUM_FILE;
else if (QFile::exists(GLOBAL_DATUM_FILE))
df = GLOBAL_DATUM_FILE;
else
qWarning("No datums file found.");
if (!ef.isNull() && !df.isNull()) {
if (!Ellipsoid::loadList(ef)) {
if (Ellipsoid::errorLine())
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
Ellipsoid::errorLine(), qPrintable(Ellipsoid::errorString()));
else
qWarning("%s: %s", qPrintable(ef), qPrintable(
Ellipsoid::errorString()));
} else {
if (!Datum::loadList(df)) {
if (Datum::errorLine())
qWarning("%s: parse error on line %d: %s", qPrintable(ef),
Datum::errorLine(), qPrintable(Datum::errorString()));
else
qWarning("%s: %s", qPrintable(ef), qPrintable(
Datum::errorString()));
} else
ok = true;
}
}
if (!ok)
qWarning("Maps based on a datum different from WGS84 won't work.");
}
void GUI::loadMaps()
{
_ml = new MapList(this);
@ -334,17 +286,17 @@ void GUI::createActions()
connect(_closePOIAction, SIGNAL(triggered()), this, SLOT(closePOIFiles()));
_overlapPOIAction = new QAction(tr("Overlap POIs"), this);
_overlapPOIAction->setCheckable(true);
connect(_overlapPOIAction, SIGNAL(triggered(bool)), _pathView,
connect(_overlapPOIAction, SIGNAL(triggered(bool)), _mapView,
SLOT(setPOIOverlap(bool)));
_showPOILabelsAction = new QAction(tr("Show POI labels"), this);
_showPOILabelsAction->setCheckable(true);
connect(_showPOILabelsAction, SIGNAL(triggered(bool)), _pathView,
connect(_showPOILabelsAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showPOILabels(bool)));
_showPOIAction = new QAction(QIcon(QPixmap(SHOW_POI_ICON)),
tr("Show POIs"), this);
_showPOIAction->setCheckable(true);
_showPOIAction->setShortcut(SHOW_POI_SHORTCUT);
connect(_showPOIAction, SIGNAL(triggered(bool)), _pathView,
connect(_showPOIAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showPOI(bool)));
addAction(_showPOIAction);
createPOIFilesActions();
@ -354,14 +306,14 @@ void GUI::createActions()
this);
_showMapAction->setCheckable(true);
_showMapAction->setShortcut(SHOW_MAP_SHORTCUT);
connect(_showMapAction, SIGNAL(triggered(bool)), _pathView,
connect(_showMapAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showMap(bool)));
addAction(_showMapAction);
_loadMapAction = new QAction(QIcon(QPixmap(OPEN_FILE_ICON)),
tr("Load map..."), this);
connect(_loadMapAction, SIGNAL(triggered()), this, SLOT(loadMap()));
_clearMapCacheAction = new QAction(tr("Clear tile cache"), this);
connect(_clearMapCacheAction, SIGNAL(triggered()), _pathView,
connect(_clearMapCacheAction, SIGNAL(triggered()), _mapView,
SLOT(clearMapCache()));
createMapActions();
_nextMapAction = new QAction(tr("Next map"), this);
@ -388,15 +340,15 @@ void GUI::createActions()
SLOT(showRoutes(bool)));
_showWaypointsAction = new QAction(tr("Show waypoints"), this);
_showWaypointsAction->setCheckable(true);
connect(_showWaypointsAction, SIGNAL(triggered(bool)), _pathView,
connect(_showWaypointsAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showWaypoints(bool)));
_showWaypointLabelsAction = new QAction(tr("Waypoint labels"), this);
_showWaypointLabelsAction->setCheckable(true);
connect(_showWaypointLabelsAction, SIGNAL(triggered(bool)), _pathView,
connect(_showWaypointLabelsAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showWaypointLabels(bool)));
_showRouteWaypointsAction = new QAction(tr("Route waypoints"), this);
_showRouteWaypointsAction->setCheckable(true);
connect(_showRouteWaypointsAction, SIGNAL(triggered(bool)), _pathView,
connect(_showRouteWaypointsAction, SIGNAL(triggered(bool)), _mapView,
SLOT(showRouteWaypoints(bool)));
// Graph actions
@ -586,14 +538,14 @@ void GUI::createToolBars()
_navigationToolBar->addAction(_lastAction);
}
void GUI::createPathView()
void GUI::createMapView()
{
_pathView = new PathView(_map, _poi, this);
_pathView->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,
_mapView = new MapView(_map, _poi, this);
_mapView->setSizePolicy(QSizePolicy(QSizePolicy::Ignored,
QSizePolicy::Expanding));
_pathView->setMinimumHeight(200);
_mapView->setMinimumHeight(200);
#ifdef Q_OS_WIN32
_pathView->setFrameShape(QFrame::NoFrame);
_mapView->setFrameShape(QFrame::NoFrame);
#endif // Q_OS_WIN32
}
@ -755,7 +707,7 @@ bool GUI::openFile(const QString &fileName)
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updatePathView();
updateMapView();
} else {
if (_files.isEmpty())
_fileActionGroup->setEnabled(false);
@ -771,7 +723,7 @@ bool GUI::loadFile(const QString &fileName)
QList<PathItem*> paths;
if (data.loadFile(fileName)) {
paths = _pathView->loadData(data);
paths = _mapView->loadData(data);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->loadData(data, paths);
@ -807,7 +759,7 @@ bool GUI::loadFile(const QString &fileName)
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updatePathView();
updateMapView();
QString error = tr("Error loading data file:") + "\n\n"
+ fileName + "\n\n" + data.errorString();
@ -842,7 +794,7 @@ bool GUI::openPOIFile(const QString &fileName)
return false;
} else {
_pathView->showPOI(true);
_mapView->showPOI(true);
_showPOIAction->setChecked(true);
QAction *action = createPOIFileAction(_poi->files().indexOf(fileName));
action->setChecked(true);
@ -867,7 +819,7 @@ void GUI::openOptions()
{
#define SET_VIEW_OPTION(option, action) \
if (options.option != _options.option) \
_pathView->action(options.option)
_mapView->action(options.option)
#define SET_TAB_OPTION(option, action) \
if (options.option != _options.option) \
for (int i = 0; i < _tabs.count(); i++) \
@ -898,11 +850,13 @@ void GUI::openOptions()
SET_VIEW_OPTION(poiColor, setPOIColor);
SET_VIEW_OPTION(pathAntiAliasing, useAntiAliasing);
SET_VIEW_OPTION(useOpenGL, useOpenGL);
SET_VIEW_OPTION(sliderColor, setMarkerColor);
SET_TAB_OPTION(palette, setPalette);
SET_TAB_OPTION(graphWidth, setGraphWidth);
SET_TAB_OPTION(graphAntiAliasing, useAntiAliasing);
SET_TAB_OPTION(useOpenGL, useOpenGL);
SET_TAB_OPTION(sliderColor, setSliderColor);
SET_TRACK_OPTION(elevationFilter, setElevationFilter);
SET_TRACK_OPTION(speedFilter, setSpeedFilter);
@ -922,6 +876,8 @@ void GUI::openOptions()
reloadFile();
_options = options;
updateMapView();
}
void GUI::printFile()
@ -966,11 +922,11 @@ void GUI::plot(QPrinter *printer)
info.insert(tr("Name"), _pathName);
if (_options.printItemCount) {
if (_trackCount > 1)
if (_showTracksAction->isChecked() && _trackCount > 1)
info.insert(tr("Tracks"), QString::number(_trackCount));
if (_routeCount > 1)
if (_showRoutesAction->isChecked() && _routeCount > 1)
info.insert(tr("Routes"), QString::number(_routeCount));
if (_waypointCount > 2)
if (_showWaypointsAction->isChecked() && _waypointCount > 2)
info.insert(tr("Waypoints"), QString::number(_waypointCount));
}
@ -1014,7 +970,7 @@ void GUI::plot(QPrinter *printer)
ratio);
} else
gh = 0;
_pathView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
_mapView->plot(&p, QRectF(0, ih + mh, printer->width(), printer->height()
- (ih + 2*mh + gh)), ratio, _options.hiresPrint);
if (_graphTabWidget->isVisible() && _options.separateGraphPage) {
@ -1054,7 +1010,7 @@ void GUI::reloadFile()
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->clear();
_pathView->clear();
_mapView->clear();
_sliderPos = 0;
@ -1068,7 +1024,7 @@ void GUI::reloadFile()
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updatePathView();
updateMapView();
if (_files.isEmpty())
_fileActionGroup->setEnabled(false);
else
@ -1091,7 +1047,7 @@ void GUI::closeFiles()
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->clear();
_pathView->clear();
_mapView->clear();
_files.clear();
}
@ -1104,7 +1060,7 @@ void GUI::closeAll()
updateStatusBarInfo();
updateWindowTitle();
updateGraphTabs();
updatePathView();
updateMapView();
}
void GUI::showGraphs(bool show)
@ -1131,7 +1087,7 @@ void GUI::showToolbars(bool show)
void GUI::showFullscreen(bool show)
{
if (show) {
_frameStyle = _pathView->frameStyle();
_frameStyle = _mapView->frameStyle();
_showGraphs = _showGraphsAction->isChecked();
statusBar()->hide();
@ -1139,7 +1095,7 @@ void GUI::showFullscreen(bool show)
showToolbars(false);
showGraphs(false);
_showGraphsAction->setChecked(false);
_pathView->setFrameStyle(QFrame::NoFrame);
_mapView->setFrameStyle(QFrame::NoFrame);
showFullScreen();
} else {
@ -1150,7 +1106,7 @@ void GUI::showFullscreen(bool show)
_showGraphsAction->setChecked(_showGraphs);
if (_showGraphsAction->isEnabled())
showGraphs(_showGraphs);
_pathView->setFrameStyle(_frameStyle);
_mapView->setFrameStyle(_frameStyle);
showNormal();
}
@ -1158,22 +1114,24 @@ void GUI::showFullscreen(bool show)
void GUI::showTracks(bool show)
{
_pathView->showTracks(show);
_mapView->showTracks(show);
for (int i = 0; i < _tabs.size(); i++)
_tabs.at(i)->showTracks(show);
updateStatusBarInfo();
updateGraphTabs();
}
void GUI::showRoutes(bool show)
{
_pathView->showRoutes(show);
_mapView->showRoutes(show);
for (int i = 0; i < _tabs.size(); i++)
_tabs.at(i)->showRoutes(show);
updateStatusBarInfo();
updateGraphTabs();
}
void GUI::showGraphGrids(bool show)
@ -1258,7 +1216,7 @@ void GUI::updateWindowTitle()
void GUI::mapChanged(int index)
{
_map = _ml->maps().at(index);
_pathView->setMap(_map);
_mapView->setMap(_map);
}
void GUI::nextMap()
@ -1338,7 +1296,9 @@ void GUI::updateGraphTabs()
_graphTabWidget->insertTab(i, tab, _tabs.at(i)->label());
}
if (_graphTabWidget->count()) {
if (_graphTabWidget->count() &&
((_showTracksAction->isChecked() && _trackCount)
|| (_showRoutesAction->isChecked() && _routeCount))) {
if (_showGraphsAction->isChecked())
_graphTabWidget->setHidden(false);
_showGraphsAction->setEnabled(true);
@ -1348,10 +1308,12 @@ void GUI::updateGraphTabs()
}
}
void GUI::updatePathView()
void GUI::updateMapView()
{
_pathView->setHidden(!(_pathView->trackCount() + _pathView->routeCount()
+ _pathView->waypointCount()));
if (_options.alwaysShowMap)
_mapView->setHidden(false);
else
_mapView->setHidden(!(_trackCount + _routeCount + _waypointCount));
}
void GUI::setTimeType(TimeType type)
@ -1367,7 +1329,7 @@ void GUI::setUnits(Units units)
_export.units = units;
_options.units = units;
_pathView->setUnits(units);
_mapView->setUnits(units);
for (int i = 0; i <_tabs.count(); i++)
_tabs.at(i)->setUnits(units);
updateStatusBarInfo();
@ -1672,6 +1634,10 @@ void GUI::writeSettings()
if (_options.separateGraphPage != SEPARATE_GRAPH_PAGE_DEFAULT)
settings.setValue(SEPARATE_GRAPH_PAGE_SETTING,
_options.separateGraphPage);
if (_options.sliderColor != SLIDER_COLOR_DEFAULT)
settings.setValue(SLIDER_COLOR_SETTING, _options.sliderColor);
if (_options.alwaysShowMap != ALWAYS_SHOW_MAP_DEFAULT)
settings.setValue(ALWAYS_SHOW_MAP_SETTING, _options.alwaysShowMap);
settings.endGroup();
}
@ -1740,17 +1706,17 @@ void GUI::readSettings()
settings.beginGroup(POI_SETTINGS_GROUP);
if (!settings.value(OVERLAP_POI_SETTING, OVERLAP_POI_DEFAULT).toBool())
_pathView->setPOIOverlap(false);
_mapView->setPOIOverlap(false);
else
_overlapPOIAction->setChecked(true);
if (!settings.value(LABELS_POI_SETTING, LABELS_POI_DEFAULT).toBool())
_pathView->showPOILabels(false);
_mapView->showPOILabels(false);
else
_showPOILabelsAction->setChecked(true);
if (settings.value(SHOW_POI_SETTING, SHOW_POI_DEFAULT).toBool())
_showPOIAction->setChecked(true);
else
_pathView->showPOI(false);
_mapView->showPOI(false);
for (int i = 0; i < _poiFilesActions.count(); i++)
_poiFilesActions.at(i)->setChecked(true);
int size = settings.beginReadArray(DISABLED_POI_FILE_SETTINGS_PREFIX);
@ -1768,30 +1734,30 @@ void GUI::readSettings()
settings.beginGroup(DATA_SETTINGS_GROUP);
if (!settings.value(SHOW_TRACKS_SETTING, SHOW_TRACKS_DEFAULT).toBool()) {
_pathView->showTracks(false);
_mapView->showTracks(false);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->showTracks(false);
} else
_showTracksAction->setChecked(true);
if (!settings.value(SHOW_ROUTES_SETTING, SHOW_ROUTES_DEFAULT).toBool()) {
_pathView->showRoutes(false);
_mapView->showRoutes(false);
for (int i = 0; i < _tabs.count(); i++)
_tabs.at(i)->showRoutes(false);
} else
_showRoutesAction->setChecked(true);
if (!settings.value(SHOW_WAYPOINTS_SETTING, SHOW_WAYPOINTS_DEFAULT)
.toBool())
_pathView->showWaypoints(false);
_mapView->showWaypoints(false);
else
_showWaypointsAction->setChecked(true);
if (!settings.value(SHOW_WAYPOINT_LABELS_SETTING,
SHOW_WAYPOINT_LABELS_DEFAULT).toBool())
_pathView->showWaypointLabels(false);
_mapView->showWaypointLabels(false);
else
_showWaypointLabelsAction->setChecked(true);
if (!settings.value(SHOW_ROUTE_WAYPOINTS_SETTING,
SHOW_ROUTE_WAYPOINTS_SETTING).toBool())
_pathView->showRouteWaypoints(false);
_mapView->showRouteWaypoints(false);
else
_showRouteWaypointsAction->setChecked(true);
settings.endGroup();
@ -1885,27 +1851,33 @@ void GUI::readSettings()
PRINT_ITEM_COUNT_DEFAULT).toBool();
_options.separateGraphPage = settings.value(SEPARATE_GRAPH_PAGE_SETTING,
SEPARATE_GRAPH_PAGE_DEFAULT).toBool();
_options.sliderColor = settings.value(SLIDER_COLOR_SETTING,
SLIDER_COLOR_DEFAULT).value<QColor>();
_options.alwaysShowMap = settings.value(ALWAYS_SHOW_MAP_SETTING,
ALWAYS_SHOW_MAP_DEFAULT).toBool();
_pathView->setPalette(_options.palette);
_pathView->setMapOpacity(_options.mapOpacity);
_pathView->setBackgroundColor(_options.backgroundColor);
_pathView->setTrackWidth(_options.trackWidth);
_pathView->setRouteWidth(_options.routeWidth);
_pathView->setTrackStyle(_options.trackStyle);
_pathView->setRouteStyle(_options.routeStyle);
_pathView->setWaypointSize(_options.waypointSize);
_pathView->setWaypointColor(_options.waypointColor);
_pathView->setPOISize(_options.poiSize);
_pathView->setPOIColor(_options.poiColor);
_pathView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
_mapView->setPalette(_options.palette);
_mapView->setMapOpacity(_options.mapOpacity);
_mapView->setBackgroundColor(_options.backgroundColor);
_mapView->setTrackWidth(_options.trackWidth);
_mapView->setRouteWidth(_options.routeWidth);
_mapView->setTrackStyle(_options.trackStyle);
_mapView->setRouteStyle(_options.routeStyle);
_mapView->setWaypointSize(_options.waypointSize);
_mapView->setWaypointColor(_options.waypointColor);
_mapView->setPOISize(_options.poiSize);
_mapView->setPOIColor(_options.poiColor);
_mapView->setRenderHint(QPainter::Antialiasing, _options.pathAntiAliasing);
_mapView->setMarkerColor(_options.sliderColor);
if (_options.useOpenGL)
_pathView->useOpenGL(true);
_mapView->useOpenGL(true);
for (int i = 0; i < _tabs.count(); i++) {
_tabs.at(i)->setPalette(_options.palette);
_tabs.at(i)->setGraphWidth(_options.graphWidth);
_tabs.at(i)->setRenderHint(QPainter::Antialiasing,
_options.graphAntiAliasing);
_tabs.at(i)->setSliderColor(_options.sliderColor);
if (_options.useOpenGL)
_tabs.at(i)->useOpenGL(true);
}

View File

@ -6,14 +6,13 @@
#include <QList>
#include <QDate>
#include <QPrinter>
#include "data/graph.h"
#include "data/poi.h"
#include "units.h"
#include "timetype.h"
#include "graph.h"
#include "poi.h"
#include "exportdialog.h"
#include "optionsdialog.h"
class QMenu;
class QToolBar;
class QTabWidget;
@ -24,7 +23,7 @@ class QSignalMapper;
class QPrinter;
class FileBrowser;
class GraphTab;
class PathView;
class MapView;
class Map;
class MapList;
@ -82,7 +81,6 @@ private slots:
private:
typedef QPair<QDate, QDate> DateRange;
void loadDatums();
void loadMaps();
void loadPOIs();
void closeFiles();
@ -95,7 +93,7 @@ private:
void createMenus();
void createToolBars();
void createStatusBar();
void createPathView();
void createMapView();
void createGraphTabs();
void createBrowser();
@ -106,7 +104,7 @@ private:
void updateWindowTitle();
void updateNavigationActions();
void updateGraphTabs();
void updatePathView();
void updateMapView();
TimeType timeType() const;
Units units() const;
@ -187,17 +185,17 @@ private:
QLabel *_distanceLabel;
QLabel *_timeLabel;
PathView *_pathView;
MapView *_mapView;
QTabWidget *_graphTabWidget;
QList<GraphTab*> _tabs;
POI *_poi;
MapList *_ml;
Map *_map;
FileBrowser *_browser;
QList<QString> _files;
Map *_map;
int _trackCount;
int _routeCount;
int _waypointCount;

View File

@ -1,4 +1,4 @@
#include "data.h"
#include "data/data.h"
#include "heartrategraphitem.h"
#include "heartrategraph.h"

View File

@ -4,17 +4,16 @@
#include <QApplication>
#include <QPixmapCache>
#include <QScrollBar>
#include "data/poi.h"
#include "data/data.h"
#include "map/map.h"
#include "opengl.h"
#include "misc.h"
#include "poi.h"
#include "data.h"
#include "map.h"
#include "trackitem.h"
#include "routeitem.h"
#include "waypointitem.h"
#include "scaleitem.h"
#include "keys.h"
#include "pathview.h"
#include "mapview.h"
#define MAX_DIGITAL_ZOOM 2
@ -22,7 +21,7 @@
#define MARGIN 10.0
#define SCALE_OFFSET 7
PathView::PathView(Map *map, POI *poi, QWidget *parent)
MapView::MapView(Map *map, POI *poi, QWidget *parent)
: QGraphicsView(parent)
{
Q_ASSERT(map != 0);
@ -52,6 +51,7 @@ PathView::PathView(Map *map, POI *poi, QWidget *parent)
_units = Metric;
_opacity = 1.0;
_backgroundColor = Qt::white;
_markerColor = Qt::red;
_showMap = true;
_showTracks = true;
@ -80,7 +80,7 @@ PathView::PathView(Map *map, POI *poi, QWidget *parent)
centerOn(_scene->sceneRect().center());
}
void PathView::centerOn(const QPointF &pos)
void MapView::centerOn(const QPointF &pos)
{
QGraphicsView::centerOn(pos);
@ -98,7 +98,7 @@ void PathView::centerOn(const QPointF &pos)
_mapScale->setResolution(_res);
}
PathItem *PathView::addTrack(const Track &track)
PathItem *MapView::addTrack(const Track &track)
{
if (track.isNull()) {
_palette.nextColor();
@ -114,14 +114,16 @@ PathItem *PathView::addTrack(const Track &track)
ti->setUnits(_units);
ti->setVisible(_showTracks);
ti->setDigitalZoom(_digitalZoom);
ti->setMarkerColor(_markerColor);
_scene->addItem(ti);
addPOI(_poi->points(ti->path()));
if (_showTracks)
addPOI(_poi->points(ti->path()));
return ti;
}
PathItem *PathView::addRoute(const Route &route)
PathItem *MapView::addRoute(const Route &route)
{
if (route.isNull()) {
_palette.nextColor();
@ -139,21 +141,23 @@ PathItem *PathView::addRoute(const Route &route)
ri->showWaypoints(_showRouteWaypoints);
ri->showWaypointLabels(_showWaypointLabels);
ri->setDigitalZoom(_digitalZoom);
ri->setMarkerColor(_markerColor);
_scene->addItem(ri);
addPOI(_poi->points(ri->path()));
if (_showRoutes)
addPOI(_poi->points(ri->path()));
return ri;
}
void PathView::addWaypoints(const QList<Waypoint> &waypoints)
void MapView::addWaypoints(const QList<Waypoint> &waypoints)
{
for (int i = 0; i < waypoints.count(); i++) {
const Waypoint &w = waypoints.at(i);
WaypointItem *wi = new WaypointItem(w, _map);
_waypoints.append(wi);
updateWaypointsBoundingRect(wi->waypoint().coordinates());
_wr.unite(wi->waypoint().coordinates());
wi->setZValue(1);
wi->setSize(_waypointSize);
wi->setColor(_waypointColor);
@ -162,12 +166,13 @@ void PathView::addWaypoints(const QList<Waypoint> &waypoints)
wi->setVisible(_showWaypoints);
wi->setDigitalZoom(_digitalZoom);
_scene->addItem(wi);
}
addPOI(_poi->points(waypoints));
if (_showWaypoints)
addPOI(_poi->points(w));
}
}
QList<PathItem *> PathView::loadData(const Data &data)
QList<PathItem *> MapView::loadData(const Data &data)
{
QList<PathItem *> paths;
qreal zoom = _map->zoom();
@ -191,29 +196,23 @@ QList<PathItem *> PathView::loadData(const Data &data)
return paths;
}
void PathView::updateWaypointsBoundingRect(const Coordinates &wp)
{
if (_wr.isNull())
_wr = RectC(wp, wp);
else
_wr.unite(wp);
}
qreal PathView::mapZoom() const
qreal MapView::mapZoom() const
{
RectC br = _tr | _rr | _wr;
return _map->zoomFit(viewport()->size() - QSize(2*MARGIN, 2*MARGIN), br);
return _map->zoomFit(viewport()->size() - QSize(2*MARGIN, 2*MARGIN),
br.isNull() ? RectC(_map->xy2ll(sceneRect().topLeft()),
_map->xy2ll(sceneRect().bottomRight())) : br);
}
QPointF PathView::contentCenter() const
QPointF MapView::contentCenter() const
{
RectC br = _tr | _rr | _wr;
return _map->ll2xy(br.center());
return br.isNull() ? sceneRect().center() : _map->ll2xy(br.center());
}
void PathView::updatePOIVisibility()
void MapView::updatePOIVisibility()
{
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it, jt;
@ -234,7 +233,7 @@ void PathView::updatePOIVisibility()
}
}
void PathView::rescale()
void MapView::rescale()
{
_scene->setSceneRect(_map->bounds());
resetCachedContent();
@ -253,7 +252,7 @@ void PathView::rescale()
updatePOIVisibility();
}
void PathView::setPalette(const Palette &palette)
void MapView::setPalette(const Palette &palette)
{
_palette = palette;
_palette.reset();
@ -264,7 +263,7 @@ void PathView::setPalette(const Palette &palette)
_routes.at(i)->setColor(_palette.nextColor());
}
void PathView::setMap(Map *map)
void MapView::setMap(Map *map)
{
QPointF pos = mapToScene(viewport()->rect().center());
Coordinates center = _map->xy2ll(pos);
@ -275,9 +274,10 @@ void PathView::setMap(Map *map)
_map = map;
_map->load();
_map->setBackgroundColor(_backgroundColor);
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
resetDigitalZoom();
digitalZoom(0);
_map->zoomFit(resolution, center);
_scene->setSceneRect(_map->bounds());
@ -300,7 +300,7 @@ void PathView::setMap(Map *map)
QPixmapCache::clear();
}
void PathView::setPOI(POI *poi)
void MapView::setPOI(POI *poi)
{
disconnect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
connect(poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
@ -310,7 +310,7 @@ void PathView::setPOI(POI *poi)
updatePOI();
}
void PathView::updatePOI()
void MapView::updatePOI()
{
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
@ -320,16 +320,20 @@ void PathView::updatePOI()
}
_pois.clear();
for (int i = 0; i < _tracks.size(); i++)
addPOI(_poi->points(_tracks.at(i)->path()));
for (int i = 0; i < _routes.size(); i++)
addPOI(_poi->points(_routes.at(i)->path()));
addPOI(_poi->points(_waypoints));
if (_showTracks)
for (int i = 0; i < _tracks.size(); i++)
addPOI(_poi->points(_tracks.at(i)->path()));
if (_showRoutes)
for (int i = 0; i < _routes.size(); i++)
addPOI(_poi->points(_routes.at(i)->path()));
if (_showWaypoints)
for (int i = 0; i< _waypoints.size(); i++)
addPOI(_poi->points(_waypoints.at(i)->waypoint()));
updatePOIVisibility();
}
void PathView::addPOI(const QVector<Waypoint> &waypoints)
void MapView::addPOI(const QList<Waypoint> &waypoints)
{
for (int i = 0; i < waypoints.size(); i++) {
const Waypoint &w = waypoints.at(i);
@ -350,7 +354,7 @@ void PathView::addPOI(const QVector<Waypoint> &waypoints)
}
}
void PathView::setUnits(enum Units units)
void MapView::setUnits(enum Units units)
{
_units = units;
@ -368,37 +372,23 @@ void PathView::setUnits(enum Units units)
it.value()->setUnits(units);
}
void PathView::clearMapCache()
void MapView::clearMapCache()
{
_map->clearCache();
resetCachedContent();
}
void PathView::resetDigitalZoom()
void MapView::digitalZoom(int zoom)
{
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
_digitalZoom = 0;
resetTransform();
for (int i = 0; i < _tracks.size(); i++)
_tracks.at(i)->setDigitalZoom(0);
for (int i = 0; i < _routes.size(); i++)
_routes.at(i)->setDigitalZoom(0);
for (int i = 0; i < _waypoints.size(); i++)
_waypoints.at(i)->setDigitalZoom(0);
for (it = _pois.constBegin(); it != _pois.constEnd(); it++)
it.value()->setDigitalZoom(0);
_mapScale->setDigitalZoom(0);
}
void PathView::digitalZoom(int zoom)
{
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
_digitalZoom += zoom;
scale(pow(2, zoom), pow(2, zoom));
if (zoom) {
_digitalZoom += zoom;
scale(pow(2, zoom), pow(2, zoom));
} else {
_digitalZoom = 0;
resetTransform();
}
for (int i = 0; i < _tracks.size(); i++)
_tracks.at(i)->setDigitalZoom(_digitalZoom);
@ -412,7 +402,7 @@ void PathView::digitalZoom(int zoom)
_mapScale->setDigitalZoom(_digitalZoom);
}
void PathView::zoom(int zoom, const QPoint &pos, const Coordinates &c)
void MapView::zoom(int zoom, const QPoint &pos, const Coordinates &c)
{
bool shift = QApplication::keyboardModifiers() & Qt::ShiftModifier;
@ -438,7 +428,7 @@ void PathView::zoom(int zoom, const QPoint &pos, const Coordinates &c)
}
}
void PathView::wheelEvent(QWheelEvent *event)
void MapView::wheelEvent(QWheelEvent *event)
{
static int deg = 0;
@ -451,7 +441,7 @@ void PathView::wheelEvent(QWheelEvent *event)
zoom((event->delta() > 0) ? 1 : -1, event->pos(), c);
}
void PathView::mouseDoubleClickEvent(QMouseEvent *event)
void MapView::mouseDoubleClickEvent(QMouseEvent *event)
{
if (event->button() != Qt::LeftButton && event->button() != Qt::RightButton)
return;
@ -460,7 +450,7 @@ void PathView::mouseDoubleClickEvent(QMouseEvent *event)
zoom((event->button() == Qt::LeftButton) ? 1 : -1, event->pos(), c);
}
void PathView::keyPressEvent(QKeyEvent *event)
void MapView::keyPressEvent(QKeyEvent *event)
{
int z;
@ -472,7 +462,7 @@ void PathView::keyPressEvent(QKeyEvent *event)
else if (event->matches(ZOOM_OUT))
z = -1;
else if (_digitalZoom && event->key() == Qt::Key_Escape) {
resetDigitalZoom();
digitalZoom(0);
return;
} else {
QGraphicsView::keyPressEvent(event);
@ -482,7 +472,7 @@ void PathView::keyPressEvent(QKeyEvent *event)
zoom(z, pos, c);
}
void PathView::plot(QPainter *painter, const QRectF &target, qreal scale,
void MapView::plot(QPainter *painter, const QRectF &target, qreal scale,
bool hires)
{
QRect orig, adj;
@ -558,7 +548,7 @@ void PathView::plot(QPainter *painter, const QRectF &target, qreal scale,
setUpdatesEnabled(true);
}
void PathView::clear()
void MapView::clear()
{
_pois.clear();
_tracks.clear();
@ -575,36 +565,40 @@ void PathView::clear()
_rr = RectC();
_wr = RectC();
resetDigitalZoom();
resetCachedContent();
QPixmapCache::clear();
digitalZoom(0);
}
void PathView::showTracks(bool show)
void MapView::showTracks(bool show)
{
_showTracks = show;
for (int i = 0; i < _tracks.count(); i++)
_tracks.at(i)->setVisible(show);
updatePOI();
}
void PathView::showRoutes(bool show)
void MapView::showRoutes(bool show)
{
_showRoutes = show;
for (int i = 0; i < _routes.count(); i++)
_routes.at(i)->setVisible(show);
updatePOI();
}
void PathView::showWaypoints(bool show)
void MapView::showWaypoints(bool show)
{
_showWaypoints = show;
for (int i = 0; i < _waypoints.count(); i++)
_waypoints.at(i)->setVisible(show);
updatePOI();
}
void PathView::showWaypointLabels(bool show)
void MapView::showWaypointLabels(bool show)
{
_showWaypointLabels = show;
@ -615,7 +609,7 @@ void PathView::showWaypointLabels(bool show)
_routes.at(i)->showWaypointLabels(show);
}
void PathView::showRouteWaypoints(bool show)
void MapView::showRouteWaypoints(bool show)
{
_showRouteWaypoints = show;
@ -623,13 +617,13 @@ void PathView::showRouteWaypoints(bool show)
_routes.at(i)->showWaypoints(show);
}
void PathView::showMap(bool show)
void MapView::showMap(bool show)
{
_showMap = show;
resetCachedContent();
}
void PathView::showPOI(bool show)
void MapView::showPOI(bool show)
{
_showPOI = show;
@ -640,7 +634,7 @@ void PathView::showPOI(bool show)
updatePOIVisibility();
}
void PathView::showPOILabels(bool show)
void MapView::showPOILabels(bool show)
{
_showPOILabels = show;
@ -651,14 +645,14 @@ void PathView::showPOILabels(bool show)
updatePOIVisibility();
}
void PathView::setPOIOverlap(bool overlap)
void MapView::setPOIOverlap(bool overlap)
{
_overlapPOIs = overlap;
updatePOIVisibility();
}
void PathView::setTrackWidth(int width)
void MapView::setTrackWidth(int width)
{
_trackWidth = width;
@ -666,7 +660,7 @@ void PathView::setTrackWidth(int width)
_tracks.at(i)->setWidth(width);
}
void PathView::setRouteWidth(int width)
void MapView::setRouteWidth(int width)
{
_routeWidth = width;
@ -674,7 +668,7 @@ void PathView::setRouteWidth(int width)
_routes.at(i)->setWidth(width);
}
void PathView::setTrackStyle(Qt::PenStyle style)
void MapView::setTrackStyle(Qt::PenStyle style)
{
_trackStyle = style;
@ -682,7 +676,7 @@ void PathView::setTrackStyle(Qt::PenStyle style)
_tracks.at(i)->setStyle(style);
}
void PathView::setRouteStyle(Qt::PenStyle style)
void MapView::setRouteStyle(Qt::PenStyle style)
{
_routeStyle = style;
@ -690,7 +684,7 @@ void PathView::setRouteStyle(Qt::PenStyle style)
_routes.at(i)->setStyle(style);
}
void PathView::setWaypointSize(int size)
void MapView::setWaypointSize(int size)
{
_waypointSize = size;
@ -698,7 +692,7 @@ void PathView::setWaypointSize(int size)
_waypoints.at(i)->setSize(size);
}
void PathView::setWaypointColor(const QColor &color)
void MapView::setWaypointColor(const QColor &color)
{
_waypointColor = color;
@ -706,7 +700,7 @@ void PathView::setWaypointColor(const QColor &color)
_waypoints.at(i)->setColor(color);
}
void PathView::setPOISize(int size)
void MapView::setPOISize(int size)
{
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
@ -716,7 +710,7 @@ void PathView::setPOISize(int size)
it.value()->setSize(size);
}
void PathView::setPOIColor(const QColor &color)
void MapView::setPOIColor(const QColor &color)
{
QHash<SearchPointer<Waypoint>, WaypointItem*>::const_iterator it;
@ -726,43 +720,46 @@ void PathView::setPOIColor(const QColor &color)
it.value()->setColor(color);
}
void PathView::setMapOpacity(int opacity)
void MapView::setMapOpacity(int opacity)
{
_opacity = opacity / 100.0;
resetCachedContent();
}
void PathView::setBackgroundColor(const QColor &color)
void MapView::setBackgroundColor(const QColor &color)
{
_backgroundColor = color;
_map->setBackgroundColor(color);
resetCachedContent();
}
void PathView::drawBackground(QPainter *painter, const QRectF &rect)
void MapView::drawBackground(QPainter *painter, const QRectF &rect)
{
if (_showMap) {
if (_opacity < 1.0) {
QRectF ir = rect.intersected(_map->bounds());
if (_opacity < 1.0 || ir != rect)
painter->fillRect(rect, _backgroundColor);
if (_opacity < 1.0)
painter->setOpacity(_opacity);
}
_map->draw(painter, rect);
_map->draw(painter, ir);
} else
painter->fillRect(rect, _backgroundColor);
}
void PathView::resizeEvent(QResizeEvent *event)
void MapView::resizeEvent(QResizeEvent *event)
{
QGraphicsView::resizeEvent(event);
qreal zoom = _map->zoom();
if (mapZoom() != zoom)
rescale();
centerOn(contentCenter());
QGraphicsView::resizeEvent(event);
}
void PathView::paintEvent(QPaintEvent *event)
void MapView::paintEvent(QPaintEvent *event)
{
QPointF scenePos = mapToScene(rect().bottomRight() + QPoint(
-(SCALE_OFFSET + _mapScale->boundingRect().width()),
@ -773,7 +770,7 @@ void PathView::paintEvent(QPaintEvent *event)
QGraphicsView::paintEvent(event);
}
void PathView::scrollContentsBy(int dx, int dy)
void MapView::scrollContentsBy(int dx, int dy)
{
QGraphicsView::scrollContentsBy(dx, dy);
@ -786,7 +783,7 @@ void PathView::scrollContentsBy(int dx, int dy)
}
}
void PathView::useOpenGL(bool use)
void MapView::useOpenGL(bool use)
{
if (use)
setViewport(new OPENGL_WIDGET);
@ -794,12 +791,22 @@ void PathView::useOpenGL(bool use)
setViewport(new QWidget);
}
void PathView::useAntiAliasing(bool use)
void MapView::useAntiAliasing(bool use)
{
setRenderHint(QPainter::Antialiasing, use);
}
void PathView::reloadMap()
void MapView::setMarkerColor(const QColor &color)
{
_markerColor = color;
for (int i = 0; i < _tracks.size(); i++)
_tracks.at(i)->setMarkerColor(color);
for (int i = 0; i < _routes.size(); i++)
_routes.at(i)->setMarkerColor(color);
}
void MapView::reloadMap()
{
resetCachedContent();
}

View File

@ -1,15 +1,15 @@
#ifndef TRACKVIEW_H
#define TRACKVIEW_H
#ifndef MAPVIEW_H
#define MAPVIEW_H
#include <QGraphicsView>
#include <QVector>
#include <QHash>
#include <QList>
#include "common/rectc.h"
#include "data/waypoint.h"
#include "searchpointer.h"
#include "units.h"
#include "palette.h"
#include "waypoint.h"
#include "rectc.h"
#include "searchpointer.h"
class Data;
class POI;
@ -22,12 +22,12 @@ class WaypointItem;
class ScaleItem;
class PathItem;
class PathView : public QGraphicsView
class MapView : public QGraphicsView
{
Q_OBJECT
public:
PathView(Map *map, POI *poi, QWidget *parent = 0);
MapView(Map *map, POI *poi, QWidget *parent = 0);
QList<PathItem*> loadData(const Data &data);
@ -38,10 +38,6 @@ public:
void plot(QPainter *painter, const QRectF &target, qreal scale, bool hires);
int trackCount() const {return _tracks.count();}
int routeCount() const {return _routes.count();}
int waypointCount() const {return _waypoints.count();}
void clear();
void setTrackWidth(int width);
@ -56,6 +52,7 @@ public:
void setBackgroundColor(const QColor &color);
void useOpenGL(bool use);
void useAntiAliasing(bool use);
void setMarkerColor(const QColor &color);
public slots:
void showMap(bool show);
@ -77,7 +74,7 @@ private:
PathItem *addTrack(const Track &track);
PathItem *addRoute(const Route &route);
void addWaypoints(const QList<Waypoint> &waypoints);
void addPOI(const QVector<Waypoint> &waypoints);
void addPOI(const QList<Waypoint> &waypoints);
void loadPOI();
void clearPOI();
@ -87,9 +84,7 @@ private:
void centerOn(const QPointF &pos);
void zoom(int zoom, const QPoint &pos, const Coordinates &c);
void digitalZoom(int zoom);
void resetDigitalZoom();
void updatePOIVisibility();
void updateWaypointsBoundingRect(const Coordinates &wp);
void mouseDoubleClickEvent(QMouseEvent *event);
void wheelEvent(QWheelEvent *event);
@ -133,9 +128,10 @@ private:
int _poiSize;
QColor _waypointColor;
QColor _poiColor;
QColor _markerColor;
int _digitalZoom;
bool _plot;
};
#endif // TRACKVIEW_H
#endif // MAPVIEW_H

View File

@ -7,7 +7,7 @@
MarkerItem::MarkerItem(QGraphicsItem *parent) : QGraphicsItem(parent)
{
_color = Qt::red;
}
QRectF MarkerItem::boundingRect() const
@ -22,9 +22,15 @@ void MarkerItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
Q_UNUSED(widget);
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setPen(QPen(Qt::red, WIDTH));
painter->setPen(QPen(_color, WIDTH));
painter->drawLine(-SIZE/2, 0, SIZE/2, 0);
painter->drawLine(0, -SIZE/2, 0, SIZE/2);
// painter->drawRect(boundingRect());
}
void MarkerItem::setColor(const QColor &color)
{
_color = color;
update();
}

View File

@ -2,6 +2,7 @@
#define MARKERITEM_H
#include <QGraphicsItem>
#include <QColor>
class MarkerItem : public QGraphicsItem
{
@ -11,6 +12,11 @@ public:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget);
void setColor(const QColor &color);
private:
QColor _color;
};
#endif // MARKERITEM_H

View File

@ -1,7 +1,5 @@
#include <cmath>
#include <cctype>
#include "misc.h"
#include "nicenum.h"
double niceNum(double x, int round)
{
@ -34,23 +32,3 @@ double niceNum(double x, int round)
return nf * pow(10.0, expv);
}
int str2int(const char *str, int len)
{
int res = 0;
for (const char *sp = str; sp < str + len; sp++) {
if (::isdigit(*sp))
res = res * 10 + *sp - '0';
else
return -1;
}
return res;
}
QRectF scaled(const QRectF &rect, qreal factor)
{
return QRectF(QPointF(rect.left() * factor, rect.top() * factor),
QSizeF(rect.width() * factor, rect.height() * factor));
}

6
src/GUI/nicenum.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef MISC_H
#define MISC_H
double niceNum(double x, int round);
#endif // MISC_H

View File

@ -35,6 +35,28 @@ static QFrame *line()
}
#endif
QWidget *OptionsDialog::createGeneralPage()
{
_alwaysShowMap = new QCheckBox(tr("Always show the map"));
_alwaysShowMap->setChecked(_options->alwaysShowMap);
_alwaysShowMap->setToolTip("<p>" +
tr("Show the map even when no files are loaded.") + "</p>");
QFormLayout *showMapLayout = new QFormLayout();
showMapLayout->addWidget(_alwaysShowMap);
QWidget *generalTab = new QWidget();
QVBoxLayout *generalTabLayout = new QVBoxLayout();
generalTabLayout->addLayout(showMapLayout);
generalTabLayout->addStretch();
generalTab->setLayout(generalTabLayout);
QTabWidget *generalPage = new QTabWidget();
generalPage->addTab(generalTab, tr("General"));
return generalPage;
}
QWidget *OptionsDialog::createAppearancePage()
{
// Paths
@ -157,11 +179,15 @@ QWidget *OptionsDialog::createAppearancePage()
// Graphs
_sliderColor = new ColorBox();
_sliderColor->setColor(_options->sliderColor);
_graphWidth = new QSpinBox();
_graphWidth->setValue(_options->graphWidth);
_graphWidth->setMinimum(1);
QFormLayout *graphLayout = new QFormLayout();
graphLayout->addRow(tr("Line width:"), _graphWidth);
graphLayout->addRow(tr("Slider color:"), _sliderColor);
_graphAA = new QCheckBox(tr("Use anti-aliasing"));
_graphAA->setChecked(_options->graphAntiAliasing);
@ -422,6 +448,7 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
: QDialog(parent), _options(options)
{
QStackedWidget *pages = new QStackedWidget();
pages->addWidget(createGeneralPage());
pages->addWidget(createAppearancePage());
pages->addWidget(createDataPage());
pages->addWidget(createPOIPage());
@ -430,6 +457,7 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
QListWidget *menu = new QListWidget();
menu->setIconSize(QSize(MENU_ICON_SIZE, MENU_ICON_SIZE));
new QListWidgetItem(QIcon(QPixmap(APP_ICON)), tr("General"), menu);
new QListWidgetItem(QIcon(QPixmap(APPEARANCE_ICON)), tr("Appearance"),
menu);
new QListWidgetItem(QIcon(QPixmap(DATA_ICON)), tr("Data"), menu);
@ -469,6 +497,8 @@ OptionsDialog::OptionsDialog(Options *options, QWidget *parent)
void OptionsDialog::accept()
{
_options->alwaysShowMap = _alwaysShowMap->isChecked();
_options->palette.setColor(_baseColor->color());
_options->palette.setShift(_colorOffset->value());
_options->mapOpacity = _mapOpacity->value();
@ -485,6 +515,7 @@ void OptionsDialog::accept()
_options->poiSize = _poiSize->value();
_options->poiColor = _poiColor->color();
_options->graphWidth = _graphWidth->value();
_options->sliderColor = _sliderColor->color();
_options->graphAntiAliasing = _graphAA->isChecked();
_options->elevationFilter = _elevationFilter->value();

View File

@ -16,6 +16,8 @@ class QRadioButton;
class PercentSlider;
struct Options {
// General
bool alwaysShowMap;
// Appearance
Palette palette;
int trackWidth;
@ -27,6 +29,7 @@ struct Options {
int waypointSize;
int poiSize;
int graphWidth;
QColor sliderColor;
bool pathAntiAliasing;
bool graphAntiAliasing;
int mapOpacity;
@ -69,6 +72,7 @@ public slots:
void accept();
private:
QWidget *createGeneralPage();
QWidget *createAppearancePage();
QWidget *createDataPage();
QWidget *createPOIPage();
@ -77,6 +81,8 @@ private:
Options *_options;
// General
QCheckBox *_alwaysShowMap;
// Appearance
ColorBox *_baseColor;
QDoubleSpinBox *_colorOffset;
@ -92,6 +98,7 @@ private:
QSpinBox *_poiSize;
ColorBox *_poiColor;
QSpinBox *_graphWidth;
ColorBox *_sliderColor;
QCheckBox *_graphAA;
// Data
OddSpinBox *_elevationFilter;

View File

@ -2,9 +2,9 @@
#include <QApplication>
#include <QCursor>
#include <QPainter>
#include "map/map.h"
#include "tooltip.h"
#include "map.h"
#include "misc.h"
#include "nicenum.h"
#include "pathitem.h"
@ -167,6 +167,11 @@ void PathItem::moveMarker(qreal distance)
_marker->setVisible(false);
}
void PathItem::setMarkerColor(const QColor &color)
{
_marker->setColor(color);
}
void PathItem::hover(bool hover)
{
if (hover) {

View File

@ -3,9 +3,8 @@
#include <QGraphicsObject>
#include <QPen>
#include "data/path.h"
#include "markeritem.h"
#include "path.h"
class Map;
@ -29,6 +28,7 @@ public:
void setWidth(qreal width);
void setStyle(Qt::PenStyle style);
void setDigitalZoom(int zoom);
void setMarkerColor(const QColor &color);
public slots:
void moveMarker(qreal distance);

View File

@ -1,4 +1,4 @@
#include "data.h"
#include "data/data.h"
#include "powergraphitem.h"
#include "powergraph.h"

View File

@ -1,9 +1,9 @@
#include <QPainter>
#include "data/waypoint.h"
#include "map/map.h"
#include "format.h"
#include "waypoint.h"
#include "waypointitem.h"
#include "tooltip.h"
#include "map.h"
#include "routeitem.h"

View File

@ -1,8 +1,8 @@
#ifndef ROUTEITEM_H
#define ROUTEITEM_H
#include "data/route.h"
#include "pathitem.h"
#include "route.h"
#include "units.h"
class Map;

View File

@ -1,7 +1,7 @@
#include <cmath>
#include <QPainter>
#include "config.h"
#include "misc.h"
#include "nicenum.h"
#include "scaleitem.h"

View File

@ -144,5 +144,9 @@
#define PRINT_ITEM_COUNT_DEFAULT true
#define SEPARATE_GRAPH_PAGE_SETTING "separateGraphPage"
#define SEPARATE_GRAPH_PAGE_DEFAULT false
#define SLIDER_COLOR_SETTING "sliderColor"
#define SLIDER_COLOR_DEFAULT QColor(Qt::red)
#define ALWAYS_SHOW_MAP_SETTING "alwaysShowMap"
#define ALWAYS_SHOW_MAP_DEFAULT true
#endif // SETTINGS_H

View File

@ -8,6 +8,7 @@
SliderInfoItem::SliderInfoItem(QGraphicsItem *parent) : QGraphicsItem(parent)
{
_side = Right;
_color = Qt::red;
}
void SliderInfoItem::updateBoundingRect()
@ -58,7 +59,7 @@ void SliderInfoItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
painter->setFont(font);
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setPen(Qt::red);
painter->setPen(_color);
if (_side == Right) {
painter->drawText(SIZE, -fm.descent()/2, _y);
@ -88,3 +89,9 @@ void SliderInfoItem::setSide(Side side)
_side = side;
updateBoundingRect();
}
void SliderInfoItem::setColor(const QColor &color)
{
_color = color;
update();
}

View File

@ -16,6 +16,7 @@ public:
void setText(const QString &x, const QString &y);
void setSide(Side side);
void setColor(const QColor &color);
private:
void updateBoundingRect();
@ -23,6 +24,7 @@ private:
Side _side;
QString _x, _y;
QRectF _boundingRect;
QColor _color;
};
#endif // SLIDERINFOITEM_H

View File

@ -8,6 +8,8 @@ SliderItem::SliderItem(QGraphicsItem *parent) : QGraphicsObject(parent)
{
setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges);
_color = Qt::red;
}
QRectF SliderItem::boundingRect() const
@ -22,7 +24,7 @@ void SliderItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
Q_UNUSED(widget);
painter->setRenderHint(QPainter::Antialiasing, false);
painter->setPen(Qt::red);
painter->setPen(_color);
painter->drawLine(0, 0, 0, -_area.height());
// painter->drawRect(boundingRect());
@ -59,3 +61,9 @@ void SliderItem::setArea(const QRectF &area)
prepareGeometryChange();
_area = area;
}
void SliderItem::setColor(const QColor &color)
{
_color = color;
update();
}

View File

@ -3,6 +3,8 @@
#include <QGraphicsObject>
class QColor;
class SliderItem : public QGraphicsObject
{
Q_OBJECT
@ -17,6 +19,8 @@ public:
const QRectF &area() const {return _area;}
void setArea(const QRectF &area);
void setColor(const QColor &color);
void clear();
signals:
@ -27,6 +31,7 @@ protected:
private:
QRectF _area;
QColor _color;
};
#endif // SLIDERITEM_H

View File

@ -1,5 +1,5 @@
#include "data/data.h"
#include "config.h"
#include "data.h"
#include "tooltip.h"
#include "speedgraphitem.h"
#include "speedgraph.h"

View File

@ -1,4 +1,4 @@
#include "data.h"
#include "data/data.h"
#include "temperaturegraphitem.h"
#include "temperaturegraph.h"

View File

@ -1,7 +1,7 @@
#include <QPainter>
#include "map/map.h"
#include "format.h"
#include "tooltip.h"
#include "map.h"
#include "trackitem.h"

View File

@ -3,7 +3,7 @@
#include <QDateTime>
#include <QPen>
#include "track.h"
#include "data/track.h"
#include "pathitem.h"
#include "units.h"

Some files were not shown because too many files have changed in this diff Show More