mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-21 06:14:25 +02:00
Compare commits
7 Commits
0c63b66544
...
4.1
Author | SHA1 | Date | |
---|---|---|---|
c9f7531f17 | |||
dc1655a2d7 | |||
cb4919d5bd | |||
affb818f4e | |||
851ed76e26 | |||
08d211204e | |||
9401f66ad7 |
@ -1,4 +1,4 @@
|
||||
version: 4.0.{build}
|
||||
version: 4.1.{build}
|
||||
|
||||
configuration:
|
||||
- Release
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,7 +7,3 @@ moc_*.cpp
|
||||
moc_*.h
|
||||
qrc_*.cpp
|
||||
Makefile*
|
||||
|
||||
# lib
|
||||
libpbf.so
|
||||
libpbf.dylib
|
||||
|
17
README.md
17
README.md
@ -84,16 +84,19 @@ nmake
|
||||
|
||||
## Install
|
||||
Copy the plugin to the system Qt image plugins path to make it work. You may
|
||||
also set the QT_PLUGIN_PATH system variable before starting the application. For
|
||||
Linux, there are RPM and DEB [packages](https://build.opensuse.org/project/show/home:tumic:QtPBFImagePlugin)
|
||||
also set the QT_PLUGIN_PATH system variable before starting the application.
|
||||
For Linux, there are RPM and DEB [packages](https://build.opensuse.org/project/show/home:tumic:QtPBFImagePlugin)
|
||||
for most common distros available on OBS.
|
||||
|
||||
## Limitations
|
||||
* Only data that is part of the PBF file is displayed. External layers defined in the
|
||||
style are ignored.
|
||||
* Text PBF features must have a unique id (OpenMapTiles >= v3.7) for the text layout
|
||||
algorithm to work properly.
|
||||
* Expressions are not supported in the styles, only property functions are implemented.
|
||||
* Only data that is part of the PBF file is displayed. External layers defined
|
||||
in the style are ignored.
|
||||
* Text PBF features must have a unique id (OpenMapTiles >= v3.7) for the text
|
||||
layout algorithm to work properly. Additionally, the tile buffer must be large
|
||||
enough to contain all neighboring text features overlapping to the tile bounds
|
||||
(only data from the tile itself can be drawn to the resulting image).
|
||||
* Expressions are not supported in the styles, only property functions are
|
||||
implemented.
|
||||
|
||||
## Changelog
|
||||
[Changelog](https://build.opensuse.org/projects/home:tumic:QtPBFImagePlugin/packages/QtPBFImagePlugin/files/qt6-qtpbfimageformat.changes)
|
||||
|
@ -2,7 +2,7 @@ TARGET = pbf
|
||||
TEMPLATE = lib
|
||||
CONFIG += plugin
|
||||
QT += gui
|
||||
VERSION = 4.0
|
||||
VERSION = 4.1
|
||||
|
||||
HEADERS += src/pbfhandler.h \
|
||||
src/data.h \
|
||||
|
13
src/data.cpp
13
src/data.cpp
@ -11,7 +11,7 @@
|
||||
struct CTX
|
||||
{
|
||||
CTX(const QByteArray &ba)
|
||||
: bp(ba.constData()), be(bp + ba.size()) {}
|
||||
: bp(ba.constData()), be(bp + ba.size()), tag(0) {}
|
||||
|
||||
const char *bp;
|
||||
const char *be;
|
||||
@ -27,8 +27,8 @@ static inline qint64 zigzag64decode(quint64 value)
|
||||
template<typename T>
|
||||
static bool varint(CTX &ctx, T &val)
|
||||
{
|
||||
unsigned int shift = 0;
|
||||
val = 0;
|
||||
uint shift = 0;
|
||||
|
||||
while (ctx.bp < ctx.be) {
|
||||
val |= ((quint8)*ctx.bp & 0x7F) << shift;
|
||||
@ -60,7 +60,14 @@ static bool str(CTX &ctx, QByteArray &val)
|
||||
if (ctx.bp + len > ctx.be)
|
||||
return false;
|
||||
|
||||
/* In Qt5 the (later) conversion to QString is broken when the QByteArray is
|
||||
not nul terminated so we have to use the "deep copy" constructor that
|
||||
nul-terminates the byte array when it is created. */
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
val = QByteArray(ctx.bp, len);
|
||||
#else
|
||||
val = QByteArray::fromRawData(ctx.bp, len);
|
||||
#endif
|
||||
ctx.bp += len;
|
||||
|
||||
return true;
|
||||
@ -148,11 +155,11 @@ static bool skip(CTX &ctx)
|
||||
|
||||
static bool value(CTX &ctx, QVariant &val)
|
||||
{
|
||||
qint32 len;
|
||||
QByteArray ba;
|
||||
quint64 num;
|
||||
double dnum;
|
||||
float fnum;
|
||||
qint32 len;
|
||||
|
||||
if (!length(ctx, len))
|
||||
return false;
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <QColor>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QJsonValue>
|
||||
|
||||
class QJsonObject;
|
||||
|
||||
|
@ -22,6 +22,7 @@ static QImage sdf2img(const QImage &sdf, const QColor &color)
|
||||
}
|
||||
|
||||
Sprites::Sprite::Sprite(const QJsonObject &json)
|
||||
: _pixelRatio(1.0), _sdf(false)
|
||||
{
|
||||
int x, y, width, height;
|
||||
|
||||
@ -44,16 +45,10 @@ Sprites::Sprite::Sprite(const QJsonObject &json)
|
||||
|
||||
_rect = QRect(x, y, width, height);
|
||||
|
||||
|
||||
if (json.contains("pixelRatio") && json["pixelRatio"].isDouble())
|
||||
_pixelRatio = json["pixelRatio"].toDouble();
|
||||
else
|
||||
_pixelRatio = 1.0;
|
||||
|
||||
if (json.contains("sdf") && json["sdf"].isBool())
|
||||
_sdf = json["sdf"].toBool();
|
||||
else
|
||||
_sdf = false;
|
||||
}
|
||||
|
||||
bool Sprites::load(const QString &jsonFile, const QString &imageFile)
|
||||
|
Reference in New Issue
Block a user