Marble

KmlUpdateTagWriter.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 "KmlUpdateTagWriter.h"
7#include "GeoDataUpdate.h"
8#include "GeoDataCreate.h"
9#include "GeoDataDelete.h"
10#include "GeoDataChange.h"
11#include "GeoDataTypes.h"
12#include "GeoWriter.h"
13#include "GeoDataAbstractView.h"
14#include "KmlElementDictionary.h"
15#include "KmlObjectTagWriter.h"
16
17namespace Marble
18{
19
20static GeoTagWriterRegistrar s_writerUpdate( GeoTagWriter::QualifiedName( GeoDataTypes::GeoDataUpdateType,
21 kml::kmlTag_nameSpaceOgc22 ), new KmlUpdateTagWriter );
22
23bool KmlUpdateTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
24{
25 const GeoDataUpdate *update = static_cast<const GeoDataUpdate*>( node );
26 KmlObjectTagWriter::writeIdentifiers( writer, update );
27 writer.writeStartElement( kml::kmlTag_Update );
28 writer.writeElement( kml::kmlTag_targetHref, update->targetHref() );
29
30 if( update->change() && update->change()->size() > 0 ){
31 writer.writeStartElement( kml::kmlTag_Change );
32 QVector<GeoDataFeature*>::ConstIterator it = update->change()->constBegin();
33 QVector<GeoDataFeature*>::ConstIterator const end = update->change()->constEnd();
34
35 for ( ; it != end; ++it ){
36 writeElement( *it, writer );
37 }
38 writer.writeEndElement();
39 } else if( update->create() && update->create()->size() > 0 ){
40 writer.writeStartElement( kml::kmlTag_Create );
41 QVector<GeoDataFeature*>::ConstIterator it = update->create()->constBegin();
42 QVector<GeoDataFeature*>::ConstIterator const end = update->create()->constEnd();
43
44 for ( ; it != end; ++it ){
45 writeElement( *it, writer );
46 }
47 writer.writeEndElement();
48 } else if( update->getDelete() && update->getDelete()->size() > 0 ){
49 writer.writeStartElement( kml::kmlTag_Delete );
50 QVector<GeoDataFeature*>::ConstIterator it = update->getDelete()->constBegin();
51 QVector<GeoDataFeature*>::ConstIterator const end = update->getDelete()->constEnd();
52
53 for ( ; it != end; ++it ){
54 writeElement( *it, writer );
55 }
56 writer.writeEndElement();
57 }
58
59 writer.writeEndElement();
60 return true;
61}
62
63}
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
void update(Part *part, const QByteArray &data, qint64 dataSize)
const QList< QKeySequence > & end()
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:18:17 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.