1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-23 19:25:54 +01:00

Compare commits

...

2 Commits

3 changed files with 38 additions and 10 deletions

View File

@ -23,7 +23,7 @@
<rule e="way" closed="yes" k="natural" v="rock|stone|bare_rock|bedrock" zoom-min="14">
<area fill="#60000000"/>
</rule>
<rule e="way" closed="yes" k="natural" v="glacier" zoom-min="12">
<rule e="way" closed="yes" k="natural" v="glacier" zoom-min="10">
<area fill="#ddf1fd"/>
</rule>
@ -586,18 +586,27 @@
<rule e="node" k="name" v="*">
<symbol id="peak" src=":/POI/mountain-11.svg" symbol-width="11" priority="10"/>
<caption fill="#000000" font-size="10" font-family="serif" font-style="italic" k="name" stroke="#FFFFFF" stroke-width="2" symbol-id="peak"/>
<rule e="node" k="*" v="*" zoom-min="14">
<caption fill="#000000" font-size="10" font-family="serif" font-style="italic" k="ele" stroke="#FFFFFF" stroke-width="2" symbol-id="peak" priority="-1"/>
</rule>
</rule>
</rule>
<rule e="node" k="natural" v="saddle" zoom-min="13">
<rule e="node" k="name" v="*">
<symbol id="saddle" src=":/symbols/saddle.svg" symbol-width="9" symbol-height="11" priority="9"/>
<caption fill="#000000" font-size="10" font-family="serif" font-style="italic" k="name" stroke="#FFFFFF" stroke-width="2" symbol-id="saddle"/>
<rule e="node" k="*" v="*" zoom-min="14">
<caption fill="#000000" font-size="10" font-family="serif" font-style="italic" k="ele" stroke="#FFFFFF" stroke-width="2" symbol-id="saddle" priority="-1"/>
</rule>
</rule>
</rule>
<rule e="node" k="natural" v="volcano" zoom-min="13">
<rule e="node" k="name" v="*">
<symbol id="volcano" src=":/POI/volcano-11.svg" symbol-width="11" priority="10"/>
<caption fill="#000000" font-size="10" font-family="serif" font-style="italic" k="name" stroke="#FFFFFF" stroke-width="2" symbol-id="volcano"/>
<rule e="node" k="*" v="*" zoom-min="14">
<caption fill="#000000" font-size="10" font-family="serif" font-style="italic" k="ele" stroke="#FFFFFF" stroke-width="2" symbol-id="volcano" priority="-1"/>
</rule>
</rule>
</rule>
<rule e="node" k="waterway" v="waterfall" zoom-min="15">

View File

@ -85,7 +85,7 @@ void RasterTile::processLabels(const QList<MapData::Point> &points,
const MapData::Point &point = points.at(i);
const Style::TextRender *ti = 0;
const Style::Symbol *si = 0;
const QByteArray *lbl = 0;
QList<const QByteArray *> ll;
for (int j = 0; j < symbols.size(); j++) {
const Style::Symbol *ri = symbols.at(j);
@ -98,17 +98,23 @@ void RasterTile::processLabels(const QList<MapData::Point> &points,
for (int j = 0; j < labels.size(); j++) {
const Style::TextRender *ri = labels.at(j);
if (ri->rule().match(point.center(), point.tags)) {
const QByteArray *lbl;
if ((lbl = label(ri->key(), point.tags))) {
if (!si || si->id() == ri->symbolId()) {
if (!si) {
ti = ri;
ll.append(lbl);
break;
} else if (si->id() == ri->symbolId()) {
if (!ti)
ti = ri;
ll.append(lbl);
}
}
}
}
if (ti || si)
items.append(Label(&point, lbl, si, ti));
items.append(Label(&point, ll, si, ti));
}
std::sort(items.begin(), items.end());

View File

@ -44,9 +44,9 @@ private:
};
struct Label {
Label(const MapData::Point *p, const QByteArray *lbl,
Label(const MapData::Point *p, const QList<const QByteArray *> lbl,
const Style::Symbol *si, const Style::TextRender *ti)
: point(p), lbl(lbl), ti(ti), si(si)
: point(p), ti(ti), si(si), lbl(lbl)
{
Q_ASSERT(si || ti);
}
@ -61,9 +61,9 @@ private:
int priority() const {return si ? si->priority() : ti->priority();}
const MapData::Point *point;
const QByteArray *lbl;
const Style::TextRender *ti;
const Style::Symbol *si;
QList<const QByteArray *> lbl;
};
struct LineLabel {
@ -170,15 +170,28 @@ private:
class PointItem : public TextPointItem
{
public:
PointItem(const QPoint &point, const QByteArray *label,
PointItem(const QPoint &point, const QList<const QByteArray *> &lbl,
const QFont *font, const QImage *img, const QColor *color,
const QColor *haloColor) : TextPointItem(point,
label ? new QString(*label) : 0, font, img, color, haloColor, 0) {}
const QColor *haloColor) : TextPointItem(point, label(lbl),
font, img, color, haloColor, 0) {}
PointItem(const QPoint &point, const QByteArray *label,
const QFont *font, const QColor *color, const QColor *bgColor)
: TextPointItem(point, label ? new QString(*label) : 0, font, 0,
color, 0, bgColor) {}
~PointItem() {delete _text;}
private:
static QString *label(const QList<const QByteArray*> &ll)
{
if (ll.isEmpty())
return 0;
QString *ret = new QString(*ll.first());
for (int i = 1; i < ll.size(); i++)
ret->append("\n" + *ll.at(i));
return ret;
}
};
class PathItem : public TextPathItem