check for empty on string_ref, rather than string itself
This commit is contained in:
parent
89080fb2b0
commit
4166b1ebbf
@ -77,8 +77,8 @@ TurnType::Enum IntersectionHandler::findBasicTurnType(const EdgeID via_edge,
|
||||
const auto &out_name_id =
|
||||
node_data_container.GetAnnotation(node_based_graph.GetEdgeData(road.eid).annotation_data)
|
||||
.name_id;
|
||||
const auto &in_name_empty = name_table.GetNameForID(in_name_id).to_string().empty();
|
||||
const auto &out_name_empty = name_table.GetNameForID(out_name_id).to_string().empty();
|
||||
const auto &in_name_empty = name_table.GetNameForID(in_name_id).empty();
|
||||
const auto &out_name_empty = name_table.GetNameForID(out_name_id).empty();
|
||||
|
||||
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||
in_name_id, out_name_id, name_table, street_name_suffix_table);
|
||||
|
@ -40,8 +40,8 @@ inline auto makeCheckRoadForName(const NameID name_id,
|
||||
.name_id;
|
||||
if (name_id == EMPTY_NAMEID || road_name_id == EMPTY_NAMEID)
|
||||
return true;
|
||||
const auto road_name_empty = name_table.GetNameForID(road_name_id).to_string().empty();
|
||||
const auto in_name_empty = name_table.GetNameForID(name_id).to_string().empty();
|
||||
const auto road_name_empty = name_table.GetNameForID(road_name_id).empty();
|
||||
const auto in_name_empty = name_table.GetNameForID(name_id).empty();
|
||||
if (in_name_empty || road_name_empty)
|
||||
return true;
|
||||
const auto requires_announcement =
|
||||
@ -480,9 +480,8 @@ bool MergableRoadDetector::IsTrafficIsland(const NodeID intersection_node,
|
||||
.name_id;
|
||||
if (road_name_id == EMPTY_NAMEID)
|
||||
return false;
|
||||
const auto &road_name_empty = name_table.GetNameForID(road_name_id).to_string().empty();
|
||||
const auto &required_name_empty =
|
||||
name_table.GetNameForID(required_name_id).to_string().empty();
|
||||
const auto &road_name_empty = name_table.GetNameForID(road_name_id).empty();
|
||||
const auto &required_name_empty = name_table.GetNameForID(required_name_id).empty();
|
||||
if (required_name_empty && road_name_empty)
|
||||
return false;
|
||||
return !util::guidance::requiresNameAnnounced(
|
||||
|
@ -386,14 +386,14 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
|
||||
//
|
||||
// 7 1
|
||||
// 0
|
||||
const auto &first_intersection_name =
|
||||
name_table.GetNameForID(first_intersection_data.name_id).to_string();
|
||||
const auto &second_intersection_name =
|
||||
name_table.GetNameForID(second_intersection_data.name_id).to_string();
|
||||
const auto &first_intersection_name_empty =
|
||||
name_table.GetNameForID(first_intersection_data.name_id).empty();
|
||||
const auto &second_intersection_name_empty =
|
||||
name_table.GetNameForID(second_intersection_data.name_id).empty();
|
||||
if (intersection[1].entry_allowed)
|
||||
{
|
||||
if (isMotorwayClass(intersection[1].eid, node_based_graph) &&
|
||||
!second_intersection_name.empty() && !first_intersection_name.empty() &&
|
||||
!second_intersection_name_empty && !first_intersection_name_empty &&
|
||||
first_second_same_name)
|
||||
{
|
||||
// circular order indicates a merge to the left (0-3 onto 4
|
||||
@ -418,7 +418,7 @@ Intersection MotorwayHandler::fromRamp(const EdgeID via_eid, Intersection inters
|
||||
{
|
||||
BOOST_ASSERT(intersection[2].entry_allowed);
|
||||
if (isMotorwayClass(intersection[2].eid, node_based_graph) &&
|
||||
!second_intersection_name.empty() && !first_intersection_name.empty() &&
|
||||
!second_intersection_name_empty && !first_intersection_name_empty &&
|
||||
first_second_same_name)
|
||||
{
|
||||
// circular order (5-0) onto 4
|
||||
|
@ -297,8 +297,9 @@ RoundaboutType RoundaboutHandler::getRoundaboutType(const NodeID nid) const
|
||||
|
||||
if (edge_data.name_id != EMPTY_NAMEID)
|
||||
{
|
||||
const auto &edge_name = name_table.GetNameForID(edge_data.name_id).to_string();
|
||||
if (!edge_name.empty())
|
||||
const auto &edge_name_empty =
|
||||
name_table.GetNameForID(edge_data.name_id).empty();
|
||||
if (!edge_name_empty)
|
||||
{
|
||||
|
||||
const auto announce = [&](unsigned id) {
|
||||
|
@ -475,9 +475,7 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
||||
// Name mismatch: check roads at `c` and `d` for same name
|
||||
const auto name_mismatch = [&](const NameID road_name_id) {
|
||||
const auto unnamed =
|
||||
road_name_id == EMPTY_NAMEID
|
||||
? true
|
||||
: name_table.GetNameForID(road_name_id).to_string().empty();
|
||||
road_name_id == EMPTY_NAMEID || name_table.GetNameForID(road_name_id).empty();
|
||||
|
||||
return unnamed ||
|
||||
util::guidance::requiresNameAnnounced(road_name_id, //
|
||||
@ -502,17 +500,18 @@ operator()(const NodeID /*nid*/, const EdgeID source_edge_id, Intersection inter
|
||||
node_data_container
|
||||
.GetAnnotation(node_based_graph.GetEdgeData(main_road.eid).annotation_data)
|
||||
.name_id;
|
||||
const auto main_road_name_empty = main_road_name_id == EMPTY_NAMEID ||
|
||||
name_table.GetNameForID(main_road_name_id).empty();
|
||||
const auto &sliproad_annotation =
|
||||
node_data_container.GetAnnotation(sliproad_edge_data.annotation_data);
|
||||
const auto &sliproad_name_empty =
|
||||
sliproad_annotation.name_id == EMPTY_NAMEID
|
||||
? true
|
||||
: name_table.GetNameForID(sliproad_annotation.name_id).to_string().empty();
|
||||
const auto &main_road_name = name_table.GetNameForID(main_road_name_id).to_string();
|
||||
const auto &candidate_road_name =
|
||||
name_table.GetNameForID(candidate_data.name_id).to_string();
|
||||
const auto sliproad_name_empty =
|
||||
sliproad_annotation.name_id == EMPTY_NAMEID ||
|
||||
name_table.GetNameForID(sliproad_annotation.name_id).empty();
|
||||
const auto candidate_road_name_empty =
|
||||
candidate_data.name_id == EMPTY_NAMEID ||
|
||||
name_table.GetNameForID(candidate_data.name_id).empty();
|
||||
if (!sliproad_edge_data.flags.road_classification.IsLinkClass() &&
|
||||
!sliproad_name_empty && !main_road_name.empty() && !candidate_road_name.empty() &&
|
||||
!sliproad_name_empty && !main_road_name_empty && !candidate_road_name_empty &&
|
||||
util::guidance::requiresNameAnnounced(main_road_name_id,
|
||||
sliproad_annotation.name_id,
|
||||
name_table,
|
||||
|
@ -200,9 +200,7 @@ bool TurnHandler::isObviousOfTwo(const EdgeID via_edge,
|
||||
const bool turn_is_perfectly_straight =
|
||||
angularDeviation(road.angle, STRAIGHT_ANGLE) < std::numeric_limits<double>::epsilon();
|
||||
const auto &via_name_empty =
|
||||
via_data.name_id == EMPTY_NAMEID
|
||||
? true
|
||||
: name_table.GetNameForID(via_data.name_id).to_string().empty();
|
||||
via_data.name_id == EMPTY_NAMEID || name_table.GetNameForID(via_data.name_id).empty();
|
||||
if (!via_name_empty)
|
||||
{
|
||||
const auto same_name = !util::guidance::requiresNameAnnounced(
|
||||
|
Loading…
Reference in New Issue
Block a user