Added scaling info & OS X build info

This commit is contained in:
Martin Tůma 2018-11-17 22:09:32 +01:00 committed by GitHub
parent 1f9e044493
commit 9388313fff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,15 +3,15 @@ Qt image plugin for displaying Mapbox vector tiles
## Description ## Description
QtPBFImagePlugin is a Qt image plugin that enables applications capable of QtPBFImagePlugin is a Qt image plugin that enables applications capable of
displaying raster MBTiles maps to also display PBF vector tiles without displaying raster MBTiles maps or raster XYZ online maps to also display PBF
(almost, see usage) any application modifications. vector tiles without (almost, see usage) any application modifications.
Standard Mapbox GL Styles are used for styling the maps. Most style features Standard Mapbox GL Styles are used for styling the maps. Most relevant style
used by [Maputnik](http://editor.openmaptiles.org) are supported. The style features used by [Maputnik](http://editor.openmaptiles.org) are supported.
is loaded from the The style is loaded from the
[$AppDataLocation](http://doc.qt.io/qt-5/qstandardpaths.html)/style/style.json [$AppDataLocation](http://doc.qt.io/qt-5/qstandardpaths.html)/style/style.json
file on plugin load. A default fallback style (OSM-Liberty) for file on plugin load. A default fallback style (OSM-Liberty) for OpenMapTiles
OpenMapTiles is part of the plugin. is part of the plugin.
## Usage ## Usage
Due to a major design flaw in the Mapbox vector tiles specification - the zoom Due to a major design flaw in the Mapbox vector tiles specification - the zoom
@ -24,6 +24,14 @@ to the functions:
QPixmap pm; QPixmap pm;
pm.loadFromData(tileData, QString::number(zoom).toLatin1()); pm.loadFromData(tileData, QString::number(zoom).toLatin1());
``` ```
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());
reader.setScaledSize(QSize(512, 512));
reader.read(&image);
```
you will get 512x512px tiles with a pixel ratio of 2 (= HiDPI tiles).
## Build ## Build
### Requirements ### Requirements
@ -42,6 +50,11 @@ make
qmake PROTOBUF=path/to/protobuf ZLIB=path/to/zlib pbfplugin.pro qmake PROTOBUF=path/to/protobuf ZLIB=path/to/zlib pbfplugin.pro
nmake nmake
``` ```
#### OS X
```shell
qmake PROTOBUF=path/to/protobuf pbfplugin.pro
make
```
## Install ## Install
Copy the plugin to the system Qt image plugins path to make it work. You may Copy the plugin to the system Qt image plugins path to make it work. You may