fixing unit tests

This commit is contained in:
Moritz Kobitzsch
2016-04-06 16:47:16 +02:00
parent fa0a5040e5
commit dfd180a292
11 changed files with 134 additions and 116 deletions
+3 -1
View File
@@ -426,7 +426,9 @@ 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.segment_offsets.back()--;
BOOST_ASSERT(next_to_last_step.geometry_end == steps.back().geometry_begin);
// since the last geometry includes the location of arrival, the arrival instruction
// geometry overlaps with the previous segment
BOOST_ASSERT(next_to_last_step.geometry_end == steps.back().geometry_begin + 1);
BOOST_ASSERT(next_to_last_step.geometry_begin < next_to_last_step.geometry_end);
next_to_last_step.geometry_end--;
steps.back().geometry_begin--;
+5 -2
View File
@@ -104,10 +104,13 @@ std::pair<double, FloatCoordinate> projectPointOnSegment(const FloatCoordinate &
{
clamped_ratio = 0.;
}
return {clamped_ratio,
{
source.lon + slope_vector.lon * FloatLongitude(clamped_ratio),
source.lat + slope_vector.lat * FloatLatitude(clamped_ratio),
FloatLongitude(1.0 - clamped_ratio) * source.lon +
target.lon * FloatLongitude(clamped_ratio),
FloatLatitude(1.0 - clamped_ratio) * source.lat +
target.lat * FloatLatitude(clamped_ratio),
}};
}