Marble

DgmlPaletteTagHandler.cpp
1/*
2 SPDX-FileCopyrightText: 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 SPDX-FileCopyrightText: 2008 Torsten Rahn <tackat@kde.org>
4 SPDX-FileCopyrightText: 2008 Henry de Valence <hdevalence@gmail.com>
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#include "DgmlPaletteTagHandler.h"
10
11#include "MarbleDebug.h"
12
13#include "DgmlAttributeDictionary.h"
14#include "DgmlAuxillaryDictionary.h"
15#include "DgmlElementDictionary.h"
16#include "GeoParser.h"
17#include "GeoSceneFilter.h"
18#include "GeoScenePalette.h"
19
20namespace Marble
21{
22namespace dgml
23{
24DGML_DEFINE_TAG_HANDLER(Palette)
25
26GeoNode *DgmlPaletteTagHandler::parse(GeoParser &parser) const
27{
28 // Check whether the tag is valid
29 Q_ASSERT(parser.isStartElement() && parser.isValidElement(QLatin1StringView(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)
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.