mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-21 22:34:25 +02:00
Compare commits
3 Commits
2.5
...
38b6e2320b
Author | SHA1 | Date | |
---|---|---|---|
38b6e2320b | |||
b36fb5fa92 | |||
a7b7d16f4f |
@ -1,4 +1,4 @@
|
||||
version: 2.5.{build}
|
||||
version: 2.6.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
@ -23,12 +23,12 @@ QPixmap::loadFromData() functions. The zoom number is passed as ASCII string
|
||||
to the functions:
|
||||
```cpp
|
||||
QPixmap pm;
|
||||
pm.loadFromData(tileData, QString::number(zoom).toLatin1());
|
||||
pm.loadFromData(tileData, QByteArray::number(zoom));
|
||||
```
|
||||
The plugin supports vector scaling using QImageReader's setScaledSize() method,
|
||||
so when used like in the following example:
|
||||
```cpp
|
||||
QImageReader reader(file, QString::number(zoom).toLatin1());
|
||||
QImageReader reader(file, QByteArray::number(zoom));
|
||||
reader.setScaledSize(QSize(1024, 1024));
|
||||
reader.read(&image);
|
||||
```
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user