Marble

DgmlDiscreteTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2008 Nikolas Zimmermann <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "DgmlDiscreteTagHandler.h"
8 
9 #include "DgmlElementDictionary.h"
10 #include "DgmlAuxillaryDictionary.h"
11 #include "GeoParser.h"
12 #include "GeoSceneZoom.h"
13 
14 namespace Marble
15 {
16 namespace dgml
17 {
18 DGML_DEFINE_TAG_HANDLER(Discrete)
19 
20 GeoNode* DgmlDiscreteTagHandler::parse(GeoParser& parser) const
21 {
22  // Check whether the tag is valid
23  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Discrete)));
24 
25  // Checking for parent item
26  GeoStackItem parentItem = parser.parentElement();
27  if (parentItem.represents(dgmlTag_Zoom)) {
28  QString parsedText = parser.readElementText().toLower().trimmed();
29  parentItem.nodeAs<GeoSceneZoom>()->setDiscrete(parsedText == dgmlValue_true || parsedText == dgmlValue_on);
30  }
31 
32  return nullptr;
33 }
34 
35 }
36 }
QString trimmed() const const
Binds a QML item to a specific geodetic location in screen coordinates.
QString toLower() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Sep 21 2023 04:12:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.