Marble

KmlSimpleArrayDataTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Niko Sams <niko.sams@gmail.com>
4//
5
6#include "KmlSimpleArrayDataTagHandler.h"
7
8#include "MarbleDebug.h"
9
10#include "KmlElementDictionary.h"
11
12#include "GeoDataExtendedData.h"
13#include "GeoDataSchemaData.h"
14#include "GeoDataSimpleArrayData.h"
15#include "GeoDataTypes.h"
16
17#include "GeoDocument.h"
18#include "GeoParser.h"
19
20namespace Marble
21{
22namespace kml
23{
24KML_DEFINE_TAG_HANDLER_GX22(SimpleArrayData)
25
26GeoNode *KmlSimpleArrayDataTagHandler::parse(GeoParser &parser) const
27{
28 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_SimpleArrayData)));
29
30 GeoStackItem parentItem = parser.parentElement();
31
32 if (parentItem.is<GeoDataExtendedData>()) {
33 auto arrayData = new GeoDataSimpleArrayData();
34 QString name = parser.attribute("name").trimmed();
35 parentItem.nodeAs<GeoDataExtendedData>()->setSimpleArrayData(name, arrayData);
36 return arrayData;
37 }
38
39 if (parentItem.is<GeoDataSchemaData>()) {
40 GeoDataExtendedData *extendedData = parentItem.nodeAs<GeoDataSchemaData>()->parent();
41 auto arrayData = new GeoDataSimpleArrayData;
42 const QString name = parser.attribute("name").trimmed();
43 extendedData->setSimpleArrayData(name, arrayData);
44 return arrayData;
45 }
46
47 return nullptr;
48}
49
50}
51}
QString name(GameStandardAction id)
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 Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.