Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArsentiy Milchakov <milcars@mapswithme.com>2018-01-23 14:20:03 +0300
committermgsergio <mgsergio@yandex.ru>2018-01-23 17:14:53 +0300
commit490416568e671c34b543a341600c650f7558fcef (patch)
tree3fd2fd56b9adde3432b644cd5a52d62603abff4b /indexer
parentf80d2dbddc17ce7ee236383d3e5831f6e7ae9578 (diff)
[editor] Support migration for old versions of edits.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/edits_migration.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/indexer/edits_migration.cpp b/indexer/edits_migration.cpp
index 5562651254..7b533cd3a0 100644
--- a/indexer/edits_migration.cpp
+++ b/indexer/edits_migration.cpp
@@ -7,7 +7,6 @@
#include "editor/feature_matcher.hpp"
#include "base/logging.hpp"
-#include "base/stl_iterator.hpp"
#include "std/algorithm.hpp"
#include "std/unique_ptr.hpp"
@@ -45,7 +44,7 @@ FeatureID MigrateNodeFeatureIndex(osm::Editor::ForEachFeaturesNearByFn & forEach
return feature->GetID();
}
-FeatureID MigrateWayorRelatonFeatureIndex(
+FeatureID MigrateWayOrRelatonFeatureIndex(
osm::Editor::ForEachFeaturesNearByFn & forEach, XMLFeature const & xml,
osm::Editor::FeatureStatus const /* Unused for now (we don't create/delete area features)*/,
TGenerateIDFn const & /*Unused for the same reason*/)
@@ -69,7 +68,19 @@ FeatureID MigrateWayorRelatonFeatureIndex(
++count;
auto ftGeometry = ft.GetTriangesAsPoints(FeatureType::BEST_GEOMETRY);
- auto const score = matcher::ScoreTriangulatedGeometries(geometry, ftGeometry);
+ double score = 0.0;
+ try
+ {
+ score = matcher::ScoreTriangulatedGeometries(geometry, ftGeometry);
+ }
+ catch (matcher::NotAPolygonException & ex)
+ {
+ // Support migration for old application versions.
+ // TODO(a): To remove it after some time.
+ my::SortUnique(geometry);
+ my::SortUnique(ftGeometry);
+ score = matcher::ScoreTriangulatedGeometriesByPoints(geometry, ftGeometry);
+ }
if (score > bestScore)
{
@@ -103,7 +114,7 @@ FeatureID MigrateFeatureIndex(osm::Editor::ForEachFeaturesNearByFn & forEach,
return MigrateNodeFeatureIndex(forEach, xml, featureStatus, generateID);
case XMLFeature::Type::Way:
case XMLFeature::Type::Relation:
- return MigrateWayorRelatonFeatureIndex(forEach, xml, featureStatus, generateID);
+ return MigrateWayOrRelatonFeatureIndex(forEach, xml, featureStatus, generateID);
}
}
} // namespace editor