Marble

KmlNetworkLinkControlTagWriter.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2014 Marek Hakala <hakala.marek@gmail.com>
4//
5
6#include "KmlNetworkLinkControlTagWriter.h"
7
8#include "GeoDataNetworkLinkControl.h"
9#include "GeoDataTypes.h"
10#include "GeoDataUpdate.h"
11#include "GeoWriter.h"
12#include "KmlElementDictionary.h"
13
14#include <QDateTime>
15
16namespace Marble
17{
18
19static GeoTagWriterRegistrar s_writerNetworkLinkControl(GeoTagWriter::QualifiedName(QString::fromLatin1(GeoDataTypes::GeoDataNetworkLinkControlType),
20 QString::fromLatin1(kml::kmlTag_nameSpaceOgc22)),
21 new KmlNetworkLinkControlTagWriter);
22
23bool KmlNetworkLinkControlTagWriter::write(const GeoNode *node, GeoWriter &writer) const
24{
25 const auto networkLinkControl = static_cast<const GeoDataNetworkLinkControl *>(node);
26
27 writer.writeStartElement(QString::fromUtf8(kml::kmlTag_NetworkLinkControl));
28 writer.writeOptionalElement(QLatin1String(kml::kmlTag_minRefreshPeriod), QString::number(networkLinkControl->minRefreshPeriod()), QStringLiteral("1"));
29 writer.writeOptionalElement(QLatin1String(kml::kmlTag_maxSessionLength), QString::number(networkLinkControl->maxSessionLength()), QStringLiteral("2"));
30 writer.writeOptionalElement(QLatin1String(kml::kmlTag_cookie), networkLinkControl->cookie());
31 writer.writeOptionalElement(QLatin1String(kml::kmlTag_message), networkLinkControl->message());
32 writer.writeOptionalElement(QLatin1String(kml::kmlTag_linkName), networkLinkControl->linkName());
33 writer.writeOptionalElement(QLatin1String(kml::kmlTag_linkDescription), networkLinkControl->linkDescription());
34
35 writer.writeStartElement(QString::fromUtf8(kml::kmlTag_linkSnippet));
36
37 if (networkLinkControl->maxLines() > 0) {
38 writer.writeAttribute("maxLines", QString::number(networkLinkControl->maxLines()));
39 }
40
41 writer.writeCharacters(networkLinkControl->linkSnippet());
42 writer.writeEndElement();
43
44 writer.writeOptionalElement(QLatin1String(kml::kmlTag_expires), networkLinkControl->expires().toString(Qt::ISODate));
45 writeElement(&networkLinkControl->update(), writer);
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.
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.