mirror of
https://github.com/tumic0/GPXSee.git
synced 2024-11-30 22:51:16 +01:00
Fixed maximal lines angle check
This commit is contained in:
parent
e1e0392917
commit
f24e70dc91
@ -235,6 +235,12 @@ static bool reverse(const QPainterPath &path)
|
|||||||
return (angle > 90 && angle < 270) ? true : false;
|
return (angle > 90 && angle < 270) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static qreal diff(qreal a1, qreal a2)
|
||||||
|
{
|
||||||
|
qreal d = qAbs(a1 - a2);
|
||||||
|
return (d > 180) ? 360 - d : d;
|
||||||
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
static QPainterPath textPath(const T &path, qreal textWidth, qreal charWidth,
|
static QPainterPath textPath(const T &path, qreal textWidth, qreal charWidth,
|
||||||
const QRectF &tileRect)
|
const QRectF &tileRect)
|
||||||
@ -254,11 +260,16 @@ static QPainterPath textPath(const T &path, qreal textWidth, qreal charWidth,
|
|||||||
qreal sl = l.length();
|
qreal sl = l.length();
|
||||||
qreal a = l.angle();
|
qreal a = l.angle();
|
||||||
|
|
||||||
if ((sl < charWidth) || (j > 1 && qAbs(angle - a) > MAX_ANGLE)) {
|
if (sl < charWidth) {
|
||||||
if (length > textWidth)
|
if (length > textWidth)
|
||||||
return subpath(pl, last, j - 1, length - textWidth);
|
return subpath(pl, last, j - 1, length - textWidth);
|
||||||
last = j;
|
last = j;
|
||||||
length = 0;
|
length = 0;
|
||||||
|
} else if (j > 1 && diff(angle, a) > MAX_ANGLE) {
|
||||||
|
if (length > textWidth)
|
||||||
|
return subpath(pl, last, j - 1, length - textWidth);
|
||||||
|
last = j - 1;
|
||||||
|
length = sl;
|
||||||
} else
|
} else
|
||||||
length += sl;
|
length += sl;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user