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

Compare commits

...

22 Commits
7.26 ... 7.29

Author SHA1 Message Date
cbe312d9c8 Version++ 2020-04-19 14:52:40 +02:00
08334d7fde Move the world maps bounds limit hack to the propper place 2020-04-19 11:36:17 +02:00
33bbd6a592 Yet another special case 2020-04-18 00:00:48 +02:00
7811527239 Rather show less road shields than more 2020-04-15 22:48:28 +02:00
31da4e1906 Some more default IMG style tweaking 2020-04-15 22:48:02 +02:00
652cbd7c11 Fixed Qt4 build 2020-04-09 10:17:30 +02:00
eb0ff84379 Code cleanup 2020-04-08 22:28:35 +02:00
6ee3a8ea8d Added support for FIT course points 2020-04-08 00:54:35 +02:00
ee3d43e249 A slightly darker white 2020-04-08 00:00:43 +02:00
242babb741 Improved default IMG style
("less green")
2020-04-07 00:54:31 +02:00
e26d1abd5a Version++ 2020-04-05 10:50:24 +02:00
e80d16bec5 Merge branch 'origin/master' into Weblate. 2020-04-05 10:39:16 +02:00
412ae74bfa Fixed broken map enable condition
(falsly enabled map can crash)
2020-04-05 10:38:16 +02:00
1c472e47b9 Translated using Weblate (Hungarian)
Currently translated at 100.0% (356 of 356 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/hu/
2020-04-04 20:09:37 +02:00
4a725375e2 Translated using Weblate (Ukrainian)
Currently translated at 100.0% (356 of 356 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/uk/
2020-04-02 12:09:36 +02:00
383a196414 Translated using Weblate (Russian)
Currently translated at 100.0% (356 of 356 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/ru/
2020-04-02 12:09:36 +02:00
f05b51efa6 Translated using Weblate (Finnish)
Currently translated at 100.0% (356 of 356 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fi/
2020-04-02 12:09:36 +02:00
a56c02953f Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.4% (354 of 356 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2020-03-29 20:05:00 +02:00
00d3849e4f Translated using Weblate (French)
Currently translated at 100.0% (356 of 356 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/fr/
2020-03-29 20:05:00 +02:00
c9244c0684 Fixed broken graph color change when secondary graphs present 2020-03-28 23:28:39 +01:00
d94938261a Version++ 2020-03-28 19:50:39 +01:00
d5fc06d9d1 Fixed remaining qWarning() format warning 2020-03-28 19:15:03 +01:00
23 changed files with 200 additions and 130 deletions

View File

@ -1,4 +1,4 @@
version: 7.26.{build}
version: 7.29.{build}
configuration:
- Release

View File

@ -3,7 +3,7 @@ unix:!macx {
} else {
TARGET = GPXSee
}
VERSION = 7.26
VERSION = 7.29
QT += core \
gui \

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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"

View File

@ -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"

View File

@ -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)

View File

@ -3,7 +3,6 @@
#include <QGraphicsView>
#include <QList>
#include <QSet>
#include "data/graph.h"
#include "palette.h"
#include "units.h"

View File

@ -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()));
}

View File

@ -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))

View File

@ -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);

View File

@ -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));
}
}

View File

@ -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;}

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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;

View File

@ -63,6 +63,7 @@ private:
Projection _projection;
Transform _transform;
QRectF _bounds;
RectC _dataBounds;
bool _valid;
QString _errorString;