Compare commits

...

2 Commits

Author SHA1 Message Date
Patrick Niklaus cc0c28f366 Fix formating for cherry-picked commit 2017-03-09 12:05:01 +00:00
Michael Krasnyk 66cc99703c Compute correct speed values in tile plugin 2017-03-09 11:49:10 +00:00
3 changed files with 102 additions and 24 deletions
+5
View File
@@ -1,4 +1,9 @@
# 5.6.3
- Changes from 5.6.0
- Bugfixes
- #3790 Fix incorrect speed values in tile plugin
# 5.6.2 # 5.6.2
- Changes from 5.6.0 - Changes from 5.6.0
- Bugfixes - Bugfixes
+66 -14
View File
@@ -79,9 +79,10 @@ struct TurnData final
TurnData(const util::Coordinate coordinate_, TurnData(const util::Coordinate coordinate_,
const std::size_t _in, const std::size_t _in,
const std::size_t _out, const std::size_t _out,
const std::size_t _weight) const std::size_t _weight,
const std::size_t _duration)
: coordinate(std::move(coordinate_)), in_angle_offset(_in), turn_angle_offset(_out), : coordinate(std::move(coordinate_)), in_angle_offset(_in), turn_angle_offset(_out),
weight_offset(_weight) weight_offset(_weight), duration_offset(_duration)
{ {
} }
@@ -89,6 +90,7 @@ struct TurnData final
const std::size_t in_angle_offset; const std::size_t in_angle_offset;
const std::size_t turn_angle_offset; const std::size_t turn_angle_offset;
const std::size_t weight_offset; const std::size_t weight_offset;
const std::size_t duration_offset;
}; };
using FixedPoint = Point<std::int32_t>; using FixedPoint = Point<std::int32_t>;
@@ -457,6 +459,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
// vw is the "exit" // vw is the "exit"
std::vector<contractor::QueryEdge::EdgeData> unpacked_shortcut; std::vector<contractor::QueryEdge::EdgeData> unpacked_shortcut;
std::vector<EdgeWeight> approach_weight_vector; std::vector<EdgeWeight> approach_weight_vector;
std::vector<EdgeWeight> approach_duration_vector;
// Make sure we traverse the startnodes in a consistent order // Make sure we traverse the startnodes in a consistent order
// to ensure identical PBF encoding on all platforms. // to ensure identical PBF encoding on all platforms.
@@ -539,16 +542,26 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
approach_weight_vector = facade->GetUncompressedForwardWeights( approach_weight_vector = facade->GetUncompressedForwardWeights(
edge_based_node_info[approachedge.edge_based_node_id] edge_based_node_info[approachedge.edge_based_node_id]
.packed_geometry_id); .packed_geometry_id);
approach_duration_vector = facade->GetUncompressedForwardDurations(
edge_based_node_info[approachedge.edge_based_node_id]
.packed_geometry_id);
} }
else else
{ {
approach_weight_vector = facade->GetUncompressedReverseWeights( approach_weight_vector = facade->GetUncompressedReverseWeights(
edge_based_node_info[approachedge.edge_based_node_id] edge_based_node_info[approachedge.edge_based_node_id]
.packed_geometry_id); .packed_geometry_id);
approach_duration_vector = facade->GetUncompressedReverseDurations(
edge_based_node_info[approachedge.edge_based_node_id]
.packed_geometry_id);
} }
const auto sum_node_weight = std::accumulate(approach_weight_vector.begin(), const auto sum_node_weight = std::accumulate(approach_weight_vector.begin(),
approach_weight_vector.end(), approach_weight_vector.end(),
EdgeWeight{0}); EdgeWeight{0});
const auto sum_node_duration =
std::accumulate(approach_duration_vector.begin(),
approach_duration_vector.end(),
EdgeWeight{0});
// The edge.weight is the whole edge weight, which includes the turn // The edge.weight is the whole edge weight, which includes the turn
// cost. // cost.
@@ -557,7 +570,8 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
// intersections include stop signs, traffic signals and other // intersections include stop signs, traffic signals and other
// penalties, but at this stage, we can't divide those out, so we just // penalties, but at this stage, we can't divide those out, so we just
// treat the whole lot as the "turn cost" that we'll stick on the map. // treat the whole lot as the "turn cost" that we'll stick on the map.
const auto turn_cost = data.weight - sum_node_weight; const auto turn_weight = data.weight - sum_node_weight;
const auto turn_duration = data.duration - sum_node_duration;
// Find the three nodes that make up the turn movement) // Find the three nodes that make up the turn movement)
const auto node_from = startnode; const auto node_from = startnode;
@@ -598,14 +612,19 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
// And, same for the actual turn cost value - it goes in the lookup // And, same for the actual turn cost value - it goes in the lookup
// table, // table,
// not directly on the feature itself. // not directly on the feature itself.
const auto turn_cost_index = use_point_float_value( const auto turn_weight_index = use_point_float_value(
turn_cost / 10.0); // Note conversion to float here turn_weight / 10.0); // Note conversion to float here
const auto turn_duration_index = use_point_float_value(
turn_duration / 10.0); // Note conversion to float here
// Save everything we need to later add all the points to the tile. // Save everything we need to later add all the points to the tile.
// We need the coordinate of the intersection, the angle in, the turn // We need the coordinate of the intersection, the angle in, the turn
// angle and the turn cost. // angle and the turn cost.
all_turn_data.emplace_back( all_turn_data.emplace_back(coord_via,
coord_via, angle_in_index, turn_angle_index, turn_cost_index); angle_in_index,
turn_angle_index,
turn_weight_index,
turn_duration_index);
} }
} }
} }
@@ -672,6 +691,8 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
for (const auto &edge_index : sorted_edge_indexes) for (const auto &edge_index : sorted_edge_indexes)
{ {
const auto &edge = edges[edge_index]; const auto &edge = edges[edge_index];
// Weight values
const auto forward_weight_vector = const auto forward_weight_vector =
facade->GetUncompressedForwardWeights(edge.packed_geometry_id); facade->GetUncompressedForwardWeights(edge.packed_geometry_id);
const auto reverse_weight_vector = const auto reverse_weight_vector =
@@ -679,8 +700,20 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
const auto forward_weight = forward_weight_vector[edge.fwd_segment_position]; const auto forward_weight = forward_weight_vector[edge.fwd_segment_position];
const auto reverse_weight = reverse_weight_vector[reverse_weight_vector.size() - const auto reverse_weight = reverse_weight_vector[reverse_weight_vector.size() -
edge.fwd_segment_position - 1]; edge.fwd_segment_position - 1];
use_line_value(reverse_weight);
use_line_value(forward_weight); use_line_value(forward_weight);
use_line_value(reverse_weight);
// Duration values
const auto forward_duration_vector =
facade->GetUncompressedForwardDurations(edge.packed_geometry_id);
const auto reverse_duration_vector =
facade->GetUncompressedReverseDurations(edge.packed_geometry_id);
const auto forward_duration = forward_duration_vector[edge.fwd_segment_position];
const auto reverse_duration =
reverse_duration_vector[reverse_duration_vector.size() -
edge.fwd_segment_position - 1];
use_line_value(forward_duration);
use_line_value(reverse_duration);
} }
// Begin the layer features block // Begin the layer features block
@@ -701,6 +734,10 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
facade->GetUncompressedForwardWeights(edge.packed_geometry_id); facade->GetUncompressedForwardWeights(edge.packed_geometry_id);
const auto reverse_weight_vector = const auto reverse_weight_vector =
facade->GetUncompressedReverseWeights(edge.packed_geometry_id); facade->GetUncompressedReverseWeights(edge.packed_geometry_id);
const auto forward_duration_vector =
facade->GetUncompressedForwardDurations(edge.packed_geometry_id);
const auto reverse_duration_vector =
facade->GetUncompressedReverseDurations(edge.packed_geometry_id);
const auto forward_datasource_vector = const auto forward_datasource_vector =
facade->GetUncompressedForwardDatasources(edge.packed_geometry_id); facade->GetUncompressedForwardDatasources(edge.packed_geometry_id);
const auto reverse_datasource_vector = const auto reverse_datasource_vector =
@@ -709,6 +746,11 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
const auto reverse_weight = const auto reverse_weight =
reverse_weight_vector[reverse_weight_vector.size() - reverse_weight_vector[reverse_weight_vector.size() -
edge.fwd_segment_position - 1]; edge.fwd_segment_position - 1];
const auto forward_duration =
forward_duration_vector[edge.fwd_segment_position];
const auto reverse_duration =
reverse_duration_vector[reverse_duration_vector.size() -
edge.fwd_segment_position - 1];
const auto forward_datasource = const auto forward_datasource =
forward_datasource_vector[edge.fwd_segment_position]; forward_datasource_vector[edge.fwd_segment_position];
const auto reverse_datasource = const auto reverse_datasource =
@@ -735,6 +777,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
&max_datasource_id, &max_datasource_id,
&used_line_ints](const FixedLine &tile_line, &used_line_ints](const FixedLine &tile_line,
const std::uint32_t speed_kmh, const std::uint32_t speed_kmh,
const std::size_t weight,
const std::size_t duration, const std::size_t duration,
const DatasourceID datasource, const DatasourceID datasource,
const std::size_t name_idx, const std::size_t name_idx,
@@ -770,10 +813,13 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
(edge.component.is_tiny ? 0 : 1)); // is_small feature (edge.component.is_tiny ? 0 : 1)); // is_small feature
field.add_element(2); // "datasource" tag key offset field.add_element(2); // "datasource" tag key offset
field.add_element(130 + datasource); // datasource value offset field.add_element(130 + datasource); // datasource value offset
field.add_element(3); // "duration" tag key offset field.add_element(3); // "weight" tag key offset
field.add_element(130 + max_datasource_id + 1 +
weight); // weight value offset
field.add_element(4); // "duration" tag key offset
field.add_element(130 + max_datasource_id + 1 + field.add_element(130 + max_datasource_id + 1 +
duration); // duration value offset duration); // duration value offset
field.add_element(4); // "name" tag key offset field.add_element(5); // "name" tag key offset
field.add_element(130 + max_datasource_id + 1 + used_line_ints.size() + field.add_element(130 + max_datasource_id + 1 + used_line_ints.size() +
name_idx); // name value offset name_idx); // name value offset
@@ -788,14 +834,14 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
}; };
// If this is a valid forward edge, go ahead and add it to the tile // If this is a valid forward edge, go ahead and add it to the tile
if (forward_weight != 0 && edge.forward_segment_id.enabled) if (forward_duration != 0 && edge.forward_segment_id.enabled)
{ {
std::int32_t start_x = 0; std::int32_t start_x = 0;
std::int32_t start_y = 0; std::int32_t start_y = 0;
// Calculate the speed for this line // Calculate the speed for this line
std::uint32_t speed_kmh = std::uint32_t speed_kmh =
static_cast<std::uint32_t>(round(length / forward_weight * 10 * 3.6)); static_cast<std::uint32_t>(round(length / forward_duration * 10 * 3.6));
auto tile_line = coordinatesToTileLine(a, b, tile_bbox); auto tile_line = coordinatesToTileLine(a, b, tile_bbox);
if (!tile_line.empty()) if (!tile_line.empty())
@@ -803,6 +849,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
encode_tile_line(tile_line, encode_tile_line(tile_line,
speed_kmh, speed_kmh,
line_int_offsets[forward_weight], line_int_offsets[forward_weight],
line_int_offsets[forward_duration],
forward_datasource, forward_datasource,
name_offset, name_offset,
start_x, start_x,
@@ -812,14 +859,14 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
// Repeat the above for the coordinates reversed and using the `reverse` // Repeat the above for the coordinates reversed and using the `reverse`
// properties // properties
if (reverse_weight != 0 && edge.reverse_segment_id.enabled) if (reverse_duration != 0 && edge.reverse_segment_id.enabled)
{ {
std::int32_t start_x = 0; std::int32_t start_x = 0;
std::int32_t start_y = 0; std::int32_t start_y = 0;
// Calculate the speed for this line // Calculate the speed for this line
std::uint32_t speed_kmh = std::uint32_t speed_kmh =
static_cast<std::uint32_t>(round(length / reverse_weight * 10 * 3.6)); static_cast<std::uint32_t>(round(length / reverse_duration * 10 * 3.6));
auto tile_line = coordinatesToTileLine(b, a, tile_bbox); auto tile_line = coordinatesToTileLine(b, a, tile_bbox);
if (!tile_line.empty()) if (!tile_line.empty())
@@ -827,6 +874,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
encode_tile_line(tile_line, encode_tile_line(tile_line,
speed_kmh, speed_kmh,
line_int_offsets[reverse_weight], line_int_offsets[reverse_weight],
line_int_offsets[reverse_duration],
reverse_datasource, reverse_datasource,
name_offset, name_offset,
start_x, start_x,
@@ -842,6 +890,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
line_layer_writer.add_string(util::vector_tile::KEY_TAG, "speed"); line_layer_writer.add_string(util::vector_tile::KEY_TAG, "speed");
line_layer_writer.add_string(util::vector_tile::KEY_TAG, "is_small"); line_layer_writer.add_string(util::vector_tile::KEY_TAG, "is_small");
line_layer_writer.add_string(util::vector_tile::KEY_TAG, "datasource"); line_layer_writer.add_string(util::vector_tile::KEY_TAG, "datasource");
line_layer_writer.add_string(util::vector_tile::KEY_TAG, "weight");
line_layer_writer.add_string(util::vector_tile::KEY_TAG, "duration"); line_layer_writer.add_string(util::vector_tile::KEY_TAG, "duration");
line_layer_writer.add_string(util::vector_tile::KEY_TAG, "name"); line_layer_writer.add_string(util::vector_tile::KEY_TAG, "name");
@@ -938,6 +987,8 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
field.add_element(1); // "turn_angle" tag key offset field.add_element(1); // "turn_angle" tag key offset
field.add_element(point_turn_data.turn_angle_offset); field.add_element(point_turn_data.turn_angle_offset);
field.add_element(2); // "cost" tag key offset field.add_element(2); // "cost" tag key offset
field.add_element(used_point_ints.size() + point_turn_data.duration_offset);
field.add_element(3); // "cost" tag key offset
field.add_element(used_point_ints.size() + point_turn_data.weight_offset); field.add_element(used_point_ints.size() + point_turn_data.weight_offset);
} }
{ {
@@ -965,6 +1016,7 @@ Status TilePlugin::HandleRequest(const std::shared_ptr<const datafacade::BaseDat
point_layer_writer.add_string(util::vector_tile::KEY_TAG, "bearing_in"); point_layer_writer.add_string(util::vector_tile::KEY_TAG, "bearing_in");
point_layer_writer.add_string(util::vector_tile::KEY_TAG, "turn_angle"); point_layer_writer.add_string(util::vector_tile::KEY_TAG, "turn_angle");
point_layer_writer.add_string(util::vector_tile::KEY_TAG, "cost"); point_layer_writer.add_string(util::vector_tile::KEY_TAG, "cost");
point_layer_writer.add_string(util::vector_tile::KEY_TAG, "weight");
// Now, save the lists of integers and floats that our features refer to. // Now, save the lists of integers and floats that our features refer to.
for (const auto &value : used_point_ints) for (const auto &value : used_point_ints)
+31 -10
View File
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(test_tile)
auto property_iter_pair = feature_message.get_packed_uint32(); auto property_iter_pair = feature_message.get_packed_uint32();
auto value_begin = property_iter_pair.begin(); auto value_begin = property_iter_pair.begin();
auto value_end = property_iter_pair.end(); auto value_end = property_iter_pair.end();
BOOST_CHECK_EQUAL(std::distance(value_begin, value_end), 10); BOOST_CHECK_EQUAL(std::distance(value_begin, value_end), 12);
auto iter = value_begin; auto iter = value_begin;
BOOST_CHECK_EQUAL(*iter++, 0); // speed key BOOST_CHECK_EQUAL(*iter++, 0); // speed key
BOOST_CHECK_LT(*iter++, 128); // speed value BOOST_CHECK_LT(*iter++, 128); // speed value
@@ -65,10 +65,12 @@ BOOST_AUTO_TEST_CASE(test_tile)
iter++; iter++;
BOOST_CHECK_EQUAL(*iter++, 2); // data source key BOOST_CHECK_EQUAL(*iter++, 2); // data source key
*iter++; // skip value check, can be valud uint32 *iter++; // skip value check, can be valud uint32
BOOST_CHECK_EQUAL(*iter++, 3); // duration key BOOST_CHECK_EQUAL(*iter++, 3); // weight key
BOOST_CHECK_GT(*iter++, 130); // weight value
BOOST_CHECK_EQUAL(*iter++, 4); // duration key
BOOST_CHECK_GT(*iter++, 130); // duration value BOOST_CHECK_GT(*iter++, 130); // duration value
// name // name
BOOST_CHECK_EQUAL(*iter++, 4); BOOST_CHECK_EQUAL(*iter++, 5);
BOOST_CHECK_GT(*iter++, 130); BOOST_CHECK_GT(*iter++, 130);
BOOST_CHECK(iter == value_end); BOOST_CHECK(iter == value_end);
// geometry // geometry
@@ -137,7 +139,7 @@ BOOST_AUTO_TEST_CASE(test_tile)
} }
} }
BOOST_CHECK_EQUAL(number_of_speed_keys, 5); BOOST_CHECK_EQUAL(number_of_speed_keys, 6);
BOOST_CHECK_GT(number_of_speed_values, 128); // speed value resolution BOOST_CHECK_GT(number_of_speed_values, 128); // speed value resolution
tile_message.next(); tile_message.next();
@@ -156,7 +158,7 @@ BOOST_AUTO_TEST_CASE(test_tile)
BOOST_CHECK_EQUAL(feature_message.tag(), util::vector_tile::FEATURE_ATTRIBUTES_TAG); BOOST_CHECK_EQUAL(feature_message.tag(), util::vector_tile::FEATURE_ATTRIBUTES_TAG);
// properties // properties
auto feature_iter_pair = feature_message.get_packed_uint32(); auto feature_iter_pair = feature_message.get_packed_uint32();
BOOST_CHECK_EQUAL(std::distance(feature_iter_pair.begin(), feature_iter_pair.end()), 6); BOOST_CHECK_EQUAL(std::distance(feature_iter_pair.begin(), feature_iter_pair.end()), 8);
auto iter = feature_iter_pair.begin(); auto iter = feature_iter_pair.begin();
BOOST_CHECK_EQUAL(*iter++, 0); // bearing_in key BOOST_CHECK_EQUAL(*iter++, 0); // bearing_in key
*iter++; *iter++;
@@ -164,6 +166,8 @@ BOOST_AUTO_TEST_CASE(test_tile)
*iter++; *iter++;
BOOST_CHECK_EQUAL(*iter++, 2); // cost key BOOST_CHECK_EQUAL(*iter++, 2); // cost key
*iter++; // skip value check, can be valud uint32 *iter++; // skip value check, can be valud uint32
BOOST_CHECK_EQUAL(*iter++, 3); // weight key
*iter++; // skip value check, can be valud uint32
BOOST_CHECK(iter == feature_iter_pair.end()); BOOST_CHECK(iter == feature_iter_pair.end());
// geometry // geometry
feature_message.next(); feature_message.next();
@@ -204,7 +208,7 @@ BOOST_AUTO_TEST_CASE(test_tile)
} }
} }
BOOST_CHECK_EQUAL(number_of_turn_keys, 3); BOOST_CHECK_EQUAL(number_of_turn_keys, 4);
BOOST_CHECK(number_of_turns_found > 700); BOOST_CHECK(number_of_turns_found > 700);
} }
@@ -236,6 +240,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns)
std::vector<int> found_bearing_in_indexes; std::vector<int> found_bearing_in_indexes;
std::vector<int> found_turn_angles_indexes; std::vector<int> found_turn_angles_indexes;
std::vector<int> found_penalties_indexes; std::vector<int> found_penalties_indexes;
std::vector<int> found_weight_indexes;
const auto check_turn_feature = [&](protozero::pbf_reader feature_message) { const auto check_turn_feature = [&](protozero::pbf_reader feature_message) {
feature_message.next(); // advance parser to first entry feature_message.next(); // advance parser to first entry
@@ -250,7 +255,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns)
BOOST_CHECK_EQUAL(feature_message.tag(), util::vector_tile::FEATURE_ATTRIBUTES_TAG); BOOST_CHECK_EQUAL(feature_message.tag(), util::vector_tile::FEATURE_ATTRIBUTES_TAG);
// properties // properties
auto feature_iter_pair = feature_message.get_packed_uint32(); auto feature_iter_pair = feature_message.get_packed_uint32();
BOOST_CHECK_EQUAL(std::distance(feature_iter_pair.begin(), feature_iter_pair.end()), 6); BOOST_CHECK_EQUAL(std::distance(feature_iter_pair.begin(), feature_iter_pair.end()), 8);
auto iter = feature_iter_pair.begin(); auto iter = feature_iter_pair.begin();
BOOST_CHECK_EQUAL(*iter++, 0); // bearing_in key BOOST_CHECK_EQUAL(*iter++, 0); // bearing_in key
found_bearing_in_indexes.push_back(*iter++); found_bearing_in_indexes.push_back(*iter++);
@@ -258,6 +263,8 @@ BOOST_AUTO_TEST_CASE(test_tile_turns)
found_turn_angles_indexes.push_back(*iter++); found_turn_angles_indexes.push_back(*iter++);
BOOST_CHECK_EQUAL(*iter++, 2); // cost key BOOST_CHECK_EQUAL(*iter++, 2); // cost key
found_penalties_indexes.push_back(*iter++); // skip value check, can be valud uint32 found_penalties_indexes.push_back(*iter++); // skip value check, can be valud uint32
BOOST_CHECK_EQUAL(*iter++, 3); // weight key
found_weight_indexes.push_back(*iter++); // skip value check, can be valud uint32
BOOST_CHECK(iter == feature_iter_pair.end()); BOOST_CHECK(iter == feature_iter_pair.end());
// geometry // geometry
feature_message.next(); feature_message.next();
@@ -333,6 +340,18 @@ BOOST_AUTO_TEST_CASE(test_tile_turns)
0, 0, 0, 0, 0, 0, .1f, .1f, .3f, .4f, 1.2f, 1.9f, 5.3f, 5.5f, 5.8f, 7.1f, 7.2f, 7.2f}; 0, 0, 0, 0, 0, 0, .1f, .1f, .3f, .4f, 1.2f, 1.9f, 5.3f, 5.5f, 5.8f, 7.1f, 7.2f, 7.2f};
BOOST_CHECK(actual_turn_penalties == expected_turn_penalties); BOOST_CHECK(actual_turn_penalties == expected_turn_penalties);
// Verify that we got the expected turn penalties
std::vector<float> actual_turn_weights;
for (const auto &i : found_weight_indexes)
{
BOOST_CHECK(float_vals.count(i) == 1);
actual_turn_weights.push_back(float_vals[i]);
}
std::sort(actual_turn_weights.begin(), actual_turn_weights.end());
const std::vector<float> expected_turn_weights = {
0, 0, 0, 0, 0, 0, .1f, .1f, .3f, .4f, 1.2f, 1.9f, 5.3f, 5.5f, 5.8f, 7.1f, 7.2f, 7.2f};
BOOST_CHECK(actual_turn_weights == expected_turn_weights);
// Verify the expected turn angles // Verify the expected turn angles
std::vector<std::int64_t> actual_turn_angles; std::vector<std::int64_t> actual_turn_angles;
for (const auto &i : found_turn_angles_indexes) for (const auto &i : found_turn_angles_indexes)
@@ -401,7 +420,7 @@ BOOST_AUTO_TEST_CASE(test_tile_speeds)
auto property_iter_pair = feature_message.get_packed_uint32(); auto property_iter_pair = feature_message.get_packed_uint32();
auto value_begin = property_iter_pair.begin(); auto value_begin = property_iter_pair.begin();
auto value_end = property_iter_pair.end(); auto value_end = property_iter_pair.end();
BOOST_CHECK_EQUAL(std::distance(value_begin, value_end), 10); BOOST_CHECK_EQUAL(std::distance(value_begin, value_end), 12);
auto iter = value_begin; auto iter = value_begin;
BOOST_CHECK_EQUAL(*iter++, 0); // speed key BOOST_CHECK_EQUAL(*iter++, 0); // speed key
found_speed_indexes.push_back(*iter++); found_speed_indexes.push_back(*iter++);
@@ -410,10 +429,12 @@ BOOST_AUTO_TEST_CASE(test_tile_speeds)
found_component_indexes.push_back(*iter++); found_component_indexes.push_back(*iter++);
BOOST_CHECK_EQUAL(*iter++, 2); // data source key BOOST_CHECK_EQUAL(*iter++, 2); // data source key
found_datasource_indexes.push_back(*iter++); found_datasource_indexes.push_back(*iter++);
BOOST_CHECK_EQUAL(*iter++, 3); // duration key BOOST_CHECK_EQUAL(*iter++, 3); // weight key
found_duration_indexes.push_back(*iter++);
BOOST_CHECK_EQUAL(*iter++, 4); // duration key
found_duration_indexes.push_back(*iter++); found_duration_indexes.push_back(*iter++);
// name // name
BOOST_CHECK_EQUAL(*iter++, 4); BOOST_CHECK_EQUAL(*iter++, 5);
found_name_indexes.push_back(*iter++); found_name_indexes.push_back(*iter++);
BOOST_CHECK(iter == value_end); BOOST_CHECK(iter == value_end);
// geometry // geometry