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

Use style-defined priorities

+ code cleanup
This commit is contained in:
Martin Tůma 2023-04-06 23:29:05 +02:00
parent 2aa759a4bc
commit 648627b17f
7 changed files with 125 additions and 119 deletions

View File

@ -15,42 +15,12 @@ using namespace Mapsforge;
#define MD(val) ((val) / 1e6) #define MD(val) ((val) / 1e6)
#define OFFSET_MASK 0x7FFFFFFFFFL #define OFFSET_MASK 0x7FFFFFFFFFL
static quint8 pointType(const QVector<MapData::Tag> &tags)
{
for (int i = 0; i < tags.size(); i++) {
const MapData::Tag &tag = tags.at(i);
if (tag.key == "place") {
if (tag.value == "country")
return 4;
else if (tag.value == "city")
return 3;
else if (tag.value == "town")
return 2;
else if (tag.value == "village")
return 1;
else
return 0;
}
}
return 0;
}
static void setPointId(MapData::Point &p)
{
HASH_T hash = qHash(QPair<double, double>(p.coordinates.lon(),
p.coordinates.lat()));
quint8 type = pointType(p.tags);
p.id = ((quint64)type)<<56 | (quint64)hash;
}
static void copyPaths(const RectC &rect, const QList<MapData::Path> *src, static void copyPaths(const RectC &rect, const QList<MapData::Path> *src,
QSet<MapData::Path> *dst) QList<MapData::Path> *dst)
{ {
for (int i = 0; i < src->size(); i++) for (int i = 0; i < src->size(); i++)
if (rect.intersects(src->at(i).poly.boundingRect())) if (rect.intersects(src->at(i).poly.boundingRect()))
dst->insert(src->at(i)); dst->append(src->at(i));
} }
static void copyPoints(const RectC &rect, const QList<MapData::Point> *src, static void copyPoints(const RectC &rect, const QList<MapData::Point> *src,
@ -494,7 +464,7 @@ void MapData::clearTiles()
bool MapData::pathCb(VectorTile *tile, void *context) bool MapData::pathCb(VectorTile *tile, void *context)
{ {
PathCTX *ctx = (PathCTX*)context; PathCTX *ctx = (PathCTX*)context;
ctx->data->paths(tile, ctx->rect, ctx->zoom, ctx->set); ctx->data->paths(tile, ctx->rect, ctx->zoom, ctx->list);
return true; return true;
} }
@ -545,10 +515,10 @@ void MapData::points(const VectorTile *tile, const RectC &rect, int zoom,
copyPoints(rect, cached, list); copyPoints(rect, cached, list);
} }
void MapData::paths(const RectC &rect, int zoom, QSet<Path> *set) void MapData::paths(const RectC &rect, int zoom, QList<Path> *list)
{ {
int l(level(zoom)); int l(level(zoom));
PathCTX ctx(this, rect, zoom, set); PathCTX ctx(this, rect, zoom, list);
double min[2], max[2]; double min[2], max[2];
min[0] = rect.left(); min[0] = rect.left();
@ -560,7 +530,7 @@ void MapData::paths(const RectC &rect, int zoom, QSet<Path> *set)
} }
void MapData::paths(const VectorTile *tile, const RectC &rect, int zoom, void MapData::paths(const VectorTile *tile, const RectC &rect, int zoom,
QSet<Path> *set) QList<Path> *list)
{ {
Key key(tile, zoom); Key key(tile, zoom);
QList<Path> *cached = _pathCache.object(key); QList<Path> *cached = _pathCache.object(key);
@ -568,12 +538,12 @@ void MapData::paths(const VectorTile *tile, const RectC &rect, int zoom,
if (!cached) { if (!cached) {
QList<Path> *p = new QList<Path>(); QList<Path> *p = new QList<Path>();
if (readPaths(tile, zoom, p)) { if (readPaths(tile, zoom, p)) {
copyPaths(rect, p, set); copyPaths(rect, p, list);
_pathCache.insert(key, p); _pathCache.insert(key, p);
} else } else
delete p; delete p;
} else } else
copyPaths(rect, cached, set); copyPaths(rect, cached, list);
} }
bool MapData::readPaths(const VectorTile *tile, int zoom, QList<Path> *list) bool MapData::readPaths(const VectorTile *tile, int zoom, QList<Path> *list)
@ -719,8 +689,6 @@ bool MapData::readPoints(const VectorTile *tile, int zoom, QList<Point> *list)
p.tags.append(Tag("ele", QByteArray::number(elevation))); p.tags.append(Tag("ele", QByteArray::number(elevation)));
} }
setPointId(p);
list->append(p); list->append(p);
} }

