summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-07-24 16:49:58 +0300
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-07-25 11:43:37 +0300
commit7ce892366d89964a04361201db66bced4dc01dee (patch)
tree010d5b648c7389c4b3fddfea8c2380215e9b02e8
parent2e5897c0f49120c72b7431b3af7d41bef3414719 (diff)
downloadqtlocation-mapboxgl-7ce892366d89964a04361201db66bced4dc01dee.tar.gz
[core] Simplfy ToGeometryCollection
-rw-r--r--src/mbgl/tile/geometry_tile_data.hpp39
1 files changed, 7 insertions, 32 deletions
diff --git a/src/mbgl/tile/geometry_tile_data.hpp b/src/mbgl/tile/geometry_tile_data.hpp
index 203afcace7..a06e2be835 100644
--- a/src/mbgl/tile/geometry_tile_data.hpp
+++ b/src/mbgl/tile/geometry_tile_data.hpp
@@ -97,31 +97,16 @@ struct ToGeometryCollection {
return { { geom } };
}
GeometryCollection operator()(const mapbox::geometry::multi_point<int16_t>& geom) const {
- GeometryCoordinates coordinates;
- coordinates.reserve(geom.size());
- for (const auto& point : geom) {
- coordinates.emplace_back(point);
- }
- return { coordinates };
+ return { geom };
}
GeometryCollection operator()(const mapbox::geometry::line_string<int16_t>& geom) const {
- GeometryCoordinates coordinates;
- coordinates.reserve(geom.size());
- for (const auto& point : geom) {
- coordinates.emplace_back(point);
- }
- return { coordinates };
+ return { geom };
}
GeometryCollection operator()(const mapbox::geometry::multi_line_string<int16_t>& geom) const {
GeometryCollection collection;
collection.reserve(geom.size());
for (const auto& ring : geom) {
- GeometryCoordinates coordinates;
- coordinates.reserve(ring.size());
- for (const auto& point : ring) {
- coordinates.emplace_back(point);
- }
- collection.push_back(std::move(coordinates));
+ collection.emplace_back(ring);
}
return collection;
}
@@ -129,25 +114,15 @@ struct ToGeometryCollection {
GeometryCollection collection;
collection.reserve(geom.size());
for (const auto& ring : geom) {
- GeometryCoordinates coordinates;
- coordinates.reserve(ring.size());
- for (const auto& point : ring) {
- coordinates.emplace_back(point);
- }
- collection.push_back(std::move(coordinates));
+ collection.emplace_back(ring);
}
return collection;
}
GeometryCollection operator()(const mapbox::geometry::multi_polygon<int16_t>& geom) const {
GeometryCollection collection;
- for (auto& polygon : geom) {
- for (auto& ring : polygon) {
- GeometryCoordinates coordinates;
- coordinates.reserve(ring.size());
- for (auto& point : ring) {
- coordinates.emplace_back(point);
- }
- collection.push_back(std::move(coordinates));
+ for (const auto& polygon : geom) {
+ for (const auto& ring : polygon) {
+ collection.emplace_back(ring);
}
}
return collection;