16 Commits

Author SHA1 Message Date
73f2b246ea Properly name the jobs/artifacts 2025-07-07 17:05:28 +02:00
5fad81c3a6 Display only relevant road shields 2025-07-07 16:34:09 +02:00
eaa5a1e14e Use Qt 6.9.1 in OS X builds 2025-06-12 08:57:28 +02:00
7f357e7559 Version++ 2025-06-12 08:56:56 +02:00
b1519e95d5 Unify the Mac & Linux builds
Should also fix the Macports build
2025-05-11 11:55:54 +02:00
b53d8f3df7 Update the nuber of cores acording to the latest GitHub runners state 2025-03-21 06:30:23 +01:00
da62d0ba63 Use Qt 6.8.2 for OS X builds 2025-02-19 00:48:22 +01:00
baff6ac17d Remove all Qt5 < 5.15 workarounds.
Qt 5.15 is now the minimal required Qt version.
2025-02-19 00:44:36 +01:00
56e83ea6d9 Version++ 2025-02-19 00:44:06 +01:00
c9f7531f17 Fixed broken strings handling under Qt5 2025-02-13 23:34:36 +01:00
dc1655a2d7 Last protobuf leftovers 2025-01-25 09:05:13 +01:00
cb4919d5bd Silence clang-tidy warnings 2025-01-12 10:37:21 +01:00
affb818f4e Added missing include 2025-01-12 10:32:58 +01:00
851ed76e26 Version++ 2025-01-12 10:32:42 +01:00
08d211204e Specify the text layout requirements more precisely 2025-01-08 00:36:27 +01:00
9401f66ad7 Cosmetics 2025-01-08 00:21:57 +01:00
12 changed files with 59 additions and 49 deletions

View File

@ -1,4 +1,4 @@
version: 4.0.{build}
version: 4.3.{build}
configuration:
- Release
@ -9,8 +9,10 @@ image:
environment:
VCPKGDIR: C:\tools\vcpkg\installed\x64-windows-static-md-release
matrix:
- QTDIR: C:\Qt\5.15\msvc2019_64
- QTDIR: C:\Qt\6.8\msvc2022_64
- job_name: Qt5
QTDIR: C:\Qt\5.15\msvc2019_64
- job_name: Qt6
QTDIR: C:\Qt\6.8\msvc2022_64
install:
- cmd: |-
@ -26,6 +28,7 @@ build_script:
artifacts:
- path: release\pbf4.dll
name: pbf4.dll
cache:
- C:\tools\vcpkg\installed\

View File

@ -40,7 +40,7 @@ jobs:
- name: Configure build
run: qmake pbfplugin.pro
- name: Build project
run: make -j2
run: make -j4
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:

View File

@ -8,7 +8,10 @@ on:
jobs:
build:
name: QtPBFImagePlugin
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
strategy:
matrix:
config: ['release', 'debug']
steps:
- name: Checkout
uses: actions/checkout@v4
@ -17,6 +20,6 @@ jobs:
sudo apt-get update
sudo apt-get install qtbase5-dev qtbase5-dev-tools qt5-qmake zlib1g-dev
- name: Configure build
run: qmake pbfplugin.pro
run: qmake CONFIG+=${{ matrix.config }} pbfplugin.pro
- name: Build project
run: make -j2
run: make -j4

View File

@ -15,7 +15,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.8.1'
version: '6.9.1'
- name: Configure build
run: qmake pbfplugin.pro QMAKE_APPLE_DEVICE_ARCHS="x86_64h arm64"
- name: Build project

4
.gitignore vendored
View File

@ -7,7 +7,3 @@ moc_*.cpp
moc_*.h
qrc_*.cpp
Makefile*
# lib
libpbf.so
libpbf.dylib

View File

@ -67,7 +67,7 @@ repository.
## Build
### Requirements
* Qt5 >= 5.11 or Qt6
* Qt5 >= 5.15 or Qt6
* Zlib
### Build steps
@ -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)

View File

@ -2,7 +2,7 @@ TARGET = pbf
TEMPLATE = lib
CONFIG += plugin
QT += gui
VERSION = 4.0
VERSION = 4.3
HEADERS += src/pbfhandler.h \
src/data.h \
@ -37,7 +37,7 @@ RESOURCES += pbfplugin.qrc
DEFINES += QT_NO_DEPRECATED_WARNINGS
unix:!macx:!android {
unix:!android {
LIBS += -lz
target.path += $$[QT_INSTALL_PLUGINS]/imageformats
@ -51,9 +51,6 @@ win32 {
QMAKE_TARGET_DESCRIPTION = Qt $$QT_VERSION MVT/PBF image plugin
QMAKE_TARGET_COPYRIGHT = Copyright (c) 2018-2025 Martin Tuma
}
macx {
LIBS += -lz
}
android {
LIBS += -lz

View File

@ -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;

View File

@ -6,6 +6,7 @@
#include <QColor>
#include <QPair>
#include <QString>
#include <QJsonValue>
class QJsonObject;

View File

@ -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)

View File

@ -2,13 +2,6 @@
#include <QPainter>
#include "textpathitem.h"
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
#define INTERSECTS intersect
#else // QT 5.15
#define INTERSECTS intersects
#endif // QT 5.15
static void swap(const QLineF &line, QPointF *p1, QPointF *p2)
{
@ -30,10 +23,10 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
{
QPointF *p = p1;
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
if (line.intersects(QLineF(rect.topLeft(), rect.topRight()), p)
== QLineF::BoundedIntersection)
p = p2;
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
== QLineF::BoundedIntersection) {
if (p == p2) {
swap(line, p1, p2);
@ -41,7 +34,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
}
p = p2;
}
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
== QLineF::BoundedIntersection) {
if (p == p2) {
swap(line, p1, p2);
@ -49,7 +42,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
}
p = p2;
}
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
== QLineF::BoundedIntersection) {
if (p == p2) {
swap(line, p1, p2);
@ -64,16 +57,16 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p)
{
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
if (line.intersects(QLineF(rect.topLeft(), rect.topRight()), p)
== QLineF::BoundedIntersection)
return true;
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
== QLineF::BoundedIntersection)
return true;
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
== QLineF::BoundedIntersection)
return true;
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
== QLineF::BoundedIntersection)
return true;

View File

@ -3610,6 +3610,18 @@
"<=",
"ref_length",
6
],
[
"!=",
"subclass",
"junction"
],
[
"in",
"class",
"motorway",
"primary",
"secondary"
]
],
"layout": {