mirror of
https://github.com/tumic0/QtPBFImagePlugin.git
synced 2025-07-18 04:44:24 +02:00
Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
73f2b246ea | |||
5fad81c3a6 | |||
eaa5a1e14e | |||
7f357e7559 | |||
b1519e95d5 | |||
b53d8f3df7 | |||
da62d0ba63 | |||
baff6ac17d | |||
56e83ea6d9 | |||
c9f7531f17 | |||
dc1655a2d7 | |||
cb4919d5bd | |||
affb818f4e | |||
851ed76e26 |
@ -1,4 +1,4 @@
|
|||||||
version: 4.0.{build}
|
version: 4.3.{build}
|
||||||
|
|
||||||
configuration:
|
configuration:
|
||||||
- Release
|
- Release
|
||||||
@ -9,8 +9,10 @@ image:
|
|||||||
environment:
|
environment:
|
||||||
VCPKGDIR: C:\tools\vcpkg\installed\x64-windows-static-md-release
|
VCPKGDIR: C:\tools\vcpkg\installed\x64-windows-static-md-release
|
||||||
matrix:
|
matrix:
|
||||||
- QTDIR: C:\Qt\5.15\msvc2019_64
|
- job_name: Qt5
|
||||||
- QTDIR: C:\Qt\6.8\msvc2022_64
|
QTDIR: C:\Qt\5.15\msvc2019_64
|
||||||
|
- job_name: Qt6
|
||||||
|
QTDIR: C:\Qt\6.8\msvc2022_64
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- cmd: |-
|
- cmd: |-
|
||||||
@ -26,6 +28,7 @@ build_script:
|
|||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: release\pbf4.dll
|
- path: release\pbf4.dll
|
||||||
|
name: pbf4.dll
|
||||||
|
|
||||||
cache:
|
cache:
|
||||||
- C:\tools\vcpkg\installed\
|
- C:\tools\vcpkg\installed\
|
||||||
|
2
.github/workflows/android.yml
vendored
2
.github/workflows/android.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
- name: Configure build
|
- name: Configure build
|
||||||
run: qmake pbfplugin.pro
|
run: qmake pbfplugin.pro
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: make -j2
|
run: make -j4
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
|
9
.github/workflows/linux.yml
vendored
9
.github/workflows/linux.yml
vendored
@ -8,7 +8,10 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: QtPBFImagePlugin
|
name: QtPBFImagePlugin
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-22.04
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
config: ['release', 'debug']
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -17,6 +20,6 @@ jobs:
|
|||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install qtbase5-dev qtbase5-dev-tools qt5-qmake zlib1g-dev
|
sudo apt-get install qtbase5-dev qtbase5-dev-tools qt5-qmake zlib1g-dev
|
||||||
- name: Configure build
|
- name: Configure build
|
||||||
run: qmake pbfplugin.pro
|
run: qmake CONFIG+=${{ matrix.config }} pbfplugin.pro
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: make -j2
|
run: make -j4
|
||||||
|
2
.github/workflows/osx.yml
vendored
2
.github/workflows/osx.yml
vendored
@ -15,7 +15,7 @@ jobs:
|
|||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v4
|
uses: jurplel/install-qt-action@v4
|
||||||
with:
|
with:
|
||||||
version: '6.8.1'
|
version: '6.9.1'
|
||||||
- name: Configure build
|
- name: Configure build
|
||||||
run: qmake pbfplugin.pro QMAKE_APPLE_DEVICE_ARCHS="x86_64h arm64"
|
run: qmake pbfplugin.pro QMAKE_APPLE_DEVICE_ARCHS="x86_64h arm64"
|
||||||
- name: Build project
|
- name: Build project
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -7,7 +7,3 @@ moc_*.cpp
|
|||||||
moc_*.h
|
moc_*.h
|
||||||
qrc_*.cpp
|
qrc_*.cpp
|
||||||
Makefile*
|
Makefile*
|
||||||
|
|
||||||
# lib
|
|
||||||
libpbf.so
|
|
||||||
libpbf.dylib
|
|
||||||
|
@ -67,7 +67,7 @@ repository.
|
|||||||
|
|
||||||
## Build
|
## Build
|
||||||
### Requirements
|
### Requirements
|
||||||
* Qt5 >= 5.11 or Qt6
|
* Qt5 >= 5.15 or Qt6
|
||||||
* Zlib
|
* Zlib
|
||||||
|
|
||||||
### Build steps
|
### Build steps
|
||||||
|
@ -2,7 +2,7 @@ TARGET = pbf
|
|||||||
TEMPLATE = lib
|
TEMPLATE = lib
|
||||||
CONFIG += plugin
|
CONFIG += plugin
|
||||||
QT += gui
|
QT += gui
|
||||||
VERSION = 4.0
|
VERSION = 4.3
|
||||||
|
|
||||||
HEADERS += src/pbfhandler.h \
|
HEADERS += src/pbfhandler.h \
|
||||||
src/data.h \
|
src/data.h \
|
||||||
@ -37,7 +37,7 @@ RESOURCES += pbfplugin.qrc
|
|||||||
|
|
||||||
DEFINES += QT_NO_DEPRECATED_WARNINGS
|
DEFINES += QT_NO_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
unix:!macx:!android {
|
unix:!android {
|
||||||
LIBS += -lz
|
LIBS += -lz
|
||||||
|
|
||||||
target.path += $$[QT_INSTALL_PLUGINS]/imageformats
|
target.path += $$[QT_INSTALL_PLUGINS]/imageformats
|
||||||
@ -51,9 +51,6 @@ win32 {
|
|||||||
QMAKE_TARGET_DESCRIPTION = Qt $$QT_VERSION MVT/PBF image plugin
|
QMAKE_TARGET_DESCRIPTION = Qt $$QT_VERSION MVT/PBF image plugin
|
||||||
QMAKE_TARGET_COPYRIGHT = Copyright (c) 2018-2025 Martin Tuma
|
QMAKE_TARGET_COPYRIGHT = Copyright (c) 2018-2025 Martin Tuma
|
||||||
}
|
}
|
||||||
macx {
|
|
||||||
LIBS += -lz
|
|
||||||
}
|
|
||||||
android {
|
android {
|
||||||
LIBS += -lz
|
LIBS += -lz
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
struct CTX
|
struct CTX
|
||||||
{
|
{
|
||||||
CTX(const QByteArray &ba)
|
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 *bp;
|
||||||
const char *be;
|
const char *be;
|
||||||
@ -60,7 +60,14 @@ static bool str(CTX &ctx, QByteArray &val)
|
|||||||
if (ctx.bp + len > ctx.be)
|
if (ctx.bp + len > ctx.be)
|
||||||
return false;
|
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);
|
val = QByteArray::fromRawData(ctx.bp, len);
|
||||||
|
#endif
|
||||||
ctx.bp += len;
|
ctx.bp += len;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include <QJsonValue>
|
||||||
|
|
||||||
class QJsonObject;
|
class QJsonObject;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ static QImage sdf2img(const QImage &sdf, const QColor &color)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Sprites::Sprite::Sprite(const QJsonObject &json)
|
Sprites::Sprite::Sprite(const QJsonObject &json)
|
||||||
|
: _pixelRatio(1.0), _sdf(false)
|
||||||
{
|
{
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
|
|
||||||
@ -44,16 +45,10 @@ Sprites::Sprite::Sprite(const QJsonObject &json)
|
|||||||
|
|
||||||
_rect = QRect(x, y, width, height);
|
_rect = QRect(x, y, width, height);
|
||||||
|
|
||||||
|
|
||||||
if (json.contains("pixelRatio") && json["pixelRatio"].isDouble())
|
if (json.contains("pixelRatio") && json["pixelRatio"].isDouble())
|
||||||
_pixelRatio = json["pixelRatio"].toDouble();
|
_pixelRatio = json["pixelRatio"].toDouble();
|
||||||
else
|
|
||||||
_pixelRatio = 1.0;
|
|
||||||
|
|
||||||
if (json.contains("sdf") && json["sdf"].isBool())
|
if (json.contains("sdf") && json["sdf"].isBool())
|
||||||
_sdf = json["sdf"].toBool();
|
_sdf = json["sdf"].toBool();
|
||||||
else
|
|
||||||
_sdf = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sprites::load(const QString &jsonFile, const QString &imageFile)
|
bool Sprites::load(const QString &jsonFile, const QString &imageFile)
|
||||||
|
@ -2,13 +2,6 @@
|
|||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
#include "textpathitem.h"
|
#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)
|
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;
|
QPointF *p = p1;
|
||||||
|
|
||||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.topRight()), p)
|
if (line.intersects(QLineF(rect.topLeft(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
p = p2;
|
p = p2;
|
||||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection) {
|
== QLineF::BoundedIntersection) {
|
||||||
if (p == p2) {
|
if (p == p2) {
|
||||||
swap(line, p1, p2);
|
swap(line, p1, p2);
|
||||||
@ -41,7 +34,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
|||||||
}
|
}
|
||||||
p = p2;
|
p = p2;
|
||||||
}
|
}
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection) {
|
== QLineF::BoundedIntersection) {
|
||||||
if (p == p2) {
|
if (p == p2) {
|
||||||
swap(line, p1, p2);
|
swap(line, p1, p2);
|
||||||
@ -49,7 +42,7 @@ static bool intersection(const QLineF &line, const QRectF &rect, QPointF *p1,
|
|||||||
}
|
}
|
||||||
p = p2;
|
p = p2;
|
||||||
}
|
}
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection) {
|
== QLineF::BoundedIntersection) {
|
||||||
if (p == p2) {
|
if (p == p2) {
|
||||||
swap(line, p1, 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)
|
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)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.INTERSECTS(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.topLeft(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.bottomLeft()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
if (line.INTERSECTS(QLineF(rect.bottomRight(), rect.topRight()), p)
|
if (line.intersects(QLineF(rect.bottomRight(), rect.topRight()), p)
|
||||||
== QLineF::BoundedIntersection)
|
== QLineF::BoundedIntersection)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -3610,6 +3610,18 @@
|
|||||||
"<=",
|
"<=",
|
||||||
"ref_length",
|
"ref_length",
|
||||||
6
|
6
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"!=",
|
||||||
|
"subclass",
|
||||||
|
"junction"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"in",
|
||||||
|
"class",
|
||||||
|
"motorway",
|
||||||
|
"primary",
|
||||||
|
"secondary"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"layout": {
|
"layout": {
|
||||||
|
Reference in New Issue
Block a user