Marble

KmlStyleUrlTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlStyleUrlTagHandler.h"
8
9#include <QString>
10
11#include "GeoDataFeature.h"
12#include "GeoDataStyleMap.h"
13#include "KmlElementDictionary.h"
14#include "MarbleDebug.h"
15
16#include "GeoParser.h"
17
18namespace Marble
19{
20namespace kml
21{
22KML_DEFINE_TAG_HANDLER(styleUrl)
23
24GeoNode *KmlstyleUrlTagHandler::parse(GeoParser &parser) const
25{
26 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_styleUrl)));
27
28 GeoStackItem parentItem = parser.parentElement();
29 GeoStackItem grandParentItem = parser.parentElement();
30
31 if (parentItem.represents(kmlTag_Pair)) {
32 QString content = parser.readElementText().trimmed();
33
34 QString key = parentItem.nodeAs<GeoDataStyleMap>()->lastKey();
35 (*parentItem.nodeAs<GeoDataStyleMap>())[key] = content;
36 parentItem.nodeAs<GeoDataStyleMap>()->setLastKey(QString());
37
38 } else if (parentItem.is<GeoDataFeature>()) {
39 QString content = parser.readElementText().trimmed();
40
41 parentItem.nodeAs<GeoDataFeature>()->setStyleUrl(content);
42 }
43 return nullptr;
44}
45
46}
47}
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.