Marble

KmlFolderTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlFolderTagHandler.h"
8
9#include "GeoDataContainer.h"
10#include "GeoDataDocument.h"
11#include "GeoDataFolder.h"
12#include "GeoDataParser.h"
13#include "KmlElementDictionary.h"
14#include "KmlObjectTagHandler.h"
15
16namespace Marble
17{
18namespace kml
19{
20KML_DEFINE_TAG_HANDLER(Folder)
21
22GeoNode *KmlFolderTagHandler::parse(GeoParser &parser) const
23{
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_Folder)));
25
26 GeoStackItem parentItem = parser.parentElement();
27 auto folder = new GeoDataFolder;
28 KmlObjectTagHandler::parseIdentifiers(parser, folder);
29 if (parentItem.represents(kmlTag_Folder) || parentItem.represents(kmlTag_Document)) {
30 auto parentPtr = parentItem.nodeAs<GeoDataContainer>();
31 parentPtr->append(folder);
32
33 return folder;
34 } else if (parentItem.qualifiedName().first == QLatin1StringView(kmlTag_kml)) {
35 GeoDataDocument *doc = geoDataDoc(parser);
36 doc->append(folder);
37 return folder;
38 } else {
39 delete folder;
40 return nullptr;
41 }
42}
43
44}
45}
Binds a QML item to a specific geodetic location in screen coordinates.
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.