Marble

KmlRefreshModeTagHandler.cpp
1 #include "KmlRefreshModeTagHandler.h"
2 #include "MarbleDebug.h"
3 #include "KmlElementDictionary.h"
4 #include "GeoDataLink.h"
5 #include "GeoParser.h"
6 
7 namespace Marble
8 {
9 namespace kml
10 {
11 KML_DEFINE_TAG_HANDLER( refreshMode )
12 
13 GeoNode* KmlrefreshModeTagHandler::parse( GeoParser& parser ) const
14 {
15  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_refreshMode)));
16 
17  GeoStackItem parentItem = parser.parentElement();
18  QString content = parser.readElementText().trimmed();
19  GeoDataLink::RefreshMode mode;
20 
21  if ( parentItem.is<GeoDataLink>()) {
22  if (content == QLatin1String("onChange")) {
23  mode = GeoDataLink::OnChange;
24  } else if (content == QLatin1String("onExpire")) {
25  mode = GeoDataLink::OnExpire;
26  } else if (content == QLatin1String("onInterval")) {
27  mode = GeoDataLink::OnInterval;
28  } else {
29  mode = GeoDataLink::OnChange;
30  mDebug() << "Value " << content << "set in kml file is invalid."
31  << "Value of <refreshMode> has been reset to onChange" ;
32  }
33  parentItem.nodeAs<GeoDataLink>()->setRefreshMode( mode );
34  }
35 
36  return nullptr;
37 }
38 
39 }
40 }
41 
QString trimmed() const const
Binds a QML item to a specific geodetic location in screen coordinates.
QDebug mDebug()
a function to replace qDebug() in Marble library code
Definition: MarbleDebug.cpp:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Sep 25 2023 03:50:19 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.