Marble

DgmlPaletteTagHandler.cpp
1 /*
2  SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <[email protected]>
3  SPDX-FileCopyrightText: 2008 Torsten Rahn <[email protected]>
4  SPDX-FileCopyrightText: 2008 Henry de Valence <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #include "DgmlPaletteTagHandler.h"
10 
11 #include "MarbleDebug.h"
12 
13 #include "DgmlElementDictionary.h"
14 #include "DgmlAttributeDictionary.h"
15 #include "DgmlAuxillaryDictionary.h"
16 #include "GeoParser.h"
17 #include "GeoSceneFilter.h"
18 #include "GeoScenePalette.h"
19 
20 namespace Marble
21 {
22 namespace dgml
23 {
24 DGML_DEFINE_TAG_HANDLER(Palette)
25 
26 GeoNode* DgmlPaletteTagHandler::parse(GeoParser& parser) const
27 {
28  // Check whether the tag is valid
29  Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1String(dgmlTag_Palette)));
30 
31  QString type = parser.attribute(dgmlAttr_type).toLower().trimmed();
32  QString file = parser.readElementText().trimmed();
33 
34  GeoScenePalette *palette = nullptr;
35 
36  // Checking for parent palette
37  GeoStackItem parentItem = parser.parentElement();
38  if (parentItem.represents(dgmlTag_Filter)) {
39  palette = new GeoScenePalette( type, file );
40  parentItem.nodeAs<GeoSceneFilter>()->addPalette( palette );
41  }
42 
43  return palette;
44 }
45 
46 }
47 }
Type type(const QSqlDatabase &db)
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 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.