Marble

DgmlItemTagWriter.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 "DgmlItemTagWriter.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_writerItem(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoSceneTypes::GeoSceneItemType),
19 QString::fromLatin1(dgml::dgmlTag_nameSpace20)),
20 new DgmlItemTagWriter());
21
22bool DgmlItemTagWriter::write(const GeoNode *node, GeoWriter &writer) const
23{
24 const auto item = static_cast<const GeoSceneItem *>(node);
25
26 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Item));
27 writer.writeAttribute(QStringLiteral("name"), item->name());
28
29 writer.writeStartElement(QString::fromUtf8(dgml::dgmlTag_Icon));
30 if (!item->icon()->pixmap().isEmpty()) {
31 writer.writeAttribute("pixmap", item->icon()->pixmap());
32 } else if (item->icon()->color().isValid()) {
33 writer.writeAttribute(QStringLiteral("color"), item->icon()->color().name());
34 }
35 writer.writeEndElement();
36 writer.writeElement(QStringLiteral("text"), item->text());
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)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:52:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.