| 260 | } |
| 261 | |
| 262 | void RoadAccessTagProcessor::Process(OsmElement const & elem) |
| 263 | { |
| 264 | auto const getAccessType = [&](vector<TagMapping const *> const & mapping) |
| 265 | { |
| 266 | bool isPermit = false; |
| 267 | for (auto const tagMapping : mapping) |
| 268 | { |
| 269 | auto const accessType = GetAccessTypeFromMapping(elem, tagMapping); |
| 270 | if (accessType != kEmptyAccess) |
| 271 | { |
| 272 | switch (accessType) |
| 273 | { |
| 274 | case RoadAccess::Type::Permit: isPermit = true; break; |
| 275 | case RoadAccess::Type::Locked: return RoadAccess::Type::Private; |
| 276 | default: |
| 277 | // Patch: (permit + access=no) -> private. |
| 278 | if (accessType == RoadAccess::Type::No && isPermit) |
| 279 | return RoadAccess::Type::Private; |
| 280 | return accessType; |
| 281 | } |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | return kEmptyAccess; |
| 286 | }; |
| 287 | |
| 288 | auto op = getAccessType(m_accessMappings); |
| 289 | if (op != kEmptyAccess) |
| 290 | { |
| 291 | if (op == RoadAccess::Type::Yes) |
| 292 | return; |
| 293 | |
| 294 | if (op == RoadAccess::Type::Destination) |
| 295 | { |
| 296 | for (auto const & tag : elem.m_tags) |
| 297 | if (kHighwaysWhereIgnoreAccessDestination.count(tag)) |
| 298 | return; |
| 299 | } |
| 300 | |
| 301 | if (elem.IsNode()) |
| 302 | { |
| 303 | // OSM mapping workaround. |
| 304 | // https://github.com/organicmaps/organicmaps/issues/4837 |
| 305 | if (op == RoadAccess::Type::No && m_vehicleType == VehicleType::Bicycle && elem.GetTag("highway") == "crossing") |
| 306 | { |
| 307 | // Skip this "barrier". It blocks cycling on main road via this kind of crossings. |
| 308 | // Example here: https://overpass-turbo.eu/s/1sSx |
| 309 | |
| 310 | /// @todo I suppose that we should allow _main_ road, but block real _crossing_ Way via this Node. |
| 311 | /// But I have no idea how we can easily implement it right now ... |
| 312 | } |
| 313 | else |
| 314 | m_barriersWithAccessTag.Add(elem.m_id, {elem.m_lat, elem.m_lon}, op); |
| 315 | } |
| 316 | else if (elem.IsWay()) |
| 317 | m_wayToAccess.Add(elem.m_id, op); |
| 318 | return; |
| 319 | } |
no test coverage detected