retire json hinting mechanism
This commit is contained in:
parent
04e1e5e3a2
commit
1fa9091239
@ -279,19 +279,19 @@ template <class DataFacadeT> class JSONDescriptor final : public BaseDescriptor<
|
|||||||
json_result.values["alternative_names"] = json_alternate_names_array;
|
json_result.values["alternative_names"] = json_alternate_names_array;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSON::Object json_hint_object;
|
// JSON::Object json_hint_object;
|
||||||
json_hint_object.values["checksum"] = facade->GetCheckSum();
|
// json_hint_object.values["checksum"] = facade->GetCheckSum();
|
||||||
JSON::Array json_location_hint_array;
|
// JSON::Array json_location_hint_array;
|
||||||
std::string hint;
|
// std::string hint;
|
||||||
for (const auto i : osrm::irange<std::size_t>(0, raw_route.segment_end_coordinates.size()))
|
// for (const auto i : osrm::irange<std::size_t>(0, raw_route.segment_end_coordinates.size()))
|
||||||
{
|
// {
|
||||||
ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates[i].source_phantom, hint);
|
// ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates[i].source_phantom, hint);
|
||||||
json_location_hint_array.values.push_back(hint);
|
// json_location_hint_array.values.push_back(hint);
|
||||||
}
|
// }
|
||||||
ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates.back().target_phantom, hint);
|
// ObjectEncoder::EncodeToBase64(raw_route.segment_end_coordinates.back().target_phantom, hint);
|
||||||
json_location_hint_array.values.push_back(hint);
|
// json_location_hint_array.values.push_back(hint);
|
||||||
json_hint_object.values["locations"] = json_location_hint_array;
|
// json_hint_object.values["locations"] = json_location_hint_array;
|
||||||
json_result.values["hint_data"] = json_hint_object;
|
// json_result.values["hint_data"] = json_hint_object;
|
||||||
|
|
||||||
// render the content to the output array
|
// render the content to the output array
|
||||||
TIMER_START(route_render);
|
TIMER_START(route_render);
|
||||||
|
@ -71,23 +71,23 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool checksum_OK = (route_parameters.check_sum == facade->GetCheckSum());
|
// const bool checksum_OK = (route_parameters.check_sum == facade->GetCheckSum());
|
||||||
unsigned max_locations =
|
unsigned max_locations =
|
||||||
std::min(100u, static_cast<unsigned>(route_parameters.coordinates.size()));
|
std::min(100u, static_cast<unsigned>(route_parameters.coordinates.size()));
|
||||||
PhantomNodeArray phantom_node_vector(max_locations);
|
PhantomNodeArray phantom_node_vector(max_locations);
|
||||||
for (const auto i : osrm::irange(0u, max_locations))
|
for (const auto i : osrm::irange(0u, max_locations))
|
||||||
{
|
{
|
||||||
if (checksum_OK && i < route_parameters.hints.size() &&
|
// if (checksum_OK && i < route_parameters.hints.size() &&
|
||||||
!route_parameters.hints[i].empty())
|
// !route_parameters.hints[i].empty())
|
||||||
{
|
// {
|
||||||
PhantomNode current_phantom_node;
|
// PhantomNode current_phantom_node;
|
||||||
ObjectEncoder::DecodeFromBase64(route_parameters.hints[i], current_phantom_node);
|
// ObjectEncoder::DecodeFromBase64(route_parameters.hints[i], current_phantom_node);
|
||||||
if (current_phantom_node.is_valid(facade->GetNumberOfNodes()))
|
// if (current_phantom_node.is_valid(facade->GetNumberOfNodes()))
|
||||||
{
|
// {
|
||||||
phantom_node_vector[i].emplace_back(std::move(current_phantom_node));
|
// phantom_node_vector[i].emplace_back(std::move(current_phantom_node));
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
facade->IncrementalFindPhantomNodeForCoordinate(route_parameters.coordinates[i],
|
facade->IncrementalFindPhantomNodeForCoordinate(route_parameters.coordinates[i],
|
||||||
phantom_node_vector[i],
|
phantom_node_vector[i],
|
||||||
1);
|
1);
|
||||||
@ -105,10 +105,11 @@ template <class DataFacadeT> class DistanceTablePlugin final : public BasePlugin
|
|||||||
reply = http::Reply::StockReply(http::Reply::badRequest);
|
reply = http::Reply::StockReply(http::Reply::badRequest);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSON::Object json_object;
|
JSON::Object json_object;
|
||||||
JSON::Array json_array;
|
JSON::Array json_array;
|
||||||
const unsigned number_of_locations = static_cast<unsigned>(phantom_node_vector.size());
|
const auto number_of_locations = phantom_node_vector.size();
|
||||||
for (unsigned row = 0; row < number_of_locations; ++row)
|
for (const auto row : osrm::irange<std::size_t>(0, number_of_locations))
|
||||||
{
|
{
|
||||||
JSON::Array json_row;
|
JSON::Array json_row;
|
||||||
auto row_begin_iterator = result_table->begin() + (row * number_of_locations);
|
auto row_begin_iterator = result_table->begin() + (row * number_of_locations);
|
||||||
|
@ -83,7 +83,7 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
|
|||||||
SimpleLogger().Write() << "coordinates ok";
|
SimpleLogger().Write() << "coordinates ok";
|
||||||
|
|
||||||
std::vector<phantom_node_pair> phantom_node_pair_list(route_parameters.coordinates.size());
|
std::vector<phantom_node_pair> phantom_node_pair_list(route_parameters.coordinates.size());
|
||||||
const bool checksum_OK = (route_parameters.check_sum == facade->GetCheckSum());
|
// const bool checksum_OK = (route_parameters.check_sum == facade->GetCheckSum());
|
||||||
|
|
||||||
for (const auto i : osrm::irange<std::size_t>(0, route_parameters.coordinates.size()))
|
for (const auto i : osrm::irange<std::size_t>(0, route_parameters.coordinates.size()))
|
||||||
{
|
{
|
||||||
@ -92,19 +92,19 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
|
|||||||
<< route_parameters.hints.size();
|
<< route_parameters.hints.size();
|
||||||
|
|
||||||
// TODO: Remove hinting mechanism
|
// TODO: Remove hinting mechanism
|
||||||
if (checksum_OK && i < route_parameters.hints.size() &&
|
// if (checksum_OK && i < route_parameters.hints.size() &&
|
||||||
!route_parameters.hints[i].empty())
|
// !route_parameters.hints[i].empty())
|
||||||
{
|
// {
|
||||||
SimpleLogger().Write() << "decoding hint " << i;
|
// SimpleLogger().Write() << "decoding hint " << i;
|
||||||
|
|
||||||
ObjectEncoder::DecodeFromBase64(route_parameters.hints[i],
|
// ObjectEncoder::DecodeFromBase64(route_parameters.hints[i],
|
||||||
phantom_node_pair_list[i]);
|
// phantom_node_pair_list[i]);
|
||||||
if (phantom_node_pair_list[i].first.is_valid(facade->GetNumberOfNodes()))
|
// if (phantom_node_pair_list[i].first.is_valid(facade->GetNumberOfNodes()))
|
||||||
{
|
// {
|
||||||
SimpleLogger().Write() << "decoded PhantomNode";
|
// SimpleLogger().Write() << "decoded PhantomNode";
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
std::vector<PhantomNode> phantom_node_vector;
|
std::vector<PhantomNode> phantom_node_vector;
|
||||||
SimpleLogger().Write() << "finding coordinate";
|
SimpleLogger().Write() << "finding coordinate";
|
||||||
|
|
||||||
@ -143,11 +143,9 @@ template <class DataFacadeT> class ViaRoutePlugin final : public BasePlugin
|
|||||||
|
|
||||||
// are all phantoms from a tiny cc?
|
// are all phantoms from a tiny cc?
|
||||||
const auto component_id = phantom_node_pair_list.front().first.component_id;
|
const auto component_id = phantom_node_pair_list.front().first.component_id;
|
||||||
BOOST_ASSERT(0 != component_id);
|
|
||||||
|
|
||||||
auto check_component_id_is_equal = [component_id](const phantom_node_pair &phantom_pair)
|
auto check_component_id_is_equal = [component_id](const phantom_node_pair &phantom_pair)
|
||||||
{
|
{
|
||||||
BOOST_ASSERT(0 != phantom_pair.first.component_id);
|
|
||||||
return component_id == phantom_pair.first.component_id;
|
return component_id == phantom_pair.first.component_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ template <class DataFacadeT> class ManyToManyRouting final : public BasicRouting
|
|||||||
std::shared_ptr<std::vector<EdgeWeight>> operator()(const PhantomNodeArray &phantom_nodes_array)
|
std::shared_ptr<std::vector<EdgeWeight>> operator()(const PhantomNodeArray &phantom_nodes_array)
|
||||||
const
|
const
|
||||||
{
|
{
|
||||||
const unsigned number_of_locations = static_cast<unsigned>(phantom_nodes_array.size());
|
const auto number_of_locations = phantom_nodes_array.size();
|
||||||
std::shared_ptr<std::vector<EdgeWeight>> result_table =
|
std::shared_ptr<std::vector<EdgeWeight>> result_table =
|
||||||
std::make_shared<std::vector<EdgeWeight>>(number_of_locations * number_of_locations,
|
std::make_shared<std::vector<EdgeWeight>>(number_of_locations * number_of_locations,
|
||||||
std::numeric_limits<EdgeWeight>::max());
|
std::numeric_limits<EdgeWeight>::max());
|
||||||
|
Loading…
Reference in New Issue
Block a user