From 28c0273f0f81bbcb915bbc26048cca2b66017421 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Fri, 22 Jun 2018 19:16:08 +0300 Subject: [PATCH] formatting fixes with make format --- debug/debug.cpp | 4 ++-- include/mapbox/geojsonvt.hpp | 18 +++++++++--------- include/mapbox/geojsonvt/convert.hpp | 3 +-- include/mapbox/geojsonvt/tile.hpp | 15 +++++++++++---- test/test.cpp | 11 ++++------- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/debug/debug.cpp b/debug/debug.cpp index e8a26c4..ff713f0 100644 --- a/debug/debug.cpp +++ b/debug/debug.cpp @@ -1,9 +1,9 @@ -#include -#include #include "../bench/util.hpp" +#include #include #include #include +#include using namespace mapbox::geojsonvt; diff --git a/include/mapbox/geojsonvt.hpp b/include/mapbox/geojsonvt.hpp index 9a0952b..af5bbc3 100644 --- a/include/mapbox/geojsonvt.hpp +++ b/include/mapbox/geojsonvt.hpp @@ -60,12 +60,12 @@ inline uint64_t toID(uint8_t z, uint32_t x, uint32_t y) { } inline const Tile geoJSONToTile(const geojson& geojson_, - uint8_t z, - uint32_t x, - uint32_t y, - const TileOptions& options = TileOptions(), - bool wrap = false, - bool clip = false) { + uint8_t z, + uint32_t x, + uint32_t y, + const TileOptions& options = TileOptions(), + bool wrap = false, + bool clip = false) { const auto features_ = geojson::visit(geojson_, ToFeatureCollection{}); auto z2 = 1u << z; @@ -80,8 +80,7 @@ inline const Tile geoJSONToTile(const geojson& geojson_, const auto left = detail::clip<0>(features, (x - p) / z2, (x + 1 + p) / z2, -1, 2); features = detail::clip<1>(left, (y - p) / z2, (y + 1 + p) / z2, -1, 2); } - return detail::InternalTile({ features, z, x, y, options.extent, tolerance }) - .tile; + return detail::InternalTile({ features, z, x, y, options.extent, tolerance }).tile; } class GeoJSONVT { @@ -186,7 +185,8 @@ class GeoJSONVT { (z == options.maxZoom ? 0 : options.tolerance / (z2 * options.extent)); it = tiles - .emplace(id, detail::InternalTile{ features, z, x, y, options.extent, tolerance }) + .emplace(id, + detail::InternalTile{ features, z, x, y, options.extent, tolerance }) .first; stats[z] = (stats.count(z) ? stats[z] + 1 : 1); total++; diff --git a/include/mapbox/geojsonvt/convert.hpp b/include/mapbox/geojsonvt/convert.hpp index ba28f44..88c036f 100644 --- a/include/mapbox/geojsonvt/convert.hpp +++ b/include/mapbox/geojsonvt/convert.hpp @@ -99,8 +99,7 @@ inline vt_features convert(const geometry::feature_collection& features, for (const auto& feature : features) { projected.emplace_back( geometry::geometry::visit(feature.geometry, project{ tolerance }), - feature.properties, - feature.id); + feature.properties, feature.id); } return projected; } diff --git a/include/mapbox/geojsonvt/tile.hpp b/include/mapbox/geojsonvt/tile.hpp index b2ed074..e382346 100644 --- a/include/mapbox/geojsonvt/tile.hpp +++ b/include/mapbox/geojsonvt/tile.hpp @@ -65,23 +65,30 @@ class InternalTile { } private: - void addFeature(const vt_point& point, const property_map& props, const optional& id) { + void + addFeature(const vt_point& point, const property_map& props, const optional& id) { tile.features.push_back({ transform(point), props, id }); } - void addFeature(const vt_line_string& line, const property_map& props, const optional& id) { + void addFeature(const vt_line_string& line, + const property_map& props, + const optional& id) { const auto new_line = transform(line); if (!new_line.empty()) tile.features.push_back({ std::move(new_line), props, id }); } - void addFeature(const vt_polygon& polygon, const property_map& props, const optional& id) { + void addFeature(const vt_polygon& polygon, + const property_map& props, + const optional& id) { const auto new_polygon = transform(polygon); if (!new_polygon.empty()) tile.features.push_back({ std::move(new_polygon), props, id }); } - void addFeature(const vt_geometry_collection& collection, const property_map& props, const optional& id) { + void addFeature(const vt_geometry_collection& collection, + const property_map& props, + const optional& id) { for (const auto& geom : collection) { vt_geometry::visit(geom, [&](const auto& g) { // `this->` is a workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61636 diff --git a/test/test.cpp b/test/test.cpp index e1b097c..3d75f9c 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -185,7 +185,7 @@ TEST(GetTile, USStates) { ASSERT_EQ(features == expected, true); const auto square = parseJSONTile(loadFile("test/fixtures/us-states-square.json")); - ASSERT_EQ(square == index.getTile(9, 148, 192).features, true); // clipped square + ASSERT_EQ(square == index.getTile(9, 148, 192).features, true); // clipped square ASSERT_EQ(empty_tile == index.getTile(11, 800, 400), true); // non-existing tile ASSERT_EQ(&empty_tile == &index.getTile(11, 800, 400), true); // non-existing tile @@ -200,7 +200,7 @@ TEST(GetTile, AntimeridianTriangle) { const auto geojson = mapbox::geojson::parse(loadFile("test/fixtures/dateline-triangle.json")); // Using default options. - GeoJSONVT index { geojson }; + GeoJSONVT index{ geojson }; struct TileCoordinate { uint8_t z; @@ -208,11 +208,8 @@ TEST(GetTile, AntimeridianTriangle) { uint32_t y; }; - std::vector tileCoordinates { - { 1, 0, 0 }, - { 1, 0, 1 }, - { 1, 1, 0 }, - { 1, 1, 1 } + std::vector tileCoordinates{ + { 1, 0, 0 }, { 1, 0, 1 }, { 1, 1, 0 }, { 1, 1, 1 } }; for (const auto tileCoordinate : tileCoordinates) {