mirror of
https://github.com/tumic0/GPXSee.git
synced 2025-07-01 21:39:15 +02:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
cbe312d9c8 | |||
08334d7fde | |||
33bbd6a592 | |||
7811527239 | |||
31da4e1906 | |||
652cbd7c11 | |||
eb0ff84379 | |||
6ee3a8ea8d | |||
ee3d43e249 | |||
242babb741 | |||
e26d1abd5a | |||
e80d16bec5 | |||
412ae74bfa | |||
1c472e47b9 | |||
4a725375e2 | |||
383a196414 | |||
f05b51efa6 | |||
a56c02953f | |||
00d3849e4f | |||
c9244c0684 | |||
d94938261a | |||
d5fc06d9d1 |
@ -1,4 +1,4 @@
|
||||
version: 7.26.{build}
|
||||
version: 7.29.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
@ -3,7 +3,7 @@ unix:!macx {
|
||||
} else {
|
||||
TARGET = GPXSee
|
||||
}
|
||||
VERSION = 7.26
|
||||
VERSION = 7.29
|
||||
|
||||
QT += core \
|
||||
gui \
|
||||
|
@ -1327,7 +1327,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="410"/>
|
||||
<source>Show secondary speed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Näytä molemmat samanaikaisesti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="413"/>
|
||||
@ -1342,7 +1342,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="419"/>
|
||||
<source>Show secondary elevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Näytä molemmat samanaikaisesti</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="462"/>
|
||||
|
@ -1327,7 +1327,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="410"/>
|
||||
<source>Show secondary speed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Afficher la vitesse secondaire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="413"/>
|
||||
@ -1342,7 +1342,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="419"/>
|
||||
<source>Show secondary elevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Afficher l’élévation secondaire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="462"/>
|
||||
@ -1628,7 +1628,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/routeitem.cpp" line="19"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Commentaire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/routeitem.cpp" line="20"/>
|
||||
@ -1849,7 +1849,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/trackitem.cpp" line="17"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Commentaire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/trackitem.cpp" line="18"/>
|
||||
@ -1907,7 +1907,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/waypointitem.cpp" line="39"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Commentaire</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/waypointitem.cpp" line="52"/>
|
||||
|
@ -864,6 +864,7 @@
|
||||
<source>%n files</source>
|
||||
<translation>
|
||||
<numerusform>%n fájl</numerusform>
|
||||
<numerusform>%n fájl</numerusform>
|
||||
</translation>
|
||||
</message>
|
||||
</context>
|
||||
@ -1366,7 +1367,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="410"/>
|
||||
<source>Show secondary speed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Másodlagos sebesség mutatása</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="413"/>
|
||||
@ -1381,7 +1382,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="419"/>
|
||||
<source>Show secondary elevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Másodlagos emelkedés mutatása</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="455"/>
|
||||
@ -1627,7 +1628,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/routeitem.cpp" line="19"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Megjegyzés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/routeitem.cpp" line="20"/>
|
||||
@ -1848,7 +1849,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/trackitem.cpp" line="17"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Megjegyzés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/trackitem.cpp" line="18"/>
|
||||
@ -1906,7 +1907,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/waypointitem.cpp" line="39"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Megjegyzés</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/waypointitem.cpp" line="52"/>
|
||||
|
@ -1362,7 +1362,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="410"/>
|
||||
<source>Show secondary speed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Vis sekundær hastighet</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="413"/>
|
||||
@ -1377,7 +1377,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="419"/>
|
||||
<source>Show secondary elevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Vis sekundær høyde</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="462"/>
|
||||
@ -1628,7 +1628,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/routeitem.cpp" line="19"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Kommentar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/routeitem.cpp" line="20"/>
|
||||
@ -1849,7 +1849,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/trackitem.cpp" line="17"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation type="unfinished">Kommentar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/trackitem.cpp" line="18"/>
|
||||
@ -1907,7 +1907,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/waypointitem.cpp" line="39"/>
|
||||
<source>Comment</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation type="unfinished">Kommentar</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/waypointitem.cpp" line="52"/>
|
||||
|
@ -1328,7 +1328,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="410"/>
|
||||
<source>Show secondary speed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Показывать обе одновременно</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="413"/>
|
||||
@ -1343,7 +1343,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="419"/>
|
||||
<source>Show secondary elevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Показывать обе одновременно</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="462"/>
|
||||
|
@ -1368,7 +1368,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="410"/>
|
||||
<source>Show secondary speed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Показувати обидві одночасно</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="413"/>
|
||||
@ -1383,7 +1383,7 @@
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="419"/>
|
||||
<source>Show secondary elevation</source>
|
||||
<translation type="unfinished"></translation>
|
||||
<translation>Показувати обидві одночасно</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../src/GUI/optionsdialog.cpp" line="455"/>
|
||||
|
@ -7,7 +7,7 @@
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "7.26"
|
||||
!define VERSION "7.29"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}.exe"
|
||||
|
@ -7,7 +7,7 @@
|
||||
; The name of the installer
|
||||
Name "GPXSee"
|
||||
; Program version
|
||||
!define VERSION "7.26"
|
||||
!define VERSION "7.29"
|
||||
|
||||
; The file to write
|
||||
OutFile "GPXSee-${VERSION}_x64.exe"
|
||||
|
@ -1,3 +1,4 @@
|
||||
#include <QSet>
|
||||
#include <QGraphicsScene>
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
@ -494,8 +495,23 @@ void GraphView::setPalette(const Palette &palette)
|
||||
_palette = palette;
|
||||
_palette.reset();
|
||||
|
||||
for (int i = 0; i < _graphs.count(); i++)
|
||||
_graphs.at(i)->setColor(_palette.nextColor());
|
||||
QSet<GraphItem*> secondary;
|
||||
for (int i = 0; i < _graphs.count(); i++) {
|
||||
GraphItem *g = _graphs[i];
|
||||
if (g->secondaryGraph())
|
||||
secondary.insert(g->secondaryGraph());
|
||||
}
|
||||
|
||||
for (int i = 0; i < _graphs.count(); i++) {
|
||||
GraphItem *g = _graphs[i];
|
||||
if (secondary.contains(g))
|
||||
continue;
|
||||
|
||||
QColor color(_palette.nextColor());
|
||||
g->setColor(color);
|
||||
if (g->secondaryGraph())
|
||||
g->secondaryGraph()->setColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
void GraphView::setGraphWidth(int width)
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#include <QGraphicsView>
|
||||
#include <QList>
|
||||
#include <QSet>
|
||||
#include "data/graph.h"
|
||||
#include "palette.h"
|
||||
#include "units.h"
|
||||
|
@ -13,7 +13,7 @@ public:
|
||||
{
|
||||
map->setParent(this);
|
||||
setData(QVariant::fromValue(map));
|
||||
setEnabled(map->isValid());
|
||||
setEnabled(map->isReady());
|
||||
connect(map, SIGNAL(mapLoaded()), this, SLOT(mapLoaded()));
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#define RECORD_MESSAGE 20
|
||||
#define EVENT_MESSAGE 21
|
||||
#define COURSE_POINT 32
|
||||
#define TIMESTAMP_FIELD 253
|
||||
|
||||
class Event {
|
||||
@ -48,10 +49,12 @@ public:
|
||||
|
||||
class FITParser::CTX {
|
||||
public:
|
||||
CTX(QFile *file) : file(file), len(0), endian(0), timestamp(0),
|
||||
lastWrite(0), ratio(NAN) {}
|
||||
CTX(QFile *file, QVector<Waypoint> &waypoints)
|
||||
: file(file), waypoints(waypoints), len(0), endian(0), timestamp(0),
|
||||
lastWrite(0), ratio(NAN) {}
|
||||
|
||||
QFile *file;
|
||||
QVector<Waypoint> &waypoints;
|
||||
quint32 len;
|
||||
quint8 endian;
|
||||
quint32 timestamp, lastWrite;
|
||||
@ -61,6 +64,41 @@ public:
|
||||
SegmentData segment;
|
||||
};
|
||||
|
||||
static QMap<int, QString> coursePointDescInit()
|
||||
{
|
||||
QMap<int, QString> map;
|
||||
|
||||
map.insert(1, "Summit");
|
||||
map.insert(2, "Valley");
|
||||
map.insert(3, "Water");
|
||||
map.insert(4, "Food");
|
||||
map.insert(5, "Danger");
|
||||
map.insert(6, "Left");
|
||||
map.insert(7, "Right");
|
||||
map.insert(8, "Straight");
|
||||
map.insert(9, "First aid");
|
||||
map.insert(10, "Fourth category");
|
||||
map.insert(11, "Third category");
|
||||
map.insert(12, "Second category");
|
||||
map.insert(13, "First category");
|
||||
map.insert(14, "Hors category");
|
||||
map.insert(15, "Sprint");
|
||||
map.insert(16, "Left fork");
|
||||
map.insert(17, "Right fork");
|
||||
map.insert(18, "Middle fork");
|
||||
map.insert(19, "Slight left");
|
||||
map.insert(20, "Sharp left");
|
||||
map.insert(21, "Slight right");
|
||||
map.insert(22, "Sharp right");
|
||||
map.insert(23, "U-Turn");
|
||||
map.insert(24, "Segment start");
|
||||
map.insert(25, "Segment end");
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
static QMap<int, QString> coursePointDesc = coursePointDescInit();
|
||||
|
||||
|
||||
bool FITParser::readData(QFile *file, char *data, size_t size)
|
||||
{
|
||||
@ -80,17 +118,12 @@ bool FITParser::readData(QFile *file, char *data, size_t size)
|
||||
|
||||
template<class T> bool FITParser::readValue(CTX &ctx, T &val)
|
||||
{
|
||||
T data;
|
||||
|
||||
if (!readData(ctx.file, (char*)&data, sizeof(T)))
|
||||
if (!readData(ctx.file, (char*)&val, sizeof(T)))
|
||||
return false;
|
||||
|
||||
ctx.len -= sizeof(T);
|
||||
|
||||
if (ctx.endian)
|
||||
val = qFromBigEndian(data);
|
||||
else
|
||||
val = qFromLittleEndian(data);
|
||||
if (sizeof(T) > 1)
|
||||
val = (ctx.endian) ? qFromBigEndian(val) : qFromLittleEndian(val);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -167,41 +200,51 @@ bool FITParser::parseDefinitionMessage(CTX &ctx, quint8 header)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FITParser::readField(CTX &ctx, Field *field, quint32 &val)
|
||||
bool FITParser::readField(CTX &ctx, Field *field, QVariant &val, bool &valid)
|
||||
{
|
||||
quint8 v8 = (quint8)-1;
|
||||
quint16 v16 = (quint16)-1;
|
||||
bool ret;
|
||||
|
||||
val = (quint32)-1;
|
||||
#define VAL(type, inval) \
|
||||
{type var; \
|
||||
if (field->size == sizeof(var)) { \
|
||||
ret = readValue(ctx, var); \
|
||||
val = var; \
|
||||
valid = (var != (inval)); \
|
||||
} else { \
|
||||
ret = skipValue(ctx, field->size); \
|
||||
valid = false; \
|
||||
}}
|
||||
|
||||
switch (field->type) {
|
||||
case 0: // enum
|
||||
case 1: // sint8
|
||||
VAL(qint8, 0x7fU);
|
||||
break;
|
||||
case 2: // uint8
|
||||
if (field->size == 1) {
|
||||
ret = readValue(ctx, v8);
|
||||
val = v8;
|
||||
} else
|
||||
ret = skipValue(ctx, field->size);
|
||||
case 0: // enum
|
||||
VAL(quint8, 0xffU);
|
||||
break;
|
||||
case 7: // UTF8 nul terminated string
|
||||
{QByteArray ba(ctx.file->read(field->size));
|
||||
ctx.len -= field->size;
|
||||
ret = (ba.size() == field->size);
|
||||
val = ret ? ba : QString();
|
||||
valid = !ba.isEmpty();}
|
||||
break;
|
||||
case 0x83: // sint16
|
||||
VAL(qint16, 0x7fffU);
|
||||
break;
|
||||
case 0x84: // uint16
|
||||
if (field->size == 2) {
|
||||
ret = readValue(ctx, v16);
|
||||
val = v16;
|
||||
} else
|
||||
ret = skipValue(ctx, field->size);
|
||||
VAL(quint16, 0xffffU);
|
||||
break;
|
||||
case 0x85: // sint32
|
||||
VAL(qint32, 0x7fffffffU);
|
||||
break;
|
||||
case 0x86: // uint32
|
||||
if (field->size == 4)
|
||||
ret = readValue(ctx, val);
|
||||
else
|
||||
ret = skipValue(ctx, field->size);
|
||||
VAL(quint32, 0xffffffffU);
|
||||
break;
|
||||
default:
|
||||
ret = skipValue(ctx, field->size);
|
||||
valid = false;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -211,8 +254,10 @@ bool FITParser::readField(CTX &ctx, Field *field, quint32 &val)
|
||||
bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
||||
{
|
||||
Field *field;
|
||||
QVariant val;
|
||||
bool valid;
|
||||
Event event;
|
||||
quint32 val;
|
||||
Waypoint waypoint;
|
||||
|
||||
|
||||
if (!def->fields && !def->devFields) {
|
||||
@ -224,69 +269,79 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
||||
|
||||
for (int i = 0; i < def->numFields; i++) {
|
||||
field = &def->fields[i];
|
||||
if (!readField(ctx, field, val))
|
||||
if (!readField(ctx, field, val, valid))
|
||||
return false;
|
||||
if (!valid)
|
||||
continue;
|
||||
|
||||
if (field->id == TIMESTAMP_FIELD)
|
||||
ctx.timestamp = val;
|
||||
ctx.timestamp = val.toUInt();
|
||||
else if (def->globalId == RECORD_MESSAGE) {
|
||||
switch (field->id) {
|
||||
case 0:
|
||||
if (val != 0x7fffffff)
|
||||
ctx.trackpoint.rcoordinates().setLat(
|
||||
((qint32)val / (double)0x7fffffff) * 180);
|
||||
ctx.trackpoint.rcoordinates().setLat(
|
||||
(val.toInt() / (double)0x7fffffff) * 180);
|
||||
break;
|
||||
case 1:
|
||||
if (val != 0x7fffffff)
|
||||
ctx.trackpoint.rcoordinates().setLon(
|
||||
((qint32)val / (double)0x7fffffff) * 180);
|
||||
ctx.trackpoint.rcoordinates().setLon(
|
||||
(val.toInt() / (double)0x7fffffff) * 180);
|
||||
break;
|
||||
case 2:
|
||||
if (val != 0xffff)
|
||||
ctx.trackpoint.setElevation((val / 5.0) - 500);
|
||||
ctx.trackpoint.setElevation((val.toUInt() / 5.0) - 500);
|
||||
break;
|
||||
case 3:
|
||||
if (val != 0xff)
|
||||
ctx.trackpoint.setHeartRate(val);
|
||||
ctx.trackpoint.setHeartRate(val.toUInt());
|
||||
break;
|
||||
case 4:
|
||||
if (val != 0xff)
|
||||
ctx.trackpoint.setCadence(val);
|
||||
ctx.trackpoint.setCadence(val.toUInt());
|
||||
break;
|
||||
case 6:
|
||||
if (val != 0xffff)
|
||||
ctx.trackpoint.setSpeed(val / 1000.0f);
|
||||
ctx.trackpoint.setSpeed(val.toUInt() / 1000.0f);
|
||||
break;
|
||||
case 7:
|
||||
if (val != 0xffff)
|
||||
ctx.trackpoint.setPower(val);
|
||||
ctx.trackpoint.setPower(val.toUInt());
|
||||
break;
|
||||
case 13:
|
||||
if (val != 0x7f)
|
||||
ctx.trackpoint.setTemperature((qint8)val);
|
||||
ctx.trackpoint.setTemperature(val.toInt());
|
||||
break;
|
||||
case 73:
|
||||
if (val != 0xffffffff)
|
||||
ctx.trackpoint.setSpeed(val / 1000.0f);
|
||||
ctx.trackpoint.setSpeed(val.toUInt() / 1000.0f);
|
||||
break;
|
||||
case 78:
|
||||
if (val != 0xffffffff)
|
||||
ctx.trackpoint.setElevation((val / 5.0) - 500);
|
||||
ctx.trackpoint.setElevation((val.toUInt() / 5.0) - 500);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
} else if (def->globalId == EVENT_MESSAGE) {
|
||||
switch (field->id) {
|
||||
case 0:
|
||||
event.id = val;
|
||||
event.id = val.toUInt();
|
||||
break;
|
||||
case 1:
|
||||
event.type = val;
|
||||
event.type = val.toUInt();
|
||||
break;
|
||||
case 3:
|
||||
event.data = val;
|
||||
event.data = val.toUInt();
|
||||
break;
|
||||
}
|
||||
} else if (def->globalId == COURSE_POINT) {
|
||||
switch (field->id) {
|
||||
case 1:
|
||||
waypoint.setTimestamp(QDateTime::fromTime_t(val.toUInt()
|
||||
+ 631065600));
|
||||
break;
|
||||
case 2:
|
||||
waypoint.rcoordinates().setLat(
|
||||
(val.toInt() / (double)0x7fffffff) * 180);
|
||||
break;
|
||||
case 3:
|
||||
waypoint.rcoordinates().setLon(
|
||||
(val.toInt() / (double)0x7fffffff) * 180);
|
||||
break;
|
||||
case 5:
|
||||
waypoint.setDescription(coursePointDesc.value(val.toUInt()));
|
||||
break;
|
||||
case 6:
|
||||
waypoint.setName(val.toString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -294,7 +349,7 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
||||
|
||||
for (int i = 0; i < def->numDevFields; i++) {
|
||||
field = &def->devFields[i];
|
||||
if (!readField(ctx, field, val))
|
||||
if (!readField(ctx, field, val, valid))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -315,7 +370,9 @@ bool FITParser::parseData(CTX &ctx, const MessageDefinition *def)
|
||||
ctx.trackpoint = Trackpoint();
|
||||
ctx.lastWrite = ctx.timestamp;
|
||||
}
|
||||
}
|
||||
} else if (def->globalId == COURSE_POINT)
|
||||
if (waypoint.coordinates().isValid())
|
||||
ctx.waypoints.append(waypoint);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -381,9 +438,8 @@ bool FITParser::parse(QFile *file, QList<TrackData> &tracks,
|
||||
QList<Area> &polygons, QVector<Waypoint> &waypoints)
|
||||
{
|
||||
Q_UNUSED(routes);
|
||||
Q_UNUSED(waypoints);
|
||||
Q_UNUSED(polygons);
|
||||
CTX ctx(file);
|
||||
CTX ctx(file, waypoints);
|
||||
|
||||
|
||||
if (!parseHeader(ctx))
|
||||
|
@ -21,7 +21,7 @@ private:
|
||||
bool readData(QFile *file, char *data, size_t size);
|
||||
template<class T> bool readValue(CTX &ctx, T &val);
|
||||
bool skipValue(CTX &ctx, quint8 size);
|
||||
bool readField(CTX &ctx, Field *field, quint32 &val);
|
||||
bool readField(CTX &ctx, Field *field, QVariant &val, bool &valid);
|
||||
|
||||
bool parseHeader(CTX &ctx);
|
||||
bool parseRecord(CTX &ctx);
|
||||
|
@ -63,8 +63,8 @@ void POI::loadDir(const QString &path)
|
||||
loadDir(fi.absoluteFilePath());
|
||||
else
|
||||
if (!loadFile(fi.absoluteFilePath()))
|
||||
qWarning(qPrintable(fi.absoluteFilePath() + ": "
|
||||
+ _errorString));
|
||||
qWarning("%s: %s", qPrintable(fi.absoluteFilePath()),
|
||||
qPrintable(_errorString));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ public:
|
||||
: _coordinates(coordinates), _elevation(NAN) {}
|
||||
|
||||
const Coordinates &coordinates() const {return _coordinates;}
|
||||
Coordinates &rcoordinates() {return _coordinates;}
|
||||
const QString &name() const {return _name;}
|
||||
const QString &description() const {return _description;}
|
||||
const QString &comment() const {return _comment;}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <QXmlStreamReader>
|
||||
#include <QDir>
|
||||
#include "map/osm.h"
|
||||
#include "vectortile.h"
|
||||
#include "gmap.h"
|
||||
|
||||
@ -104,11 +103,6 @@ bool GMAP::loadTile(const QDir &dir, bool baseMap)
|
||||
if (tile->zooms().min() < _zooms.min())
|
||||
_zooms.setMin(tile->zooms().min());
|
||||
|
||||
// Limit world maps bounds so that the maps can be projected using
|
||||
// the default Web Mercator projection
|
||||
if (_bounds.height() > 120)
|
||||
_bounds &= OSM::BOUNDS;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <QMap>
|
||||
#include <QtEndian>
|
||||
#include "map/osm.h"
|
||||
#include "vectortile.h"
|
||||
#include "img.h"
|
||||
|
||||
@ -169,11 +168,6 @@ IMG::IMG(const QString &fileName) : _file(fileName)
|
||||
tile->markAsBasemap();
|
||||
}
|
||||
|
||||
// Limit world maps bounds so that the maps can be projected using
|
||||
// the default Web Mercator projection
|
||||
if (_bounds.height() > 120)
|
||||
_bounds &= OSM::BOUNDS;
|
||||
|
||||
if (!_tileTree.Count())
|
||||
_errorString = "No usable map tile found";
|
||||
else
|
||||
|
@ -151,7 +151,9 @@ Label LBLFile::label8b(Handle &hdl, quint32 offset, bool capitalize) const
|
||||
if (!c || c == 0x1d)
|
||||
break;
|
||||
|
||||
if ((c >= 0x1e && c <= 0x1f)) {
|
||||
if (c == 0x1c)
|
||||
capitalize = false;
|
||||
else if ((c >= 0x1e && c <= 0x1f)) {
|
||||
if (bap == &shieldLabel)
|
||||
bap = &label;
|
||||
else
|
||||
|
@ -25,12 +25,12 @@ void Style::defaultPolygonStyle()
|
||||
_polygons[TYPE(0x12)] = Polygon(QBrush("#e6e2d9"));
|
||||
_polygons[TYPE(0x13)] = Polygon(QBrush("#dbd0b6"),
|
||||
QPen(QColor("#cdccc4"), 1));
|
||||
_polygons[TYPE(0x14)] = Polygon(QBrush("#d4ebb8"));
|
||||
_polygons[TYPE(0x15)] = Polygon(QBrush("#d4ebb8"));
|
||||
_polygons[TYPE(0x14)] = Polygon(QBrush("#cadfaf"));
|
||||
_polygons[TYPE(0x15)] = Polygon(QBrush("#cadfaf"));
|
||||
_polygons[TYPE(0x16)] = Polygon(QBrush(QColor("#9ac269"),
|
||||
Qt::BDiagPattern));
|
||||
_polygons[TYPE(0x17)] = Polygon(QBrush("#d4ebb8"));
|
||||
_polygons[TYPE(0x18)] = Polygon(QBrush("#d4ebb8"));
|
||||
_polygons[TYPE(0x17)] = Polygon(QBrush("#e4efcf"));
|
||||
_polygons[TYPE(0x18)] = Polygon(QBrush("#e3edc6"));
|
||||
_polygons[TYPE(0x19)] = Polygon(QBrush("#e3edc6"), QPen("#c9d3a5"));
|
||||
_polygons[TYPE(0x1a)] = Polygon(QBrush("#000000", Qt::Dense6Pattern),
|
||||
QPen(QColor("#cdccc4"), 1));
|
||||
@ -60,23 +60,23 @@ void Style::defaultPolygonStyle()
|
||||
_polygons[TYPE(0x4a)] = Polygon(QBrush("#f1f0e5"), QPen("#f1f0e5"));
|
||||
_polygons[TYPE(0x4c)] = Polygon(QBrush("#9fc4e1", Qt::Dense6Pattern));
|
||||
_polygons[TYPE(0x4d)] = Polygon(QBrush("#ddf1fd"));
|
||||
_polygons[TYPE(0x4e)] = Polygon(QBrush("#e3edc1"));
|
||||
_polygons[TYPE(0x4f)] = Polygon(QBrush("#d4ebb8"));
|
||||
_polygons[TYPE(0x50)] = Polygon(QBrush("#d4ebb8"));
|
||||
_polygons[TYPE(0x4e)] = Polygon(QBrush("#f8f8f8"));
|
||||
_polygons[TYPE(0x4f)] = Polygon(QBrush("#e4efcf"));
|
||||
_polygons[TYPE(0x50)] = Polygon(QBrush("#cadfaf"));
|
||||
_polygons[TYPE(0x51)] = Polygon(QBrush("#9fc4e1", Qt::Dense4Pattern));
|
||||
_polygons[TYPE(0x52)] = Polygon(QBrush("#d4ebb8"));
|
||||
_polygons[TYPE(0x52)] = Polygon(QBrush("#cadfaf"));
|
||||
|
||||
_drawOrder << TYPE(0x4b) << TYPE(0x4a) << TYPE(0x01) << TYPE(0x02)
|
||||
<< TYPE(0x03) << TYPE(0x17) << TYPE(0x18) << TYPE(0x19) << TYPE(0x1a)
|
||||
<< TYPE(0x28) << TYPE(0x29) << TYPE(0x32) << TYPE(0x3b) << TYPE(0x3c)
|
||||
<< TYPE(0x3d) << TYPE(0x3e) << TYPE(0x3f) << TYPE(0x40) << TYPE(0x41)
|
||||
<< TYPE(0x42) << TYPE(0x43) << TYPE(0x44) << TYPE(0x45) << TYPE(0x46)
|
||||
<< TYPE(0x47) << TYPE(0x48) << TYPE(0x49) << TYPE(0x4c) << TYPE(0x4d)
|
||||
<< TYPE(0x4e) << TYPE(0x4f) << TYPE(0x50) << TYPE(0x51) << TYPE(0x52)
|
||||
<< TYPE(0x14) << TYPE(0x15) << TYPE(0x16) << TYPE(0x1e) << TYPE(0x1f)
|
||||
<< TYPE(0x04) << TYPE(0x05) << TYPE(0x06) << TYPE(0x07) << TYPE(0x08)
|
||||
<< TYPE(0x09) << TYPE(0x0a) << TYPE(0x0b) << TYPE(0x0c) << TYPE(0x0d)
|
||||
<< TYPE(0x0e) << TYPE(0x0f) << TYPE(0x10) << TYPE(0x11) << TYPE(0x12)
|
||||
<< TYPE(0x03) << TYPE(0x17) << TYPE(0x18) << TYPE(0x1a) << TYPE(0x28)
|
||||
<< TYPE(0x29) << TYPE(0x32) << TYPE(0x3b) << TYPE(0x3c) << TYPE(0x3d)
|
||||
<< TYPE(0x3e) << TYPE(0x3f) << TYPE(0x40) << TYPE(0x41) << TYPE(0x42)
|
||||
<< TYPE(0x43) << TYPE(0x44) << TYPE(0x45) << TYPE(0x46) << TYPE(0x47)
|
||||
<< TYPE(0x48) << TYPE(0x49) << TYPE(0x4c) << TYPE(0x4d) << TYPE(0x4e)
|
||||
<< TYPE(0x4f) << TYPE(0x50) << TYPE(0x51) << TYPE(0x52) << TYPE(0x14)
|
||||
<< TYPE(0x15) << TYPE(0x16) << TYPE(0x1e) << TYPE(0x1f) << TYPE(0x04)
|
||||
<< TYPE(0x05) << TYPE(0x06) << TYPE(0x07) << TYPE(0x08) << TYPE(0x09)
|
||||
<< TYPE(0x0a) << TYPE(0x0b) << TYPE(0x0c) << TYPE(0x0d) << TYPE(0x0e)
|
||||
<< TYPE(0x0f) << TYPE(0x10) << TYPE(0x11) << TYPE(0x12) << TYPE(0x19)
|
||||
<< TYPE(0x13);
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "IMG/style.h"
|
||||
#include "IMG/img.h"
|
||||
#include "IMG/gmap.h"
|
||||
#include "osm.h"
|
||||
#include "pcs.h"
|
||||
#include "rectd.h"
|
||||
#include "imgmap.h"
|
||||
@ -244,6 +245,11 @@ IMGMap::IMGMap(const QString &fileName, QObject *parent)
|
||||
return;
|
||||
}
|
||||
|
||||
// Limit world maps bounds so that the maps can be projected using
|
||||
// the default Web Mercator projection
|
||||
_dataBounds = (_data->bounds().height() > 120)
|
||||
? _data->bounds() & OSM::BOUNDS : _data->bounds();
|
||||
|
||||
_zoom = _data->zooms().min();
|
||||
updateTransform();
|
||||
|
||||
@ -305,7 +311,7 @@ Transform IMGMap::transform(int zoom) const
|
||||
{
|
||||
double scale = _projection.isGeographic()
|
||||
? 360.0 / (1<<zoom) : (2.0 * M_PI * WGS84_RADIUS) / (1<<zoom);
|
||||
PointD topLeft(_projection.ll2xy(_data->bounds().topLeft()));
|
||||
PointD topLeft(_projection.ll2xy(_dataBounds.topLeft()));
|
||||
return Transform(ReferencePoint(PointD(0, 0), topLeft),
|
||||
PointD(scale, scale));
|
||||
}
|
||||
@ -314,7 +320,7 @@ void IMGMap::updateTransform()
|
||||
{
|
||||
_transform = transform(_zoom);
|
||||
|
||||
RectD prect(_data->bounds(), _projection);
|
||||
RectD prect(_dataBounds, _projection);
|
||||
_bounds = QRectF(_transform.proj2img(prect.topLeft()),
|
||||
_transform.proj2img(prect.bottomRight()));
|
||||
}
|
||||
@ -483,7 +489,7 @@ void IMGMap::processShields(QList<MapData::Poly> &lines, const QRect &tileRect,
|
||||
= shields.constBegin(); it != shields.constEnd(); ++it) {
|
||||
const QPolygonF &p = it.value();
|
||||
QRectF rect(p.boundingRect() & tileRect);
|
||||
if (qSqrt(AREA(rect)) < TILE_SIZE/8)
|
||||
if (qSqrt(AREA(rect)) < TILE_SIZE/4)
|
||||
continue;
|
||||
|
||||
QMap<qreal, int> map;
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
Projection _projection;
|
||||
Transform _transform;
|
||||
QRectF _bounds;
|
||||
RectC _dataBounds;
|
||||
|
||||
bool _valid;
|
||||
QString _errorString;
|
||||
|
Reference in New Issue
Block a user