Marble

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

KDE's Doxygen guidelines are available online.