Marble

KmlDocumentTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <[email protected]>
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 
16 namespace Marble
17 {
18 namespace kml
19 {
20 KML_DEFINE_TAG_HANDLER(Document)
21 
22 GeoNode* 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-2023 The KDE developers.
Generated on Wed Oct 4 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.