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

Compare commits

...

18 Commits

Author SHA1 Message Date
ec06793a19 Code cleanup 2022-04-14 04:31:46 +02:00
53cdc86aa0 Improved error handling + code cleanup 2022-04-13 22:13:57 +02:00
82ea54cacc Added some more missing marine symbols 2022-04-12 23:44:57 +02:00
d8fb7cb41e Merge branch 'origin/master' into Weblate. 2022-04-11 00:58:36 +02:00
5041d935f0 Increase marinas rendering priority 2022-04-11 00:59:26 +02:00
98f9aab9d9 Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.7% (438 of 439 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2022-04-10 13:07:16 +02:00
8bc91c760a Only read the node offset when it is actually present 2022-04-08 00:23:45 +02:00
e96400e564 Merge branch 'origin/master' into Weblate. 2022-04-08 00:23:17 +02:00
e088f03cf9 Translated using Weblate (Norwegian Bokmål)
Currently translated at 99.7% (438 of 439 strings)

Translation: GPXSee/Translations
Translate-URL: https://hosted.weblate.org/projects/gpxsee/translations/nb_NO/
2022-04-06 18:06:33 +02:00
e3582cc5cf Added missing "Established direction of traffic flow" line 2022-04-04 23:17:46 +02:00
fc033826a1 Code cleanup 2022-04-04 22:27:57 +02:00
8cf4c474f2 Added missing buoy icons 2022-04-04 22:26:57 +02:00
351a969606 Properly center the beacon symbol 2022-04-04 22:25:42 +02:00
2234245e81 Extend obstruction info 2022-04-03 21:20:21 +02:00
681de81b1c Version++ 2022-04-03 18:52:33 +02:00
a5ae41f8ad Added pile symbol 2022-04-03 18:51:15 +02:00
576a063dcb Added support for depth points 2022-04-03 18:21:26 +02:00
c5e46957a8 Removed unused image metadata 2022-03-27 19:25:38 +02:00
18 changed files with 176 additions and 72 deletions

View File

@ -1,4 +1,4 @@
version: 10.5.{build}
version: 10.6.{build}
configuration:
- Release

View File

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

View File

@ -155,6 +155,11 @@
<file alias="church.png">icons/IMG/marine/church.png</file>
<file alias="triangulation-point.png">icons/IMG/marine/triangulation-point.png</file>
<file alias="yacht-harbor.png">icons/IMG/marine/yacht-harbor.png</file>
<file alias="pile.png">icons/IMG/marine/pile.png</file>
<file alias="spar-buoy.png">icons/IMG/marine/spar-buoy.png</file>
<file alias="mooring-buoy.png">icons/IMG/marine/mooring-buoy.png</file>
<file alias="tower.png">icons/IMG/marine/tower.png</file>
<file alias="chimney.png">icons/IMG/marine/chimney.png</file>
</qresource>
<!-- Mapsforge rendertheme -->

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 256 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 445 B

BIN
icons/IMG/marine/pile.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

BIN
icons/IMG/marine/tower.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

View File

@ -864,7 +864,7 @@
<message>
<location filename="../src/GUI/gui.cpp" line="996"/>
<source>Error loading POI file:</source>
<translation>Kunne ikke laste inn interessepunktfil:</translation>
<translation>Feil ved innlasting av interessepunktfil:</translation>
</message>
<message>
<location filename="../src/GUI/gui.cpp" line="1226"/>
@ -1129,7 +1129,7 @@
<message>
<location filename="../src/map/maplist.cpp" line="127"/>
<source>Garmin IMG maps</source>
<translation>Garming IMG-kart</translation>
<translation>Garmin IMG-kart</translation>
</message>
<message>
<location filename="../src/map/maplist.cpp" line="130"/>
@ -1164,7 +1164,7 @@
<message>
<location filename="../src/map/maplist.cpp" line="139"/>
<source>TrekBuddy maps/atlases</source>
<translation>TrekBuddy kart/atlas</translation>
<translation>TrekBuddy-kart/atlas</translation>
</message>
<message>
<location filename="../src/map/maplist.cpp" line="140"/>
@ -1225,17 +1225,17 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="66"/>
<source>Standard</source>
<translation>Forvalg</translation>
<translation>Standard</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="71"/>
<source>Non-HiDPI maps are loaded as HiDPI maps. The map is sharp but map objects are small/hard to read.</source>
<translation>Ikke-HiDPI -kart lastes som HiDPI-kart. Kartet er skarpt, men kartobjekter kan være små/vanskelige å lese.</translation>
<translation>Ikke-HiDPI-kart lastes som HiDPI-kart. Kartet er skarpt, men kartobjekter er små/vanskelige å lese.</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="73"/>
<source>Non-HiDPI maps are loaded such as they are. Map objects have the expected size but the map is blurry.</source>
<translation>Ikke-HiDPI -kart lastes som de er. Kartobjekter har forventet størrelse, men kartet er uskarpt.</translation>
<translation>Ikke-HiDPI-kart lastes som de er. Kartobjekter har forventet størrelse, men kartet er uskarpt.</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="117"/>
@ -1347,7 +1347,7 @@
<location filename="../src/GUI/optionsdialog.cpp" line="148"/>
<location filename="../src/GUI/optionsdialog.cpp" line="249"/>
<source>Use anti-aliasing</source>
<translation>Bruk kanutjevning</translation>
<translation>Bruk kantutjevning</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="218"/>
@ -1437,7 +1437,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="310"/>
<source>Moving average window size</source>
<translation>Flytter gjennomsnittlig kartstørrelse</translation>
<translation>Vindusstørrelse for glidende gjennomsnitt</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="335"/>
@ -1463,7 +1463,7 @@
<location filename="../src/GUI/optionsdialog.cpp" line="338"/>
<location filename="../src/GUI/optionsdialog.cpp" line="348"/>
<source>Cadence:</source>
<translation>Stegfrekvens:</translation>
<translation>Kadens:</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="339"/>
@ -1490,7 +1490,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="376"/>
<source>mi/h</source>
<translation>mi/t</translation>
<translation>mi/h</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="379"/>
@ -1586,7 +1586,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="523"/>
<source>Pause detection</source>
<translation>Sett oppdagelse pause</translation>
<translation>Pausedetektering</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="545"/>
@ -1658,7 +1658,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="566"/>
<source>Use HTTP authentication</source>
<translation>Bruk HTTP-identitetsbekreftelse</translation>
<translation>Bruk HTTP-autentisering</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="572"/>
@ -1695,7 +1695,7 @@
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="648"/>
<source>The printed area is approximately the display area. The map zoom level does not change.</source>
<translation>Det utskrevne området er omentrent det samme som visningsområdet. Kartforstørrelsesnivået endrer seg ikke.</translation>
<translation>Det utskrevne området er omtrent det samme som visningsområdet. Kartforstørrelsesnivået endrer seg ikke.</translation>
</message>
<message>
<location filename="../src/GUI/optionsdialog.cpp" line="650"/>

View File

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

View File

@ -6,6 +6,8 @@ using namespace IMG;
#define ARRAY_SIZE(array) \
(sizeof(array) / sizeof(array[0]))
#define DELTA(val, llBits, maxBits) \
(((int)((val) << (32 - (llBits))) >> (32 - (llBits))) << (32 - (maxBits)))
static const struct
{
@ -166,64 +168,62 @@ bool NODFile::linkInfo(Handle &hdl, const BlockInfo &blockInfo, quint32 linkId,
if (!(linkInfo.flags & 0x100)) {
if (!bs.read(s1, linkInfo.linkOffset))
return false;
linkInfo.nodeOffset = 0xFFFFFFFF;
} else {
if (!bs.read(s1 - s2, linkInfo.linkOffset))
return false;
linkInfo.linkOffset += blockInfo.hdr.linkInfoOffsetBase;
}
if (!bs.read(s2, linkInfo.nodeOffset))
return false;
linkInfo.nodeOffset = (blockInfo.offset - linkInfo.nodeOffset)
>> _nodeShift;
if (!bs.read(s2, linkInfo.nodeOffset))
return false;
linkInfo.nodeOffset = (blockInfo.offset - linkInfo.nodeOffset)
>> _nodeShift;
}
return true;
}
bool NODFile::nodeInfo(Handle &hdl, const BlockInfo &blockInfo,
quint32 nodeOffset, NodeInfo &nodeInfo) const
bool NODFile::nodeInfo(Handle &hdl, AdjacencyInfo &adj) const
{
quint32 infoOffset = (nodeOffset << _nodeShift) + _block.offset;
if (infoOffset > _block.offset + _block.size || infoOffset < blockInfo.offset)
quint32 infoOffset = (adj.nodeOffset << _nodeShift) + _block.offset;
if (infoOffset > _block.offset + _block.size
|| infoOffset < adj.blockInfo.offset)
return false;
if (!seek(hdl, infoOffset))
return false;
BitStream1 bs(*this, hdl, _block.offset + _block.size - infoOffset);
if (!bs.read(8, nodeInfo.flags))
if (!bs.read(8, adj.nodeInfo.flags))
return false;
if ((nodeInfo.flags & 7) >= ARRAY_SIZE(LLBITS))
if ((adj.nodeInfo.flags & 7) >= ARRAY_SIZE(LLBITS))
return false;
quint8 lonBits = LLBITS[nodeInfo.flags & 7].lon;
quint8 latBits = LLBITS[nodeInfo.flags & 7].lat;
quint8 lonBits = LLBITS[adj.nodeInfo.flags & 7].lon;
quint8 latBits = LLBITS[adj.nodeInfo.flags & 7].lat;
quint8 maxBits = ((_flags >> 10) & 7) | 0x18;
quint32 lon, lat;
if (!(bs.read(lonBits, lon) && bs.read(latBits, lat)))
return false;
quint8 lonShift = 0x20 - lonBits;
quint8 latShift = 0x20 - latBits;
quint8 shift = 0x20 - maxBits;
QPoint pos(
(((int)(lon << lonShift) >> lonShift) << shift) + blockInfo.hdr.nodeLonBase,
(((int)(lat << latShift) >> latShift) << shift) + blockInfo.hdr.nodeLatBase);
nodeInfo.bytes = ((lonBits + latBits) >> 3) + 1;
adj.blockInfo.hdr.nodeLonBase + DELTA(lon, lonBits, maxBits),
adj.blockInfo.hdr.nodeLatBase + DELTA(lat, latBits, maxBits));
adj.nodeInfo.bytes = ((lonBits + latBits) >> 3) + 1;
if ((maxBits < 0x1c) && (nodeInfo.flags & 8)) {
if ((maxBits < 0x1c) && (adj.nodeInfo.flags & 8)) {
quint8 extraBits = 0x1c - maxBits;
quint32 extraLon, extraLat;
if (!(bs.read(extraBits, extraLon) && bs.read(extraBits, extraLat)))
return false;
pos.setX(pos.x() | extraLon << 4); pos.setY(pos.y() | extraLat << 4);
nodeInfo.bytes++;
adj.nodeInfo.bytes++;
}
// TODO?: check and adjust (shift) coordinates
nodeInfo.pos = pos;
adj.nodeInfo.pos = pos;
return true;
}
@ -480,14 +480,14 @@ bool NODFile::relAdjInfo(Handle &hdl, AdjacencyInfo &adj) const
return true;
}
int NODFile::nextNode(Handle &hdl, AdjacencyInfo &adjInfo) const
int NODFile::nextNode(Handle &hdl, AdjacencyInfo &adj) const
{
if (adjInfo.nodeOffset == 0xFFFFFFFF)
if (adj.nodeOffset == 0xFFFFFFFF)
return 1;
if (!nodeInfo(hdl, adjInfo.blockInfo, adjInfo.nodeOffset, adjInfo.nodeInfo))
if (!nodeInfo(hdl, adj))
return -1;
if (!adjacencyInfo(hdl, adjInfo))
if (!adjacencyInfo(hdl, adj))
return -1;
return 0;

View File

@ -78,13 +78,14 @@ public:
LinkInfo &linkInfo) const;
bool linkType(Handle &hdl, const BlockInfo &blockInfo, quint8 linkId,
quint32 &type) const;
int nextNode(Handle &hdl, AdjacencyInfo &adjInfo) const;
int nextNode(Handle &hdl, AdjacencyInfo &adj) const;
private:
bool nodeInfo(Handle &hdl, const BlockInfo &blockInfo, quint32 nodeOffset,
NodeInfo &nodeInfo) const;
bool nodeOffset(Handle &hdl, const BlockInfo &blockInfo, quint8 nodeId,
quint32 &nodeOffset) const;
bool nodeBlock(Handle &hdl, quint32 nodeOffset, BlockInfo &blockInfo) const;
bool readBlock(Handle &hdl, quint32 blockOffset, BlockInfo &blockInfo) const;
bool nodeInfo(Handle &hdl, AdjacencyInfo &adj) const;
bool absAdjInfo(Handle &hdl, AdjacencyInfo &adj) const;
bool relAdjInfo(Handle &hdl, AdjacencyInfo &adj) const;
bool adjacencyInfo(Handle &hdl, AdjacencyInfo &adj) const
@ -92,8 +93,6 @@ private:
return (adj.nodeInfo.flags & 0x20) ? absAdjInfo(hdl, adj)
: relAdjInfo(hdl, adj);
}
bool nodeBlock(Handle &hdl, quint32 nodeOffset, BlockInfo &blockInfo) const;
bool readBlock(Handle &hdl, quint32 blockOffset, BlockInfo &blockInfo) const;
Section _block, _index;
quint32 _flags, _indexFlags;

