mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-24 03:35:53 +01:00
Fixed symbol/label display priority
This commit is contained in:
parent
62ef1f4243
commit
9b0fb8b77c
@ -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))
|
si = ri;
|
||||||
if (!si || si->priority() < ri->priority())
|
break;
|
||||||
si = ri;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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,21 +166,20 @@ 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))
|
si = ri;
|
||||||
if (!si || si->priority() < ri->priority())
|
break;
|
||||||
si = ri;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
break;
|
||||||
ti = ri;
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,16 @@ static QList<QByteArray> valList(const QList<QByteArray> &in)
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool symbolCmp(const Style::Symbol &a, const Style::Symbol &b)
|
||||||
|
{
|
||||||
|
return a.priority() > b.priority();
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool labelCmp(const Style::TextRender &a, const Style::TextRender &b)
|
||||||
|
{
|
||||||
|
return a.priority() > b.priority();
|
||||||
|
}
|
||||||
|
|
||||||
const Style::Menu::Layer *Style::Menu::findLayer(const QString &id) const
|
const Style::Menu::Layer *Style::Menu::findLayer(const QString &id) const
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _layers.size(); i++)
|
for (int i = 0; i < _layers.size(); i++)
|
||||||
@ -759,6 +769,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(), symbolCmp);
|
||||||
|
std::sort(_lineSymbols.begin(), _lineSymbols.end(), symbolCmp);
|
||||||
|
std::stable_sort(_pointLabels.begin(), _pointLabels.end(), labelCmp);
|
||||||
|
std::stable_sort(_areaLabels.begin(), _areaLabels.end(), labelCmp);
|
||||||
|
std::stable_sort(_pathLabels.begin(), _pathLabels.end(), labelCmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Style::clear()
|
void Style::clear()
|
||||||
|
Loading…
Reference in New Issue
Block a user