Compare commits

...

2 Commits

Author SHA1 Message Date
b36fb5fa92 Fixed maximal lines angle check 2023-10-22 23:53:39 +02:00
a7b7d16f4f Version++ 2023-10-22 23:47:28 +02:00
3 changed files with 14 additions and 3 deletions

View File

@ -1,4 +1,4 @@
version: 2.5.{build}
version: 2.6.{build}
configuration:
- Release

View File

@ -2,7 +2,7 @@ TARGET = pbf
TEMPLATE = lib
CONFIG += plugin
QT += gui
VERSION = 2.5
VERSION = 2.6
PROTOS = protobuf/vector_tile.proto
include(protobuf/vector_tile.pri)

View File

@ -171,6 +171,12 @@ static QList<QPolygonF> polyLines(const QPainterPath &path, const QRectF &rect)
return lines;
}
static qreal diff(qreal a1, qreal a2)
{
qreal d = qAbs(a1 - a2);
return (d > 180) ? 360 - d : d;
}
static QPainterPath textPath(const QPainterPath &path, qreal textWidth,
qreal maxAngle, qreal charWidth, const QRectF &tileRect)
{
@ -189,11 +195,16 @@ static QPainterPath textPath(const QPainterPath &path, qreal textWidth,
qreal sl = l.length();
qreal a = l.angle();
if ((sl < charWidth) || (j > 1 && qAbs(angle - a) > maxAngle)) {
if (sl < charWidth) {
if (length > textWidth)
return subpath(pl, last, j - 1, length - textWidth);
last = j;
length = 0;
} else if (j > 1 && diff(angle, a) > maxAngle) {
if (length > textWidth)
return subpath(pl, last, j - 1, length - textWidth);
last = j - 1;
length = sl;
} else
length += sl;