mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2024-11-30 22:51:17 +01:00
Compare commits
8 Commits
38b6e2320b
...
c86eb7bac2
Author | SHA1 | Date | |
---|---|---|---|
c86eb7bac2 | |||
3ef6c55d20 | |||
98933deb0e | |||
6e1bc09d62 | |||
ea98da4a74 | |||
8261ee2e79 | |||
d5c315efbe | |||
39ffdaf616 |
@ -1,4 +1,4 @@
|
||||
version: 2.6.{build}
|
||||
version: 3.0.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
23
README.md
23
README.md
@ -23,19 +23,34 @@ QPixmap::loadFromData() functions. The zoom number is passed as ASCII string
|
||||
to the functions:
|
||||
```cpp
|
||||
QPixmap pm;
|
||||
pm.loadFromData(tileData, QByteArray::number(zoom));
|
||||
pm.loadFromData(data, QByteArray::number(zoom));
|
||||
```
|
||||
|
||||
For a complete code sample see the [pbf2png](https://github.com/tumic0/pbf2png)
|
||||
conversion utility.
|
||||
|
||||
### HiDPI
|
||||
The plugin supports vector scaling using QImageReader's setScaledSize() method,
|
||||
so when used like in the following example:
|
||||
```cpp
|
||||
QImage img;
|
||||
QImageReader reader(file, QByteArray::number(zoom));
|
||||
reader.setScaledSize(QSize(1024, 1024));
|
||||
reader.read(&image);
|
||||
reader.read(&img);
|
||||
```
|
||||
you will get 1024x1024px tiles with a pixel ratio of 2 (= HiDPI tiles).
|
||||
|
||||
For a sample code see the [pbf2png](https://github.com/tumic0/pbf2png)
|
||||
conversion utility.
|
||||
### Overzoom
|
||||
Since version 3 of the plugin tile overzoom is supported. If you set *format*
|
||||
to `$zoom;$overzoom`:
|
||||
```cpp
|
||||
QPixmap pm;
|
||||
QByteArray fmt(QByteArray::number(zoom) + ';' + QByteArray::number(overzoom));
|
||||
pm.loadFromData(data, fmt);
|
||||
```
|
||||
you will get (512<<overzoom)x(512<<overzoom)px tiles with a pixel ratio of 1.
|
||||
When overzoom is combined with setScaledSize(), the base size is the overzoomed
|
||||
tile size.
|
||||
|
||||
## Styles
|
||||
The map style is loaded from the
|
||||
|
@ -2,7 +2,7 @@ TARGET = pbf
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
QT += gui
|
||||
VERSION = 2.6
|
||||
VERSION = 3.0
|
||||
|
||||
PROTOS = protobuf/vector_tile.proto
|
||||
include(protobuf/vector_tile.pri)
|
||||
|
@ -79,16 +79,19 @@ bool PBFHandler::read(QImage *image)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ok;
|
||||
int zoom = format().toInt(&ok);
|
||||
QList<QByteArray> list(format().split(';'));
|
||||
int zoom = list.size() ? list.first().toInt() : 0;
|
||||
int overzoom = (list.size() > 1) ? list.at(1).toInt() : 0;
|
||||
|
||||
QSize scaledSize(_scaledSize.isValid()
|
||||
? _scaledSize : QSize(TILE_SIZE, TILE_SIZE));
|
||||
QSize size(scaledSize.width()<<overzoom,
|
||||
scaledSize.height()<<overzoom);
|
||||
QPointF scale((qreal)scaledSize.width() / TILE_SIZE,
|
||||
(qreal)scaledSize.height() / TILE_SIZE);
|
||||
|
||||
QSize size = _scaledSize.isValid()
|
||||
? _scaledSize : QSize(TILE_SIZE, TILE_SIZE);
|
||||
QPointF scale = _scaledSize.isValid()
|
||||
? QPointF((qreal)_scaledSize.width() / TILE_SIZE,
|
||||
(qreal)_scaledSize.height() / TILE_SIZE) : QPointF(1.0, 1.0);
|
||||
*image = QImage(size, QImage::Format_ARGB32_Premultiplied);
|
||||
Tile tile(image, ok ? zoom : -1, scale);
|
||||
Tile tile(image, zoom, scale);
|
||||
|
||||
_style->render(data, tile);
|
||||
|
||||
|
@ -2265,7 +2265,6 @@
|
||||
"source": "openmaptiles",
|
||||
"source-layer": "building",
|
||||
"minzoom": 13,
|
||||
"maxzoom": 14,
|
||||
"layout": {
|
||||
"visibility": "visible"
|
||||
},
|
||||
@ -4059,4 +4058,4 @@
|
||||
}
|
||||
],
|
||||
"id": "osm-liberty"
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user