mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-12-03 16:09:10 +01:00
Compare commits
2 Commits
8cf73b5bb5
...
b36fb5fa92
Author | SHA1 | Date | |
---|---|---|---|
b36fb5fa92 | |||
a7b7d16f4f |
@ -1,4 +1,4 @@
|
||||
version: 2.5.{build}
|
||||
version: 2.6.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user