Marble

KmlTrackTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Guillaume Martres <smarter@ubuntu.com>
4//
5
6#include "KmlTrackTagHandler.h"
7#include "GeoDataMultiGeometry.h"
8#include "GeoDataMultiTrack.h"
9#include "GeoDataPlacemark.h"
10#include "GeoDataTrack.h"
11#include "KmlElementDictionary.h"
12#include "KmlObjectTagHandler.h"
13#include "MarbleDebug.h"
14
15namespace Marble
16{
17namespace kml
18{
19
20KML_DEFINE_TAG_HANDLER_GX22(Track)
21
22GeoNode *KmlTrackTagHandler::parse(GeoParser &parser) const
23{
24 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_Track)));
25
26 GeoStackItem parentItem = parser.parentElement();
27 auto track = new GeoDataTrack();
28 KmlObjectTagHandler::parseIdentifiers(parser, track);
29
30 if (parentItem.represents(kmlTag_Placemark)) {
31 parentItem.nodeAs<GeoDataPlacemark>()->setGeometry(track);
32 return track;
33 } else if (parentItem.represents(kmlTag_MultiTrack)) {
34 parentItem.nodeAs<GeoDataMultiTrack>()->append(track);
35 return track;
36 } else if (parentItem.represents(kmlTag_MultiGeometry)) {
37 parentItem.nodeAs<GeoDataMultiGeometry>()->append(track);
38 return track;
39 } else {
40 delete track;
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 Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.