Move debug printer code to own header
This commit is contained in:
committed by
Patrick Niklaus
parent
83d7a57b73
commit
e7bb612050
@@ -46,6 +46,20 @@ inline bool hasValidLanes(const guidance::IntermediateIntersection &intersection
|
||||
return intersection.lanes.lanes_in_turn > 0;
|
||||
}
|
||||
|
||||
inline util::json::Array toJSON(const extractor::TurnLaneType::Mask lane_type)
|
||||
{
|
||||
util::json::Array result;
|
||||
std::bitset<8 * sizeof(extractor::TurnLaneType::Mask)> mask(lane_type);
|
||||
for (auto index : util::irange<std::size_t>(0, extractor::TurnLaneType::NUM_TYPES))
|
||||
{
|
||||
if (mask[index])
|
||||
{
|
||||
result.values.push_back(extractor::TurnLaneType::laneTypeToName(index));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
util::json::Array lanesFromIntersection(const guidance::IntermediateIntersection &intersection)
|
||||
{
|
||||
BOOST_ASSERT(intersection.lanes.lanes_in_turn >= 1);
|
||||
@@ -56,7 +70,7 @@ util::json::Array lanesFromIntersection(const guidance::IntermediateIntersection
|
||||
{
|
||||
--lane_id;
|
||||
util::json::Object lane;
|
||||
lane.values["indications"] = extractor::TurnLaneType::toJsonArray(lane_desc);
|
||||
lane.values["indications"] = toJSON(lane_desc);
|
||||
if (lane_id >= intersection.lanes.first_lane_from_the_right &&
|
||||
lane_id <
|
||||
intersection.lanes.first_lane_from_the_right + intersection.lanes.lanes_in_turn)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "util/coordinate_calculation.hpp"
|
||||
#include "util/guidance/name_announcements.hpp"
|
||||
#include "util/log.hpp"
|
||||
#include "util/to_osm_link.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@@ -177,7 +178,7 @@ bool RoundaboutHandler::qualifiesAsRoundaboutIntersection(
|
||||
// but is at least not random.
|
||||
if (src_coordinate == next_coordinate)
|
||||
{
|
||||
util::Log(logDEBUG) << "Zero length segment at " << next_coordinate
|
||||
util::Log(logDEBUG) << "Zero length segment at " << toOSMLink(next_coordinate)
|
||||
<< " could cause invalid roundabout exit bearings";
|
||||
BOOST_ASSERT(std::abs(result.back()) <= 0.1);
|
||||
}
|
||||
@@ -210,7 +211,9 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
|
||||
std::unordered_set<unsigned> connected_names;
|
||||
|
||||
const auto getNextOnRoundabout = [this, &roundabout_name_ids, &connected_names](
|
||||
const NodeID node, const bool roundabout, const bool circular) {
|
||||
const NodeID node,
|
||||
const bool roundabout,
|
||||
const bool circular) {
|
||||
BOOST_ASSERT(roundabout != circular);
|
||||
EdgeID continue_edge = SPECIAL_EDGEID;
|
||||
for (const auto edge_id : node_based_graph.GetAdjacentEdgeRange(node))
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "guidance/turn_classification.hpp"
|
||||
|
||||
#include "util/to_osm_link.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@@ -56,8 +58,10 @@ classifyIntersection(Intersection intersection, const osrm::util::Coordinate &lo
|
||||
if (road.entry_allowed)
|
||||
{
|
||||
if (!entry_class.activate(number))
|
||||
{
|
||||
util::Log(logWARNING) << "Road " << number << " was not activated at "
|
||||
<< location;
|
||||
<< util::toOSMLink(location);
|
||||
}
|
||||
}
|
||||
|
||||
auto discrete_bearing_class =
|
||||
@@ -74,8 +78,10 @@ classifyIntersection(Intersection intersection, const osrm::util::Coordinate &lo
|
||||
if (road.entry_allowed)
|
||||
{
|
||||
if (!entry_class.activate(number))
|
||||
{
|
||||
util::Log(logWARNING) << "Road " << number << " was not activated at "
|
||||
<< location;
|
||||
<< util::toOSMLink(location);
|
||||
}
|
||||
}
|
||||
bearing_class.add(std::round(road.bearing));
|
||||
++number;
|
||||
|
||||
@@ -76,7 +76,7 @@ LaneDataVector laneDataFromDescription(TurnLaneDescription turn_lane_description
|
||||
return (test_mask & full_mask) == test_mask;
|
||||
};
|
||||
|
||||
for (std::size_t shift = 0; shift < TurnLaneType::detail::num_supported_lane_types; ++shift)
|
||||
for (const auto shift : util::irange<std::size_t>(0, TurnLaneType::NUM_TYPES))
|
||||
{
|
||||
TurnLaneType::Mask mask = 1 << shift;
|
||||
if (isSet(mask))
|
||||
|
||||
@@ -43,16 +43,5 @@ bool operator==(const FloatCoordinate lhs, const FloatCoordinate rhs)
|
||||
bool operator!=(const Coordinate lhs, const Coordinate rhs) { return !(lhs == rhs); }
|
||||
bool operator!=(const FloatCoordinate lhs, const FloatCoordinate rhs) { return !(lhs == rhs); }
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const Coordinate coordinate)
|
||||
{
|
||||
out << std::setprecision(12) << "(lon:" << toFloating(coordinate.lon)
|
||||
<< ", lat:" << toFloating(coordinate.lat) << ")";
|
||||
return out;
|
||||
}
|
||||
std::ostream &operator<<(std::ostream &out, const FloatCoordinate coordinate)
|
||||
{
|
||||
out << std::setprecision(12) << "(lon:" << coordinate.lon << ", lat:" << coordinate.lat << ")";
|
||||
return out;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user