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 "MarbleDebug.h"
10
11#include "KmlElementDictionary.h"
12#include "KmlObjectTagHandler.h"
13#include "GeoDataDocument.h"
14#include "GeoDataParser.h"
15
16namespace Marble
17{
18namespace kml
19{
20KML_DEFINE_TAG_HANDLER(Document)
21
22GeoNode* KmlDocumentTagHandler::parse(GeoParser& parser) const
23{
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_Document)));
25
26 GeoStackItem parentItem = parser.parentElement();
27 if( !(parentItem.qualifiedName().first.isNull() && parentItem.qualifiedName().second.isNull()) ) {
28 // this happens if there is a parent element to the Document tag. We can work around that and simply expect that
29 // the new Document tag works like a Folder
30 if( parentItem.represents( kmlTag_Folder ) || parentItem.represents( kmlTag_Document ) || parentItem.represents( kmlTag_Create ) ) {
31 GeoDataDocument *document = new GeoDataDocument;
32 KmlObjectTagHandler::parseIdentifiers( parser, document );
33 parentItem.nodeAs<GeoDataContainer>()->append( document );
34
35 return document;
36 }
37 else if (parentItem.qualifiedName().first == QLatin1String(kmlTag_kml)) {
38 GeoDataDocument* doc = geoDataDoc( parser );
39 KmlObjectTagHandler::parseIdentifiers( parser, doc );
40 return doc;
41 }
42 }
43 return nullptr;
44}
45
46}
47}
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 Jul 26 2024 11:57:57 by doxygen 1.11.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.