Marble

KmlTourTagHandler.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2012 Illya Kovalevskyy <[email protected]>
4 //
5 
6 #include "KmlTourTagHandler.h"
7 #include "KmlObjectTagHandler.h"
8 #include "GeoDataTour.h"
9 #include "GeoDataDocument.h"
10 #include "GeoDataParser.h"
11 #include "KmlElementDictionary.h"
12 
13 namespace Marble
14 {
15 namespace kml
16 {
17 KML_DEFINE_TAG_HANDLER_GX22( Tour )
18 
19 GeoNode* KmlTourTagHandler::parse(GeoParser &parser) const
20 {
21  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_Tour)));
22 
23  GeoStackItem parentItem = parser.parentElement();
24 
25  GeoDataTour *tour = new GeoDataTour;
26  KmlObjectTagHandler::parseIdentifiers( parser, tour );
27 
28  if (parentItem.represents(kmlTag_Folder) || parentItem.represents(kmlTag_Document)) {
29  parentItem.nodeAs<GeoDataContainer>()->append(tour);
30  return tour;
31  } else if ( parentItem.qualifiedName().first == kmlTag_kml ) {
32  GeoDataDocument* doc = geoDataDoc(parser);
33  doc->append(tour);
34  return tour;
35  } else {
36  delete tour;
37  return nullptr;
38  }
39 
40  return nullptr;
41 }
42 
43 } // namespace kml
44 } // namespace Marble
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 Thu Sep 21 2023 04:12:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.