View File

@ -20,23 +20,114 @@ static quint64 pointId(const QPoint &pos, quint32 type, quint32 labelPtr)
uint hash = (uint)qHash(QPair<uint,uint>((uint)qHash(
QPair<int, int>(pos.x(), pos.y())), labelPtr));
id = ((quint64)type)<<32 | hash;
// Make country labels precedent over city labels
if (!Style::isCountry(type))
// Increase rendering priorities for some special items
if (!Style::isCountry(type) && !Style::isMarina(type))
id |= 1ULL<<63;
return id;
}
static double d2m(quint32 val, quint32 flags)
{
return (flags & 1) ? val / 10.0 : val;
}
RGNFile::~RGNFile()
{
delete _huffmanTable;
}
bool RGNFile::readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
MapData::Poly *poly) const
{
quint32 id;
quint32 top, right, bottom, left;
if (!(lbl && lbl->imageIdSize()))
return false;
if (size < lbl->imageIdSize() + 16U)
return false;
if (!(readVUInt32(hdl, lbl->imageIdSize(), id)
&& readUInt32(hdl, top) && readUInt32(hdl, right)
&& readUInt32(hdl, bottom) && readUInt32(hdl, left)))
return false;
poly->raster = Raster(lbl, id, QRect(QPoint(left, top), QPoint(right,
bottom)));
return true;
}
bool RGNFile::readDepthInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const
{
quint32 depth = 0;
quint32 units = (flags >> 3) & 3;
quint32 val;
if (!size) {
depth = flags & 0x3f;
units = (flags >> 5) & 2;
} else if (size == 1) {
if (!readUInt8(hdl, val))
return false;
depth = val | ((quint32)flags & 7) << 8;
} else if (size < 4) {
Q_ASSERT(!(flags & 4));
if (!readVUInt32(hdl, size, val))
return false;
depth = val | ((quint32)flags & 3) << (size * 8);
} else
return false;
point->label = QString::number(d2m(depth, units));
return true;
}
bool RGNFile::readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const
{
quint32 val, rb = size;
quint32 units = (flags >> 3) & 3;
if (!size)
return false;
if ((flags & 7) == 7) {
if (!readUInt8(hdl, val))
return false;
rb--;
}
if (!readVUInt32(hdl, rb, val))
return false;
point->label = QString::number(d2m(val, units));
return true;
}
bool RGNFile::readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const
{
if (!(flags & 1))
return true;
if (!lbl)
return false;
point->label = lbl->label(lblHdl, this, hdl, size);
point->classLabel = true;
return true;
}
bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
void *object, const LBLFile *lbl, Handle &lblHdl) const
{
quint8 flags;
quint32 rs;
quint32 rs = 0;
MapData::Poly *poly = (segmentType == Polygon)
? (MapData::Poly *) object : 0;
MapData::Point *point = (segmentType == Point)
@ -59,32 +150,18 @@ bool RGNFile::readClassFields(Handle &hdl, SegmentType segmentType,
if (!readVUInt32(hdl, rs))
return false;
break;
default:
rs = 0;
break;
}
quint32 off = pos(hdl);
if (poly && Style::isRaster(poly->type) && lbl && lbl->imageIdSize()) {
quint32 id;
quint32 top, right, bottom, left;
if (rs < lbl->imageIdSize() + 16U)
return false;
if (!(readVUInt32(hdl, lbl->imageIdSize(), id)
&& readUInt32(hdl, top) && readUInt32(hdl, right)
&& readUInt32(hdl, bottom) && readUInt32(hdl, left)))
return false;
poly->raster = Raster(lbl, id, QRect(QPoint(left, top), QPoint(right,
bottom)));
}
if (point && (flags & 1) && lbl) {
point->label = lbl->label(lblHdl, this, hdl, rs);
point->classLabel = true;
}
if (poly && Style::isRaster(poly->type))
readRasterInfo(hdl, lbl, rs, poly);
if (point && Style::isDepthPoint(point->type))
readDepthInfo(hdl, flags, rs, point);
if (point && Style::isObstructionPoint(point->type))
readObstructionInfo(hdl, flags, rs, point);
if (point && !Style::isMarinePoint(point->type))
readLabel(hdl, lbl, lblHdl, flags, rs, point);
return seek(hdl, off + rs);
}

