Marble

KmlOverlayTagWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2012 Dennis Nienhüser <nienhueser@kde.org>
4//
5
6#include "KmlOverlayTagWriter.h"
7
8#include "GeoDataOverlay.h"
9#include "GeoDataTypes.h"
10#include "GeoWriter.h"
11#include "KmlColorStyleTagWriter.h"
12#include "KmlElementDictionary.h"
13
14namespace Marble
15{
16
17KmlOverlayTagWriter::KmlOverlayTagWriter(const QString &elementName)
18 : KmlFeatureTagWriter(elementName)
19{
20 // nothing to do
21}
22
23bool KmlOverlayTagWriter::writeMid(const Marble::GeoNode *node, GeoWriter &writer) const
24{
25 auto const *overlay = static_cast<const GeoDataOverlay *>(node);
26
27 QString const color = KmlColorStyleTagWriter::formatColor(overlay->color());
28 writer.writeOptionalElement(QLatin1String(kml::kmlTag_color), color, QStringLiteral("ffffffff"));
29 QString const drawOrder = QString::number(overlay->drawOrder());
30 writer.writeOptionalElement(QLatin1String(kml::kmlTag_drawOrder), drawOrder, QStringLiteral("0"));
31
32 if (!overlay->iconFile().isEmpty()) {
33 writer.writeStartElement(QString::fromUtf8(kml::kmlTag_Icon));
34 writer.writeStartElement(QString::fromUtf8(kml::kmlTag_href));
35 writer.writeCharacters(overlay->iconFile());
36 writer.writeEndElement();
37 writer.writeEndElement();
38 }
39
40 return true;
41}
42
43}
A shared base class for all classes that are mapped to a specific tag (ie.
Definition GeoDocument.h:35
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 Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.