Hello community, here is the log from the commit of package gpxsee for openSUSE:Factory checked in at 2019-07-21 11:34:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gpxsee (Old) and /work/SRC/openSUSE:Factory/.gpxsee.new.4126 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gpxsee" Sun Jul 21 11:34:24 2019 rev:47 rq:716779 version:7.11 Changes: -------- --- /work/SRC/openSUSE:Factory/gpxsee/gpxsee.changes 2019-07-16 08:40:57.579028923 +0200 +++ /work/SRC/openSUSE:Factory/.gpxsee.new.4126/gpxsee.changes 2019-07-21 11:34:25.528776476 +0200 @@ -1,0 +2,7 @@ +Thu Jul 18 21:31:34 CEST 2019 - tu...@cbox.cz + +- Update to version 7.11 + * Improved IMG maps loading performance and memory footprint. + * Improved road shields layout on IMG maps. + +------------------------------------------------------------------- Old: ---- GPXSee-7.10.tar.gz New: ---- GPXSee-7.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gpxsee.spec ++++++ --- /var/tmp/diff_new_pack.mS7OrP/_old 2019-07-21 11:34:26.380776332 +0200 +++ /var/tmp/diff_new_pack.mS7OrP/_new 2019-07-21 11:34:26.384776332 +0200 @@ -19,7 +19,7 @@ # See also http://en.opensuse.org/openSUSE:Specfile_guidelines Name: gpxsee -Version: 7.10 +Version: 7.11 Release: 1 Summary: GPS log file visualization and analysis tool License: GPL-3.0-only ++++++ GPXSee-7.10.tar.gz -> GPXSee-7.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/.appveyor.yml new/GPXSee-7.11/.appveyor.yml --- old/GPXSee-7.10/.appveyor.yml 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/.appveyor.yml 2019-07-18 08:14:47.000000000 +0200 @@ -1,4 +1,4 @@ -version: 7.10.{build} +version: 7.11.{build} configuration: Release platform: Any CPU environment: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/gpxsee.pro new/GPXSee-7.11/gpxsee.pro --- old/GPXSee-7.10/gpxsee.pro 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/gpxsee.pro 2019-07-18 08:14:47.000000000 +0200 @@ -3,7 +3,7 @@ } else { TARGET = GPXSee } -VERSION = 7.10 +VERSION = 7.11 QT += core \ gui \ @@ -319,7 +319,8 @@ SOURCES += src/data/geojsonparser.cpp } -DEFINES += APP_VERSION=\\\"$$VERSION\\\" +DEFINES += APP_VERSION=\\\"$$VERSION\\\" \ + QT_NO_DEPRECATED_WARNINGS DEFINES *= QT_USE_QSTRINGBUILDER RESOURCES += gpxsee.qrc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/lang/gpxsee_pl.ts new/GPXSee-7.11/lang/gpxsee_pl.ts --- old/GPXSee-7.10/lang/gpxsee_pl.ts 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/lang/gpxsee_pl.ts 2019-07-18 08:14:47.000000000 +0200 @@ -64,7 +64,7 @@ <message> <location filename="../src/data/data.cpp" line="152"/> <source>GeoJSON files</source> - <translation type="unfinished"></translation> + <translation>Pliki GeoJSON</translation> </message> <message> <location filename="../src/data/data.cpp" line="154"/> @@ -79,7 +79,7 @@ <message> <location filename="../src/data/data.cpp" line="156"/> <source>JPEG images</source> - <translation type="unfinished"></translation> + <translation>Pliki JPEG</translation> </message> <message> <location filename="../src/data/data.cpp" line="157"/> @@ -439,7 +439,7 @@ <message> <location filename="../src/GUI/gui.cpp" line="315"/> <source>Show cursor coordinates</source> - <translation type="unfinished"></translation> + <translation>Pokaż współrzędne kursora</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="322"/> @@ -459,7 +459,7 @@ <message> <location filename="../src/GUI/gui.cpp" line="337"/> <source>Show areas</source> - <translation type="unfinished"></translation> + <translation>Pokaż obszary</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="342"/> @@ -469,7 +469,7 @@ <message> <location filename="../src/GUI/gui.cpp" line="352"/> <source>km/mi markers</source> - <translation type="unfinished"></translation> + <translation>Znaczniki km/mi</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="359"/> @@ -489,7 +489,7 @@ <message> <location filename="../src/GUI/gui.cpp" line="393"/> <source>Show path markers</source> - <translation type="unfinished"></translation> + <translation>Pokaż znaczniki ścieżki</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="400"/> @@ -651,18 +651,18 @@ <message> <location filename="../src/GUI/gui.cpp" line="731"/> <source>DEM directory:</source> - <translation type="unfinished"></translation> + <translation>Katalog z danymi DEM:</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="733"/> <source>Styles directory:</source> - <translation type="unfinished"></translation> + <translation>Katalog ze stylami:</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="1037"/> <location filename="../src/GUI/gui.cpp" line="1105"/> <source>Areas</source> - <translation type="unfinished"></translation> + <translation>Obszary</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="1080"/> @@ -736,7 +736,7 @@ <message> <location filename="../src/GUI/gui.cpp" line="735"/> <source>Tile cache directory:</source> - <translation type="unfinished"></translation> + <translation>Katalog pamięci podręcznej kafelków:</translation> </message> <message> <location filename="../src/GUI/gui.cpp" line="1031"/> @@ -1018,7 +1018,7 @@ <message> <location filename="../src/map/maplist.cpp" line="123"/> <source>Garmin IMG maps</source> - <translation type="unfinished"></translation> + <translation>Mapy Garmin IMG</translation> </message> <message> <location filename="../src/map/maplist.cpp" line="125"/> @@ -1038,7 +1038,7 @@ <message> <location filename="../src/map/maplist.cpp" line="129"/> <source>TwoNav maps</source> - <translation type="unfinished"></translation> + <translation>Mapy TwoNav</translation> </message> <message> <location filename="../src/map/maplist.cpp" line="130"/> @@ -1309,18 +1309,18 @@ <location filename="../src/GUI/optionsdialog.cpp" line="378"/> <location filename="../src/GUI/optionsdialog.cpp" line="436"/> <source>GPS data</source> - <translation type="unfinished"></translation> + <translation>Dane GPS</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="379"/> <location filename="../src/GUI/optionsdialog.cpp" line="437"/> <source>DEM data</source> - <translation type="unfinished"></translation> + <translation>Dane DEM</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="416"/> <source>Elevation</source> - <translation type="unfinished">Wysokość</translation> + <translation>Wysokość</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="427"/> @@ -1330,7 +1330,7 @@ <message> <location filename="../src/GUI/optionsdialog.cpp" line="428"/> <source>Sources</source> - <translation type="unfinished"></translation> + <translation>Źródła</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="429"/> @@ -1340,7 +1340,7 @@ <message> <location filename="../src/GUI/optionsdialog.cpp" line="462"/> <source>Radius:</source> - <translation type="unfinished"></translation> + <translation>Promień:</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="410"/> @@ -1350,37 +1350,37 @@ <message> <location filename="../src/GUI/optionsdialog.cpp" line="72"/> <source>Projection:</source> - <translation type="unfinished"></translation> + <translation>Odwzorowanie:</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="94"/> <source>Vector maps</source> - <translation type="unfinished"></translation> + <translation>Mapy wektorowe</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="147"/> <source>Area border width:</source> - <translation type="unfinished"></translation> + <translation>Szerokość granicy obszaru:</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="148"/> <source>Area border style:</source> - <translation type="unfinished"></translation> + <translation>Styl obramowania obszaru:</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="149"/> <source>Area fill opacity:</source> - <translation type="unfinished"></translation> + <translation>Nieprzezroczystość wypełnienia obszaru:</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="153"/> <source>Fill opacity:</source> - <translation type="unfinished"></translation> + <translation>Nieprzezroczystość wypełnienia:</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="154"/> <source>Areas</source> - <translation type="unfinished"></translation> + <translation>Obszary</translation> </message> <message> <location filename="../src/GUI/optionsdialog.cpp" line="448"/> @@ -1530,12 +1530,12 @@ <message> <location filename="../src/GUI/areaitem.cpp" line="15"/> <source>Name</source> - <translation type="unfinished">Nazwa</translation> + <translation>Nazwa</translation> </message> <message> <location filename="../src/GUI/areaitem.cpp" line="17"/> <source>Description</source> - <translation type="unfinished">Opis</translation> + <translation>Opis</translation> </message> </context> <context> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/pkg/gpxsee.nsi new/GPXSee-7.11/pkg/gpxsee.nsi --- old/GPXSee-7.10/pkg/gpxsee.nsi 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/pkg/gpxsee.nsi 2019-07-18 08:14:47.000000000 +0200 @@ -7,7 +7,7 @@ ; The name of the installer Name "GPXSee" ; Program version -!define VERSION "7.10" +!define VERSION "7.11" ; The file to write OutFile "GPXSee-${VERSION}.exe" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/pkg/gpxsee64.nsi new/GPXSee-7.11/pkg/gpxsee64.nsi --- old/GPXSee-7.10/pkg/gpxsee64.nsi 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/pkg/gpxsee64.nsi 2019-07-18 08:14:47.000000000 +0200 @@ -7,7 +7,7 @@ ; The name of the installer Name "GPXSee" ; Program version -!define VERSION "7.10" +!define VERSION "7.11" ; The file to write OutFile "GPXSee-${VERSION}_x64.exe" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/IMG/label.h new/GPXSee-7.11/src/map/IMG/label.h --- old/GPXSee-7.10/src/map/IMG/label.h 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/IMG/label.h 2019-07-18 08:14:47.000000000 +0200 @@ -4,6 +4,9 @@ #include <QString> #include <QDebug> +#define FIRST_SHIELD Label::Shield::USInterstate +#define LAST_SHIELD Label::Shield::Oval + class Label { public: class Shield diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/IMG/lblfile.cpp new/GPXSee-7.11/src/map/IMG/lblfile.cpp --- old/GPXSee-7.10/src/map/IMG/lblfile.cpp 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/IMG/lblfile.cpp 2019-07-18 08:14:47.000000000 +0200 @@ -102,7 +102,8 @@ else if (c[cpt] == 0x1b) curCharSet = Special; else if (c[cpt] >= 0x2a && c[cpt] <= 0x2f) { - shieldType = (Label::Shield::Type)(c[cpt] - 0x29); + shieldType = static_cast<Label::Shield::Type> + (c[cpt] - 0x29); bap = &shieldLabel; } else if (bap == &shieldLabel && NORMAL_CHARS[c[cpt]] == ' ') @@ -145,7 +146,7 @@ else bap->append(' '); } else if (c <= 0x07) { - shieldType = (Label::Shield::Type)c; + shieldType = static_cast<Label::Shield::Type>(c); bap = &shieldLabel; } else if (bap == &shieldLabel && QChar(c).isSpace()) { bap = &label; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/IMG/rgnfile.cpp new/GPXSee-7.11/src/map/IMG/rgnfile.cpp --- old/GPXSee-7.10/src/map/IMG/rgnfile.cpp 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/IMG/rgnfile.cpp 2019-07-18 08:14:47.000000000 +0200 @@ -459,7 +459,7 @@ quint32 start = _pointsOffset + subdiv->pointsOffset(); quint32 end = subdiv->pointsEnd() ? _pointsOffset + subdiv->pointsEnd() - : _pointsOffset + _linesSize; + : _pointsOffset + _pointsSize; extPointObjects(rect, rgnHdl, subdiv, Segment(start, end, Segment::Point), lbl, lblHdl, points); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/IMG/textpointitem.cpp new/GPXSee-7.11/src/map/IMG/textpointitem.cpp --- old/GPXSee-7.10/src/map/IMG/textpointitem.cpp 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/IMG/textpointitem.cpp 2019-07-18 08:14:47.000000000 +0200 @@ -17,18 +17,18 @@ TextPointItem::TextPointItem(const QPoint &point, const QString *text, const QFont *font, const QImage *img, const QColor *color, - const QColor *bgColor) : _text(text), _font(font), _img(img), _color(color), - _bgColor(bgColor) + const QColor *bgColor) : _text(font ? text : 0), _font(font), _img(img), + _color(color), _bgColor(bgColor) { - if (text) { - QFontMetrics fm(*font); - int limit = font->pixelSize() * MAX_TEXT_WIDTH; - _textRect = fm.boundingRect(QRect(0, 0, limit, 0), FLAGS, *text); + if (_text) { + QFontMetrics fm(*_font); + int limit = _font->pixelSize() * MAX_TEXT_WIDTH; + _textRect = fm.boundingRect(QRect(0, 0, limit, 0), FLAGS, *_text); _textRect.adjust(0, 0, 1, 1); - } - if (_bgColor && _textRect.width() < font->pixelSize() * MIN_BOX_WIDTH) - expand(_textRect, font->pixelSize() * MIN_BOX_WIDTH); + if (_bgColor && _textRect.width() < _font->pixelSize() * MIN_BOX_WIDTH) + expand(_textRect, _font->pixelSize() * MIN_BOX_WIDTH); + } setPos(point); } @@ -58,41 +58,44 @@ - _img->height()/2), *_img); if (_text) { - QImage img(_textRect.size(), QImage::Format_ARGB32_Premultiplied); - img.fill(Qt::transparent); - QPainter ip(&img); - ip.setPen(Qt::white); - ip.setFont(*_font); - ip.drawText(img.rect(), FLAGS, *_text); - - painter->drawImage(_textRect.x() - 1, _textRect.y() - 1, img); - painter->drawImage(_textRect.x() + 1, _textRect.y() + 1, img); - painter->drawImage(_textRect.x() - 1, _textRect.y() + 1, img); - painter->drawImage(_textRect.x(), _textRect.y() - 1, img); - painter->drawImage(_textRect.x(), _textRect.y() + 1, img); - painter->drawImage(_textRect.x() - 1, _textRect.y(), img); - painter->drawImage(_textRect.x() + 1, _textRect.y(), img); - - if (_bgColor) { painter->setPen(*_color); painter->setBrush(*_bgColor); painter->drawRect(_textRect); painter->setBrush(Qt::NoBrush); - } - if (_color) { painter->setFont(*_font); - painter->setPen(*_color); painter->drawText(_textRect, FLAGS, *_text); } else { + QImage img(_textRect.size(), QImage::Format_ARGB32_Premultiplied); + img.fill(Qt::transparent); + QPainter ip(&img); + ip.setPen(Qt::white); + ip.setFont(*_font); + ip.drawText(img.rect(), FLAGS, *_text); + + painter->drawImage(_textRect.x() - 1, _textRect.y() - 1, img); + painter->drawImage(_textRect.x() + 1, _textRect.y() + 1, img); + painter->drawImage(_textRect.x() - 1, _textRect.y() + 1, img); + painter->drawImage(_textRect.x() + 1, _textRect.y() - 1, img); + painter->drawImage(_textRect.x(), _textRect.y() - 1, img); + painter->drawImage(_textRect.x(), _textRect.y() + 1, img); + painter->drawImage(_textRect.x() - 1, _textRect.y(), img); + painter->drawImage(_textRect.x() + 1, _textRect.y(), img); + + if (_color) { + painter->setFont(*_font); + painter->setPen(*_color); + painter->drawText(_textRect, FLAGS, *_text); + } else { #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) - img.invertPixels(); - painter->drawImage(_textRect, img); + img.invertPixels(); + painter->drawImage(_textRect, img); #else // QT >= 5.4 - QImage iimg(img.convertToFormat(QImage::Format_ARGB32)); - iimg.invertPixels(); - painter->drawImage(_textRect, iimg); + QImage iimg(img.convertToFormat(QImage::Format_ARGB32)); + iimg.invertPixels(); + painter->drawImage(_textRect, iimg); #endif // QT >= 5.4 + } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/IMG/trefile.cpp new/GPXSee-7.11/src/map/IMG/trefile.cpp --- old/GPXSee-7.10/src/map/IMG/trefile.cpp 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/IMG/trefile.cpp 2019-07-18 08:14:47.000000000 +0200 @@ -3,12 +3,6 @@ #include "trefile.h" -struct MapLevel { - quint8 level; - quint8 bits; - quint16 subdivs; -}; - static void unlock(quint8 *dst, const quint8 *src, quint32 size, quint32 key) { static const unsigned char shuf[] = { @@ -46,6 +40,12 @@ bool TREFile::init() { Handle hdl; + quint8 locked; + quint16 hdrLen; + + if (!(seek(hdl, 0) && readUInt16(hdl, hdrLen) + && seek(hdl, 0x0D) && readByte(hdl, locked))) + return false; // Tile bounds qint32 north, east, south, west; @@ -55,30 +55,18 @@ _bounds = RectC(Coordinates(toWGS84(west), toWGS84(north)), Coordinates(toWGS84(east), toWGS84(south))); - return true; -} - -bool TREFile::load() -{ - Handle hdl; - quint8 locked; - quint16 hdrLen; - - if (!(seek(hdl, 0) && readUInt16(hdl, hdrLen) - && seek(hdl, 0x0D) && readByte(hdl, locked))) - return false; - - quint32 levelsOffset, levelsSize, subdivOffset, subdivSize; + // Levels & subdivs info + quint32 levelsOffset, levelsSize, subdivSize; if (!(seek(hdl, 0x21) && readUInt32(hdl, levelsOffset) - && readUInt32(hdl, levelsSize) && readUInt32(hdl, subdivOffset) + && readUInt32(hdl, levelsSize) && readUInt32(hdl, _subdivOffset) && readUInt32(hdl, subdivSize))) return false; - quint32 extOffset, extSize = 0; - quint16 extItemSize = 0; + // TRE7 info if (hdrLen > 0x9A) { - if (!(seek(hdl, 0x7C) && readUInt32(hdl, extOffset) - && readUInt32(hdl, extSize) && readUInt16(hdl, extItemSize))) + if (!(seek(hdl, 0x7C) && readUInt32(hdl, _extended.offset) + && readUInt32(hdl, _extended.size) + && readUInt16(hdl, _extended.itemSize))) return false; } @@ -99,96 +87,134 @@ } quint32 levelsCount = levelsSize / 4; - QVector<MapLevel> ml(levelsCount); - QMap<int, int> level2bits; + _levels = QVector<MapLevel>(levelsCount); for (quint32 i = 0; i < levelsCount; i++) { quint8 *zoom = levels + (i * 4); - ml[i].level = *zoom; - ml[i].bits = *(zoom + 1); - ml[i].subdivs = *(zoom + 2) | (quint16)(*(zoom + 3)) << 8; - if ((ml[i].level & 0xF) > 15 || ml[i].bits > 24) + _levels[i].level = *zoom; + _levels[i].bits = *(zoom + 1); + _levels[i].subdivs = *(zoom + 2) | (quint16)(*(zoom + 3)) << 8; + if (_levels[i].bits > 24 || !_levels[i].subdivs) return false; + } - level2bits.insert(ml[i].level & 0xF, ml[i].bits); + // Get first non-inherited level + _firstLevel = -1; + for (int i = 0; i < _levels.size(); i++) { + if (!(_levels.at(i).level & 0x80)) { + _firstLevel = i; + break; + } } - // Subdivisions - if (!seek(hdl, subdivOffset)) - return false; - SubDiv *s = 0; + return (_firstLevel >= 0); +} + +bool TREFile::load(int idx) +{ + Handle hdl; QList<SubDiv*> sl; + SubDiv *s = 0; + SubDivTree *tree = new SubDivTree(); - for (int i = 0; i < ml.size(); i++) { - if (!(ml.at(i).level & 0x80)) - _subdivs.insert(ml.at(i).bits, new SubDivTree()); - - for (int j = 0; j < ml.at(i).subdivs; j++) { - quint32 offset; - qint32 lon, lat; - quint8 objects; - quint16 width, height, nextLevel; - - if (!(readUInt24(hdl, offset) && readByte(hdl, objects) - && readInt24(hdl, lon) && readInt24(hdl, lat) - && readUInt16(hdl, width) && readUInt16(hdl, height))) - return false; - if (i != (int)levelsCount - 1) - if (!readUInt16(hdl, nextLevel)) - return false; - - if (s) - s->setEnd(offset); - - if (ml.at(i).level & 0x80) { - sl.append(0); - s = 0; - continue; - } - - width &= 0x7FFF; - width <<= (24 - ml.at(i).bits); - height <<= (24 - ml.at(i).bits); - - s = new SubDiv(offset, lon, lat, ml.at(i).bits, objects); - sl.append(s); - - double min[2], max[2]; - RectC bounds(Coordinates(toWGS84(lon - width), - toWGS84(lat + height + 1)), Coordinates(toWGS84(lon + width + 1), - toWGS84(lat - height))); - - min[0] = bounds.left(); - min[1] = bounds.bottom(); - max[0] = bounds.right(); - max[1] = bounds.top(); - _subdivs[ml.at(i).bits]->Insert(min, max, s); - } + + _subdivs.insert(_levels.at(idx).bits, tree); + + quint32 skip = 0; + for (int i = 0; i < idx; i++) + skip += _levels.at(i).subdivs; + + if (!seek(hdl, _subdivOffset + skip * 16)) + return false; + + for (int j = 0; j < _levels.at(idx).subdivs; j++) { + quint32 offset; + qint32 lon, lat; + quint8 objects; + quint16 width, height, nextLevel; + + if (!(readUInt24(hdl, offset) && readByte(hdl, objects) + && readInt24(hdl, lon) && readInt24(hdl, lat) + && readUInt16(hdl, width) && readUInt16(hdl, height))) + goto error; + if (idx != _levels.size() - 1) + if (!readUInt16(hdl, nextLevel)) + goto error; + + if (s) + s->setEnd(offset); + + width &= 0x7FFF; + width <<= (24 - _levels.at(idx).bits); + height <<= (24 - _levels.at(idx).bits); + + s = new SubDiv(offset, lon, lat, _levels.at(idx).bits, objects); + sl.append(s); + + double min[2], max[2]; + RectC bounds(Coordinates(toWGS84(lon - width), + toWGS84(lat + height + 1)), Coordinates(toWGS84(lon + width + 1), + toWGS84(lat - height))); + + min[0] = bounds.left(); + min[1] = bounds.bottom(); + max[0] = bounds.right(); + max[1] = bounds.top(); + + tree->Insert(min, max, s); } - // objects with extended types (TRE7) - if (extSize && extItemSize >= 12 - && (sl.size() - (int)(extSize/extItemSize) + 1 >= 0)) { + if (idx != _levels.size() - 1) { + quint32 offset; + if (!readUInt24(hdl, offset)) + goto error; + s->setEnd(offset); + } + + + // Objects with extended types (TRE7) + if (_extended.size && _extended.itemSize >= 12) { + /* Some maps skip entries for the inherited levels, some don't. Our + decision is based on the difference between the extended subdivs + count and the total subdivs count. */ + quint32 totalSubdivs = 0; + for (int i = 0; i < _levels.size(); i++) + totalSubdivs += _levels.at(i).subdivs; + quint32 extendedSubdivs = _extended.size / _extended.itemSize; + quint32 diff = totalSubdivs - extendedSubdivs + 1; + quint32 polygons, lines, points; - if (!seek(hdl, extOffset)) - return false; + if (!seek(hdl, _extended.offset + (skip - diff) * _extended.itemSize)) + goto error; - for (int i = sl.size() - (extSize/extItemSize) + 1; i < sl.size(); i++) { + for (int i = 0; i < sl.size(); i++) { if (!(readUInt32(hdl, polygons) && readUInt32(hdl, lines) && readUInt32(hdl, points))) - return false; - if (!seek(hdl, hdl.pos + extItemSize - 12)) - return false; - if (i && sl.at(i-1)) + goto error; + + sl.at(i)->setExtOffsets(polygons, lines, points); + if (i) sl.at(i-1)->setExtEnds(polygons, lines, points); - if (sl.at(i)) - sl.at(i)->setExtOffsets(polygons, lines, points); + + if (!seek(hdl, hdl.pos + _extended.itemSize - 12)) + goto error; } - } - _levels = _subdivs.keys(); + if (idx != _levels.size() - 1) { + if (!(readUInt32(hdl, polygons) && readUInt32(hdl, lines) + && readUInt32(hdl, points))) + goto error; + sl.last()->setExtEnds(polygons, lines, points); + } + } return true; + +error: + qDeleteAll(sl); + tree->RemoveAll(); + + return false; } void TREFile::clear() @@ -205,23 +231,22 @@ qDeleteAll(_subdivs); _subdivs.clear(); - _levels.clear(); } int TREFile::level(int bits) { - if (_levels.isEmpty() && !load()) - return -1; + int idx = _firstLevel; - int l = _levels.first(); - for (int i = 0; i < _levels.size(); i++) { - if (_levels.at(i) > bits) + for (int i = idx + 1; i < _levels.size(); i++) { + if (_levels.at(i).bits > bits) break; - else - l = _levels.at(i); + idx++; } - return l; + if (!_subdivs.contains(_levels.at(idx).bits) && !load(idx)) + return -1; + + return _levels.at(idx).bits; } static bool cb(SubDiv *subdiv, void *context) @@ -247,3 +272,12 @@ return list; } + +#ifndef QT_NO_DEBUG +QDebug operator<<(QDebug dbg, const TREFile::MapLevel &level) +{ + dbg.nospace() << "MapLevel(" << level.level << ", " << level.bits << ", " + << level.subdivs << ")"; + return dbg.space(); +} +#endif // QT_NO_DEBUG diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/IMG/trefile.h new/GPXSee-7.11/src/map/IMG/trefile.h --- old/GPXSee-7.10/src/map/IMG/trefile.h 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/IMG/trefile.h 2019-07-18 08:14:47.000000000 +0200 @@ -23,17 +23,39 @@ QList<SubDiv*> subdivs(const RectC &rect, int bits); private: + struct MapLevel { + quint8 level; + quint8 bits; + quint16 subdivs; + }; + struct Extended { + quint32 offset; + quint32 size; + quint16 itemSize; + + Extended() : offset(0), size(0), itemSize(0) {} + }; typedef RTree<SubDiv*, double, 2> SubDivTree; - bool load(); + bool load(int idx); int level(int bits); bool parsePoly(Handle hdl, quint32 pos, const QMap<int, int> &level2bits, QMap<quint32, int> &map); bool parsePoints(Handle hdl, quint32 pos, const QMap<int, int> &level2bits); + friend QDebug operator<<(QDebug dbg, const MapLevel &level); + RectC _bounds; - QList<int> _levels; + QVector<MapLevel> _levels; + quint32 _subdivOffset; + Extended _extended; + int _firstLevel; + QMap<int, SubDivTree*> _subdivs; }; +#ifndef QT_NO_DEBUG +QDebug operator<<(QDebug dbg, const TREFile::MapLevel &level); +#endif // QT_NO_DEBUG + #endif // TREFILE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/imgmap.cpp new/GPXSee-7.11/src/map/imgmap.cpp --- old/GPXSee-7.10/src/map/imgmap.cpp 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/imgmap.cpp 2019-07-18 08:14:47.000000000 +0200 @@ -18,7 +18,9 @@ #define TILE_SIZE 256 #define TEXT_EXTENT 256 -#define LINE_TEXT_MIN_ZOOM 22 + +#define AREA(rect) \ + (rect.size().width() * rect.size().height()) class RasterTile { @@ -35,13 +37,14 @@ QList<IMG::Poly> &lines() {return _lines;} QList<IMG::Point> &points() {return _points;} - void load() + void render() { QList<TextItem*> textItems; _map->processPolygons(_polygons); _map->processPoints(_points, textItems); - _map->processLines(_lines, _xy, textItems); + _map->processLines(_lines, QRect(_xy, QSize(TILE_SIZE, TILE_SIZE)), + textItems); _img.fill(Qt::transparent); @@ -53,6 +56,8 @@ _map->drawPolygons(&painter, _polygons); _map->drawLines(&painter, _lines); _map->drawTextItems(&painter, textItems); + //painter.setPen(Qt::red); + //painter.drawRect(QRect(_xy, QSize(TILE_SIZE, TILE_SIZE))); qDeleteAll(textItems); } @@ -68,12 +73,13 @@ }; +static Range zooms(12, 28); + static QColor shieldColor(Qt::white); static QColor shieldBgColor1("#dd3e3e"); static QColor shieldBgColor2("#379947"); static QColor shieldBgColor3("#4a7fc1"); - static QString convertUnits(const QString &str) { bool ok; @@ -102,26 +108,47 @@ } } -static QFont font(int pixelSize) +static QFont pixelSizeFont(int pixelSize) { QFont f; f.setPixelSize(pixelSize); return f; } -/* The fonts must be initialized on first usage (after the QGuiApplication - instance is created) */ -#define FONT(name, size) \ -static const QFont *name() \ -{ \ - static QFont f = font(size); \ - return &f; \ +static QFont *font(Style::FontSize size, Style::FontSize defaultSize + = Style::Normal) +{ + /* The fonts must be initialized on first usage (after the QGuiApplication + instance is created) */ + static QFont large = pixelSizeFont(16); + static QFont normal = pixelSizeFont(14); + static QFont small = pixelSizeFont(12); + + switch (size) { + case Style::None: + return 0; + case Style::Large: + return &large; + case Style::Normal: + return &normal; + case Style::Small: + return &small; + default: + return font(defaultSize); + } } -FONT(largeFont, 16) -FONT(normalFont, 14) -FONT(smallFont, 12) -FONT(poiFont, 10) +static QFont *poiFont(Style::FontSize size = Style::Normal) +{ + static QFont poi = pixelSizeFont(10); + + switch (size) { + case Style::None: + return 0; + default: + return &poi; + } +} static const QColor *shieldBgColor(Label::Shield::Type type) { @@ -153,7 +180,7 @@ case Label::Shield::Oval: return 20; default: - return INT_MAX; + return 0; } } @@ -166,9 +193,7 @@ return; } - _zooms = Range(12, 28); - _zoom = _zooms.min(); - + _zoom = zooms.min(); updateTransform(); _valid = true; @@ -196,8 +221,8 @@ if (rect.isValid()) { RectD pr(rect, _projection, 10); - _zoom = _zooms.min(); - for (int i = _zooms.min() + 1; i <= _zooms.max(); i++) { + _zoom = zooms.min(); + for (int i = zooms.min() + 1; i <= zooms.max(); i++) { Transform t(transform(i)); QRectF r(t.proj2img(pr.topLeft()), t.proj2img(pr.bottomRight())); if (size.width() < r.width() || size.height() < r.height()) @@ -205,7 +230,7 @@ _zoom = i; } } else - _zoom = _zooms.max(); + _zoom = zooms.max(); updateTransform(); @@ -214,14 +239,14 @@ int IMGMap::zoomIn() { - _zoom = qMin(_zoom + 1, _zooms.max()); + _zoom = qMin(_zoom + 1, zooms.max()); updateTransform(); return _zoom; } int IMGMap::zoomOut() { - _zoom = qMax(_zoom - 1, _zooms.min()); + _zoom = qMax(_zoom - 1, zooms.min()); updateTransform(); return _zoom; } @@ -318,11 +343,9 @@ } } -void IMGMap::processLines(QList<IMG::Poly> &lines, const QPoint &tile, +void IMGMap::processLines(QList<IMG::Poly> &lines, const QRect &tileRect, QList<TextItem*> &textItems) { - QRect tileRect(tile, QSize(TILE_SIZE, TILE_SIZE)); - qStableSort(lines); for (int i = 0; i < lines.size(); i++) { @@ -333,86 +356,100 @@ } } - if (_zoom >= LINE_TEXT_MIN_ZOOM) { - for (int i = 0; i < lines.size(); i++) { - IMG::Poly &poly = lines[i]; - const Style::Line &style = _img.style()->line(poly.type); + if (_zoom >= 22) + processStreetNames(lines, tileRect, textItems); + processShields(lines, tileRect, textItems); +} - if (style.img().isNull() && style.foreground() == Qt::NoPen) - continue; - if (poly.label.text().isEmpty() - || style.textFontSize() == Style::None) - continue; +void IMGMap::processStreetNames(QList<IMG::Poly> &lines, const QRect &tileRect, + QList<TextItem*> &textItems) +{ + for (int i = 0; i < lines.size(); i++) { + IMG::Poly &poly = lines[i]; + const Style::Line &style = _img.style()->line(poly.type); - if (Style::isContourLine(poly.type)) - poly.label.setText(convertUnits(poly.label.text())); + if (style.img().isNull() && style.foreground() == Qt::NoPen) + continue; + if (poly.label.text().isEmpty() + || style.textFontSize() == Style::None) + continue; - const QFont *font; - switch (style.textFontSize()) { - case Style::Large: - font = largeFont(); - break; - case Style::Normal: - font = normalFont(); - break; - default: - font = smallFont(); - } - const QColor *color = style.textColor().isValid() - ? &style.textColor() : 0; + if (Style::isContourLine(poly.type)) + poly.label.setText(convertUnits(poly.label.text())); - TextPathItem *item = new TextPathItem(poly.points, - &poly.label.text(), tileRect, font, color); - if (item->isValid() && !item->collides(textItems)) - textItems.append(item); - else - delete item; - } - } + const QFont *fnt = font(style.textFontSize(), Style::Small); + const QColor *color = style.textColor().isValid() + ? &style.textColor() : 0; + TextPathItem *item = new TextPathItem(poly.points, + &poly.label.text(), tileRect, fnt, color); + if (item->isValid() && !item->collides(textItems)) + textItems.append(item); + else + delete item; + } +} - for (int type = 1; type < 7; type++) { - if (minShieldZoom((Label::Shield::Type)type) > _zoom) +void IMGMap::processShields(QList<IMG::Poly> &lines, const QRect &tileRect, + QList<TextItem*> &textItems) +{ + for (int type = FIRST_SHIELD; type <= LAST_SHIELD; type++) { + if (minShieldZoom(static_cast<Label::Shield::Type>(type)) > _zoom) continue; - QSet<Label::Shield> shields; + QHash<Label::Shield, QPolygonF> shields; + QHash<Label::Shield, const Label::Shield*> sp; for (int i = 0; i < lines.size(); i++) { const IMG::Poly &poly = lines.at(i); const Label::Shield &shield = poly.label.shield(); - if (shield.type() != type || !Style::isMajorRoad(poly.type)) + if (!shield.isValid() || shield.type() != type + || !Style::isMajorRoad(poly.type)) continue; - if (poly.label.shield().isValid() && !shields.contains(shield)) { - bool valid = false; - int idx = poly.points.size()/2, inc = 0, sign = 1; - - TextPointItem *item = new TextPointItem( - poly.points.at(idx).toPoint(), &shield.text(), poiFont(), - 0, &shieldColor, shieldBgColor(shield.type())); - - while (1) { - if (!item->collides(textItems) - && tileRect.contains(item->boundingRect().toRect())) { - valid = true; - break; - } - inc++; - sign = (sign < 0) ? 1 : -1; - idx += inc * sign; + QPolygonF &p = shields[shield]; + for (int j = 0; j < poly.points.size(); j++) + p.append(poly.points.at(j)); - if (!(idx >= 0 && idx < poly.points.size())) - break; + sp.insert(shield, &shield); + } - item->setPos(poly.points.at(idx).toPoint()); - } + for (QHash<Label::Shield, QPolygonF>::const_iterator it + = shields.constBegin(); it != shields.constEnd(); ++it) { + const QPolygonF &p = it.value(); + QRectF rect(p.boundingRect() & tileRect); + if (qSqrt(AREA(rect)) < 32) + continue; - if (valid) { - textItems.append(item); - shields.insert(shield); - } else - delete item; + QMap<qreal, int> map; + QPointF center = rect.center(); + for (int j = 0; j < p.size(); j++) { + QLineF l(p.at(j), center); + map.insert(l.length(), j); } + + QMap<qreal, int>::const_iterator jt = map.constBegin(); + + TextPointItem *item = new TextPointItem( + p.at(jt.value()).toPoint(), &(sp.value(it.key())->text()), + poiFont(), 0, &shieldColor, shieldBgColor(it.key().type())); + + bool valid = false; + while (true) { + if (!item->collides(textItems) + && tileRect.contains(item->boundingRect().toRect())) { + valid = true; + break; + } + if (++jt == map.constEnd()) + break; + item->setPos(p.at(jt.value()).toPoint()); + } + + if (valid) + textItems.append(item); + else + delete item; } } } @@ -424,7 +461,6 @@ for (int i = 0; i < points.size(); i++) { IMG::Point &point = points[i]; - const Style::Point &style = _img.style()->point(point.type); if (point.poi && _zoom < minPOIZoom(Style::poiClass(point.type))) @@ -433,31 +469,12 @@ const QString *label = point.label.text().isEmpty() ? 0 : &(point.label.text()); const QImage *img = style.img().isNull() ? 0 : &style.img(); - const QFont *font = 0; - if (point.poi) { - if (style.textFontSize() == Style::None) - label = 0; - else - font = poiFont(); - } else { - switch (style.textFontSize()) { - case Style::None: - label = 0; - break; - case Style::Small: - font = smallFont(); - break; - case Style::Large: - font = largeFont(); - break; - default: - font = normalFont(); - } - } + const QFont *fnt = point.poi + ? poiFont(style.textFontSize()) : font(style.textFontSize()); const QColor *color = style.textColor().isValid() ? &style.textColor() : 0; - if (!label && !img) + if ((!label || !fnt) && !img) continue; if (Style::isSpot(point.type)) @@ -469,7 +486,7 @@ } TextPointItem *item = new TextPointItem( - ll2xy(point.coordinates).toPoint(), label, font, img, color); + ll2xy(point.coordinates).toPoint(), label, fnt, img, color); if (item->isValid() && !item->collides(textItems)) textItems.append(item); else @@ -479,7 +496,7 @@ static void render(RasterTile &tile) { - tile.load(); + tile.render(); } void IMGMap::draw(QPainter *painter, const QRectF &rect, Flags flags) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/imgmap.h new/GPXSee-7.11/src/map/imgmap.h --- old/GPXSee-7.10/src/map/imgmap.h 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/imgmap.h 2019-07-18 08:14:47.000000000 +0200 @@ -50,13 +50,16 @@ void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems); void processPolygons(QList<IMG::Poly> &polygons); - void processLines(QList<IMG::Poly> &lines, const QPoint &tile, + void processLines(QList<IMG::Poly> &lines, const QRect &tileRect, QList<TextItem*> &textItems); void processPoints(QList<IMG::Point> &points, QList<TextItem*> &textItems); + void processShields(QList<IMG::Poly> &lines, const QRect &tileRect, + QList<TextItem*> &textItems); + void processStreetNames(QList<IMG::Poly> &lines, const QRect &tileRect, + QList<TextItem*> &textItems); IMG _img; int _zoom; - Range _zooms; Projection _projection; Transform _transform; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/matrix.cpp new/GPXSee-7.11/src/map/matrix.cpp --- old/GPXSee-7.10/src/map/matrix.cpp 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/matrix.cpp 2019-07-18 08:14:47.000000000 +0200 @@ -37,20 +37,22 @@ Matrix &Matrix::operator=(const Matrix &M) { - if (_h != M._h || _w != M._w) { - if (!isNull()) - delete[] _m; + if (this != &M) { + if (_h != M._h || _w != M._w) { + if (!isNull()) + delete[] _m; - _h = M._h; _w = M._w; - if (isNull()) - _m = 0; - else - _m = new double[_h * _w]; - } + _h = M._h; _w = M._w; + if (isNull()) + _m = 0; + else + _m = new double[_h * _w]; + } - for (size_t i = 0; i < _h; i++) - for (size_t j = 0; j < _w; j++) - m(i,j) = M.m(i,j); + for (size_t i = 0; i < _h; i++) + for (size_t j = 0; j < _w; j++) + m(i,j) = M.m(i,j); + } return *this; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/GPXSee-7.10/src/map/projection.cpp new/GPXSee-7.11/src/map/projection.cpp --- old/GPXSee-7.10/src/map/projection.cpp 2019-07-07 19:16:56.000000000 +0200 +++ new/GPXSee-7.11/src/map/projection.cpp 2019-07-18 08:14:47.000000000 +0200 @@ -128,13 +128,15 @@ Projection &Projection::operator=(const Projection &p) { - delete _ct; + if (this != &p) { + delete _ct; - _gcs = p._gcs; - _units = p._units; - _ct = p._ct ? p._ct->clone() : 0; - _geographic = p._geographic; - _cs = p._cs; + _gcs = p._gcs; + _units = p._units; + _ct = p._ct ? p._ct->clone() : 0; + _geographic = p._geographic; + _cs = p._cs; + } return *this; } ++++++ PKGBUILD ++++++ --- /var/tmp/diff_new_pack.mS7OrP/_old 2019-07-21 11:34:26.692776280 +0200 +++ /var/tmp/diff_new_pack.mS7OrP/_new 2019-07-21 11:34:26.692776280 +0200 @@ -1,5 +1,5 @@ pkgname=gpxsee -pkgver=7.10 +pkgver=7.11 pkgrel=1 pkgdesc='GPS log files visualizing and analyzing tool' arch=('i686' 'x86_64') ++++++ debian.changelog ++++++ --- /var/tmp/diff_new_pack.mS7OrP/_old 2019-07-21 11:34:26.736776272 +0200 +++ /var/tmp/diff_new_pack.mS7OrP/_new 2019-07-21 11:34:26.736776272 +0200 @@ -1,3 +1,10 @@ +gpxsee (7.11) stable; urgency=low + + * Improved IMG maps loading performance and memory footprint. + * Improved road shields layout on IMG maps. + + -- Martin Tuma <tu...@cbox.cz> Thu, 18 Jul 2019 21:34:52 +0200 + gpxsee (7.10) stable; urgency=low * Various IMG maps fixes and improvements. ++++++ gpxsee.dsc ++++++ --- /var/tmp/diff_new_pack.mS7OrP/_old 2019-07-21 11:34:26.804776260 +0200 +++ /var/tmp/diff_new_pack.mS7OrP/_new 2019-07-21 11:34:26.804776260 +0200 @@ -1,9 +1,9 @@ Format: 1.0 Source: gpxsee -Version: 7.10 +Version: 7.11 Binary: gpxsee Maintainer: Martin Tuma <tu...@cbox.cz> Architecture: any Build-Depends: debhelper (>= 9), qtbase5-dev, qtbase5-dev-tools, qt5-qmake, qttools5-dev-tools, libqt5opengl5-dev Files: - 00000000000000000000000000000000 0 GPXSee-7.10.tar.gz + 00000000000000000000000000000000 0 GPXSee-7.11.tar.gz