From 9388313fff45a1671053147495afd4416bbdfc10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sat, 17 Nov 2018 22:09:32 +0100 Subject: [PATCH] Added scaling info & OS X build info --- README.md | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c988464..79100e7 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,15 @@ Qt image plugin for displaying Mapbox vector tiles ## Description QtPBFImagePlugin is a Qt image plugin that enables applications capable of -displaying raster MBTiles maps to also display PBF vector tiles without -(almost, see usage) any application modifications. +displaying raster MBTiles maps or raster XYZ online maps to also display PBF +vector tiles without (almost, see usage) any application modifications. -Standard Mapbox GL Styles are used for styling the maps. Most style features -used by [Maputnik](http://editor.openmaptiles.org) are supported. The style -is loaded from the +Standard Mapbox GL Styles are used for styling the maps. Most relevant style +features used by [Maputnik](http://editor.openmaptiles.org) are supported. +The style is loaded from the [$AppDataLocation](http://doc.qt.io/qt-5/qstandardpaths.html)/style/style.json -file on plugin load. A default fallback style (OSM-Liberty) for -OpenMapTiles is part of the plugin. +file on plugin load. A default fallback style (OSM-Liberty) for OpenMapTiles +is part of the plugin. ## Usage Due to a major design flaw in the Mapbox vector tiles specification - the zoom @@ -24,6 +24,14 @@ to the functions: QPixmap pm; 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 ### Requirements @@ -42,6 +50,11 @@ make qmake PROTOBUF=path/to/protobuf ZLIB=path/to/zlib pbfplugin.pro nmake ``` +#### OS X +```shell +qmake PROTOBUF=path/to/protobuf pbfplugin.pro +make +``` ## Install Copy the plugin to the system Qt image plugins path to make it work. You may