Adjusted number of nodes
in annotation
, resolves #3515
This commit is contained in:
parent
70e899378d
commit
d0f1347ff1
@ -2,6 +2,7 @@
|
||||
- Changes from 5.5
|
||||
- Bugfixes
|
||||
- Fix #3475 removed an invalid `exit` field from the `arrive` maneuver
|
||||
- Fix #3515 adjusted number of `nodes` in `annotation`
|
||||
- Infrastructure
|
||||
- Support building rpm packages.
|
||||
- Guidance
|
||||
@ -401,5 +402,3 @@
|
||||
- `properties.use_turn_restrictions`
|
||||
- `properties.u_turn_penalty`
|
||||
- `properties.allow_u_turn_at_via`
|
||||
|
||||
|
||||
|
@ -1359,6 +1359,7 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
|
||||
// This can happen if the last coordinate snaps to a node in the unpacked geometry
|
||||
geometry.locations.pop_back();
|
||||
geometry.annotations.pop_back();
|
||||
geometry.osm_node_ids.pop_back();
|
||||
geometry.segment_offsets.back()--;
|
||||
// since the last geometry includes the location of arrival, the arrival instruction
|
||||
// geometry overlaps with the previous segment
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "engine/guidance/assemble_overview.hpp"
|
||||
#include "engine/guidance/assemble_route.hpp"
|
||||
#include "engine/guidance/assemble_steps.hpp"
|
||||
#include "engine/guidance/post_processing.hpp"
|
||||
|
||||
#include <boost/test/test_case_template.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
@ -17,4 +18,85 @@ BOOST_AUTO_TEST_CASE(rfc4648_test_vectors)
|
||||
// TODO(daniel-j-h):
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(trim_short_segments)
|
||||
{
|
||||
using namespace osrm::extractor::guidance;
|
||||
using namespace osrm::engine::guidance;
|
||||
using namespace osrm::engine;
|
||||
using namespace osrm::util;
|
||||
|
||||
IntermediateIntersection intersection1{{FloatLongitude{-73.981154}, FloatLatitude{40.767762}},
|
||||
{302},
|
||||
{1},
|
||||
IntermediateIntersection::NO_INDEX,
|
||||
0,
|
||||
{0, 255},
|
||||
{}};
|
||||
IntermediateIntersection intersection2{{FloatLongitude{-73.981495}, FloatLatitude{40.768275}},
|
||||
{180},
|
||||
{1},
|
||||
0,
|
||||
IntermediateIntersection::NO_INDEX,
|
||||
{0, 255},
|
||||
{}};
|
||||
|
||||
// Check that duplicated coordinate in the end is removed
|
||||
std::vector<RouteStep> steps = {{324,
|
||||
"Central Park West",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0.2,
|
||||
1.9076601161280742,
|
||||
TRAVEL_MODE_DRIVING,
|
||||
{{FloatLongitude{-73.981492}, FloatLatitude{40.768258}},
|
||||
329,
|
||||
348,
|
||||
{TurnType::ExitRotary, DirectionModifier::Straight},
|
||||
WaypointType::Depart,
|
||||
0},
|
||||
0,
|
||||
3,
|
||||
{intersection1}},
|
||||
{324,
|
||||
"Central Park West",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
0,
|
||||
0,
|
||||
TRAVEL_MODE_DRIVING,
|
||||
{{FloatLongitude{-73.981495}, FloatLatitude{40.768275}},
|
||||
0,
|
||||
0,
|
||||
{TurnType::NoTurn, DirectionModifier::UTurn},
|
||||
WaypointType::Arrive,
|
||||
0},
|
||||
2,
|
||||
3,
|
||||
{intersection2}}};
|
||||
|
||||
LegGeometry geometry;
|
||||
geometry.locations = {{FloatLongitude{-73.981492}, FloatLatitude{40.768258}},
|
||||
{FloatLongitude{-73.981495}, FloatLatitude{40.768275}},
|
||||
{FloatLongitude{-73.981495}, FloatLatitude{40.768275}}};
|
||||
geometry.segment_offsets = {0, 2};
|
||||
geometry.segment_distances = {1.9076601161280742};
|
||||
geometry.osm_node_ids = {OSMNodeID{0}, OSMNodeID{1}, OSMNodeID{2}};
|
||||
geometry.annotations = {{1.9076601161280742, 0.2, 0}, {0, 0, 0}};
|
||||
|
||||
trimShortSegments(steps, geometry);
|
||||
|
||||
BOOST_CHECK_EQUAL(geometry.segment_distances.size(), 1);
|
||||
BOOST_CHECK_EQUAL(geometry.segment_offsets.size(), 2);
|
||||
BOOST_CHECK_EQUAL(geometry.segment_offsets.back(), 1);
|
||||
BOOST_CHECK_EQUAL(geometry.annotations.size(), 1);
|
||||
BOOST_CHECK_EQUAL(geometry.locations.size(), 2);
|
||||
BOOST_CHECK_EQUAL(geometry.osm_node_ids.size(), 2);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
Loading…
Reference in New Issue
Block a user