Marble

KmlRefreshModeTagHandler.cpp
1#include "KmlRefreshModeTagHandler.h"
2#include "GeoDataLink.h"
3#include "GeoParser.h"
4#include "KmlElementDictionary.h"
5#include "MarbleDebug.h"
6
7namespace Marble
8{
9namespace kml
10{
11KML_DEFINE_TAG_HANDLER(refreshMode)
12
13GeoNode *KmlrefreshModeTagHandler::parse(GeoParser &parser) const
14{
15 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(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 == QLatin1StringView("onChange")) {
23 mode = GeoDataLink::OnChange;
24 } else if (content == QLatin1StringView("onExpire")) {
25 mode = GeoDataLink::OnExpire;
26 } else if (content == QLatin1StringView("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}
Binds a QML item to a specific geodetic location in screen coordinates.
QString trimmed() const const
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.