forked from organicmaps/organicmaps
Geometry unpacking tests.
This commit is contained in:
parent
3f700633c1
commit
3394a43154
2 changed files with 38 additions and 5 deletions
|
@ -44,6 +44,39 @@ namespace
|
|||
);
|
||||
}
|
||||
|
||||
// Geometry unpacking test.
|
||||
UNIT_TEST(RussiaFerryToCrimeaLoadCrossGeometryTest)
|
||||
{
|
||||
// Forward
|
||||
TRouteResult route = integration::CalculateRoute(
|
||||
integration::GetAllMaps(), MercatorBounds::FromLatLon(45.34123, 36.67679),
|
||||
{0., 0.}, MercatorBounds::FromLatLon(45.36479, 36.62194));
|
||||
TEST_EQUAL(route.second, IRouter::NoError, ());
|
||||
TEST_GREATER(route.first->GetPoly().GetSize(), 50, ());
|
||||
// And backward case
|
||||
route = integration::CalculateRoute(
|
||||
integration::GetAllMaps(), MercatorBounds::FromLatLon(45.36479, 36.62194), {0., 0.},
|
||||
MercatorBounds::FromLatLon(45.34123, 36.67679));
|
||||
TEST_EQUAL(route.second, IRouter::NoError, ());
|
||||
TEST_GREATER(route.first->GetPoly().GetSize(), 50, ());
|
||||
}
|
||||
|
||||
UNIT_TEST(PriceIslandLoadCrossGeometryTest)
|
||||
{
|
||||
// Forward
|
||||
TRouteResult route = integration::CalculateRoute(
|
||||
integration::GetAllMaps(), MercatorBounds::FromLatLon(46.16255,-63.81643),
|
||||
{0., 0.}, MercatorBounds::FromLatLon(46.25401, -63.70213));
|
||||
TEST_EQUAL(route.second, IRouter::NoError, ());
|
||||
TEST_GREATER(route.first->GetPoly().GetSize(), 29, ());
|
||||
// And backward case
|
||||
route = integration::CalculateRoute(
|
||||
integration::GetAllMaps(), MercatorBounds::FromLatLon(46.25401, -63.70213), {0., 0.},
|
||||
MercatorBounds::FromLatLon(46.16255,-63.81643));
|
||||
TEST_EQUAL(route.second, IRouter::NoError, ());
|
||||
TEST_GREATER(route.first->GetPoly().GetSize(), 29, ());
|
||||
}
|
||||
|
||||
// Cross mwm tests.
|
||||
UNIT_TEST(RussiaMoscowLeningradskiy39GerPanfilovtsev22RouteTest)
|
||||
{
|
||||
|
|
|
@ -506,9 +506,11 @@ OsrmRouter::ResultCode OsrmRouter::MakeRouteFromCrossesPath(TCheckedPath const &
|
|||
turns::TTurnsGeom mwmTurnsGeom;
|
||||
MakeTurnAnnotation(routingResult, mwmMapping, mwmPoints, mwmTurnsDir, mwmTimes, mwmTurnsGeom);
|
||||
// And connect it to result route
|
||||
// -1 because --mwmPoints.begin(), so psize can be negative.
|
||||
const int64_t pSize = Points.size() - 1;
|
||||
for (auto turn : mwmTurnsDir)
|
||||
{
|
||||
turn.m_index += Points.size() - 1;
|
||||
turn.m_index += pSize;
|
||||
TurnsDir.push_back(turn);
|
||||
}
|
||||
|
||||
|
@ -516,7 +518,7 @@ OsrmRouter::ResultCode OsrmRouter::MakeRouteFromCrossesPath(TCheckedPath const &
|
|||
double const estimationTime = Times.size() ? Times.back().second : 0.0;
|
||||
for (auto time : mwmTimes)
|
||||
{
|
||||
time.first += Points.size() - 1;
|
||||
time.first += pSize;
|
||||
time.second += estimationTime;
|
||||
Times.push_back(time);
|
||||
}
|
||||
|
@ -526,10 +528,8 @@ OsrmRouter::ResultCode OsrmRouter::MakeRouteFromCrossesPath(TCheckedPath const &
|
|||
{
|
||||
// We're at the end point
|
||||
Points.pop_back();
|
||||
// -1 because --mwmPoints.begin()
|
||||
const size_t psize = Points.size() - 1;
|
||||
for (auto & turnGeom : mwmTurnsGeom)
|
||||
turnGeom.m_indexInRoute += psize;
|
||||
turnGeom.m_indexInRoute += pSize;
|
||||
}
|
||||
Points.insert(Points.end(), ++mwmPoints.begin(), mwmPoints.end());
|
||||
TurnsGeom.insert(TurnsGeom.end(), mwmTurnsGeom.begin(), mwmTurnsGeom.end());
|
||||
|
|
Loading…
Add table
Reference in a new issue