mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-27 21:24:48 +01:00
Optimization
This commit is contained in:
parent
a4089f9a29
commit
d9d2042b03
@ -401,6 +401,9 @@ void Style::Layer::drawPath(int zoom, const QPainterPath &path,
|
|||||||
void Style::Layer::drawSymbol(int zoom, const QPainterPath &path,
|
void Style::Layer::drawSymbol(int zoom, const QPainterPath &path,
|
||||||
const QVariantMap &tags, Tile &tile) const
|
const QVariantMap &tags, Tile &tile) const
|
||||||
{
|
{
|
||||||
|
if (_layout.keys().isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QString text(_layout.field());
|
QString text(_layout.field());
|
||||||
for (int i = 0; i < _layout.keys().size(); i++) {
|
for (int i = 0; i < _layout.keys().size(); i++) {
|
||||||
const QString &key = _layout.keys().at(i);
|
const QString &key = _layout.keys().at(i);
|
||||||
@ -409,14 +412,18 @@ void Style::Layer::drawSymbol(int zoom, const QPainterPath &path,
|
|||||||
? val.toString().toUpper() : val.toString());
|
? val.toString().toUpper() : val.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString tt(text.trimmed());
|
||||||
|
if (tt.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
QPen pen(_paint.pen(_type, zoom));
|
QPen pen(_paint.pen(_type, zoom));
|
||||||
QFont font(_layout.font(zoom));
|
QFont font(_layout.font(zoom));
|
||||||
|
|
||||||
if (path.elementCount() == 1 && path.elementAt(0).isMoveTo())
|
if (path.elementCount() == 1 && path.elementAt(0).isMoveTo())
|
||||||
tile.text().addLabel(text.trimmed(), path.elementAt(0), font, pen,
|
tile.text().addLabel(tt, path.elementAt(0), font, pen,
|
||||||
_layout.maxTextWidth(zoom));
|
_layout.maxTextWidth(zoom));
|
||||||
else
|
else
|
||||||
tile.text().addLabel(text.trimmed(), path, font, pen,
|
tile.text().addLabel(tt, path, font, pen,
|
||||||
_layout.maxTextAngle(zoom), _layout.symbolSpacing(zoom));
|
_layout.maxTextAngle(zoom), _layout.symbolSpacing(zoom));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user