View File

@ -41,15 +41,15 @@ public:
}; };
struct Point { struct Point {
Point(const Coordinates &c) : coordinates(c) {} Point(const Coordinates &c) : coordinates(c)
{
id = (quint64)qHash(QPair<double, double>(c.lon(), c.lat()));
}
quint64 id; quint64 id;
Coordinates coordinates; Coordinates coordinates;
QVector<Tag> tags; QVector<Tag> tags;
int layer; int layer;
bool operator<(const Point &other) const
{return id > other.id;}
}; };
struct Path { struct Path {
@ -74,7 +74,7 @@ public:
int tileSize() const {return _tileSize;} int tileSize() const {return _tileSize;}
void points(const RectC &rect, int zoom, QList<Point> *list); void points(const RectC &rect, int zoom, QList<Point> *list);
void paths(const RectC &rect, int zoom, QSet<Path> *set); void paths(const RectC &rect, int zoom, QList<Path> *set);
void load(); void load();
void clear(); void clear();
@ -100,13 +100,13 @@ private:
}; };
struct PathCTX { struct PathCTX {
PathCTX(MapData *data, const RectC &rect, int zoom, QSet<Path> *set) PathCTX(MapData *data, const RectC &rect, int zoom, QList<Path> *list)
: data(data), rect(rect), zoom(zoom), set(set) {} : data(data), rect(rect), zoom(zoom), list(list) {}
MapData *data; MapData *data;
const RectC &rect; const RectC &rect;
int zoom; int zoom;
QSet<Path> *set; QList<Path> *list;
}; };
struct PointCTX { struct PointCTX {
@ -139,7 +139,7 @@ private:
int level(int zoom) const; int level(int zoom) const;
void paths(const VectorTile *tile, const RectC &rect, int zoom, void paths(const VectorTile *tile, const RectC &rect, int zoom,
QSet<Path> *set); QList<Path> *list);
void points(const VectorTile *tile, const RectC &rect, int zoom, void points(const VectorTile *tile, const RectC &rect, int zoom,
QList<Point> *list); QList<Point> *list);
bool readPaths(const VectorTile *tile, int zoom, QList<Path> *list); bool readPaths(const VectorTile *tile, int zoom, QList<Path> *list);

View File

@ -1,8 +1,6 @@
#include <QPainter> #include <QPainter>
#include <QCache> #include <QCache>
#include "common/programpaths.h" #include "common/programpaths.h"
#include "map/mapsforgemap.h"
#include "map/textpathitem.h"
#include "rastertile.h" #include "rastertile.h"
using namespace Mapsforge; using namespace Mapsforge;
@ -61,15 +59,15 @@ static const QColor *haloColor(const Style::TextRender *ti)
? &ti->strokeColor() : 0; ? &ti->strokeColor() : 0;
} }
void RasterTile::processPointLabels(QList<TextItem*> &textItems) void RasterTile::processPointLabels(QList<TextItem*> &textItems)
{ {
const Style &s = style(_ratio); const Style &s = style(_ratio);
QList<const Style::TextRender*> labels(s.pointLabels(_zoom)); QList<const Style::TextRender*> labels(s.pointLabels(_zoom));
QList<const Style::Symbol*> symbols(s.pointSymbols(_zoom)); QList<const Style::Symbol*> symbols(s.pointSymbols(_zoom));
QList<PainterPoint> points;
for (int i = 0; i < _points.size(); i++) { for (int i = 0; i < _points.size(); i++) {
MapData::Point &point = _points[i]; const MapData::Point &point = _points.at(i);
const QByteArray *lbl = 0; const QByteArray *lbl = 0;
const Style::TextRender *ti = 0; const Style::TextRender *ti = 0;
const Style::Symbol *si = 0; const Style::Symbol *si = 0;
@ -92,16 +90,21 @@ void RasterTile::processPointLabels(QList<TextItem*> &textItems)
} }
} }
if (!ti && !si) if (ti || si)
continue; points.append(PainterPoint(&point, lbl, si, ti));
}
const QImage *img = si ? &si->img() : 0; std::sort(points.begin(), points.end());
const QFont *font = ti ? &ti->font() : 0;
const QColor *color = ti ? &ti->fillColor() : 0;
const QColor *hColor = ti ? haloColor(ti) : 0;
PointItem *item = new PointItem(ll2xy(point.coordinates).toPoint(), for (int i = 0; i < points.size(); i++) {
lbl ? new QString(*lbl) : 0, font, img, color, hColor); const PainterPoint &p = points.at(i);
const QImage *img = p.si ? &p.si->img() : 0;
const QFont *font = p.ti ? &p.ti->font() : 0;
const QColor *color = p.ti ? &p.ti->fillColor() : 0;
const QColor *hColor = p.ti ? haloColor(p.ti) : 0;
PointItem *item = new PointItem(ll2xy(p.p->coordinates).toPoint(),
p.lbl, font, img, color, hColor);
if (item->isValid() && !item->collides(textItems)) if (item->isValid() && !item->collides(textItems))
textItems.append(item); textItems.append(item);
else else
@ -110,16 +113,17 @@ void RasterTile::processPointLabels(QList<TextItem*> &textItems)
} }
void RasterTile::processAreaLabels(QList<TextItem*> &textItems, void RasterTile::processAreaLabels(QList<TextItem*> &textItems,
QVector<RenderPath> &renderPaths) QVector<PainterPath> &paths)
{ {
const Style &s = style(_ratio); const Style &s = style(_ratio);
QList<const Style::TextRender*> labels(s.areaLabels(_zoom)); QList<const Style::TextRender*> labels(s.areaLabels(_zoom));
QList<const Style::Symbol*> symbols(s.areaSymbols(_zoom)); QList<const Style::Symbol*> symbols(s.areaSymbols(_zoom));
for (int i = 0; i < renderPaths.size(); i++) { for (int i = 0; i < paths.size(); i++) {
RenderPath &path = renderPaths[i]; PainterPath &path = paths[i];
const Style::TextRender *ti = 0; const Style::TextRender *ti = 0;
const Style::Symbol *si = 0; const Style::Symbol *si = 0;
const QByteArray *lbl = 0;
if (!path.path->closed) if (!path.path->closed)
continue; continue;
@ -127,11 +131,8 @@ void RasterTile::processAreaLabels(QList<TextItem*> &textItems,
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)) {
const QByteArray *lbl; if ((lbl = label(ri->key(), path.path->tags)))
if ((lbl = label(ri->key(), path.path->tags))) {
path.label = *lbl;
ti = ri; ti = ri;
}
break; break;
} }
} }
@ -154,8 +155,8 @@ void RasterTile::processAreaLabels(QList<TextItem*> &textItems,
QPointF pos = path.path->labelPos.isNull() QPointF pos = path.path->labelPos.isNull()
? centroid(path.pp) : ll2xy(path.path->labelPos); ? centroid(path.pp) : ll2xy(path.path->labelPos);
TextPointItem *item = new TextPointItem(pos.toPoint(), &path.label, PointItem *item = new PointItem(pos.toPoint(), lbl, font, img, color,
font, img, color, hColor, 0); hColor);
if (item->isValid() && _rect.contains(item->boundingRect().toRect()) if (item->isValid() && _rect.contains(item->boundingRect().toRect())
&& !item->collides(textItems)) && !item->collides(textItems))
textItems.append(item); textItems.append(item);
@ -165,7 +166,7 @@ void RasterTile::processAreaLabels(QList<TextItem*> &textItems,
} }
void RasterTile::processLineLabels(QList<TextItem*> &textItems, void RasterTile::processLineLabels(QList<TextItem*> &textItems,
QVector<RenderPath> &renderPaths) QVector<PainterPath> &paths)
{ {
const Style &s = style(_ratio); const Style &s = style(_ratio);
QList<const Style::TextRender*> instructions(s.pathLabels(_zoom)); QList<const Style::TextRender*> instructions(s.pathLabels(_zoom));
@ -174,8 +175,8 @@ void RasterTile::processLineLabels(QList<TextItem*> &textItems,
for (int i = 0; i < instructions.size(); i++) { for (int i = 0; i < instructions.size(); i++) {
const Style::TextRender *ri = instructions.at(i); const Style::TextRender *ri = instructions.at(i);
for (int i = 0; i < renderPaths.size(); i++) { for (int i = 0; i < paths.size(); i++) {
RenderPath &path = renderPaths[i]; PainterPath &path = paths[i];
const QByteArray *lbl = label(ri->key(), path.path->tags); const QByteArray *lbl = label(ri->key(), path.path->tags);
if (!lbl) if (!lbl)
@ -188,10 +189,8 @@ void RasterTile::processLineLabels(QList<TextItem*> &textItems,
if (limit && set.contains(*lbl)) if (limit && set.contains(*lbl))
continue; continue;
path.label = *lbl; PathItem *item = new PathItem(path.pp, lbl, _rect, &ri->font(),
&ri->fillColor(), haloColor(ri));
TextPathItem *item = new TextPathItem(path.pp, &path.label, _rect,
&ri->font(), &ri->fillColor(), haloColor(ri));
if (item->isValid() && !item->collides(textItems)) { if (item->isValid() && !item->collides(textItems)) {
textItems.append(item); textItems.append(item);
if (limit) if (limit)
@ -240,25 +239,23 @@ QPainterPath RasterTile::painterPath(const Polygon &polygon, bool curve) const
} }
QVector<RasterTile::PathInstruction> RasterTile::pathInstructions( QVector<RasterTile::PathInstruction> RasterTile::pathInstructions(
QVector<RenderPath> &renderPaths) QVector<PainterPath> &paths)
{ {
QCache<Key, QList<const Style::PathRender *> > cache(8192); QCache<Key, QList<const Style::PathRender *> > cache(8192);
QVector<PathInstruction> instructions; QVector<PathInstruction> instructions;
const Style &s = style(_ratio); const Style &s = style(_ratio);
QList<const Style::PathRender*> *ri; QList<const Style::PathRender*> *ri;
int i = 0;
for (QSet<MapData::Path>::const_iterator it = _paths.cbegin(); for (int i = 0; i < _paths.size(); i++) {
it != _paths.cend(); ++it) { const MapData::Path &path = _paths.at(i);
const MapData::Path &path = *it; PainterPath &rp = paths[i];
RenderPath &rp = renderPaths[i];
Key key(_zoom, path.closed, path.tags); Key key(_zoom, path.closed, path.tags);
rp.path = &path; rp.path = &path;
if (!(ri = cache.object(key))) { if (!(ri = cache.object(key))) {
ri = new QList<const Style::PathRender*>(s.paths(_zoom, ri = new QList<const Style::PathRender*>(s.paths(_zoom, path.closed,
path.closed, path.tags)); path.tags));
for (int j = 0; j < ri->size(); j++) for (int j = 0; j < ri->size(); j++)
instructions.append(PathInstruction(ri->at(j), &rp)); instructions.append(PathInstruction(ri->at(j), &rp));
cache.insert(key, ri); cache.insert(key, ri);
@ -266,8 +263,6 @@ QVector<RasterTile::PathInstruction> RasterTile::pathInstructions(
for (int j = 0; j < ri->size(); j++) for (int j = 0; j < ri->size(); j++)
instructions.append(PathInstruction(ri->at(j), &rp)); instructions.append(PathInstruction(ri->at(j), &rp));
} }
i++;
} }
std::sort(instructions.begin(), instructions.end()); std::sort(instructions.begin(), instructions.end());
@ -275,14 +270,14 @@ QVector<RasterTile::PathInstruction> RasterTile::pathInstructions(
return instructions; return instructions;
} }
void RasterTile::drawPaths(QPainter *painter, QVector<RenderPath> &renderPaths) void RasterTile::drawPaths(QPainter *painter, QVector<PainterPath> &paths)
{ {
QVector<PathInstruction> instructions(pathInstructions(renderPaths)); QVector<PathInstruction> instructions(pathInstructions(paths));
for (int i = 0; i < instructions.size(); i++) { for (int i = 0; i < instructions.size(); i++) {
const PathInstruction &is = instructions.at(i); const PathInstruction &is = instructions.at(i);
const Style::PathRender *ri = is.render(); const Style::PathRender *ri = is.render();
RenderPath *path = is.path(); PainterPath *path = is.path();
if (!path->pp.elementCount()) if (!path->pp.elementCount())
path->pp = painterPath(path->path->poly, ri->curve()); path->pp = painterPath(path->path->poly, ri->curve());
@ -295,10 +290,8 @@ void RasterTile::drawPaths(QPainter *painter, QVector<RenderPath> &renderPaths)
void RasterTile::render() void RasterTile::render()
{ {
std::sort(_points.begin(), _points.end());
QList<TextItem*> textItems; QList<TextItem*> textItems;
QVector<RenderPath> renderPaths(_paths.size()); QVector<PainterPath> renderPaths(_paths.size());
_pixmap.setDevicePixelRatio(_ratio); _pixmap.setDevicePixelRatio(_ratio);
_pixmap.fill(Qt::transparent); _pixmap.fill(Qt::transparent);

View File

@ -5,19 +5,17 @@
#include "map/projection.h" #include "map/projection.h"
#include "map/transform.h" #include "map/transform.h"
#include "map/textpointitem.h" #include "map/textpointitem.h"
#include "map/textpathitem.h"
#include "style.h" #include "style.h"
#include "mapdata.h" #include "mapdata.h"
class MapsforgeMap;
class TextItem;
namespace Mapsforge { namespace Mapsforge {
class RasterTile class RasterTile
{ {
public: public:
RasterTile(const Projection &proj, const Transform &transform, int zoom, RasterTile(const Projection &proj, const Transform &transform, int zoom,
const QRect &rect, qreal ratio, const QSet<MapData::Path> &paths, const QRect &rect, qreal ratio, const QList<MapData::Path> &paths,
const QList<MapData::Point> &points) : _proj(proj), _transform(transform), const QList<MapData::Point> &points) : _proj(proj), _transform(transform),
_zoom(zoom), _rect(rect), _ratio(ratio), _zoom(zoom), _rect(rect), _ratio(ratio),
_pixmap(rect.width() * ratio, rect.height() * ratio), _paths(paths), _pixmap(rect.width() * ratio, rect.height() * ratio), _paths(paths),
@ -31,19 +29,41 @@ public:
void render(); void render();
private: private:
struct RenderPath { struct PainterPath {
RenderPath() : path(0) {} PainterPath() : path(0) {}
QPainterPath pp; QPainterPath pp;
QString label;
const MapData::Path *path; const MapData::Path *path;
}; };
struct PainterPoint {
PainterPoint(const MapData::Point *p, const QByteArray *lbl,
const Style::Symbol *si, const Style::TextRender *ti)
: p(p), lbl(lbl), ti(ti), si(si)
{
Q_ASSERT(si || ti);
}
bool operator<(const PainterPoint &other) const
{
if (priority() == other.priority())
return p->id < other.p->id;
else
return (priority() > other.priority());
}
int priority() const {return si ? si->priority() : ti->priority();}
const MapData::Point *p;
const QByteArray *lbl;
const Style::TextRender *ti;
const Style::Symbol *si;
};
class PathInstruction class PathInstruction
{ {
public: public:
PathInstruction() : _render(0), _path(0) {} PathInstruction() : _render(0), _path(0) {}
PathInstruction(const Style::PathRender *render, RenderPath *path) PathInstruction(const Style::PathRender *render, PainterPath *path)
: _render(render), _path(path) {} : _render(render), _path(path) {}
bool operator<(const PathInstruction &other) const bool operator<(const PathInstruction &other) const
@ -55,11 +75,11 @@ private:
} }
const Style::PathRender *render() const {return _render;} const Style::PathRender *render() const {return _render;}
RenderPath *path() const {return _path;} PainterPath *path() const {return _path;}
private: private:
const Style::PathRender *_render; const Style::PathRender *_render;
RenderPath *_path; PainterPath *_path;
}; };
struct Key { struct Key {
@ -79,29 +99,36 @@ private:
class PointItem : public TextPointItem class PointItem : public TextPointItem
{ {
public: public:
PointItem(const QPoint &point, QString *text, const QFont *font, PointItem(const QPoint &point, const QByteArray *label,
const QImage *img, const QColor *color, const QColor *haloColor) const QFont *font, const QImage *img, const QColor *color,
: TextPointItem(point, text, font, img, color, haloColor, 0), const QColor *haloColor) : TextPointItem(point,
_label(text) {} label ? new QString(*label) : 0, font, img, color, haloColor, 0) {}
~PointItem() {delete _label;} ~PointItem() {delete _text;}
};
private: class PathItem : public TextPathItem
QString *_label; {
public:
PathItem(const QPainterPath &line, const QByteArray *label,
const QRect &tileRect, const QFont *font, const QColor *color,
const QColor *haloColor) : TextPathItem(line,
label ? new QString(*label) : 0, tileRect, font, color, haloColor) {}
~PathItem() {delete _text;}
}; };
friend HASH_T qHash(const RasterTile::Key &key); friend HASH_T qHash(const RasterTile::Key &key);
QVector<PathInstruction> pathInstructions(QVector<RenderPath> &renderPaths); QVector<PathInstruction> pathInstructions(QVector<PainterPath> &paths);
QPointF ll2xy(const Coordinates &c) const QPointF ll2xy(const Coordinates &c) const
{return _transform.proj2img(_proj.ll2xy(c));} {return _transform.proj2img(_proj.ll2xy(c));}
void processPointLabels(QList<TextItem*> &textItems); void processPointLabels(QList<TextItem*> &textItems);
void processAreaLabels(QList<TextItem*> &textItems, void processAreaLabels(QList<TextItem*> &textItems,
QVector<RenderPath> &renderPaths); QVector<PainterPath> &paths);
void processLineLabels(QList<TextItem*> &textItems, void processLineLabels(QList<TextItem*> &textItems,
QVector<RenderPath> &renderPaths); QVector<PainterPath> &paths);
QPainterPath painterPath(const Polygon &polygon, bool curve) const; QPainterPath painterPath(const Polygon &polygon, bool curve) const;
void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems); void drawTextItems(QPainter *painter, const QList<TextItem*> &textItems);
void drawPaths(QPainter *painter, QVector<RenderPath> &renderPaths); void drawPaths(QPainter *painter, QVector<PainterPath> &paths);
Projection _proj; Projection _proj;
Transform _transform; Transform _transform;
@ -109,7 +136,7 @@ private:
QRect _rect; QRect _rect;
qreal _ratio; qreal _ratio;
QPixmap _pixmap; QPixmap _pixmap;
QSet<MapData::Path> _paths; QList<MapData::Path> _paths;
QList<MapData::Point> _points; QList<MapData::Point> _points;
bool _valid; bool _valid;

View File

@ -238,6 +238,13 @@ void Style::text(QXmlStreamReader &reader, const Rule &rule,
else if (transform == "capitalize") else if (transform == "capitalize")
capitalization = QFont::Capitalize; capitalization = QFont::Capitalize;
} }
if (attr.hasAttribute("priority")) {
ri._priority = attr.value("priority").toInt(&ok);
if (!ok) {
reader.raiseError("invalid priority value");
return;
}
}
ri._font.setFamily(fontFamily); ri._font.setFamily(fontFamily);
ri._font.setPixelSize(fontSize); ri._font.setPixelSize(fontSize);
@ -277,6 +284,13 @@ void Style::symbol(QXmlStreamReader &reader, const QString &dir, qreal ratio,
return; return;
} }
} }
if (attr.hasAttribute("priority")) {
ri._priority = attr.value("priority").toInt(&ok);
if (!ok) {
reader.raiseError("invalid priority value");
return;
}
}
if (!file.isNull()) if (!file.isNull())
ri._img = image(file, width, height, ratio); ri._img = image(file, width, height, ratio);

View File

@ -188,18 +188,20 @@ public:
{ {
public: public:
TextRender(const Rule &rule) TextRender(const Rule &rule)
: Render(rule), _fillColor(Qt::black), _strokeColor(Qt::black), : Render(rule), _priority(0), _fillColor(Qt::black),
_strokeWidth(0) {} _strokeColor(Qt::black), _strokeWidth(0) {}
const QFont &font() const {return _font;} const QFont &font() const {return _font;}
const QColor &fillColor() const {return _fillColor;} const QColor &fillColor() const {return _fillColor;}
const QColor &strokeColor() const {return _strokeColor;} const QColor &strokeColor() const {return _strokeColor;}
qreal strokeWidth() const {return _strokeWidth;} qreal strokeWidth() const {return _strokeWidth;}
const QByteArray &key() const {return _key;} const QByteArray &key() const {return _key;}
int priority() const {return _priority;}
private: private:
friend class Style; friend class Style;
int _priority;
QColor _fillColor, _strokeColor; QColor _fillColor, _strokeColor;
qreal _strokeWidth; qreal _strokeWidth;
QFont _font; QFont _font;
@ -209,13 +211,15 @@ public:
class Symbol : public Render class Symbol : public Render
{ {
public: public:
Symbol(const Rule &rule) : Render(rule) {} Symbol(const Rule &rule) : Render(rule), _priority(0) {}
const QImage &img() const {return _img;} const QImage &img() const {return _img;}
int priority() const {return _priority;}
private: private:
friend class Style; friend class Style;
int _priority;
QImage _img; QImage _img;
}; };

View File

@ -175,7 +175,7 @@ void MapsforgeMap::draw(QPainter *painter, const QRectF &rect, Flags flags)
if (QPixmapCache::find(key(_zoom, ttl), &pm)) if (QPixmapCache::find(key(_zoom, ttl), &pm))
painter->drawPixmap(ttl, pm); painter->drawPixmap(ttl, pm);
else { else {
QSet<MapData::Path> paths; QList<MapData::Path> paths;
QList<MapData::Point> points; QList<MapData::Point> points;
/* Add a "sub-pixel" margin to assure the tile areas do not /* Add a "sub-pixel" margin to assure the tile areas do not