summaryrefslogtreecommitdiff
path: root/platform/qt/app
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2017-02-07 17:52:21 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2017-02-08 15:55:47 +0200
commitd3ca6c67f1b8fbf5d71c307e71ba89a483ec75bc (patch)
tree194565cdc8bf7f497eb7c157b35e73042551ea2e /platform/qt/app
parent7db79da50185a471f77ebed52575c3bc212c7d7d (diff)
downloadqtlocation-mapboxgl-d3ca6c67f1b8fbf5d71c307e71ba89a483ec75bc.tar.gz
[Qt] Added QMapbox::Feature → GeoJSON conversion helper
Diffstat (limited to 'platform/qt/app')
-rw-r--r--platform/qt/app/mapwindow.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index 050b498503..e29e62f157 100644
--- a/platform/qt/app/mapwindow.cpp
+++ b/platform/qt/app/mapwindow.cpp
@@ -258,6 +258,30 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
}
}
break;
+ case Qt::Key_5: {
+ if (m_map->layerExists("circleLayer")) {
+ m_map->removeLayer("circleLayer");
+ m_map->removeSource("circleSource");
+ } else {
+ QMapbox::CoordinatesCollections geometry { { { m_map->coordinate() } } };
+ QMapbox::Feature feature { QMapbox::Feature::PointType, geometry, {}, {} };
+
+ QVariantMap circleSource;
+ circleSource["type"] = "geojson";
+ circleSource["data"] = QVariant::fromValue<QMapbox::Feature>(feature);
+ m_map->addSource("circleSource", circleSource);
+
+ QVariantMap circle;
+ circle["id"] = "circleLayer";
+ circle["type"] = "circle";
+ circle["source"] = "circleSource";
+ m_map->addLayer(circle);
+
+ m_map->setPaintProperty("circleLayer", "circle-radius", 10.0);
+ m_map->setPaintProperty("circleLayer", "circle-color", QColor("black"));
+ }
+ }
+ break;
case Qt::Key_Tab:
m_map->cycleDebugOptions();
break;