Marble

KmlMultiTrackTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Thibaut Gridel <tgridel@free.fr>
4
5#include "KmlMultiTrackTagHandler.h"
6
7#include "MarbleDebug.h"
8
9#include "GeoDataMultiGeometry.h"
10#include "GeoDataMultiTrack.h"
11#include "GeoDataPlacemark.h"
12#include "KmlElementDictionary.h"
13#include "KmlObjectTagHandler.h"
14
15#include "GeoParser.h"
16
17namespace Marble
18{
19namespace kml
20{
21
22KML_DEFINE_TAG_HANDLER_GX22(MultiTrack)
23
24GeoNode *KmlMultiTrackTagHandler::parse(GeoParser &parser) const
25{
26 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_MultiTrack)));
27
28 GeoStackItem parentItem = parser.parentElement();
29
30 auto geom = new GeoDataMultiTrack;
31 KmlObjectTagHandler::parseIdentifiers(parser, geom);
32 if (parentItem.represents(kmlTag_Placemark)) {
33 parentItem.nodeAs<GeoDataPlacemark>()->setGeometry(geom);
34 return parentItem.nodeAs<GeoDataPlacemark>()->geometry();
35
36 } else if (parentItem.represents(kmlTag_MultiGeometry)) {
37 parentItem.nodeAs<GeoDataMultiGeometry>()->append(geom);
38 return geom;
39 } else {
40 delete geom;
41 return nullptr;
42 }
43}
44
45}
46}
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 Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.