Marble

KmlViewRefreshModeTagHandler.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2013 Mayank Madan <[email protected]>
4 //
5 
6 #include "KmlViewRefreshModeTagHandler.h"
7 
8 #include "GeoDataLink.h"
9 #include "GeoParser.h"
10 #include "KmlElementDictionary.h"
11 
12 namespace Marble
13 {
14 namespace kml
15 {
16 
17 KML_DEFINE_TAG_HANDLER( viewRefreshMode )
18 
19 GeoNode* KmlviewRefreshModeTagHandler::parse( GeoParser& parser ) const
20 {
21  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(kmlTag_viewRefreshMode)));
22 
23  GeoStackItem parentItem = parser.parentElement();
24  if ( parentItem.is<GeoDataLink>() ) {
25  QString content = parser.readElementText().trimmed();
26 
27  GeoDataLink::ViewRefreshMode mode = GeoDataLink::Never;
28  if (content == QLatin1String("onStop")) {
29  mode = GeoDataLink::OnStop;
30  } else if (content == QLatin1String("onRegion")) {
31  mode = GeoDataLink::OnRegion;
32  } else if (content == QLatin1String("onRequest")) {
33  mode = GeoDataLink::OnRequest;
34  }
35 
36  parentItem.nodeAs<GeoDataLink>()->setViewRefreshMode( mode );
37  }
38 
39  return nullptr;
40 }
41 
42 }
43 }
QString trimmed() const const
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 Wed Oct 4 2023 04:09:42 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.