File indexing completed on 2024-05-12 04:42:09

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_OSMELEMENT_H
0008 #define KOSMINDOORMAP_OSMELEMENT_H
0009 
0010 #include <osm/element.h>
0011 
0012 #include <QMetaType>
0013 #include <QUrl>
0014 
0015 namespace KOSMIndoorMap {
0016 
0017 /** QML wrapper around an OSM element. */
0018 class OSMElement
0019 {
0020     Q_GADGET
0021     Q_PROPERTY(bool isNull READ isNull)
0022     Q_PROPERTY(QString name READ name)
0023     Q_PROPERTY(QString url READ url)
0024     Q_PROPERTY(OSM::Element element READ element)
0025 public:
0026     OSMElement();
0027     explicit OSMElement(OSM::Element e);
0028     ~OSMElement();
0029 
0030     [[nodiscard]] bool isNull() const;
0031     [[nodiscard]] QString name() const;
0032     [[nodiscard]] QString url() const;
0033 
0034     [[nodiscard]] Q_INVOKABLE QString tagValue(const QString &key) const;
0035 
0036     // @internal
0037     [[nodiscard]] OSM::Element element() const;
0038 
0039 private:
0040     OSM::Element m_element;
0041 };
0042 
0043 }
0044 
0045 Q_DECLARE_METATYPE(KOSMIndoorMap::OSMElement)
0046 
0047 #endif // KOSMINDOORMAP_OSMELEMENT_H