Skip to content

Commit

Permalink
formatting fixes with make format
Browse files Browse the repository at this point in the history
  • Loading branch information
mourner committed Jun 22, 2018
1 parent c14931b commit 28c0273
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
4 changes: 2 additions & 2 deletions debug/debug.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#include <GLFW/glfw3.h>
#include <memory>
#include "../bench/util.hpp"
#include <GLFW/glfw3.h>
#include <mapbox/geojson.hpp>
#include <mapbox/geojson_impl.hpp>
#include <mapbox/geojsonvt.hpp>
#include <memory>

using namespace mapbox::geojsonvt;

Expand Down
18 changes: 9 additions & 9 deletions include/mapbox/geojsonvt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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++;
Expand Down
3 changes: 1 addition & 2 deletions include/mapbox/geojsonvt/convert.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ inline vt_features convert(const geometry::feature_collection<double>& features,
for (const auto& feature : features) {
projected.emplace_back(
geometry::geometry<double>::visit(feature.geometry, project{ tolerance }),
feature.properties,
feature.id);
feature.properties, feature.id);
}
return projected;
}
Expand Down
15 changes: 11 additions & 4 deletions include/mapbox/geojsonvt/tile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,30 @@ class InternalTile {
}

private:
void addFeature(const vt_point& point, const property_map& props, const optional<identifier>& id) {
void
addFeature(const vt_point& point, const property_map& props, const optional<identifier>& id) {
tile.features.push_back({ transform(point), props, id });
}

void addFeature(const vt_line_string& line, const property_map& props, const optional<identifier>& id) {
void addFeature(const vt_line_string& line,
const property_map& props,
const optional<identifier>& 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<identifier>& id) {
void addFeature(const vt_polygon& polygon,
const property_map& props,
const optional<identifier>& 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<identifier>& id) {
void addFeature(const vt_geometry_collection& collection,
const property_map& props,
const optional<identifier>& 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
Expand Down
11 changes: 4 additions & 7 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -200,19 +200,16 @@ 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;
uint32_t x;
uint32_t y;
};

std::vector<TileCoordinate> tileCoordinates {
{ 1, 0, 0 },
{ 1, 0, 1 },
{ 1, 1, 0 },
{ 1, 1, 1 }
std::vector<TileCoordinate> tileCoordinates{
{ 1, 0, 0 }, { 1, 0, 1 }, { 1, 1, 0 }, { 1, 1, 1 }
};

for (const auto tileCoordinate : tileCoordinates) {
Expand Down

0 comments on commit 28c0273

Please sign in to comment.