1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Compare commits

...

3 Commits

Author SHA1 Message Date
70ddd83154 Code cleanup 2024-11-07 18:40:25 +01:00
9b0fb8b77c Fixed symbol/label display priority 2024-11-07 18:31:39 +01:00
62ef1f4243 Version++ 2024-11-07 18:31:25 +01:00
6 changed files with 42 additions and 28 deletions

View File

@ -1,4 +1,4 @@
version: 13.27.{build} version: 13.28.{build}
configuration: configuration:
- Release - Release

View File

@ -3,7 +3,7 @@ unix:!macx:!android {
} else { } else {
TARGET = GPXSee TARGET = GPXSee
} }
VERSION = 13.27 VERSION = 13.28
QT += core \ QT += core \

View File

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

View File

@ -107,20 +107,20 @@ void RasterTile::processPointLabels(const QList<MapData::Point> &points,
for (int j = 0; j < symbols.size(); j++) { for (int j = 0; j < symbols.size(); j++) {
const Style::Symbol *ri = symbols.at(j); const Style::Symbol *ri = symbols.at(j);
if (ri->rule().match(point.tags)) {
if (ri->rule().match(point.tags))
if (!si || si->priority() < ri->priority())
si = ri; si = ri;
break;
}
} }
for (int j = 0; j < labels.size(); j++) { for (int j = 0; j < labels.size(); j++) {
const Style::TextRender *ri = labels.at(j); const Style::TextRender *ri = labels.at(j);
if (ri->rule().match(point.tags)) { if (ri->rule().match(point.tags)) {
if ((lbl = label(ri->key(), point.tags))) { if ((lbl = label(ri->key(), point.tags))) {
if (si && si->id() != ri->symbolId()) if (!si || si->id() == ri->symbolId()) {
continue;
if (!ti || ti->priority() < ri->priority())
ti = ri; ti = ri;
break;
}
} }
} }
} }
@ -166,24 +166,23 @@ void RasterTile::processAreaLabels(const QVector<PainterPath> &paths,
for (int j = 0; j < symbols.size(); j++) { for (int j = 0; j < symbols.size(); j++) {
const Style::Symbol *ri = symbols.at(j); const Style::Symbol *ri = symbols.at(j);
if (ri->rule().match(path.path->closed, path.path->tags)) {
if (ri->rule().match(path.path->closed, path.path->tags))
if (!si || si->priority() < ri->priority())
si = ri; si = ri;
break;
}
} }
for (int j = 0; j < labels.size(); j++) { for (int j = 0; j < labels.size(); j++) {
const Style::TextRender *ri = labels.at(j); const Style::TextRender *ri = labels.at(j);
if (ri->rule().match(path.path->closed, path.path->tags)) { if (ri->rule().match(path.path->closed, path.path->tags)) {
if ((lbl = label(ri->key(), path.path->tags))) { if ((lbl = label(ri->key(), path.path->tags))) {
if (si && si->id() != ri->symbolId()) if (!si || si->id() == ri->symbolId()) {
continue;
ti = ri; ti = ri;
break; break;
} }
} }
} }
}
if (ti || si) if (ti || si)
items.append(PathText(&path, lbl, si, ti)); items.append(PathText(&path, lbl, si, ti));
@ -232,15 +231,6 @@ void RasterTile::processLineLabels(const QVector<PainterPath> &paths,
if (path.path->closed) if (path.path->closed)
continue; continue;
for (int j = 0; j < labels.size(); j++) {
const Style::TextRender *ri = labels.at(j);
if (ri->rule().match(path.path->closed, path.path->tags)) {
if ((lbl = label(ri->key(), path.path->tags)))
ti = ri;
break;
}
}
for (int j = 0; j < symbols.size(); j++) { for (int j = 0; j < symbols.size(); j++) {
const Style::Symbol *ri = symbols.at(j); const Style::Symbol *ri = symbols.at(j);
if (ri->rule().match(path.path->closed, path.path->tags)) { if (ri->rule().match(path.path->closed, path.path->tags)) {
@ -249,6 +239,18 @@ void RasterTile::processLineLabels(const QVector<PainterPath> &paths,
} }
} }
for (int j = 0; j < labels.size(); j++) {
const Style::TextRender *ri = labels.at(j);
if (ri->rule().match(path.path->closed, path.path->tags)) {
if ((lbl = label(ri->key(), path.path->tags))) {
if (!si || si->id() == ri->symbolId()) {
ti = ri;
break;
}
}
}
}
if (ti || si) if (ti || si)
items.append(PathText(&path, lbl, si, ti)); items.append(PathText(&path, lbl, si, ti));
} }

View File

@ -759,6 +759,12 @@ void Style::load(const MapData &data, qreal ratio)
if (!QFileInfo::exists(path) || !loadXml(path, data, ratio)) if (!QFileInfo::exists(path) || !loadXml(path, data, ratio))
loadXml(":/mapsforge/default.xml", data, ratio); loadXml(":/mapsforge/default.xml", data, ratio);
std::sort(_symbols.begin(), _symbols.end());
std::sort(_lineSymbols.begin(), _lineSymbols.end());
std::stable_sort(_pointLabels.begin(), _pointLabels.end());
std::stable_sort(_areaLabels.begin(), _areaLabels.end());
std::stable_sort(_pathLabels.begin(), _pathLabels.end());
} }
void Style::clear() void Style::clear()

View File

@ -217,6 +217,9 @@ public:
unsigned key() const {return _key;} unsigned key() const {return _key;}
int priority() const {return _priority;} int priority() const {return _priority;}
bool operator<(const TextRender &other) const
{return _priority > other._priority;}
private: private:
friend class Style; friend class Style;
@ -239,6 +242,9 @@ public:
bool rotate() const {return _rotate;} bool rotate() const {return _rotate;}
int priority() const {return _priority;} int priority() const {return _priority;}
bool operator<(const Symbol &other) const
{return _priority > other._priority;}
private: private:
friend class Style; friend class Style;