Marble

DgmlHeadTagWriter.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 "DgmlHeadTagWriter.h"
7
8#include "DgmlElementDictionary.h"
9#include "GeoSceneHead.h"
10#include "GeoSceneIcon.h"
11#include "GeoSceneTypes.h"
12#include "GeoSceneZoom.h"
13#include "GeoWriter.h"
14
15namespace Marble
16{
17
18static GeoTagWriterRegistrar s_writerHead(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoSceneTypes::GeoSceneHeadType),
19 QString::fromLatin1(dgml::dgmlTag_nameSpace20)),
20 new DgmlHeadTagWriter());
21
22bool DgmlHeadTagWriter::write(const GeoNode *node, GeoWriter &writer) const
23{
24 const auto head = static_cast<const GeoSceneHead *>(node);
25 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Head));
26 writer.writeElement(QStringLiteral("name"), head->name());
27 writer.writeElement(QStringLiteral("target"), head->target());
28 writer.writeElement(QStringLiteral("theme"), head->theme());
29 writer.writeElement(QStringLiteral("visible"), head->visible() ? QStringLiteral("true") : QStringLiteral("false"));
30 writer.writeStartElement("description");
31 writer.writeCDATA(head->description());
32 writer.writeEndElement();
33
34 const auto &icon = static_cast<const GeoSceneIcon &>(*head->icon());
35 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Icon));
36 writer.writeAttribute("pixmap", icon.pixmap());
37 writer.writeEndElement();
38
39 const auto &zoom = static_cast<const GeoSceneZoom &>(*head->zoom());
40 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Zoom));
41 writer.writeElement(QStringLiteral("discrete"), zoom.discrete() ? QStringLiteral("true") : QStringLiteral("false"));
42 writer.writeTextElement("minimum", QString::number(zoom.minimum()));
43 writer.writeTextElement("maximum", QString::number(zoom.maximum()));
44 writer.writeEndElement();
45
46 writer.writeEndElement();
47
48 return true;
49}
50
51}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
QAction * zoom(const QObject *recvr, const char *slot, QObject *parent)
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.