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

Compare commits

...

7 Commits
4.15 ... 4.16

12 changed files with 184 additions and 15 deletions

View File

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

BIN
cert/mac/gpxsee.cer Normal file

Binary file not shown.

View File

@ -1,5 +1,5 @@
TARGET = GPXSee TARGET = GPXSee
VERSION = 4.15 VERSION = 4.16
QT += core \ QT += core \
gui \ gui \
network network

View File

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

View File

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

View File

@ -187,7 +187,7 @@ void GUI::loadMaps()
} }
} }
_map = _ml->maps().isEmpty() ? new EmptyMap(this) : _ml->maps().first(); _map = new EmptyMap(this);
} }
void GUI::loadPOIs() void GUI::loadPOIs()
@ -1711,9 +1711,7 @@ void GUI::readSettings()
_showMapAction->setChecked(true); _showMapAction->setChecked(true);
if (_ml->maps().count()) { if (_ml->maps().count()) {
int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString()); int index = mapIndex(settings.value(CURRENT_MAP_SETTING).toString());
_mapActions.at(index)->setChecked(true); _mapActions.at(index)->trigger();
_map = _ml->maps().at(index);
_pathView->setMap(_map);
} }
settings.endGroup(); settings.endGroup();

View File

@ -225,10 +225,127 @@ void KMLParser::point(Waypoint &waypoint)
_reader.raiseError("Missing Point coordinates"); _reader.raiseError("Missing Point coordinates");
} }
void KMLParser::heartRate(TrackData &track, int start)
{
int i = start;
const char error[] = "Heartrate data count mismatch";
while (_reader.readNextStartElement()) {
if (_reader.name() == "value") {
if (i < track.size())
track[i++].setHeartRate(number());
else {
_reader.raiseError(error);
return;
}
} else
_reader.skipCurrentElement();
}
if (i != track.size())
_reader.raiseError(error);
}
void KMLParser::cadence(TrackData &track, int start)
{
int i = start;
const char error[] = "Cadence data count mismatch";
while (_reader.readNextStartElement()) {
if (_reader.name() == "value") {
if (i < track.size())
track[i++].setCadence(number());
else {
_reader.raiseError(error);
return;
}
} else
_reader.skipCurrentElement();
}
if (i != track.size())
_reader.raiseError(error);
}
void KMLParser::speed(TrackData &track, int start)
{
int i = start;
const char error[] = "Speed data count mismatch";
while (_reader.readNextStartElement()) {
if (_reader.name() == "value") {
if (i < track.size())
track[i++].setSpeed(number());
else {
_reader.raiseError(error);
return;
}
} else
_reader.skipCurrentElement();
}
if (i != track.size())
_reader.raiseError(error);
}
void KMLParser::temperature(TrackData &track, int start)
{
int i = start;
const char error[] = "Temperature data count mismatch";
while (_reader.readNextStartElement()) {
if (_reader.name() == "value") {
if (i < track.size())
track[i++].setTemperature(number());
else {
_reader.raiseError(error);
return;
}
} else
_reader.skipCurrentElement();
}
if (i != track.size())
_reader.raiseError(error);
}
void KMLParser::schemaData(TrackData &track, int start)
{
while (_reader.readNextStartElement()) {
if (_reader.name() == "SimpleArrayData") {
QXmlStreamAttributes attr = _reader.attributes();
QStringRef name = attr.value("name");
if (name == "Heartrate")
heartRate(track, start);
else if (name == "Cadence")
cadence(track, start);
else if (name == "Speed")
speed(track, start);
else if (name == "Temperature")
temperature(track, start);
else
_reader.skipCurrentElement();
} else
_reader.skipCurrentElement();
}
}
void KMLParser::extendedData(TrackData &track, int start)
{
while (_reader.readNextStartElement()) {
if (_reader.name() == "SchemaData")
schemaData(track, start);
else
_reader.skipCurrentElement();
}
}
void KMLParser::track(TrackData &track) void KMLParser::track(TrackData &track)
{ {
const char mismatchError[] = "gx:coord/when element count mismatch"; const char error[] = "gx:coord/when element count mismatch";
int i = track.size(); int first = track.size();
int i = first;
while (_reader.readNextStartElement()) { while (_reader.readNextStartElement()) {
if (_reader.name() == "when") { if (_reader.name() == "when") {
@ -236,19 +353,31 @@ void KMLParser::track(TrackData &track)
track.last().setTimestamp(time()); track.last().setTimestamp(time());
} else if (_reader.name() == "coord") { } else if (_reader.name() == "coord") {
if (i == track.size()) { if (i == track.size()) {
_reader.raiseError(mismatchError); _reader.raiseError(error);
return; return;
} else if (!coord(track[i])) { } else if (!coord(track[i])) {
_reader.raiseError("Invalid coordinates"); _reader.raiseError("Invalid coordinates");
return; return;
} }
i++; i++;
} else } else if (_reader.name() == "ExtendedData")
extendedData(track, first);
else
_reader.skipCurrentElement(); _reader.skipCurrentElement();
} }
if (i != track.size()) if (i != track.size())
_reader.raiseError(mismatchError); _reader.raiseError(error);
}
void KMLParser::multiTrack(TrackData &t)
{
while (_reader.readNextStartElement()) {
if (_reader.name() == "Track")
track(t);
else
_reader.skipCurrentElement();
}
} }
void KMLParser::multiGeometry(QList<TrackData> &tracks, void KMLParser::multiGeometry(QList<TrackData> &tracks,
@ -308,6 +437,12 @@ void KMLParser::placemark(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
t.setName(name); t.setName(name);
t.setDescription(desc); t.setDescription(desc);
track(t); track(t);
} else if (_reader.name() == "MultiTrack") {
tracks.append(TrackData());
TrackData &t = tracks.last();
t.setName(name);
t.setDescription(desc);
multiTrack(t);
} else } else
_reader.skipCurrentElement(); _reader.skipCurrentElement();
} }
@ -344,6 +479,8 @@ void KMLParser::kml(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
document(tracks, waypoints); document(tracks, waypoints);
else if (_reader.name() == "Placemark") else if (_reader.name() == "Placemark")
placemark(tracks, waypoints); placemark(tracks, waypoints);
else if (_reader.name() == "Folder")
folder(tracks, waypoints);
else else
_reader.skipCurrentElement(); _reader.skipCurrentElement();
} }

