1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-26 00:14:24 +02:00

Compare commits

..

6 Commits
7.21 ... 7.22

10 changed files with 74 additions and 98 deletions

View File

@ -1,4 +1,4 @@
version: 7.21.{build} version: 7.22.{build}
configuration: configuration:
- Release - Release

View File

@ -4,7 +4,7 @@ GPXSee is a Qt-based GPS log file viewer and analyzer that supports all common G
## Features ## Features
* Opens GPX, TCX, FIT, KML, NMEA, IGC, CUP, SIGMA SLF, Suunto SML, LOC, GeoJSON, OziExplorer (PLT, RTE, WPT), Garmin GPI&CSV and geotagged JPEG files. * Opens GPX, TCX, FIT, KML, NMEA, IGC, CUP, SIGMA SLF, Suunto SML, LOC, GeoJSON, OziExplorer (PLT, RTE, WPT), Garmin GPI&CSV and geotagged JPEG files.
* User-definable online maps (OpenStreetMap/Google tiles, WMTS, WMS, TMS, QuadTiles). * User-definable online maps (OpenStreetMap/Google tiles, WMTS, WMS, TMS, QuadTiles).
* Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases, Garmin IMG & JNX maps, TwoNav RMaps, GeoTIFF images). * Offline maps (MBTiles, OziExplorer maps, TrekBuddy maps/atlases, Garmin IMG/GMAP & JNX maps, TwoNav RMaps, GeoTIFF images).
* Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts graphs. * Elevation, speed, heart rate, cadence, power, temperature and gear ratio/shifts graphs.
* Support for DEM files (SRTM HGT). * Support for DEM files (SRTM HGT).
* Support for multiple tracks in one view. * Support for multiple tracks in one view.

View File

