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(
20 GeoTagWriter::QualifiedName( GeoDataTypes::GeoDataNetworkLinkControlType,
21 kml::kmlTag_nameSpaceOgc22 ),
22 new KmlNetworkLinkControlTagWriter );
23
24bool KmlNetworkLinkControlTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
25{
26 const GeoDataNetworkLinkControl *networkLinkControl = static_cast<const GeoDataNetworkLinkControl*>( node );
27
28 writer.writeStartElement( kml::kmlTag_NetworkLinkControl );
29 writer.writeOptionalElement( kml::kmlTag_minRefreshPeriod, QString::number( networkLinkControl->minRefreshPeriod() ), "1" );
30 writer.writeOptionalElement( kml::kmlTag_maxSessionLength, QString::number( networkLinkControl->maxSessionLength() ), "2" );
31 writer.writeOptionalElement( kml::kmlTag_cookie, networkLinkControl->cookie() );
32 writer.writeOptionalElement( kml::kmlTag_message, networkLinkControl->message() );
33 writer.writeOptionalElement( kml::kmlTag_linkName, networkLinkControl->linkName() );
34 writer.writeOptionalElement( kml::kmlTag_linkDescription, networkLinkControl->linkDescription() );
35
36 writer.writeStartElement( kml::kmlTag_linkSnippet );
37
38 if( networkLinkControl->maxLines() > 0 ) {
39 writer.writeAttribute( "maxLines", QString::number( networkLinkControl->maxLines() ) );
40 }
41
42 writer.writeCharacters( networkLinkControl->linkSnippet() );
43 writer.writeEndElement();
44
45 writer.writeOptionalElement( kml::kmlTag_expires, networkLinkControl->expires().toString( Qt::ISODate ) );
46 writeElement( &networkLinkControl->update(), writer );
47 writer.writeEndElement();
48
49 return true;
50}
51
52}
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 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 Apr 27 2024 22:12:40 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.