mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-26 08:44: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
|
## 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 or raster XYZ online maps to also display PBF
|
displaying raster MBTiles maps or raster XYZ online maps to also display
|
||||||
vector tiles without (almost, see usage) any application modifications.
|
PBF(MVT) vector tiles without (almost, see usage) any application modifications.
|
||||||
|
|
||||||
Standard Mapbox GL Styles are used for styling the maps. Most relevant style
|
Standard Mapbox GL Styles are used for styling the maps. Most relevant style
|
||||||
features used by [Maputnik](http://editor.openmaptiles.org) are supported.
|
features used by [Maputnik](http://editor.openmaptiles.org) are supported.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"Keys": [ "pbf" ],
|
"Keys": [ "mvt" ],
|
||||||
"MimeTypes": [ "image/pbf" ]
|
"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;
|
QColor ret;
|
||||||
|
|
||||||
if (str.startsWith('#'))
|
if (str.startsWith("rgb(")) {
|
||||||
return QColor(str);
|
|
||||||
else if (str.startsWith("rgb(")) {
|
|
||||||
QStringList comp(str.mid(4, str.size() - 5).split(','));
|
QStringList comp(str.mid(4, str.size() - 5).split(','));
|
||||||
if (comp.size() != 3)
|
if (comp.size() != 3)
|
||||||
return QColor();
|
return QColor();
|
||||||
@ -39,7 +37,8 @@ QColor Color::fromJsonString(const QString &str)
|
|||||||
return QColor();
|
return QColor();
|
||||||
ret = QColor::fromHslF(comp.at(0).toFloat() / 360.0, pval(comp.at(1)),
|
ret = QColor::fromHslF(comp.at(0).toFloat() / 360.0, pval(comp.at(1)),
|
||||||
pval(comp.at(2)), comp.at(3).toFloat());
|
pval(comp.at(2)), comp.at(3).toFloat());
|
||||||
}
|
} else
|
||||||
|
ret = QColor(str);
|
||||||
|
|
||||||
if (!ret.isValid())
|
if (!ret.isValid())
|
||||||
qWarning() << str << ": invalid color";
|
qWarning() << str << ": invalid color";
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
#include "pbf.h"
|
#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 MOVE_TO 1
|
||||||
#define LINE_TO 2
|
#define LINE_TO 2
|
||||||
#define CLOSE_PATH 7
|
#define CLOSE_PATH 7
|
||||||
|
@ -21,7 +21,7 @@ QImageIOPlugin::Capabilities PBFPlugin::capabilities(QIODevice *device,
|
|||||||
const QByteArray &format) const
|
const QByteArray &format) const
|
||||||
{
|
{
|
||||||
if (device == 0)
|
if (device == 0)
|
||||||
return (format == "pbf") ? Capabilities(CanRead) : Capabilities();
|
return (format == "mvt") ? Capabilities(CanRead) : Capabilities();
|
||||||
else
|
else
|
||||||
return (device->isReadable() && PBFHandler::canRead(device))
|
return (device->isReadable() && PBFHandler::canRead(device))
|
||||||
? Capabilities(CanRead) : Capabilities();
|
? Capabilities(CanRead) : Capabilities();
|
||||||
|
Reference in New Issue
Block a user