Skip to content
Snippets Groups Projects
Commit 3eb21baf authored by Teemu Ikonen's avatar Teemu Ikonen
Browse files

New upstream version 2.1.0

parent b7a0e509
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ include(GNUInstallDirs)
set(QT_MIN_VERSION "5.6.0")
find_package(Qt5 ${QT_MIN_VERSION} COMPONENTS Gui Quick Positioning Sql Svg REQUIRED)
find_package(QMapboxGL REQUIRED)
find_package(QMapLibreGL REQUIRED)
if(USE_CURL_SSL)
find_package(PkgConfig REQUIRED)
......
......@@ -16,7 +16,7 @@ use_curl_ssl {
PKGCONFIG += libcurl openssl
}
LIBS += -lqmapboxgl -lz -lcrypto -ldl
LIBS += -lqmaplibregl -lz -lcrypto -ldl
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
......
Summary: Mapbox GL Native QML plugin
Name: mapboxgl-qml
Version: 2.0.1
Version: 2.1.0
Release: 1%{?dist}
License: LGPLv3
Group: Libraries/Geosciences
......@@ -26,7 +26,7 @@ BuildRequires: qt5-qtbase-devel
%if 0%{?suse_version} >= 1500
BuildRequires: libqt5-qtbase-devel
%endif
BuildRequires: qmaplibregl-devel
BuildRequires: qmaplibregl-devel >= 0.220826.0
%description
QML plugin for Maplibre GL Native, Mapbox GL Native fork.
......
### Sets QT_INSTALL_QML to the directory where QML Plugins should be installed
function(FindQtInstallQml)
find_program(QMAKE NAMES qmake-qt5 qmake)
find_program(QMAKE NAMES qmake-qt5 qmake qmake5)
if(NOT QMAKE)
message(FATAL_ERROR "qmake not found")
endif()
......@@ -36,7 +36,7 @@ target_link_libraries(qmlmapboxglplugin PRIVATE
Qt5::Positioning
Qt5::Sql
Qt5::Svg
QMapboxGL)
QMapLibreGL)
if(USE_CURL_SSL)
add_definitions(-DUSE_CURL_SSL=1)
......
......@@ -54,7 +54,8 @@
#include <QHash>
#include <QMutex>
#include <QMapboxGL>
#include <QMapLibreGL/Map>
#include <QMapLibreGL/Settings>
#include <QGeoCoordinate>
#include <string>
......@@ -64,7 +65,7 @@
///////////////////////////////////////////////////////////////////////////////////
/// \brief The QQuickItemMapboxGL class
///
/// Interface with QMapboxGL for QML. API is documented in api.md available at
/// Interface with QMapLibreGL for QML. API is documented in api.md available at
/// https://github.com/rinigus/mapbox-gl-qml/blob/master/api.md
///
/// Note that there is a difference in the order of coordinates when using GeoJSON and
......@@ -350,8 +351,8 @@ protected:
private:
void onMapChanged(QMapboxGL::MapChange change); ///< Follow the state of the map
void onMapLoadingFailed(QMapboxGL::MapLoadingFailure type, const QString &description);
void onMapChanged(QMapLibreGL::Map::MapChange change); ///< Follow the state of the map
void onMapLoadingFailed(QMapLibreGL::Map::MapLoadingFailure type, const QString &description);
std::string resourceTransform(const std::string &url); ///< Use resource transform API to change requested URL
......@@ -378,7 +379,7 @@ private:
};
private:
QMapboxGLSettings m_settings;
QMapLibreGL::Settings m_settings;
/// Signals that the first full init is done and setup-related
/// properties cannot be changed
......@@ -406,8 +407,8 @@ private:
qreal m_pitch = 0;
QMarginsF m_margins;
QMapbox::Coordinate m_fit_sw;
QMapbox::Coordinate m_fit_ne;
QMapLibreGL::Coordinate m_fit_sw;
QMapLibreGL::Coordinate m_fit_ne;
QGeoCoordinate m_fit_center;
qreal m_fit_zoomLevel = -1;
bool m_fit_preserve_box = false;
......@@ -433,11 +434,11 @@ private:
bool m_block_data_until_loaded{true}; ///< Blocks loading of additional data until base map is loaded
bool m_finalize_data_loading{true}; ///< Used to load additional data when the base map is fully loaded
QMapboxSync::SourceList m_sources;
QMapboxSync::LayerList m_layers;
QMapboxSync::LayoutPropertyList m_layout_properties;
QMapboxSync::PaintPropertyList m_paint_properties;
QMapboxSync::ImageList m_images;
QMapLibreSync::SourceList m_sources;
QMapLibreSync::LayerList m_layers;
QMapLibreSync::LayoutPropertyList m_layout_properties;
QMapLibreSync::PaintPropertyList m_paint_properties;
QMapLibreSync::ImageList m_images;
enum SyncState {
NothingNeedsSync = 0,
......
......@@ -51,16 +51,17 @@
#include <QQuickItem>
#include <QGeoCoordinate>
#include <QMapboxGL>
#include <QMapLibreGL/Map>
#include <QMapLibreGL/Settings>
class QSGMapboxGLAbstractNode : public QObject
{
Q_OBJECT
public:
QSGMapboxGLAbstractNode(const QMapboxGLSettings &, const QSize &, qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item);
QSGMapboxGLAbstractNode(const QMapLibreGL::Settings &, const QSize &, qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item);
QMapboxGL* map() const { return m_map.data(); }
QMapLibreGL::Map* map() const { return m_map.data(); }
float height() const { return m_map_size.height(); }
float width() const { return m_map_size.width(); }
float mapToQtPixelRatio() const;
......@@ -79,7 +80,7 @@ signals:
void replyCoordinateForPixel(const QPointF p, QGeoCoordinate geo, qreal degLatPerPixel, qreal degLonPerPixel, const QVariant &tag);
protected:
QScopedPointer<QMapboxGL> m_map;
QScopedPointer<QMapLibreGL::Map> m_map;
QSize m_map_size; ///<- size as set for map
QSize m_item_size; ///<- size of Qt item in Qt logical pixels units
qreal m_pixel_ratio;
......@@ -91,10 +92,10 @@ class QSGMapboxGLTextureNode : public QSGMapboxGLAbstractNode, public QSGSimpleT
Q_OBJECT
public:
QSGMapboxGLTextureNode(const QMapboxGLSettings &, const QSize &, qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item);
QSGMapboxGLTextureNode(const QMapLibreGL::Settings &, const QSize &, qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item);
~QSGMapboxGLTextureNode();
QMapboxGL* map() const { return m_map.data(); }
QMapLibreGL::Map* map() const { return m_map.data(); }
void resize(const QSize &size, qreal pixelRatio) override;
void render(QQuickWindow *) override;
......@@ -111,9 +112,9 @@ class QSGMapboxGLRenderNode : public QSGMapboxGLAbstractNode, public QSGRenderNo
Q_OBJECT
public:
QSGMapboxGLRenderNode(const QMapboxGLSettings &, const QSize &, qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item);
QSGMapboxGLRenderNode(const QMapLibreGL::Settings &, const QSize &, qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item);
QMapboxGL* map() const;
QMapLibreGL::Map* map() const;
void resize(const QSize &size, qreal pixelRatio);
......
......@@ -4,7 +4,7 @@
#include <QDebug>
using namespace QMapboxSync;
using namespace QMapLibreSync;
/// Source
......@@ -14,7 +14,7 @@ SourceList::SourceAction::SourceAction(Type t, const QString id, const QVariantM
{
}
void SourceList::SourceAction::apply(QMapboxGL *map)
void SourceList::SourceAction::apply(QMapLibreGL::Map *map)
{
// special treatment of "data" field
if (m_asset.params.contains("data"))
......@@ -76,7 +76,7 @@ void SourceList::add_to_stack(Action::Type t, const QString &id, const QVariantM
m_action_stack.append( SourceAction(t, id, params) );
}
void SourceList::apply(QMapboxGL *map)
void SourceList::apply(QMapLibreGL::Map *map)
{
for (SourceAction &action: m_action_stack)
{
......@@ -112,7 +112,7 @@ void SourceList::apply(QMapboxGL *map)
m_action_stack.clear();
}
void SourceList::setup(QMapboxGL *map)
void SourceList::setup(QMapLibreGL::Map *map)
{
for (Asset &asset: m_assets)
{
......@@ -131,7 +131,7 @@ LayerList::LayerAction::LayerAction(Type t, const QString id, const QVariantMap
m_asset.params["id"] = id;
}
void LayerList::LayerAction::apply(QMapboxGL *map)
void LayerList::LayerAction::apply(QMapLibreGL::Map *map)
{
if (type() == Add)
{
......@@ -155,7 +155,7 @@ void LayerList::remove(const QString &id)
m_action_stack.append( LayerAction(Action::Remove, id) );
}
void LayerList::apply(QMapboxGL *map)
void LayerList::apply(QMapLibreGL::Map *map)
{
for (LayerAction &action: m_action_stack)
{
......@@ -175,7 +175,7 @@ void LayerList::apply(QMapboxGL *map)
m_action_stack.clear();
}
void LayerList::setup(QMapboxGL *map)
void LayerList::setup(QMapLibreGL::Map *map)
{
for (Asset &asset: m_assets)
{
......@@ -191,7 +191,7 @@ void PropertyList::add(const QString &layer, const QString &property, const QVar
m_action_stack.append( Property(layer, property, value) );
}
void PropertyList::apply(QMapboxGL *map)
void PropertyList::apply(QMapLibreGL::Map *map)
{
for (Property &p: m_action_stack)
{
......@@ -202,7 +202,7 @@ void PropertyList::apply(QMapboxGL *map)
m_action_stack.clear();
}
void PropertyList::setup(QMapboxGL *map)
void PropertyList::setup(QMapLibreGL::Map *map)
{
for (Property &p: m_properties)
{
......@@ -210,12 +210,12 @@ void PropertyList::setup(QMapboxGL *map)
}
}
void LayoutPropertyList::apply_property(QMapboxGL *map, Property &p)
void LayoutPropertyList::apply_property(QMapLibreGL::Map *map, Property &p)
{
map->setLayoutProperty(p.layer, p.property, p.value);
}
void PaintPropertyList::apply_property(QMapboxGL *map, Property &p)
void PaintPropertyList::apply_property(QMapLibreGL::Map *map, Property &p)
{
map->setPaintProperty(p.layer, p.property, p.value);
}
......@@ -231,7 +231,7 @@ ImageList::ImageAction::ImageAction(Type t, const QString id, const QImage im):
{
}
void ImageList::ImageAction::apply(QMapboxGL *map)
void ImageList::ImageAction::apply(QMapLibreGL::Map *map)
{
if (type() == Add)
map->addImage(m_image.id, m_image.image);
......@@ -251,7 +251,7 @@ void ImageList::remove(const QString &id)
m_action_stack.append( ImageAction(Action::Remove, id) );
}
void ImageList::apply(QMapboxGL *map)
void ImageList::apply(QMapLibreGL::Map *map)
{
for (ImageAction &action: m_action_stack)
{
......@@ -271,7 +271,7 @@ void ImageList::apply(QMapboxGL *map)
m_action_stack.clear();
}
void ImageList::setup(QMapboxGL *map)
void ImageList::setup(QMapLibreGL::Map *map)
{
for (Image &image: m_images)
{
......
#ifndef QMAPBOXSYNC_H
#define QMAPBOXSYNC_H
#include <QMapboxGL>
#include <QMapLibreGL/Map>
#include <QString>
#include <QVariantMap>
#include <QList>
#include <QImage>
namespace QMapboxSync
namespace QMapLibreSync
{
//////////////////////////////////////////////////////////////////////////
/// QMapboxSync namespace contains classes that are responsible
/// QMapLibreSync namespace contains classes that are responsible
/// for application of dynamic settings, such as manipulation with
/// additional sources, layers, paint properties. All supported
/// assets have similar approach. On addition/update/removal, the request
......@@ -34,7 +34,7 @@ namespace QMapboxSync
public:
Action(Type t): m_type(t) {}
virtual void apply(QMapboxGL *map) = 0;
virtual void apply(QMapLibreGL::Map *map) = 0;
Type type() const { return m_type; }
......@@ -68,15 +68,15 @@ namespace QMapboxSync
void update(const QString &id, const QVariantMap& params);
void remove(const QString &id);
void apply(QMapboxGL *map);
void setup(QMapboxGL *map);
void apply(QMapLibreGL::Map *map);
void setup(QMapLibreGL::Map *map);
protected:
class SourceAction: public Action {
public:
SourceAction(Type t, const QString id, const QVariantMap params = QVariantMap());
virtual void apply(QMapboxGL *map);
virtual void apply(QMapLibreGL::Map *map);
Asset& asset() { return m_asset; }
protected:
......@@ -101,15 +101,15 @@ namespace QMapboxSync
void add(const QString &id, const QVariantMap& params, const QString &before);
void remove(const QString &id);
void apply(QMapboxGL *map);
void setup(QMapboxGL *map);
void apply(QMapLibreGL::Map *map);
void setup(QMapLibreGL::Map *map);
protected:
class LayerAction: public Action {
public:
LayerAction(Type t, const QString id, const QVariantMap params = QVariantMap(), const QString before = QString());
virtual void apply(QMapboxGL *map);
virtual void apply(QMapLibreGL::Map *map);
Asset& asset() { return m_asset; }
protected:
......@@ -141,11 +141,11 @@ namespace QMapboxSync
void add(const QString &layer, const QString &property, const QVariant& value);
void apply(QMapboxGL *map);
void setup(QMapboxGL *map);
void apply(QMapLibreGL::Map *map);
void setup(QMapLibreGL::Map *map);
protected:
virtual void apply_property(QMapboxGL *map, Property &p) = 0;
virtual void apply_property(QMapLibreGL::Map *map, Property &p) = 0;
protected:
QList<Property> m_properties;
......@@ -156,14 +156,14 @@ namespace QMapboxSync
public:
LayoutPropertyList(): PropertyList() {}
protected:
virtual void apply_property(QMapboxGL *map, Property &p);
virtual void apply_property(QMapLibreGL::Map *map, Property &p);
};
class PaintPropertyList: public PropertyList {
public:
PaintPropertyList(): PropertyList() {}
protected:
virtual void apply_property(QMapboxGL *map, Property &p);
virtual void apply_property(QMapLibreGL::Map *map, Property &p);
};
///////////////////////////////////////////////////////////
......@@ -187,14 +187,14 @@ namespace QMapboxSync
void add(const QString &id, const QImage &sprite);
void remove(const QString &id);
void apply(QMapboxGL *map);
void setup(QMapboxGL *map);
void apply(QMapLibreGL::Map *map);
void setup(QMapLibreGL::Map *map);
protected:
class ImageAction: public Action {
public:
ImageAction(Type t, const QString id, const QImage image = QImage());
virtual void apply(QMapboxGL *map);
virtual void apply(QMapLibreGL::Map *map);
Image& image() { return m_image; }
protected:
......
......@@ -62,6 +62,8 @@
#include <QPainter>
#include <QVariantMap>
#include <QMapLibreGL/Utils>
#include <math.h>
#include <iostream>
......@@ -139,13 +141,13 @@ QQuickItemMapboxGL::QQuickItemMapboxGL(QQuickItem *parent):
m_styleUrl = QStringLiteral("mapbox://styles/mapbox/streets-v10");
m_styleJson = QString(); // empty
m_settings.setViewportMode(QMapboxGLSettings::DefaultViewport);
m_settings.setViewportMode(QMapLibreGL::Settings::DefaultViewport);
QFont font;
font.setStyleHint(QFont::SansSerif);
m_settings.setLocalFontFamily(font.defaultFamily());
m_settings.resetToTemplate(QMapboxGLSettings::MapboxSettings);
m_settings.resetToTemplate(QMapLibreGL::Settings::MapboxSettings);
m_settings.setResourceTransform(std::bind(&QQuickItemMapboxGL::resourceTransform,
this, std::placeholders::_1));
......@@ -964,7 +966,7 @@ void QQuickItemMapboxGL::clearCache()
QSGNode* QQuickItemMapboxGL::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
{
QSize sz(width(), height());
QMapboxGL *map = nullptr;
QMapLibreGL::Map *map = nullptr;
m_first_init_done = true;
QSGMapboxGLAbstractNode *n = nullptr;
......@@ -1030,8 +1032,8 @@ QSGNode* QQuickItemMapboxGL::updatePaintNode(QSGNode *node, UpdatePaintNodeData
/////////////////////////////////////////////////////
/// connect map changed and failure signals
connect(map, &QMapboxGL::mapChanged, this, &QQuickItemMapboxGL::onMapChanged, Qt::QueuedConnection);
connect(map, &QMapboxGL::mapLoadingFailed, this, &QQuickItemMapboxGL::onMapLoadingFailed, Qt::QueuedConnection);
connect(map, &QMapLibreGL::Map::mapChanged, this, &QQuickItemMapboxGL::onMapChanged, Qt::QueuedConnection);
connect(map, &QMapLibreGL::Map::mapLoadingFailed, this, &QQuickItemMapboxGL::onMapLoadingFailed, Qt::QueuedConnection);
}
else
map = n->map();
......@@ -1055,7 +1057,7 @@ QSGNode* QQuickItemMapboxGL::updatePaintNode(QSGNode *node, UpdatePaintNodeData
if (m_syncState & FitViewNeedsSync)
{
QMapbox::CoordinateZoom cz = map->coordinateZoomForBounds(m_fit_sw, m_fit_ne);
QMapLibreGL::CoordinateZoom cz = map->coordinateZoomForBounds(m_fit_sw, m_fit_ne);
m_fit_center = QGeoCoordinate(cz.first.first, cz.first.second);
m_fit_zoomLevel = cz.second;
setCenter(m_fit_center);
......@@ -1169,7 +1171,7 @@ QSGNode* QQuickItemMapboxGL::updatePaintNode(QSGNode *node, UpdatePaintNodeData
{ // metersPerPixel
const double tol = metersPerPixelTolerance(); // tolerance used when comparing floating point numbers
qreal mapmeters = map->metersPerPixelAtLatitude( map->coordinate().first, map->zoom() );
qreal mapmeters = QMapLibreGL::metersPerPixelAtLatitude( map->coordinate().first, map->zoom() );
qreal meters = mapmeters * n->mapToQtPixelRatio();
if ( fabs(meters - metersPerPixel()) > tol )
{
......@@ -1211,10 +1213,10 @@ QSGNode* QQuickItemMapboxGL::updatePaintNode(QSGNode *node, UpdatePaintNodeData
return node;
}
void QQuickItemMapboxGL::onMapChanged(QMapboxGL::MapChange change)
void QQuickItemMapboxGL::onMapChanged(QMapLibreGL::Map::MapChange change)
{
// check if we can add user-added sources, layers ...
if (QMapboxGL::MapChangeDidFinishLoadingStyle == change && m_block_data_until_loaded)
if (QMapLibreGL::Map::MapChangeDidFinishLoadingStyle == change && m_block_data_until_loaded)
{
m_syncState |= DataNeedsSetupSync;
m_syncState |= DataNeedsSync;
......@@ -1229,7 +1231,7 @@ void QQuickItemMapboxGL::onMapChanged(QMapboxGL::MapChange change)
}
}
void QQuickItemMapboxGL::onMapLoadingFailed(QMapboxGL::MapLoadingFailure /*type*/, const QString &description)
void QQuickItemMapboxGL::onMapLoadingFailed(QMapLibreGL::Map::MapLoadingFailure /*type*/, const QString &description)
{
setError(description);
}
......
......@@ -56,15 +56,15 @@ static const QSize minTextureSize = QSize(16, 16);
////////////////////////////////////////////
/// QSGMapboxGLAbstractNode
QSGMapboxGLAbstractNode::QSGMapboxGLAbstractNode(const QMapboxGLSettings &settings, const QSize &size,
QSGMapboxGLAbstractNode::QSGMapboxGLAbstractNode(const QMapLibreGL::Settings &settings, const QSize &size,
qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item):
QObject(), m_map_size(size), m_item_size(size),
m_device_pixel_ratio(devicePixelRatio), m_pixel_ratio(pixelRatio)
{
m_map.reset(new QMapboxGL(nullptr, settings, size.expandedTo(minTextureSize), pixelRatio));
m_map.reset(new QMapLibreGL::Map(nullptr, settings, size.expandedTo(minTextureSize), pixelRatio));
QObject::connect(m_map.data(), &QMapboxGL::needsRendering, item, &QQuickItem::update);
QObject::connect(m_map.data(), &QMapboxGL::copyrightsChanged, item, &QQuickItem::update);
QObject::connect(m_map.data(), &QMapLibreGL::Map::needsRendering, item, &QQuickItem::update);
QObject::connect(m_map.data(), &QMapLibreGL::Map::copyrightsChanged, item, &QQuickItem::update);
}
void QSGMapboxGLAbstractNode::resize(const QSize &size, qreal pixelRatio)
......@@ -99,7 +99,7 @@ void QSGMapboxGLAbstractNode::queryCoordinateForPixel(QPointF p, const QVariant
p.setX(p.x() * rx);
p.setY(p.y() * ry);
QMapbox::Coordinate mbc = m_map->coordinateForPixel(p);
QMapLibreGL::Coordinate mbc = m_map->coordinateForPixel(p);
QGeoCoordinate coor(mbc.first, mbc.second);
// get sensitivity of coordinates to the changes in pixel coordinates
......@@ -107,7 +107,7 @@ void QSGMapboxGLAbstractNode::queryCoordinateForPixel(QPointF p, const QVariant
double sinB = sin(bearing);
double cosB = cos(bearing);
p += QPointF(cosB + sinB, -sinB + cosB);
QMapbox::Coordinate mbc_shift = m_map->coordinateForPixel(p);
QMapLibreGL::Coordinate mbc_shift = m_map->coordinateForPixel(p);
qreal degLatPerPixel = fabs(mbc_shift.first - mbc.first) * rx;
qreal degLonPerPixel = fabs(mbc_shift.second - mbc.second) * ry;
......@@ -119,7 +119,7 @@ void QSGMapboxGLAbstractNode::queryCoordinateForPixel(QPointF p, const QVariant
////////////////////////////////////////////
/// QSGMapboxGLTextureNode
QSGMapboxGLTextureNode::QSGMapboxGLTextureNode(const QMapboxGLSettings &settings, const QSize &size,
QSGMapboxGLTextureNode::QSGMapboxGLTextureNode(const QMapLibreGL::Settings &settings, const QSize &size,
qreal devicePixelRatio,
qreal pixelRatio, QQuickItem *item)
: QSGMapboxGLAbstractNode(settings, size, devicePixelRatio, pixelRatio, item),
......@@ -190,7 +190,7 @@ void QSGMapboxGLTextureNode::render(QQuickWindow *window)
////////////////////////////////////////////
/// QSGMapboxGLRenderNode
QSGMapboxGLRenderNode::QSGMapboxGLRenderNode(const QMapboxGLSettings &settings, const QSize &size,
QSGMapboxGLRenderNode::QSGMapboxGLRenderNode(const QMapLibreGL::Settings &settings, const QSize &size,
qreal devicePixelRatio, qreal pixelRatio, QQuickItem *item)
: QSGMapboxGLAbstractNode(settings, size, devicePixelRatio, pixelRatio, item)
{
......@@ -208,7 +208,7 @@ void QSGMapboxGLRenderNode::resize(const QSize &size, qreal pixelRatio)
void QSGMapboxGLRenderNode::render(const RenderState *state)
{
// QMapboxGL assumes we've prepared the viewport prior to render().
// QMapLibreGL assumes we've prepared the viewport prior to render().
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
f->glViewport(state->scissorRect().x(), state->scissorRect().y(), state->scissorRect().width(), state->scissorRect().height());
f->glScissor(state->scissorRect().x(), state->scissorRect().y(), state->scissorRect().width(), state->scissorRect().height());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment