diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-12-20 15:06:00 -0200 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2017-01-24 11:36:59 +0200 |
commit | 74d362337db29de8864bcdd7a97b299216247b19 (patch) | |
tree | 63c02267ec0759a6c02f97888a492df7aabceb71 | |
parent | b39fc1146f1b4f02d03ed40957241205ea83c3c6 (diff) | |
download | qtlocation-mapboxgl-74d362337db29de8864bcdd7a97b299216247b19.tar.gz |
[gcc4.9] Make supercluster.hpp GCC 4.9 compatible
-rw-r--r-- | src/3rd_party/supercluster.hpp/include/supercluster.hpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/3rd_party/supercluster.hpp/include/supercluster.hpp b/src/3rd_party/supercluster.hpp/include/supercluster.hpp index 99a1f559b3..fe24f4942b 100644 --- a/src/3rd_party/supercluster.hpp/include/supercluster.hpp +++ b/src/3rd_party/supercluster.hpp/include/supercluster.hpp @@ -20,6 +20,9 @@ namespace supercluster { using namespace mapbox::geometry; struct Cluster { + Cluster(point<double> pos_, std::uint32_t num_points_, std::uint32_t id_) + : pos(pos_), num_points(num_points_), id(id_) {} + point<double> pos; std::uint32_t num_points; std::uint32_t id = 0; @@ -118,9 +121,14 @@ public: auto visitor = [&, this](const auto &id) { auto const &c = zoom.clusters[id]; - TilePoint point(std::round(this->options.extent * (c.pos.x * z2 - x)), - std::round(this->options.extent * (c.pos.y * z2 - y))); - TileFeature feature{ point }; + TilePoint point(::round(this->options.extent * (c.pos.x * z2 - x)), + ::round(this->options.extent * (c.pos.y * z2 - y))); +#if !defined(__GNUC__) || __GNUC__ >= 5 + TileFeature feature { point }; +#else + TileFeature feature; + feature.geometry = point; +#endif if (c.num_points == 1) { feature.properties = this->features[c.id].properties; @@ -161,7 +169,7 @@ private: std::uint32_t i = 0; for (const auto &f : features_) { - clusters.push_back({ project(f.geometry.get<GeoJSONPoint>()), 1, i++ }); + clusters.emplace_back(project(f.geometry.get<GeoJSONPoint>()), 1, i++); } tree.fill(clusters); @@ -190,7 +198,7 @@ private: num_points += b.num_points; }); - clusters.push_back({ weight / double(num_points), num_points, p.id }); + clusters.emplace_back(weight / double(num_points), num_points, p.id); } tree.fill(clusters); |