View File

@ -58,6 +58,14 @@ private:
const LBLFile *lbl, Handle &lblHdl) const;
bool skipLclFields(Handle &hdl, const quint32 flags[3]) const;
bool skipGblFields(Handle &hdl, quint32 flags) const;
bool readRasterInfo(Handle &hdl, const LBLFile *lbl, quint32 size,
MapData::Poly *poly) const;
bool readDepthInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const;
bool readObstructionInfo(Handle &hdl, quint8 flags, quint32 size,
MapData::Point *point) const;
bool readLabel(Handle &hdl, const LBLFile *lbl, Handle &lblHdl,
quint8 flags, quint32 size, MapData::Point *point) const;
HuffmanTable *_huffmanTable;
Section _base, _dict, _polygons, _lines, _points;

View File

@ -252,6 +252,7 @@ void Style::defaultLineStyle()
_lines[0x10507] = Line(QPen(QColor("#e728e7"), 1, Qt::DashLine));
_lines[0x10601] = Line(QPen(QColor("#000000"), 1, Qt::SolidLine));
_lines[0x10606] = Line(QImage(":/IMG/anchor-line.png"));
_lines[0x1060c] = Line(QPen(QColor("#e728e7"), 1, Qt::SolidLine));
_lines[0x1060d] = Line(QPen(QColor("#eb49eb"), 1, Qt::DashLine));
_lines[0x10611] = Line(QPen(QColor("#eb49eb"), 1, Qt::DashLine));
}
@ -507,6 +508,7 @@ void Style::defaultPointStyle()
_points[0x10204] = Point(QImage(":/IMG/buoy.png"));
_points[0x10205] = Point(QImage(":/IMG/buoy.png"));
_points[0x10206] = Point(QImage(":/IMG/beacon.png"));
_points[0x10207] = Point(QImage(":/IMG/spar-buoy.png"));
_points[0x1020b] = Point(QImage(":/IMG/buoy.png"));
_points[0x1020d] = Point(QImage(":/IMG/light-platform.png"));
_points[0x1020e] = Point(QImage(":/IMG/beacon.png"));
@ -517,8 +519,12 @@ void Style::defaultPointStyle()
_points[0x10213] = Point(QImage(":/IMG/beacon.png"));
_points[0x10214] = Point(QImage(":/IMG/beacon.png"));
_points[0x10215] = Point(QImage(":/IMG/beacon.png"));
_points[0x10216] = Point(QImage(":/IMG/mooring-buoy.png"));
_points[0x10305] = Point(QImage(":/IMG/chimney.png"));
_points[0x10306] = Point(QImage(":/IMG/church.png"));
_points[0x10308] = Point(QImage(":/IMG/tower.png"));
_points[0x1030a] = Point(QImage(":/IMG/triangulation-point.png"));
_points[0x10400] = Point(QImage(":/IMG/obstruction.png"));
_points[0x10401] = Point(QImage(":/IMG/obstruction.png"));
_points[0x10402] = Point(QImage(":/IMG/wreck.png"));
_points[0x10403] = Point(QImage(":/IMG/wreck-exposed.png"));
@ -527,6 +533,7 @@ void Style::defaultPointStyle()
_points[0x1040c] = Point(QImage(":/IMG/rock-exposed.png"));
_points[0x10701] = Point(QImage(":/IMG/anchorage.png"));
_points[0x10703] = Point(QImage(":/IMG/yacht-harbor.png"));
_points[0x10704] = Point(QImage(":/IMG/pile.png"));
_points[0x10705] = Point(QImage(":/IMG/anchoring-prohibited.png"));
}

View File

@ -119,6 +119,14 @@ public:
{return (type == TYPE(0x1e));}
static bool isRaster(quint32 type)
{return (type == 0x10613);}
static bool isDepthPoint(quint32 type)
{return (type == 0x10301);}
static bool isObstructionPoint(quint32 type)
{return (type >= 0x10400 && type <= 0x10401);}
static bool isMarinePoint(quint32 type)
{return type >= 0x10100 && type < 0x10a00;}
static bool isMarina(quint32 type)
{return type == 0x10703;}
private:
struct Section {