Marble

KmlDurationTagHandler.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
4//
5#include "KmlDurationTagHandler.h"
6
7#include "KmlElementDictionary.h"
8
9#include "GeoDataAnimatedUpdate.h"
10#include "GeoDataFlyTo.h"
11#include "GeoDataWait.h"
12#include "GeoParser.h"
13
14namespace Marble
15{
16namespace kml
17{
18
19KML_DEFINE_TAG_HANDLER_GX22(duration)
20
21GeoNode *KmldurationTagHandler::parse(GeoParser &parser) const
22{
23 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(kmlTag_duration)));
24
25 GeoStackItem parentItem = parser.parentElement();
26
27 qreal const duration = parser.readElementText().trimmed().toDouble();
28 if (parentItem.is<GeoDataFlyTo>()) {
29 parentItem.nodeAs<GeoDataFlyTo>()->setDuration(duration);
30 }
31 if (parentItem.is<GeoDataWait>()) {
32 parentItem.nodeAs<GeoDataWait>()->setDuration(duration);
33 }
34 if (parentItem.is<GeoDataAnimatedUpdate>()) {
35 parentItem.nodeAs<GeoDataAnimatedUpdate>()->setDuration(duration);
36 }
37 return nullptr;
38}
39
40}
41}
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 Fri Nov 29 2024 11:55:53 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.