@ -3,7 +3,7 @@ unix:!macx {
} else { } else {
TARGET = GPXSee TARGET = GPXSee
} }
VERSION = 7.21 VERSION = 7.22
QT += core \ QT += core \
gui \ gui \
@ -383,7 +383,8 @@ macx {
lang/gpxsee_tr.qm \ lang/gpxsee_tr.qm \
lang/gpxsee_es.qm \ lang/gpxsee_es.qm \
lang/gpxsee_pt_BR.qm \ lang/gpxsee_pt_BR.qm \
lang/gpxsee_uk.qm lang/gpxsee_uk.qm \
lang/gpxsee_hu.qm
csv.path = Contents/Resources csv.path = Contents/Resources
csv.files = pkg/csv csv.files = pkg/csv
maps.path = Contents/Resources maps.path = Contents/Resources

View File

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

View File

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

View File

@ -112,7 +112,7 @@ void GUI::loadMaps()
QString mapDir(ProgramPaths::mapDir()); QString mapDir(ProgramPaths::mapDir());
if (!mapDir.isNull() && !_ml->loadDir(mapDir)) if (!mapDir.isNull() && !_ml->loadDir(mapDir))
qWarning("%s", qPrintable(_ml->errorString())); qWarning("%s", qPrintable(_ml->errorPath() + ": " + _ml->errorString()));
_map = new EmptyMap(this); _map = new EmptyMap(this);
} }
@ -1325,7 +1325,10 @@ bool GUI::loadMap(const QString &fileName)
if (fileName.isEmpty()) if (fileName.isEmpty())
return false; return false;
if (_ml->loadFile(fileName)) { QFileInfo fi(fileName);
bool res = fi.isDir() ? _ml->loadDir(fileName) : _ml->loadFile(fileName);
if (res) {
QAction *a = createMapAction(_ml->maps().last()); QAction *a = createMapAction(_ml->maps().last());
_mapMenu->insertAction(_mapsEnd, a); _mapMenu->insertAction(_mapsEnd, a);
_showMapAction->setEnabled(true); _showMapAction->setEnabled(true);

View File

@ -44,37 +44,37 @@ static CUPParser cup;
static GPIParser gpi; static GPIParser gpi;
static SMLParser sml; static SMLParser sml;
static QHash<QString, Parser*> parsers() static QMap<QString, Parser*> parsers()
{ {
QHash<QString, Parser*> hash; QMap<QString, Parser*> map;
hash.insert("gpx", &gpx); map.insert("gpx", &gpx);
hash.insert("tcx", &tcx); map.insert("tcx", &tcx);
hash.insert("kml", &kml); map.insert("kml", &kml);
hash.insert("fit", &fit); map.insert("fit", &fit);
hash.insert("csv", &csv); map.insert("csv", &csv);
hash.insert("igc", &igc); map.insert("igc", &igc);
hash.insert("nmea", &nmea); map.insert("nmea", &nmea);
hash.insert("plt", &plt); map.insert("plt", &plt);
hash.insert("wpt", &wpt); map.insert("wpt", &wpt);
hash.insert("rte", &rte); map.insert("rte", &rte);
hash.insert("loc", &loc); map.insert("loc", &loc);
hash.insert("slf", &slf); map.insert("slf", &slf);
#ifdef ENABLE_GEOJSON #ifdef ENABLE_GEOJSON
hash.insert("json", &geojson); map.insert("json", &geojson);
hash.insert("geojson", &geojson); map.insert("geojson", &geojson);
#endif // ENABLE_GEOJSON #endif // ENABLE_GEOJSON
hash.insert("jpeg", &exif); map.insert("jpeg", &exif);
hash.insert("jpg", &exif); map.insert("jpg", &exif);
hash.insert("cup", &cup); map.insert("cup", &cup);
hash.insert("gpi", &gpi); map.insert("gpi", &gpi);
hash.insert("sml", &sml); map.insert("sml", &sml);
return hash; return map;
} }
QHash<QString, Parser*> Data::_parsers = parsers(); QMap<QString, Parser*> Data::_parsers = parsers();
bool Data::_useDEM = false; bool Data::_useDEM = false;
void Data::processData(QList<TrackData> &trackData, QList<RouteData> &routeData) void Data::processData(QList<TrackData> &trackData, QList<RouteData> &routeData)
@ -130,7 +130,7 @@ Data::Data(const QString &fileName, bool poi)
return; return;
} }
QHash<QString, Parser*>::iterator it; QMap<QString, Parser*>::iterator it;
if ((it = _parsers.find(fi.suffix().toLower())) != _parsers.end()) { if ((it = _parsers.find(fi.suffix().toLower())) != _parsers.end()) {
if (it.value()->parse(&file, trackData, routeData, _polygons, if (it.value()->parse(&file, trackData, routeData, _polygons,
_waypoints)) { _waypoints)) {
@ -166,17 +166,8 @@ Data::Data(const QString &fileName, bool poi)
QString Data::formats() QString Data::formats()
{ {
QStringList l(filter());
qSort(l);
QString supported;
for (int i = 0; i < l.size(); i++) {
supported += l.at(i);
if (i != l.size() - 1)
supported += " ";
}
return return
qApp->translate("Data", "Supported files") + " (" + supported + ");;" qApp->translate("Data", "Supported files") + " (" + filter().join(" ") + ");;"
+ qApp->translate("Data", "CSV files") + " (*.csv);;" + qApp->translate("Data", "CSV files") + " (*.csv);;"
+ qApp->translate("Data", "CUP files") + " (*.cup);;" + qApp->translate("Data", "CUP files") + " (*.cup);;"
+ qApp->translate("Data", "FIT files") + " (*.fit);;" + qApp->translate("Data", "FIT files") + " (*.fit);;"
@ -200,10 +191,10 @@ QString Data::formats()
QStringList Data::filter() QStringList Data::filter()
{ {
QStringList filter; QStringList filter;
QHash<QString, Parser*>::iterator it;
for (it = _parsers.begin(); it != _parsers.end(); it++) for (QMap<QString, Parser*>::iterator it = _parsers.begin();
filter << QString("*.%1").arg(it.key()); it != _parsers.end(); it++)
filter << "*." + it.key();
return filter; return filter;
} }

View File

@ -2,7 +2,7 @@
#define DATA_H #define DATA_H
#include <QList> #include <QList>
#include <QHash> #include <QMap>
#include <QString> #include <QString>
#include <QStringList> #include <QStringList>
#include "waypoint.h" #include "waypoint.h"
@ -42,7 +42,7 @@ private:
QList<Area> _polygons; QList<Area> _polygons;
QVector<Waypoint> _waypoints; QVector<Waypoint> _waypoints;
static QHash<QString, Parser*> _parsers; static QMap<QString, Parser*> _parsers;
static bool _useDEM; static bool _useDEM;
}; };

View File

@ -12,56 +12,50 @@
#include "maplist.h" #include "maplist.h"
bool MapList::loadMap(Map *map, const QString &path, bool dir) bool MapList::loadMap(Map *map, const QString &path)
{ {
if (map && map->isValid()) { if (map && map->isValid()) {
_maps.append(map); _maps.append(map);
return true; return true;
} else if (map) { } else if (map) {
if (dir) _errorPath = path;
_errorString += path + ": " + map->errorString() + "\n"; _errorString = map->errorString();
else
_errorString = map->errorString();
return false; return false;
} else { } else {
if (dir) _errorString = path;
_errorString += path + ": " + "Unknown map format\n"; _errorString = "Unknown file format";
else
_errorString = "Unknown map format";
return false; return false;
} }
} }
Map *MapList::loadSource(const QString &path, bool dir) Map *MapList::loadSource(const QString &path)
{ {
QString err; Map *map = MapSource::loadMap(path, _errorString);
Map *map = MapSource::loadMap(path, err);
if (!map) { if (!map)
if (dir) _errorPath = path;
_errorString += path + ": " + err + "\n"; else
else
_errorString = err;
} else
map->setParent(this); map->setParent(this);
return map; return map;
} }
bool MapList::loadFile(const QString &path, bool *terminate, bool dir) bool MapList::loadFile(const QString &path, bool *terminate)
{ {
QFileInfo fi(path); QFileInfo fi(path);
QString suffix = fi.suffix().toLower(); QString suffix = fi.suffix().toLower();
Map *map = 0; Map *map = 0;
if (Atlas::isAtlas(path)) { if (Atlas::isAtlas(path)) {
*terminate = true; if (terminate)
*terminate = true;
map = new Atlas(path, this); map = new Atlas(path, this);
} else if (suffix == "xml") { } else if (suffix == "xml") {
if (MapSource::isMap(path) && !(map = loadSource(path, dir))) if (MapSource::isMap(path) && !(map = loadSource(path)))
return false; return false;
else if (GMAP::isGMAP(path)) { else if (GMAP::isGMAP(path)) {
*terminate = true; if (terminate)
*terminate = true;
map = new IMGMap(path); map = new IMGMap(path);
} }
} else if (suffix == "jnx") } else if (suffix == "jnx")
@ -74,10 +68,10 @@ bool MapList::loadFile(const QString &path, bool *terminate, bool dir)
map = new RMap(path, this); map = new RMap(path, this);
else if (suffix == "img") else if (suffix == "img")
map = new IMGMap(path, this); map = new IMGMap(path, this);
else else if (suffix == "map" || suffix == "tar")
map = new OziMap(path, this); map = new OziMap(path, this);
if (!loadMap(map, path, dir)) { if (!loadMap(map, path)) {
delete map; delete map;
return false; return false;
} }
@ -85,7 +79,7 @@ bool MapList::loadFile(const QString &path, bool *terminate, bool dir)
return true; return true;
} }
bool MapList::loadDirR(const QString &path) bool MapList::loadDir(const QString &path)
{ {
QDir md(path); QDir md(path);
md.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); md.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
@ -99,10 +93,10 @@ bool MapList::loadDirR(const QString &path)
bool terminate = false; bool terminate = false;
if (fi.isDir() && fi.fileName() != "set") { if (fi.isDir() && fi.fileName() != "set") {
if (!loadDirR(fi.absoluteFilePath())) if (!loadDir(fi.absoluteFilePath()))
ret = false; ret = false;
} else if (filter().contains("*." + suffix)) { } else if (filter().contains("*." + suffix)) {
if (!loadFile(fi.absoluteFilePath(), &terminate, true)) if (!loadFile(fi.absoluteFilePath(), &terminate))
ret = false; ret = false;
if (terminate) if (terminate)
break; break;
@ -112,26 +106,11 @@ bool MapList::loadDirR(const QString &path)
return ret; return ret;
} }
bool MapList::loadFile(const QString &path)
{
bool atlas;
_errorString.clear();
return loadFile(path, &atlas, false);
}
bool MapList::loadDir(const QString &path)
{
_errorString.clear();
return loadDirR(path);
}
QString MapList::formats() QString MapList::formats()
{ {
return return
tr("Supported files") tr("Supported files") + " (" + filter().join(" ") + ");;"
+ " (*.img *.jnx *.map *.mbtiles *.rmap *.rtmap *.tar *.tba *.tif *.tiff *.xml);;" + tr("Garmin IMG maps") + " (*.gmap *.gmapi *.img *.xml);;"
+ tr("Garmin IMG maps") + " (*.img *.xml);;"
+ tr("Garmin JNX maps") + " (*.jnx);;" + tr("Garmin JNX maps") + " (*.jnx);;"
+ tr("OziExplorer maps") + " (*.map);;" + tr("OziExplorer maps") + " (*.map);;"
+ tr("MBTiles maps") + " (*.mbtiles);;" + tr("MBTiles maps") + " (*.mbtiles);;"
@ -144,7 +123,8 @@ QString MapList::formats()
QStringList MapList::filter() QStringList MapList::filter()
{ {
QStringList filter; QStringList filter;
filter << "*.img" << "*.jnx" << "*.map" << "*.tba" << "*.tar" << "*.xml" filter << "*.gmap" << "*.gmapi" << "*.img" << "*.jnx" << "*.map"
<< "*.tif" << "*.tiff" << "*.mbtiles" << "*.rmap" << "*.rtmap" << "*.img"; << "*.mbtiles" << "*.rmap" << "*.rtmap" << "*.tar" << "*.tba" << "*.tif"
<< "*.tiff" << "*.xml";
return filter; return filter;
} }

View File

@ -13,23 +13,24 @@ class MapList : public QObject
public: public:
MapList(QObject *parent = 0) : QObject(parent) {} MapList(QObject *parent = 0) : QObject(parent) {}
bool loadFile(const QString &path); bool loadFile(const QString &path, bool *terminate = 0);
bool loadDir(const QString &path); bool loadDir(const QString &path);
const QList<Map*> &maps() const {return _maps;} const QList<Map*> &maps() const {return _maps;}
const QString &errorString() const {return _errorString;} const QString &errorString() const {return _errorString;}
const QString &errorPath() const {return _errorPath;}
static QString formats(); static QString formats();
static QStringList filter(); static QStringList filter();
private: private:
bool loadFile(const QString &path, bool *terminate, bool dir); Map *loadSource(const QString &path);
bool loadDirR(const QString &path); bool loadMap(Map *map, const QString &path);
Map *loadSource(const QString &path, bool dir);
bool loadMap(Map *map, const QString &path, bool dir);
QList<Map*> _maps; QList<Map*> _maps;
QString _errorString; QString _errorString;
QString _errorPath;
}; };
#endif // MAPLIST_H #endif // MAPLIST_H