mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-21 22:34:25 +02:00
Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
5ccb93bd59 | |||
c3df78a455 | |||
f96b530fa3 | |||
9fdfd35752 | |||
20f2e7c7d2 |
@ -3,8 +3,8 @@ Qt image plugin for displaying Mapbox vector tiles
|
||||
|
||||
## Description
|
||||
QtPBFImagePlugin is a Qt image plugin that enables applications capable of
|
||||
displaying raster MBTiles maps or raster XYZ online 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(MVT) vector tiles without (almost, see usage) any application modifications.
|
||||
|
||||
Standard Mapbox GL Styles are used for styling the maps. Most relevant style
|
||||
features used by [Maputnik](http://editor.openmaptiles.org) are supported.
|
||||
|
@ -1,4 +1,4 @@
|
||||
{
|
||||
"Keys": [ "pbf" ],
|
||||
"MimeTypes": [ "image/pbf" ]
|
||||
"Keys": [ "mvt" ],
|
||||
"MimeTypes": [ "application/vnd.mapbox-vector-tile" ]
|
||||
}
|
||||
|
9
pkg/pbfplugin.xml
Normal file
9
pkg/pbfplugin.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
|
||||
<mime-type type="application/vnd.mapbox-vector-tile">
|
||||
<comment>Mapbox Vector Tile</comment>
|
||||
<sub-class-of type="application/octet-stream"/>
|
||||
<generic-icon name="application/octet-stream"/>
|
||||
<glob pattern="*.mvt"/>
|
||||
</mime-type>
|
||||
</mime-info>
|
@ -13,9 +13,7 @@ QColor Color::fromJsonString(const QString &str)
|
||||
{
|
||||
QColor ret;
|
||||
|
||||
if (str.startsWith('#'))
|
||||
return QColor(str);
|
||||
else if (str.startsWith("rgb(")) {
|
||||
if (str.startsWith("rgb(")) {
|
||||
QStringList comp(str.mid(4, str.size() - 5).split(','));
|
||||
if (comp.size() != 3)
|
||||
return QColor();
|
||||
@ -39,7 +37,8 @@ QColor Color::fromJsonString(const QString &str)
|
||||
return QColor();
|
||||
ret = QColor::fromHslF(comp.at(0).toFloat() / 360.0, pval(comp.at(1)),
|
||||
pval(comp.at(2)), comp.at(3).toFloat());
|
||||
}
|
||||
} else
|
||||
ret = QColor(str);
|
||||
|
||||
if (!ret.isValid())
|
||||
qWarning() << str << ": invalid color";
|
||||
|
@ -1,9 +1,5 @@
|
||||
#include "pbf.h"
|
||||
|
||||
#define POLYGON vector_tile::Tile_GeomType_POLYGON
|
||||
#define LINESTRING vector_tile::Tile_GeomType_LINESTRING
|
||||
#define POINT vector_tile::Tile_GeomType_POINT
|
||||
|
||||
#define MOVE_TO 1
|
||||
#define LINE_TO 2
|
||||
#define CLOSE_PATH 7
|
||||
|
@ -21,7 +21,7 @@ QImageIOPlugin::Capabilities PBFPlugin::capabilities(QIODevice *device,
|
||||
const QByteArray &format) const
|
||||
{
|
||||
if (device == 0)
|
||||
return (format == "pbf") ? Capabilities(CanRead) : Capabilities();
|
||||
return (format == "mvt") ? Capabilities(CanRead) : Capabilities();
|
||||
else
|
||||
return (device->isReadable() && PBFHandler::canRead(device))
|
||||
? Capabilities(CanRead) : Capabilities();
|
||||
|
Reference in New Issue
Block a user