Marble

KmlDocumentTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <zimmermann@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "KmlDocumentTagHandler.h"
8
9#include "GeoDataDocument.h"
10#include "GeoDataParser.h"
11#include "KmlElementDictionary.h"
12#include "KmlObjectTagHandler.h"
13
14namespace Marble
15{
16namespace kml
17{
18KML_DEFINE_TAG_HANDLER(Document)
19
20GeoNode *KmlDocumentTagHandler::parse(GeoParser &parser) const
21{
22 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_Document)));
23
24 GeoStackItem parentItem = parser.parentElement();
25 if (!(parentItem.qualifiedName().first.isNull() && parentItem.qualifiedName().second.isNull())) {
26 // this happens if there is a parent element to the Document tag. We can work around that and simply expect that
27 // the new Document tag works like a Folder
28 if (parentItem.represents(kmlTag_Folder) || parentItem.represents(kmlTag_Document) || parentItem.represents(kmlTag_Create)) {
29 auto document = new GeoDataDocument;
30 KmlObjectTagHandler::parseIdentifiers(parser, document);
31 parentItem.nodeAs<GeoDataContainer>()->append(document);
32
33 return document;
34 } else if (parentItem.qualifiedName().first == QLatin1StringView(kmlTag_kml)) {
35 GeoDataDocument *doc = geoDataDoc(parser);
36 KmlObjectTagHandler::parseIdentifiers(parser, doc);
37 return doc;
38 }
39 }
40 return nullptr;
41}
42
43}
44}
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 Fri Nov 29 2024 11:55:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.