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(GeoSceneTypes::GeoSceneHeadType, dgml::dgmlTag_nameSpace20), new DgmlHeadTagWriter());
19
20bool DgmlHeadTagWriter::write(const GeoNode *node, GeoWriter &writer) const
21{
22 const auto head = static_cast<const GeoSceneHead *>(node);
23 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Head));
24 writer.writeElement("name", head->name());
25 writer.writeElement("target", head->target());
26 writer.writeElement("theme", head->theme());
27 writer.writeElement("visible", head->visible() ? "true" : "false");
28 writer.writeStartElement("description");
29 writer.writeCDATA(head->description());
30 writer.writeEndElement();
31
32 const auto &icon = static_cast<const GeoSceneIcon &>(*head->icon());
33 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Icon));
34 writer.writeAttribute("pixmap", icon.pixmap());
35 writer.writeEndElement();
36
37 const auto &zoom = static_cast<const GeoSceneZoom &>(*head->zoom());
38 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Zoom));
39 writer.writeElement("discrete", zoom.discrete() ? "true" : "false");
40 writer.writeTextElement("minimum", QString::number(zoom.minimum()));
41 writer.writeTextElement("maximum", QString::number(zoom.maximum()));
42 writer.writeEndElement();
43
44 writer.writeEndElement();
45
46 return true;
47}
48
49}
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 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 Fri Oct 11 2024 12:14:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.