diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-07-07 19:16:57 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-07-11 17:01:32 +0300 |
commit | abff8e42c1c0c4725def0e3bc0cb5e5a029bff21 (patch) | |
tree | 68842a06f4db94cd6c590fdb3208a728aa197236 /platform/qt/src | |
parent | 18c88301696de16037aaa2d3b9b31fdabc813696 (diff) | |
download | qtlocation-mapboxgl-abff8e42c1c0c4725def0e3bc0cb5e5a029bff21.tar.gz |
[Qt] Added add style layer method
Diffstat (limited to 'platform/qt/src')
-rw-r--r-- | platform/qt/src/qmapboxgl.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index c793353ac6..2a1cfd6f50 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -637,7 +637,21 @@ void QMapboxGL::addCustomLayer(const QString &id, before ? mbgl::optional<std::string>(before) : mbgl::optional<std::string>()); } -void QMapboxGL::removeCustomLayer(const QString& id) +void QMapboxGL::addLayer(const QVariant& value) +{ + using namespace mbgl::style; + using namespace mbgl::style::conversion; + + Result<std::unique_ptr<Layer>> layer = convert<std::unique_ptr<Layer>>(value); + if (!layer) { + qWarning() << "Unable to add layer:" << layer.error().message; + return; + } + + d_ptr->mapObj->addLayer(std::move(*layer)); +} + +void QMapboxGL::removeLayer(const QString& id) { d_ptr->mapObj->removeLayer(id.toStdString()); } |