#5325 CLang format
This commit is contained in:
parent
d69d0c2fe6
commit
44bc0a521e
@ -56,7 +56,7 @@ inline LegGeometry assembleGeometry(const datafacade::BaseDataFacade &facade,
|
|||||||
reversed_source ? source_node.reverse_segment_id.id : source_node.forward_segment_id.id;
|
reversed_source ? source_node.reverse_segment_id.id : source_node.forward_segment_id.id;
|
||||||
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
|
const auto source_geometry_id = facade.GetGeometryIndex(source_node_id).id;
|
||||||
const auto source_geometry = facade.GetUncompressedForwardGeometry(source_geometry_id);
|
const auto source_geometry = facade.GetUncompressedForwardGeometry(source_geometry_id);
|
||||||
//const auto source_osm_way_ids = facade.GetUncompressedForwardWayIDs(source_geometry_id);
|
// const auto source_osm_way_ids = facade.GetUncompressedForwardWayIDs(source_geometry_id);
|
||||||
|
|
||||||
geometry.osm_node_ids.push_back(
|
geometry.osm_node_ids.push_back(
|
||||||
facade.GetOSMNodeIDOfNode(source_geometry(source_segment_start_coordinate)));
|
facade.GetOSMNodeIDOfNode(source_geometry(source_segment_start_coordinate)));
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
#ifndef GEOMETRY_COMPRESSOR_HPP_
|
#ifndef GEOMETRY_COMPRESSOR_HPP_
|
||||||
#define GEOMETRY_COMPRESSOR_HPP_
|
#define GEOMETRY_COMPRESSOR_HPP_
|
||||||
|
|
||||||
#include "extractor/segment_data_container.hpp"
|
|
||||||
#include "extractor/node_based_edge.hpp"
|
#include "extractor/node_based_edge.hpp"
|
||||||
|
#include "extractor/segment_data_container.hpp"
|
||||||
|
|
||||||
#include "util/typedefs.hpp"
|
#include "util/typedefs.hpp"
|
||||||
|
|
||||||
@ -49,7 +49,8 @@ class CompressedEdgeContainer
|
|||||||
const SegmentWeight duration);
|
const SegmentWeight duration);
|
||||||
|
|
||||||
void InitializeBothwayVector();
|
void InitializeBothwayVector();
|
||||||
unsigned ZipEdges(const unsigned f_edge_pos, const unsigned r_edge_pos, OSMWayIDMap &osm_way_id_map);
|
unsigned
|
||||||
|
ZipEdges(const unsigned f_edge_pos, const unsigned r_edge_pos, OSMWayIDMap &osm_way_id_map);
|
||||||
|
|
||||||
bool HasEntryForID(const EdgeID edge_id) const;
|
bool HasEntryForID(const EdgeID edge_id) const;
|
||||||
bool HasZippedEntryForForwardID(const EdgeID edge_id) const;
|
bool HasZippedEntryForForwardID(const EdgeID edge_id) const;
|
||||||
|
|||||||
@ -2,8 +2,8 @@
|
|||||||
#define NODE_BASED_EDGE_HPP
|
#define NODE_BASED_EDGE_HPP
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <tuple>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <tuple>
|
||||||
|
|
||||||
#include "extractor/class_data.hpp"
|
#include "extractor/class_data.hpp"
|
||||||
#include "extractor/travel_mode.hpp"
|
#include "extractor/travel_mode.hpp"
|
||||||
|
|||||||
@ -73,10 +73,8 @@ struct RouteParametersGrammar : public BaseParametersGrammar<Iterator, Signature
|
|||||||
"full", engine::api::RouteParameters::OverviewType::Full)(
|
"full", engine::api::RouteParameters::OverviewType::Full)(
|
||||||
"false", engine::api::RouteParameters::OverviewType::False);
|
"false", engine::api::RouteParameters::OverviewType::False);
|
||||||
|
|
||||||
annotations_type.add(
|
annotations_type.add("duration", AnnotationsType::Duration)(
|
||||||
"duration", AnnotationsType::Duration)(
|
"nodes", AnnotationsType::Nodes)("ways", AnnotationsType::Ways)(
|
||||||
"nodes", AnnotationsType::Nodes)(
|
|
||||||
"ways", AnnotationsType::Ways)(
|
|
||||||
"distance", AnnotationsType::Distance)("weight", AnnotationsType::Weight)(
|
"distance", AnnotationsType::Distance)("weight", AnnotationsType::Weight)(
|
||||||
"datasources", AnnotationsType::Datasources)("speed", AnnotationsType::Speed);
|
"datasources", AnnotationsType::Datasources)("speed", AnnotationsType::Speed);
|
||||||
|
|
||||||
|
|||||||
@ -282,7 +282,7 @@ void trimShortSegments(std::vector<RouteStep> &steps, LegGeometry &geometry)
|
|||||||
geometry.osm_node_ids.erase(geometry.osm_node_ids.begin(),
|
geometry.osm_node_ids.erase(geometry.osm_node_ids.begin(),
|
||||||
geometry.osm_node_ids.begin() + offset);
|
geometry.osm_node_ids.begin() + offset);
|
||||||
geometry.osm_way_ids.erase(geometry.osm_way_ids.begin(),
|
geometry.osm_way_ids.erase(geometry.osm_way_ids.begin(),
|
||||||
geometry.osm_way_ids.begin() + offset);
|
geometry.osm_way_ids.begin() + offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const first_bearing = steps.front().maneuver.bearing_after;
|
auto const first_bearing = steps.front().maneuver.bearing_after;
|
||||||
|
|||||||
@ -262,7 +262,9 @@ void CompressedEdgeContainer::InitializeBothwayVector()
|
|||||||
segment_data->rev_datasources.reserve(m_compressed_oneway_geometries.size());
|
segment_data->rev_datasources.reserve(m_compressed_oneway_geometries.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id, const EdgeID r_edge_id, OSMWayIDMap &osm_way_id_map)
|
unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id,
|
||||||
|
const EdgeID r_edge_id,
|
||||||
|
OSMWayIDMap &osm_way_id_map)
|
||||||
{
|
{
|
||||||
if (!segment_data)
|
if (!segment_data)
|
||||||
InitializeBothwayVector();
|
InitializeBothwayVector();
|
||||||
@ -299,18 +301,27 @@ unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id, const EdgeID
|
|||||||
BOOST_ASSERT(fwd_node.node_id == rev_node.node_id);
|
BOOST_ASSERT(fwd_node.node_id == rev_node.node_id);
|
||||||
|
|
||||||
auto node_id = fwd_node.node_id;
|
auto node_id = fwd_node.node_id;
|
||||||
if( node_id != prev_node_id ) {
|
if (node_id != prev_node_id)
|
||||||
auto find_way_id = osm_way_id_map.find( OSMWayIDMapKey(prev_node_id, node_id) );
|
{
|
||||||
if( find_way_id == osm_way_id_map.cend() ) {
|
auto find_way_id = osm_way_id_map.find(OSMWayIDMapKey(prev_node_id, node_id));
|
||||||
find_way_id = osm_way_id_map.find( OSMWayIDMapKey(node_id, prev_node_id) );
|
if (find_way_id == osm_way_id_map.cend())
|
||||||
|
{
|
||||||
|
find_way_id = osm_way_id_map.find(OSMWayIDMapKey(node_id, prev_node_id));
|
||||||
}
|
}
|
||||||
if( find_way_id == osm_way_id_map.cend() ) {
|
if (find_way_id == osm_way_id_map.cend())
|
||||||
util::Log(logERROR) << "OSM Way ID not found for (nbg) nodes, it should never be happened: " << prev_node_id << "<-x->" << node_id;
|
{
|
||||||
|
util::Log(logERROR)
|
||||||
|
<< "OSM Way ID not found for (nbg) nodes, it should never be happened: "
|
||||||
|
<< prev_node_id << "<-x->" << node_id;
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id);
|
segment_data->osm_ways.emplace_back(osm_way_id);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id = find_way_id->second);
|
segment_data->osm_ways.emplace_back(osm_way_id = find_way_id->second);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Special case (artificial lighting signal edge)
|
// Special case (artificial lighting signal edge)
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id);
|
segment_data->osm_ways.emplace_back(osm_way_id);
|
||||||
}
|
}
|
||||||
@ -327,18 +338,27 @@ unsigned CompressedEdgeContainer::ZipEdges(const EdgeID f_edge_id, const EdgeID
|
|||||||
|
|
||||||
const auto &last_node = forward_bucket.back();
|
const auto &last_node = forward_bucket.back();
|
||||||
auto node_id = last_node.node_id;
|
auto node_id = last_node.node_id;
|
||||||
if( node_id != prev_node_id ) {
|
if (node_id != prev_node_id)
|
||||||
auto find_way_id = osm_way_id_map.find( OSMWayIDMapKey(prev_node_id, node_id) );
|
{
|
||||||
if( find_way_id == osm_way_id_map.cend() ) {
|
auto find_way_id = osm_way_id_map.find(OSMWayIDMapKey(prev_node_id, node_id));
|
||||||
find_way_id = osm_way_id_map.find( OSMWayIDMapKey(node_id, prev_node_id) );
|
if (find_way_id == osm_way_id_map.cend())
|
||||||
|
{
|
||||||
|
find_way_id = osm_way_id_map.find(OSMWayIDMapKey(node_id, prev_node_id));
|
||||||
}
|
}
|
||||||
if( find_way_id == osm_way_id_map.cend() ) {
|
if (find_way_id == osm_way_id_map.cend())
|
||||||
util::Log(logERROR) << "OSM Way ID not found for (nbg) nodes, it should never be happened: " << prev_node_id << "<-x->" << node_id;
|
{
|
||||||
|
util::Log(logERROR)
|
||||||
|
<< "OSM Way ID not found for (nbg) nodes, it should never be happened: "
|
||||||
|
<< prev_node_id << "<-x->" << node_id;
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id);
|
segment_data->osm_ways.emplace_back(osm_way_id);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id = find_way_id->second);
|
segment_data->osm_ways.emplace_back(osm_way_id = find_way_id->second);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// Special case (artificial lighting signal edge)
|
// Special case (artificial lighting signal edge)
|
||||||
segment_data->osm_ways.emplace_back(osm_way_id);
|
segment_data->osm_ways.emplace_back(osm_way_id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -370,10 +370,12 @@ int Extractor::run(ScriptingEnvironment &scripting_environment)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::
|
std::tuple<LaneDescriptionMap,
|
||||||
tuple<LaneDescriptionMap, OSMWayIDMap, std::vector<TurnRestriction>, std::vector<UnresolvedManeuverOverride>>
|
OSMWayIDMap,
|
||||||
Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
std::vector<TurnRestriction>,
|
||||||
const unsigned number_of_threads)
|
std::vector<UnresolvedManeuverOverride>>
|
||||||
|
Extractor::ParseOSMData(ScriptingEnvironment &scripting_environment,
|
||||||
|
const unsigned number_of_threads)
|
||||||
{
|
{
|
||||||
TIMER_START(extracting);
|
TIMER_START(extracting);
|
||||||
|
|
||||||
@ -631,10 +633,10 @@ std::
|
|||||||
files::writeProfileProperties(config.GetPath(".osrm.properties").string(), profile_properties);
|
files::writeProfileProperties(config.GetPath(".osrm.properties").string(), profile_properties);
|
||||||
|
|
||||||
// Fill OSM Way ID Lookup Map to use it later
|
// Fill OSM Way ID Lookup Map to use it later
|
||||||
for(auto edge: extraction_containers.all_edges_list) {
|
for (auto edge : extraction_containers.all_edges_list)
|
||||||
osm_way_id_map[
|
{
|
||||||
OSMWayIDMapKey(edge.result.source, edge.result.target)
|
osm_way_id_map[OSMWayIDMapKey(edge.result.source, edge.result.target)] =
|
||||||
] = edge.result.osm_way_id;
|
edge.result.osm_way_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
TIMER_STOP(extracting);
|
TIMER_STOP(extracting);
|
||||||
|
|||||||
@ -32,8 +32,7 @@ ExtractorCallbacks::ExtractorCallbacks(ExtractionContainers &extraction_containe
|
|||||||
OSMWayIDMap &osm_way_id_map,
|
OSMWayIDMap &osm_way_id_map,
|
||||||
const ProfileProperties &properties)
|
const ProfileProperties &properties)
|
||||||
: external_memory(extraction_containers_), classes_map(classes_map),
|
: external_memory(extraction_containers_), classes_map(classes_map),
|
||||||
lane_description_map(lane_description_map),
|
lane_description_map(lane_description_map), osm_way_id_map(osm_way_id_map),
|
||||||
osm_way_id_map(osm_way_id_map),
|
|
||||||
fallback_to_duration(properties.fallback_to_duration),
|
fallback_to_duration(properties.fallback_to_duration),
|
||||||
force_split_edges(properties.force_split_edges)
|
force_split_edges(properties.force_split_edges)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -127,7 +127,8 @@ void NodeBasedGraphFactory::CompressGeometry(OSMWayIDMap &osm_way_id_map)
|
|||||||
const EdgeID edge_id_2 = compressed_output_graph.FindEdge(to, from);
|
const EdgeID edge_id_2 = compressed_output_graph.FindEdge(to, from);
|
||||||
BOOST_ASSERT(edge_id_2 != SPECIAL_EDGEID);
|
BOOST_ASSERT(edge_id_2 != SPECIAL_EDGEID);
|
||||||
|
|
||||||
auto packed_geometry_id = compressed_edge_container.ZipEdges(edge_id_1, edge_id_2, osm_way_id_map);
|
auto packed_geometry_id =
|
||||||
|
compressed_edge_container.ZipEdges(edge_id_1, edge_id_2, osm_way_id_map);
|
||||||
|
|
||||||
// remember the geometry ID for both edges in the node-based graph
|
// remember the geometry ID for both edges in the node-based graph
|
||||||
compressed_output_graph.GetEdgeData(edge_id_1).geometry_id = {packed_geometry_id, true};
|
compressed_output_graph.GetEdgeData(edge_id_1).geometry_id = {packed_geometry_id, true};
|
||||||
|
|||||||
@ -14,9 +14,9 @@
|
|||||||
#include "osrm/osrm.hpp"
|
#include "osrm/osrm.hpp"
|
||||||
#include "osrm/route_parameters.hpp"
|
#include "osrm/route_parameters.hpp"
|
||||||
#include "osrm/status.hpp"
|
#include "osrm/status.hpp"
|
||||||
#include <osmium/io/reader.hpp>
|
|
||||||
#include <osmium/io/pbf_input.hpp>
|
|
||||||
#include <osmium/handler.hpp>
|
#include <osmium/handler.hpp>
|
||||||
|
#include <osmium/io/pbf_input.hpp>
|
||||||
|
#include <osmium/io/reader.hpp>
|
||||||
#include <osmium/osm/node.hpp>
|
#include <osmium/osm/node.hpp>
|
||||||
#include <osmium/osm/way.hpp>
|
#include <osmium/osm/way.hpp>
|
||||||
#include <osmium/visitor.hpp>
|
#include <osmium/visitor.hpp>
|
||||||
@ -601,17 +601,22 @@ BOOST_AUTO_TEST_CASE(test_manual_setting_of_annotations_property_new_api)
|
|||||||
test_manual_setting_of_annotations_property(false);
|
test_manual_setting_of_annotations_property(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
using NodePair = std::pair<osmium::unsigned_object_id_type,osmium::unsigned_object_id_type>;
|
using NodePair = std::pair<osmium::unsigned_object_id_type, osmium::unsigned_object_id_type>;
|
||||||
using NodePairToWayIDMap = std::map<NodePair,osmium::unsigned_object_id_type>;
|
using NodePairToWayIDMap = std::map<NodePair, osmium::unsigned_object_id_type>;
|
||||||
|
|
||||||
NodePairToWayIDMap read_node_pair_to_way_id_map(osmium::io::Reader &osm) {
|
NodePairToWayIDMap read_node_pair_to_way_id_map(osmium::io::Reader &osm)
|
||||||
struct H: public osmium::handler::Handler {
|
{
|
||||||
|
struct H : public osmium::handler::Handler
|
||||||
|
{
|
||||||
NodePairToWayIDMap ret;
|
NodePairToWayIDMap ret;
|
||||||
void way(const osmium::Way &way) {
|
void way(const osmium::Way &way)
|
||||||
|
{
|
||||||
auto first = osmium::unsigned_object_id_type(-1);
|
auto first = osmium::unsigned_object_id_type(-1);
|
||||||
for( const auto &n: way.nodes() ) {
|
for (const auto &n : way.nodes())
|
||||||
|
{
|
||||||
const auto second = n.positive_ref();
|
const auto second = n.positive_ref();
|
||||||
if( first != osmium::unsigned_object_id_type(-1) ) {
|
if (first != osmium::unsigned_object_id_type(-1))
|
||||||
|
{
|
||||||
ret[{first, second}] = way.id();
|
ret[{first, second}] = way.id();
|
||||||
}
|
}
|
||||||
first = second;
|
first = second;
|
||||||
@ -625,19 +630,17 @@ NodePairToWayIDMap read_node_pair_to_way_id_map(osmium::io::Reader &osm) {
|
|||||||
using LonLat = std::pair<float, float>;
|
using LonLat = std::pair<float, float>;
|
||||||
using LonLatVector = std::vector<LonLat>;
|
using LonLatVector = std::vector<LonLat>;
|
||||||
|
|
||||||
LonLatVector check_route_annotated_ways(
|
LonLatVector check_route_annotated_ways(std::vector<osrm::util::Coordinate> &coordinates,
|
||||||
std::vector<osrm::util::Coordinate> &coordinates,
|
osrm::OSRM &osrm,
|
||||||
osrm::OSRM &osrm,
|
NodePairToWayIDMap &node_pair_to_way_id_map,
|
||||||
NodePairToWayIDMap &node_pair_to_way_id_map,
|
bool use_steps)
|
||||||
bool use_steps
|
{
|
||||||
) {
|
|
||||||
LonLatVector ret;
|
LonLatVector ret;
|
||||||
using namespace osrm;
|
using namespace osrm;
|
||||||
(void) node_pair_to_way_id_map;
|
(void)node_pair_to_way_id_map;
|
||||||
RouteParameters params{};
|
RouteParameters params{};
|
||||||
params.annotations_type =
|
params.annotations_type =
|
||||||
RouteParameters::AnnotationsType::Nodes |
|
RouteParameters::AnnotationsType::Nodes | RouteParameters::AnnotationsType::Ways;
|
||||||
RouteParameters::AnnotationsType::Ways;
|
|
||||||
params.steps = use_steps;
|
params.steps = use_steps;
|
||||||
params.geometries = engine::api::RouteParameters::GeometriesType::GeoJSON;
|
params.geometries = engine::api::RouteParameters::GeometriesType::GeoJSON;
|
||||||
params.coordinates = coordinates;
|
params.coordinates = coordinates;
|
||||||
@ -649,37 +652,33 @@ LonLatVector check_route_annotated_ways(
|
|||||||
const auto code = json_result.values.at("code").get<json::String>().value;
|
const auto code = json_result.values.at("code").get<json::String>().value;
|
||||||
BOOST_CHECK_EQUAL(code, "Ok");
|
BOOST_CHECK_EQUAL(code, "Ok");
|
||||||
|
|
||||||
auto routes = json_result.values["routes"]
|
auto routes = json_result.values["routes"].get<json::Array>().values;
|
||||||
.get<json::Array>()
|
|
||||||
.values;
|
|
||||||
BOOST_CHECK_EQUAL(routes.size(), 1);
|
BOOST_CHECK_EQUAL(routes.size(), 1);
|
||||||
auto route = routes[0];
|
auto route = routes[0];
|
||||||
|
|
||||||
auto geom = route.get<json::Object>()
|
auto geom = route.get<json::Object>()
|
||||||
.values["geometry"]
|
.values["geometry"]
|
||||||
.get<json::Object>()
|
.get<json::Object>()
|
||||||
.values["coordinates"]
|
.values["coordinates"]
|
||||||
.get<json::Array>()
|
.get<json::Array>()
|
||||||
.values;
|
.values;
|
||||||
|
|
||||||
auto legs = route.get<json::Object>()
|
auto legs = route.get<json::Object>().values["legs"].get<json::Array>().values;
|
||||||
.values["legs"]
|
for (auto leg : legs)
|
||||||
.get<json::Array>()
|
{
|
||||||
.values;
|
if (use_steps)
|
||||||
for(auto leg: legs) {
|
{
|
||||||
if( use_steps ) {
|
auto steps = leg.get<json::Object>().values["steps"].get<json::Array>().values;
|
||||||
auto steps = leg.get<json::Object>()
|
for (auto step : steps)
|
||||||
.values["steps"]
|
{
|
||||||
.get<json::Array>()
|
|
||||||
.values;
|
|
||||||
for(auto step: steps) {
|
|
||||||
auto geom = step.get<json::Object>()
|
auto geom = step.get<json::Object>()
|
||||||
.values["geometry"]
|
.values["geometry"]
|
||||||
.get<json::Object>()
|
.get<json::Object>()
|
||||||
.values["coordinates"]
|
.values["coordinates"]
|
||||||
.get<json::Array>()
|
.get<json::Array>()
|
||||||
.values;
|
.values;
|
||||||
for(auto gleg: geom) {
|
for (auto gleg : geom)
|
||||||
|
{
|
||||||
auto p = gleg.get<json::Array>().values;
|
auto p = gleg.get<json::Array>().values;
|
||||||
auto lon = p[0].get<json::Number>().value;
|
auto lon = p[0].get<json::Number>().value;
|
||||||
auto lat = p[1].get<json::Number>().value;
|
auto lat = p[1].get<json::Number>().value;
|
||||||
@ -687,38 +686,30 @@ LonLatVector check_route_annotated_ways(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto annotations = leg.get<json::Object>()
|
auto annotations = leg.get<json::Object>().values["annotation"].get<json::Object>().values;
|
||||||
.values["annotation"]
|
|
||||||
.get<json::Object>()
|
|
||||||
.values;
|
|
||||||
BOOST_CHECK_EQUAL(annotations.size(), 2);
|
BOOST_CHECK_EQUAL(annotations.size(), 2);
|
||||||
|
|
||||||
auto nodes = annotations["nodes"]
|
auto nodes = annotations["nodes"].get<json::Array>().values;
|
||||||
.get<json::Array>()
|
auto ways = annotations["ways"].get<json::Array>().values;
|
||||||
.values;
|
|
||||||
auto ways = annotations["ways"]
|
|
||||||
.get<json::Array>()
|
|
||||||
.values;
|
|
||||||
|
|
||||||
BOOST_CHECK_GT(nodes.size(), 1);
|
BOOST_CHECK_GT(nodes.size(), 1);
|
||||||
BOOST_CHECK_EQUAL(nodes.size() - 1, ways.size());
|
BOOST_CHECK_EQUAL(nodes.size() - 1, ways.size());
|
||||||
auto nodes_it = nodes.cbegin();
|
auto nodes_it = nodes.cbegin();
|
||||||
auto ways_it = ways.cbegin();
|
auto ways_it = ways.cbegin();
|
||||||
osmium::unsigned_object_id_type first = nodes_it->get<json::Number>().value;
|
osmium::unsigned_object_id_type first = nodes_it->get<json::Number>().value;
|
||||||
for(nodes_it++; nodes_it != nodes.cend(); nodes_it++, ways_it++) {
|
for (nodes_it++; nodes_it != nodes.cend(); nodes_it++, ways_it++)
|
||||||
|
{
|
||||||
osmium::unsigned_object_id_type second = nodes_it->get<json::Number>().value;
|
osmium::unsigned_object_id_type second = nodes_it->get<json::Number>().value;
|
||||||
osmium::unsigned_object_id_type way_id = ways_it->get<json::Number>().value;
|
osmium::unsigned_object_id_type way_id = ways_it->get<json::Number>().value;
|
||||||
auto found = node_pair_to_way_id_map.find(NodePair(first, second));
|
auto found = node_pair_to_way_id_map.find(NodePair(first, second));
|
||||||
if( found == node_pair_to_way_id_map.end() )
|
if (found == node_pair_to_way_id_map.end())
|
||||||
found = node_pair_to_way_id_map.find(NodePair(second, first));
|
found = node_pair_to_way_id_map.find(NodePair(second, first));
|
||||||
BOOST_CHECK_MESSAGE(
|
BOOST_CHECK_MESSAGE(found != node_pair_to_way_id_map.end(),
|
||||||
found != node_pair_to_way_id_map.end(),
|
"The node pair not found: " << first << "<->" << second);
|
||||||
"The node pair not found: " << first << "<->" << second
|
BOOST_CHECK_MESSAGE(found->second == way_id,
|
||||||
);
|
"The node pair way doesn't correspond: " << first << "<->" << second
|
||||||
BOOST_CHECK_MESSAGE(
|
<< "=" << found->second
|
||||||
found->second == way_id,
|
<< "=?=" << way_id);
|
||||||
"The node pair way doesn't correspond: " << first << "<->" << second << "=" << found->second << "=?=" << way_id
|
|
||||||
);
|
|
||||||
first = second;
|
first = second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -737,21 +728,22 @@ BOOST_AUTO_TEST_CASE(test_route_annotated_ways)
|
|||||||
BOOST_TEST_MESSAGE("split_trace_locations with steps");
|
BOOST_TEST_MESSAGE("split_trace_locations with steps");
|
||||||
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
||||||
coordinates = get_locations_in_big_component();
|
coordinates = get_locations_in_big_component();
|
||||||
// auto coords =
|
// auto coords =
|
||||||
BOOST_TEST_MESSAGE("locations_in_big_component without steps");
|
BOOST_TEST_MESSAGE("locations_in_big_component without steps");
|
||||||
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, false);
|
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, false);
|
||||||
BOOST_TEST_MESSAGE("locations_in_big_component with steps");
|
BOOST_TEST_MESSAGE("locations_in_big_component with steps");
|
||||||
auto coords = check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
auto coords = check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
||||||
auto c1 = coords.cbegin(), c2 = coords.cend();
|
auto c1 = coords.cbegin(), c2 = coords.cend();
|
||||||
for( c1++, c2--; c1 != coords.cend() && c2 != coords.cbegin(); c1++, c2--) {
|
for (c1++, c2--; c1 != coords.cend() && c2 != coords.cbegin(); c1++, c2--)
|
||||||
if( c1 == c2 )
|
{
|
||||||
|
if (c1 == c2)
|
||||||
continue;
|
continue;
|
||||||
coordinates = Locations{{Longitude{c1->first},Latitude{c1->second}},{Longitude{c2->first},Latitude{c2->second}}};
|
coordinates = Locations{{Longitude{c1->first}, Latitude{c1->second}},
|
||||||
BOOST_TEST_MESSAGE(
|
{Longitude{c2->first}, Latitude{c2->second}}};
|
||||||
"Checking: <" <<
|
BOOST_TEST_MESSAGE("Checking: <" << osrm::util::toFloating(coordinates[0].lat) << ":"
|
||||||
osrm::util::toFloating(coordinates[0].lat) << ":" << osrm::util::toFloating(coordinates[0].lon) << "> -> <" <<
|
<< osrm::util::toFloating(coordinates[0].lon) << "> -> <"
|
||||||
osrm::util::toFloating(coordinates[1].lat) << ":" << osrm::util::toFloating(coordinates[1].lon) << ">"
|
<< osrm::util::toFloating(coordinates[1].lat) << ":"
|
||||||
);
|
<< osrm::util::toFloating(coordinates[1].lon) << ">");
|
||||||
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, false);
|
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, false);
|
||||||
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
check_route_annotated_ways(coordinates, osrm, node_pair_to_way_id_map, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user