summaryrefslogtreecommitdiff
path: root/platform/glfw
diff options
context:
space:
mode:
authorJuha Alanen <juha.alanen@mapbox.com>2019-09-17 15:40:01 +0300
committerJuha Alanen <19551460+jmalanen@users.noreply.github.com>2019-09-18 14:29:15 +0300
commit6b13c42314f28e3b27111367c4f3296c3c3c1248 (patch)
tree2f91aae637e2c49bb55cfc336f772ac772ab5a2d /platform/glfw
parent0042f0b9f5de7151f14300f02a559b6ecb48a507 (diff)
downloadqtlocation-mapboxgl-6b13c42314f28e3b27111367c4f3296c3c3c1248.tar.gz
[build] Fix clang format and tidy checks
Diffstat (limited to 'platform/glfw')
-rw-r--r--platform/glfw/glfw_view.cpp61
-rw-r--r--platform/glfw/glfw_view.hpp4
2 files changed, 34 insertions, 31 deletions
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index 7d05bab43a..c39b2c904a 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -4,24 +4,24 @@
#include "ny_route.hpp"
#include <mbgl/annotation/annotation.hpp>
-#include <mbgl/style/style.hpp>
-#include <mbgl/style/sources/custom_geometry_source.hpp>
-#include <mbgl/style/sources/geojson_source.hpp>
+#include <mbgl/gfx/backend.hpp>
+#include <mbgl/gfx/backend_scope.hpp>
+#include <mbgl/map/camera.hpp>
+#include <mbgl/renderer/renderer.hpp>
+#include <mbgl/style/expression/dsl.hpp>
#include <mbgl/style/image.hpp>
-#include <mbgl/style/transition_options.hpp>
#include <mbgl/style/layers/fill_extrusion_layer.hpp>
-#include <mbgl/style/layers/line_layer.hpp>
#include <mbgl/style/layers/fill_layer.hpp>
-#include <mbgl/style/expression/dsl.hpp>
+#include <mbgl/style/layers/line_layer.hpp>
+#include <mbgl/style/sources/custom_geometry_source.hpp>
+#include <mbgl/style/sources/geojson_source.hpp>
+#include <mbgl/style/style.hpp>
+#include <mbgl/style/transition_options.hpp>
+#include <mbgl/util/chrono.hpp>
+#include <mbgl/util/geo.hpp>
#include <mbgl/util/logging.hpp>
#include <mbgl/util/platform.hpp>
#include <mbgl/util/string.hpp>
-#include <mbgl/util/chrono.hpp>
-#include <mbgl/util/geo.hpp>
-#include <mbgl/renderer/renderer.hpp>
-#include <mbgl/gfx/backend.hpp>
-#include <mbgl/gfx/backend_scope.hpp>
-#include <mbgl/map/camera.hpp>
#include <mapbox/cheap_ruler.hpp>
#include <mapbox/geometry.hpp>
@@ -330,7 +330,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
using namespace mbgl::style;
using namespace mbgl::style::expression::dsl;
- auto& style = view->map->getStyle();
+ auto &style = view->map->getStyle();
if (!style.getSource("states")) {
std::string url = "https://docs.mapbox.com/mapbox-gl-js/assets/us_states.geojson";
auto source = std::make_unique<GeoJSONSource>("states");
@@ -338,7 +338,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
style.addSource(std::move(source));
mbgl::CameraOptions cameraOptions;
- cameraOptions.center = mbgl::LatLng { 42.619626, -103.523181 };
+ cameraOptions.center = mbgl::LatLng{42.619626, -103.523181};
cameraOptions.zoom = 3;
cameraOptions.pitch = 0;
cameraOptions.bearing = 0;
@@ -348,23 +348,27 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
auto layer = style.getLayer("state-fills");
if (!layer) {
auto fillLayer = std::make_unique<FillLayer>("state-fills", "states");
- fillLayer->setFillColor(mbgl::Color{ 0.0, 0.0, 1.0, 0.5 });
- fillLayer->setFillOpacity(PropertyExpression<float>(createExpression(R"(["case", ["boolean", ["feature-state", "hover"], false], 1, 0.5])")));
+ fillLayer->setFillColor(mbgl::Color{0.0, 0.0, 1.0, 0.5});
+ fillLayer->setFillOpacity(PropertyExpression<float>(
+ createExpression(R"(["case", ["boolean", ["feature-state", "hover"], false], 1, 0.5])")));
style.addLayer(std::move(fillLayer));
} else {
- layer->setVisibility(layer->getVisibility() == mbgl::style::VisibilityType::Visible ?
- mbgl::style::VisibilityType::None : mbgl::style::VisibilityType::Visible);
+ layer->setVisibility(layer->getVisibility() == mbgl::style::VisibilityType::Visible
+ ? mbgl::style::VisibilityType::None
+ : mbgl::style::VisibilityType::Visible);
}
layer = style.getLayer("state-borders");
if (!layer) {
auto borderLayer = std::make_unique<LineLayer>("state-borders", "states");
- borderLayer->setLineColor(mbgl::Color{ 0.0, 0.0, 1.0, 1.0 });
- borderLayer->setLineWidth(PropertyExpression<float>(createExpression(R"(["case", ["boolean", ["feature-state", "hover"], false], 2, 1])")));
+ borderLayer->setLineColor(mbgl::Color{0.0, 0.0, 1.0, 1.0});
+ borderLayer->setLineWidth(PropertyExpression<float>(
+ createExpression(R"(["case", ["boolean", ["feature-state", "hover"], false], 2, 1])")));
style.addLayer(std::move(borderLayer));
} else {
- layer->setVisibility(layer->getVisibility() == mbgl::style::VisibilityType::Visible ?
- mbgl::style::VisibilityType::None : mbgl::style::VisibilityType::Visible);
+ layer->setVisibility(layer->getVisibility() == mbgl::style::VisibilityType::Visible
+ ? mbgl::style::VisibilityType::None
+ : mbgl::style::VisibilityType::Visible);
}
} break;
}
@@ -581,7 +585,6 @@ void GLFWView::onMouseClick(GLFWwindow *window, int button, int action, int modi
}
view->lastClick = now;
}
-
}
}
@@ -604,10 +607,10 @@ void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) {
view->lastX = x;
view->lastY = y;
- auto& style = view->map->getStyle();
+ auto &style = view->map->getStyle();
if (style.getLayer("state-fills")) {
- auto screenCoordinate = mbgl::ScreenCoordinate { view->lastX, view->lastY };
- const mbgl::RenderedQueryOptions queryOptions({{{ "state-fills" }}, {}});
+ auto screenCoordinate = mbgl::ScreenCoordinate{view->lastX, view->lastY};
+ const mbgl::RenderedQueryOptions queryOptions({{{"state-fills"}}, {}});
auto result = view->rendererFrontend->getRenderer()->queryRenderedFeatures(screenCoordinate, queryOptions);
using namespace mbgl;
FeatureState newState;
@@ -619,20 +622,20 @@ void GLFWView::onMouseMove(GLFWwindow *window, double x, double y) {
if (idStr) {
if (view->featureID && (*view->featureID != *idStr)) {
newState["hover"] = false;
- view->rendererFrontend->getRenderer()->setFeatureState("states", { }, *view->featureID, newState);
+ view->rendererFrontend->getRenderer()->setFeatureState("states", {}, *view->featureID, newState);
view->featureID = nullopt;
}
if (!view->featureID) {
newState["hover"] = true;
view->featureID = featureIDtoString(id);
- view->rendererFrontend->getRenderer()->setFeatureState("states", { }, *view->featureID, newState);
+ view->rendererFrontend->getRenderer()->setFeatureState("states", {}, *view->featureID, newState);
}
}
} else {
if (view->featureID) {
newState["hover"] = false;
- view->rendererFrontend->getRenderer()->setFeatureState("states", { }, *view->featureID, newState);
+ view->rendererFrontend->getRenderer()->setFeatureState("states", {}, *view->featureID, newState);
view->featureID = nullopt;
}
}
diff --git a/platform/glfw/glfw_view.hpp b/platform/glfw/glfw_view.hpp
index cc7c821810..dbe6ceb046 100644
--- a/platform/glfw/glfw_view.hpp
+++ b/platform/glfw/glfw_view.hpp
@@ -1,10 +1,10 @@
#pragma once
#include <mbgl/map/map.hpp>
-#include <mbgl/util/run_loop.hpp>
-#include <mbgl/util/timer.hpp>
#include <mbgl/util/geometry.hpp>
#include <mbgl/util/optional.hpp>
+#include <mbgl/util/run_loop.hpp>
+#include <mbgl/util/timer.hpp>
struct GLFWwindow;
class GLFWBackend;