From 82d60c74db5d04ff455d7e8e102c898224d6fa0c Mon Sep 17 00:00:00 2001 From: Anton Kvasha Date: Wed, 6 May 2020 21:01:39 +0300 Subject: [PATCH] Fixed codestyle --- dbms/src/Dictionaries/PolygonDictionary.cpp | 9 ++++++--- dbms/src/Dictionaries/PolygonDictionaryUtils.cpp | 3 ++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/dbms/src/Dictionaries/PolygonDictionary.cpp b/dbms/src/Dictionaries/PolygonDictionary.cpp index e81c649fa9f..a5027f88ebf 100644 --- a/dbms/src/Dictionaries/PolygonDictionary.cpp +++ b/dbms/src/Dictionaries/PolygonDictionary.cpp @@ -227,18 +227,21 @@ void IPolygonDictionary::loadData() std::vector> polygon_ids; polygon_ids.reserve(polygons.size()); - for (size_t i = 0; i < polygons.size(); ++i) { + for (size_t i = 0; i < polygons.size(); ++i) + { auto & polygon = polygons[i]; bg::correct(polygon); areas.push_back(bg::area(polygon)); polygon_ids.emplace_back(polygon, i); } - sort(polygon_ids.begin(), polygon_ids.end(), [& areas](const auto & lhs, const auto & rhs) { + sort(polygon_ids.begin(), polygon_ids.end(), [& areas](const auto & lhs, const auto & rhs) + { return areas[lhs.second] < areas[rhs.second]; }); std::vector correct_ids; correct_ids.reserve(polygon_ids.size()); - for (size_t i = 0; i < polygon_ids.size(); ++i) { + for (size_t i = 0; i < polygon_ids.size(); ++i) + { auto & polygon = polygon_ids[i]; correct_ids.emplace_back(ids[polygon.second]); polygons[i] = polygon.first; diff --git a/dbms/src/Dictionaries/PolygonDictionaryUtils.cpp b/dbms/src/Dictionaries/PolygonDictionaryUtils.cpp index 4e257a7cfe4..c2713c56dd2 100644 --- a/dbms/src/Dictionaries/PolygonDictionaryUtils.cpp +++ b/dbms/src/Dictionaries/PolygonDictionaryUtils.cpp @@ -39,7 +39,8 @@ const FinalCell * DividedCell::find(Float64 x, Float64 y) const } GridRoot::GridRoot(const size_t min_intersections_, const size_t max_depth_, const std::vector & polygons_): -kMinIntersections(min_intersections_), kMaxDepth(max_depth_), polygons(polygons_) { +kMinIntersections(min_intersections_), kMaxDepth(max_depth_), polygons(polygons_) +{ setBoundingBox(); std::vector order(polygons.size()); std::iota(order.begin(), order.end(), 0);