View File

@ -23,11 +23,18 @@ private:
void multiGeometry(QList<TrackData> &tracks, QList<Waypoint> &waypoints, void multiGeometry(QList<TrackData> &tracks, QList<Waypoint> &waypoints,
const QString &name, const QString &desc, const QDateTime timestamp); const QString &name, const QString &desc, const QDateTime timestamp);
void track(TrackData &track); void track(TrackData &track);
void multiTrack(TrackData &t);
void lineString(TrackData &track); void lineString(TrackData &track);
void point(Waypoint &waypoint); void point(Waypoint &waypoint);
bool pointCoordinates(Waypoint &waypoint); bool pointCoordinates(Waypoint &waypoint);
bool lineCoordinates(TrackData &track); bool lineCoordinates(TrackData &track);
bool coord(Trackpoint &trackpoint); bool coord(Trackpoint &trackpoint);
void extendedData(TrackData &track, int start);
void schemaData(TrackData &track, int start);
void heartRate(TrackData &track, int start);
void cadence(TrackData &track, int start);
void speed(TrackData &track, int start);
void temperature(TrackData &track, int start);
QDateTime timeStamp(); QDateTime timeStamp();
qreal number(); qreal number();
QDateTime time(); QDateTime time();

View File

@ -43,8 +43,10 @@ PathView::PathView(Map *map, POI *poi, QWidget *parent)
_scene->addItem(_mapScale); _scene->addItem(_mapScale);
_map = map; _map = map;
_poi = poi; _map->load();
connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap())); connect(_map, SIGNAL(loaded()), this, SLOT(reloadMap()));
_poi = poi;
connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI())); connect(_poi, SIGNAL(pointsChanged()), this, SLOT(updatePOI()));
_units = Metric; _units = Metric;

View File

@ -183,7 +183,7 @@ void TCXParser::courses(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
} }
} }
void TCXParser::activities(QList<TrackData> &tracks) void TCXParser::sport(QList<TrackData> &tracks)
{ {
while (_reader.readNextStartElement()) { while (_reader.readNextStartElement()) {
if (_reader.name() == "Activity") { if (_reader.name() == "Activity") {
@ -194,6 +194,29 @@ void TCXParser::activities(QList<TrackData> &tracks)
} }
} }
void TCXParser::multiSportSession(QList<TrackData> &tracks)
{
while (_reader.readNextStartElement()) {
if (_reader.name() == "FirstSport" || _reader.name() == "NextSport")
sport(tracks);
else
_reader.skipCurrentElement();
}
}
void TCXParser::activities(QList<TrackData> &tracks)
{
while (_reader.readNextStartElement()) {
if (_reader.name() == "Activity") {
tracks.append(TrackData());
activity(tracks.back());
} else if (_reader.name() == "MultiSportSession")
multiSportSession(tracks);
else
_reader.skipCurrentElement();
}
}
void TCXParser::tcx(QList<TrackData> &tracks, QList<Waypoint> &waypoints) void TCXParser::tcx(QList<TrackData> &tracks, QList<Waypoint> &waypoints)
{ {
while (_reader.readNextStartElement()) { while (_reader.readNextStartElement()) {

View File

@ -19,6 +19,8 @@ private:
void tcx(QList<TrackData> &tracks, QList<Waypoint> &waypoints); void tcx(QList<TrackData> &tracks, QList<Waypoint> &waypoints);
void courses(QList<TrackData> &tracks, QList<Waypoint> &waypoints); void courses(QList<TrackData> &tracks, QList<Waypoint> &waypoints);
void activities(QList<TrackData> &tracks); void activities(QList<TrackData> &tracks);
void multiSportSession(QList<TrackData> &tracks);
void sport(QList<TrackData> &tracks);
void course(QList<Waypoint> &waypoints, TrackData &track); void course(QList<Waypoint> &waypoints, TrackData &track);
void activity(TrackData &track); void activity(TrackData &track);
void lap(TrackData &track); void lap(TrackData &track);