File indexing completed on 2024-11-17 04:17:22
0001 /* 0002 SPDX-FileCopyrightText: 2020 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KOSMINDOORMAP_EQUIPMENTMODEL_H 0008 #define KOSMINDOORMAP_EQUIPMENTMODEL_H 0009 0010 #include "kosmindoormap_export.h" 0011 0012 #include <KOSMIndoorMap/MapData> 0013 #include <KOSMIndoorMap/OverlaySource> 0014 0015 namespace KOSMIndoorMap { 0016 0017 /** Elevator or escalator element. */ 0018 class KOSMINDOORMAP_EXPORT Equipment 0019 { 0020 public: 0021 enum Type { Elevator, Escalator }; 0022 std::vector<OSM::Element> sourceElements; 0023 std::vector<int> levels; 0024 OSM::UniqueElement syntheticElement; 0025 Type type; 0026 0027 float distanceTo(const OSM::DataSet &dataSet, float lat, float lon) const; 0028 }; 0029 0030 /** Overlay source for elevators and escalators. */ 0031 class KOSMINDOORMAP_EXPORT EquipmentModel : public AbstractOverlaySource 0032 { 0033 Q_OBJECT 0034 Q_PROPERTY(KOSMIndoorMap::MapData mapData READ mapData WRITE setMapData NOTIFY mapDataChanged) 0035 public: 0036 explicit EquipmentModel(QObject *parent = nullptr); 0037 ~EquipmentModel(); 0038 0039 MapData mapData() const; 0040 void setMapData(const MapData &data); 0041 0042 void forEach(int floorLevel, const std::function<void(OSM::Element, int)> &func) const override; 0043 void hiddenElements(std::vector<OSM::Element> &elems) const override; 0044 0045 Q_SIGNALS: 0046 void mapDataChanged(); 0047 0048 protected: 0049 void createSyntheticElement(Equipment &eq) const; 0050 0051 MapData m_data; 0052 std::vector<Equipment> m_equipment; 0053 0054 struct { 0055 OSM::TagKey building; 0056 OSM::TagKey buildling_part; 0057 OSM::TagKey conveying; 0058 OSM::TagKey elevator; 0059 OSM::TagKey highway; 0060 OSM::TagKey indoor; 0061 OSM::TagKey level; 0062 OSM::TagKey room; 0063 OSM::TagKey stairwell; 0064 0065 OSM::TagKey mxoid; 0066 OSM::TagKey realtimeStatus; 0067 } m_tagKeys; 0068 0069 private: 0070 void findEquipment(); 0071 }; 0072 0073 } 0074 0075 #endif // KOSMINDOORMAP_EQUIPMENTMODEL_H