Marble

DgmlSettingsTagWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2011 Utku Aydın <utkuaydin34@gmail.com>
4//
5
6#include "DgmlSettingsTagWriter.h"
7
8#include "DgmlElementDictionary.h"
9#include "GeoSceneProperty.h"
10#include "GeoSceneSettings.h"
11#include "GeoSceneTypes.h"
12#include "GeoWriter.h"
13
14namespace Marble
15{
16
17static GeoTagWriterRegistrar s_writerSettings(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoSceneTypes::GeoSceneSettingsType),
18 QString::fromLatin1(dgml::dgmlTag_nameSpace20)),
19 new DgmlSettingsTagWriter());
20
21bool DgmlSettingsTagWriter::write(const GeoNode *node, GeoWriter &writer) const
22{
23 const auto settings = static_cast<const GeoSceneSettings *>(node);
24 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Settings));
25
26 for (int i = 0; i < settings->allProperties().count(); ++i) {
27 const GeoSceneProperty *property = settings->allProperties().at(i);
28 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Property));
29 writer.writeAttribute(QStringLiteral("name"), property->name());
30 writer.writeElement(QString::fromLatin1(dgml::dgmlTag_Value), property->defaultValue() ? QStringLiteral("true") : QStringLiteral("false"));
31 writer.writeElement(QString::fromLatin1(dgml::dgmlTag_Available), property->available() ? QStringLiteral("true") : QStringLiteral("false"));
32 writer.writeEndElement();
33 }
34
35 writer.writeEndElement();
36 return true;
37}
38
39}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
Binds a QML item to a specific geodetic location in screen coordinates.
QString fromLatin1(QByteArrayView str)
QString fromUtf8(QByteArrayView str)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 8 2024 12:02:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.