KOSMIndoorMap

routingarea.cpp
1/*
2 SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#include "routingarea.h"
7#include "logging.h"
8
9#include <algorithm>
10
11using namespace KOSMIndoorRouting;
12
13// ### keep sorted by area type
14struct {
15 AreaType area;
16 AreaFlags flags;
17} constexpr inline const area_type_flag_map[] = {
18 { AreaType::Unwalkable, {} },
19 { AreaType::Stairs, AreaFlag::Stairs },
20 { AreaType::Elevator, AreaFlag::Elevator },
21 { AreaType::Escalator, AreaFlag::Escalator },
22 { AreaType::MovingWalkway, AreaFlag::Escalator },
23 { AreaType::TactilePaving, AreaFlag::Walkable },
24 { AreaType::StreetCrossing, AreaFlag::Walkable },
25 { AreaType::Ramp, AreaFlag::Walkable },
26 { AreaType::Room, AreaFlag::Walkable },
27 { AreaType::Walkable, AreaFlag::Walkable },
28};
29
30AreaFlags KOSMIndoorRouting::flagsForAreaType(AreaType area)
31{
32 const auto it = std::lower_bound(std::begin(area_type_flag_map), std::end(area_type_flag_map), area, [](auto lhs, auto rhs) {
33 return lhs.area < rhs;
34 });
35 if (it != std::end(area_type_flag_map) && (*it).area == area) {
36 return (*it).flags;
37 }
38
39 qCWarning(Log) << "no area flags for area type defined:" << qToUnderlying(area);
40 return {};
41}
42
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.