mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-01 21:49:15 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
d8df5cb595 | |||
543bf63017 | |||
7ea19d260c | |||
0185cd904f | |||
ec6302d524 | |||
0916d6330c |
11
README.md
11
README.md
@ -16,7 +16,8 @@ placed in the same directory as the style itself. A default fallback style
|
||||
(OSM-Liberty) for OpenMapTiles is part of the plugin.
|
||||
|
||||
"Plain" PBF files as well as gzip compressed files (as used in MBTiles) are
|
||||
supported by the plugin.
|
||||
supported by the plugin. The tile size is (since version 2.0 of the plugin) 512px
|
||||
to fit the styles and available data (OpenMapTiles, Mapbox tiles).
|
||||
|
||||
## Usage
|
||||
Due to a major design flaw in the Mapbox vector tiles specification - the zoom
|
||||
@ -33,10 +34,10 @@ 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.setScaledSize(QSize(1024, 1024));
|
||||
reader.read(&image);
|
||||
```
|
||||
you will get 512x512px tiles with a pixel ratio of 2 (= HiDPI tiles).
|
||||
you will get 1024x1024px tiles with a pixel ratio of 2 (= HiDPI tiles).
|
||||
|
||||
## Build
|
||||
### Requirements
|
||||
@ -72,6 +73,10 @@ for most common distros available on OBS.
|
||||
style are ignored.
|
||||
* Text PBF features must have a unique id (OpenMapTiles >= v3.7) for the text layout
|
||||
algorithm to work properly.
|
||||
* Expressions not supported in the styles, only property functions are implemented.
|
||||
|
||||
## Changelog
|
||||
[Changelog](https://build.opensuse.org/package/view_file/home:tumic:QtPBFImagePlugin/QtPBFImagePlugin/libqt5-qtpbfimageformat.changes)
|
||||
|
||||
## Status
|
||||
A picture is worth a thousand words. Data and styles from https://openmaptiles.org.
|
||||
|
@ -40,7 +40,9 @@ static QColor interpolate(const QPair<qreal, QColor> &p0,
|
||||
qreal p1h, p1s, p1l, p1a;
|
||||
p1.second.getHslF(&p1h, &p1s, &p1l, &p1a);
|
||||
|
||||
return QColor::fromHslF(f(p0h, p1h, ratio), f(p0s, p1s, ratio),
|
||||
/* Qt returns a hue of -1 for achromatic colors. We convert it to a hue of 1
|
||||
using qAbs() to enable interpolation of grayscale colors */
|
||||
return QColor::fromHslF(f(qAbs(p0h), qAbs(p1h), ratio), f(p0s, p1s, ratio),
|
||||
f(p0l, p1l, ratio), f(p0a, p1a, ratio));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user