Marble

KmlTourTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Illya Kovalevskyy <illya.kovalevskyy@gmail.com>
4//
5
6#include "KmlTourTagHandler.h"
7#include "GeoDataDocument.h"
8#include "GeoDataParser.h"
9#include "GeoDataTour.h"
10#include "KmlElementDictionary.h"
11#include "KmlObjectTagHandler.h"
12
13namespace Marble
14{
15namespace kml
16{
17KML_DEFINE_TAG_HANDLER_GX22(Tour)
18
19GeoNode *KmlTourTagHandler::parse(GeoParser &parser) const
20{
21 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_Tour)));
22
23 GeoStackItem parentItem = parser.parentElement();
24
25 auto 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 == QString::fromLatin1(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.
QString fromLatin1(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:52:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.