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:
authorLev Dragunov <l.dragunov@corp.mail.ru>2015-08-12 16:12:24 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 03:01:18 +0300
commit6c83df2ed6bf87ad21382c7d9e25d2b3ecb28d59 (patch)
tree6eb7913e4a90b32d470325ae72f9f5dae69c143d /generator
parent1543860d25c96bdb5761a6c086b93b1cd095b58a (diff)
Routing generator osrm2ft index creation fix.
Diffstat (limited to 'generator')
-rw-r--r--generator/routing_generator.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/generator/routing_generator.cpp b/generator/routing_generator.cpp
index 5bbc5ac555..e9ce5a3326 100644
--- a/generator/routing_generator.cpp
+++ b/generator/routing_generator.cpp
@@ -259,6 +259,8 @@ void BuildRoutingIndex(string const & baseDir, string const & countryName, strin
for (auto const & seg : data.m_segments)
{
m2::PointD const pts[2] = { { seg.lon1, seg.lat1 }, { seg.lon2, seg.lat2 } };
+ m2::PointD const segVector = MercatorBounds::FromLatLon(seg.lat2, seg.lon2) -
+ MercatorBounds::FromLatLon(seg.lat1, seg.lon1);
++all;
// now need to determine feature id and segments in it
@@ -322,15 +324,19 @@ void BuildRoutingIndex(string const & baseDir, string const & countryName, strin
}
}
- // Find best matching for multiple choices. Get match with minimal sum distance.
- int ind1 = -1, ind2 = -1;
- double dist = numeric_limits<double>::max();
+ // Find best matching for multiple choices.
+ int ind1 = -1, ind2 = -1, dist = numeric_limits<int>::max();
for (auto i1 : indices[0])
for (auto i2 : indices[1])
{
- double const d = i1.second + i2.second;
+ // We use delta of the indexes to avoid P formed curves cases.
+ int const d = abs(i1.first - i2.first);
if (d < dist && i1.first != i2.first)
{
+ // Check if resulting vector has same direction with the edge.
+ m2::PointD candidateVector = ft.GetPoint(i2.first) - ft.GetPoint(i1.first);
+ if (m2::DotProduct(candidateVector, segVector) < 0)
+ continue;
ind1 = i1.first;
ind2 = i2.first;
dist = d;