summaryrefslogtreecommitdiff
path: root/platform/glfw/glfw_view.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/glfw/glfw_view.cpp')
-rw-r--r--platform/glfw/glfw_view.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index 43c4de9759..b5fc7c0ce9 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -2,6 +2,7 @@
#include "glfw_backend.hpp"
#include "glfw_renderer_frontend.hpp"
#include "ny_route.hpp"
+#include "helsinki_dots.hpp"
#include <mbgl/annotation/annotation.hpp>
#include <mbgl/style/style.hpp>
@@ -20,6 +21,9 @@
#include <mbgl/gfx/backend.hpp>
#include <mbgl/gfx/backend_scope.hpp>
#include <mbgl/map/camera.hpp>
+#include <mbgl/style/sources/geojson_source.hpp>
+#include <mbgl/style/layers/circle_layer.hpp>
+#include <mbgl/style/layers/symbol_layer.hpp>
#include <mapbox/cheap_ruler.hpp>
#include <mapbox/geometry.hpp>
@@ -320,6 +324,28 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
}
}
} break;
+ case GLFW_KEY_F: {
+ using namespace mbgl::style;
+ GeoJSONOptions options;
+ options.cluster = true;
+ options.clusterRadius = 100;
+
+ auto source = std::make_unique<GeoJSONSource>("dots", options);
+ source->setGeoJSON(mapbox::geojson::parse(mbgl::platform::glfw::dots));
+
+ auto& style = view->map->getStyle();
+ style.addSource(std::move(source));
+
+ auto circleLayer = std::make_unique<mbgl::style::CircleLayer>("clusters", "dots");
+ circleLayer->setCircleColor(mbgl::Color{ 1.0, 0.0, 0.0, 1.0 });
+ style.addLayer(std::move(circleLayer));
+
+ auto symbolLayer = std::make_unique<mbgl::style::SymbolLayer>("test", "dots");
+ using namespace mbgl::style::expression::dsl;
+ symbolLayer->setTextField(PropertyExpression<expression::Formatted>(toFormatted(get("max"))));
+
+ style.addLayer(std::move(symbolLayer));
+ } break;
case GLFW_KEY_T:
view->toggleCustomSource();
break;