Marble

DgmlSectionTagWriter.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 "DgmlSectionTagWriter.h"
7
8#include "DgmlElementDictionary.h"
9#include "GeoSceneIcon.h"
10#include "GeoSceneItem.h"
11#include "GeoSceneSection.h"
12#include "GeoSceneTypes.h"
13#include "GeoWriter.h"
14
15namespace Marble
16{
17
18static GeoTagWriterRegistrar s_writerSection(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoSceneTypes::GeoSceneSectionType),
19 QString::fromLatin1(dgml::dgmlTag_nameSpace20)),
20 new DgmlSectionTagWriter());
21
22bool DgmlSectionTagWriter::write(const GeoNode *node, GeoWriter &writer) const
23{
24 const auto section = static_cast<const GeoSceneSection *>(node);
25
26 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Section));
27 writer.writeAttribute(QStringLiteral("name"), section->name());
28 writer.writeAttribute("checkable", section->checkable() ? QStringLiteral("true") : QStringLiteral("false"));
29 writer.writeAttribute("connect", section->connectTo());
30 writer.writeAttribute("spacing", QString::number(section->spacing()));
31 writer.writeElement(QString::fromLatin1(dgml::dgmlTag_Heading), section->heading());
32
33 for (int i = 0; i < section->items().count(); ++i) {
34 GeoSceneItem *item = section->items().at(i);
35 writeElement(item, writer);
36 }
37
38 writer.writeEndElement();
39 return true;
40}
41
42}
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)
QString number(double n, char format, int precision)
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.