| 139 | { |
| 140 | |
| 141 | inline bool roadHasLowerClass(const util::NodeBasedEdgeData &from_data, |
| 142 | const util::NodeBasedEdgeData &to_data, |
| 143 | const util::NodeBasedEdgeData &compare_data) |
| 144 | { |
| 145 | // Check if a road has a strictly lower category |
| 146 | const auto from_classification = from_data.flags.road_classification; |
| 147 | const auto to_classification = to_data.flags.road_classification; |
| 148 | const auto compare_classification = compare_data.flags.road_classification; |
| 149 | const auto from_lanes_number = from_classification.GetNumberOfLanes(); |
| 150 | const auto compare_lanes_number = compare_classification.GetNumberOfLanes(); |
| 151 | |
| 152 | // 1) if the road has strictly less classification than the incoming candidate roads |
| 153 | // and has smaller number of lanes |
| 154 | const auto lanes_number_reduced = |
| 155 | compare_lanes_number > 0 && compare_lanes_number + 1 < from_lanes_number; |
| 156 | if (strictlyLess(compare_classification, from_classification) && |
| 157 | strictlyLess(compare_classification, to_classification) && lanes_number_reduced) |
| 158 | { |
| 159 | return true; |
| 160 | } |
| 161 | |
| 162 | // 2) if a link of the same category |
| 163 | if (isLinkTo(compare_classification, from_classification) && |
| 164 | isLinkTo(compare_classification, to_classification)) |
| 165 | { |
| 166 | return true; |
| 167 | } |
| 168 | |
| 169 | return false; |
| 170 | } |
| 171 | } // namespace |
| 172 | |
| 173 | template <typename IntersectionType> // works with Intersection and IntersectionView |
no test coverage detected