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 #include "osmelement.h"
0008 
0009 #include <QLocale>
0010 
0011 using namespace KOSMIndoorMap;
0012 
0013 OSMElement::OSMElement() = default;
0014 OSMElement::OSMElement(OSM::Element e)
0015     : m_element(e)
0016 {
0017 }
0018 
0019 OSMElement::~OSMElement() = default;
0020 
0021 bool OSMElement::isNull() const
0022 {
0023     return m_element.type() == OSM::Type::Null;
0024 }
0025 
0026 QString OSMElement::name() const
0027 {
0028     return QString::fromUtf8(m_element.tagValue(OSM::Languages::fromQLocale(QLocale()), "name"));
0029 }
0030 
0031 QString OSMElement::url() const
0032 {
0033     return m_element.url();
0034 }
0035 
0036 QString OSMElement::tagValue(const QString &key) const
0037 {
0038     return QString::fromUtf8(m_element.tagValue(key.toUtf8().constData()));
0039 }
0040 
0041 OSM::Element OSMElement::element() const
0042 {
0043     return m_element;
0044 }
0045 
0046 #include "moc_osmelement.cpp"