diff options
author | Sergey Magidovich <mgsergio@mapswithme.com> | 2016-05-05 11:02:28 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-05-12 10:38:37 +0300 |
commit | 1a467a1b97b913f6f0fe680c29d5943f486990d8 (patch) | |
tree | 768cbfc8c4d05381eaf38e2d55b86ad8f052fbec /indexer/edits_migration.cpp | |
parent | abb449bc7fa2b1ad70fb237f7296115f9dcf730b (diff) |
Fix buildings from xml loading.
Diffstat (limited to 'indexer/edits_migration.cpp')
-rw-r--r-- | indexer/edits_migration.cpp | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/indexer/edits_migration.cpp b/indexer/edits_migration.cpp index c1577b786f..fc58779527 100644 --- a/indexer/edits_migration.cpp +++ b/indexer/edits_migration.cpp @@ -10,19 +10,6 @@ #include "std/algorithm.hpp" #include "std/unique_ptr.hpp" -namespace -{ -m2::PointD CalculateCenter(vector<m2::PointD> const & geometry) -{ - ASSERT(!geometry.empty() && geometry.size() % 3 == 0, - ("Invalid geometry should be handled in caller. geometry.size() =", geometry.size())); - - auto const boundingBox = ApplyCalculator(begin(geometry), end(geometry), - m2::CalculateBoundingBox()); - return ApplyCalculator(begin(geometry), end(geometry), m2::CalculatePointOnSurface(boundingBox)); -} -} // namespace - namespace editor { FeatureID MigrateNodeFeatureIndex(osm::Editor::TForEachFeaturesNearByFn & forEach, @@ -57,10 +44,11 @@ FeatureID MigrateWayFeatureIndex(osm::Editor::TForEachFeaturesNearByFn & forEach auto bestScore = 0.6; // initial score is used as a threshold. auto geometry = xml.GetGeometry(); - if (geometry.empty() || geometry.size() % 3 != 0) + if (geometry.empty()) MYTHROW(MigrationError, ("Feature has invalid geometry", xml)); - auto const someFeaturePoint = CalculateCenter(geometry); + // This can be any point on a feature. + auto const someFeaturePoint = geometry[0]; sort(begin(geometry), end(geometry)); // Sort to use in set_intersection. auto count = 0; |