• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • writers
  • kml
KmlUpdateTagWriter.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2014 Marek Hakala <hakala.marek@gmail.com>
9 //
10 
11 #include "KmlUpdateTagWriter.h"
12 #include "GeoDataUpdate.h"
13 #include "GeoDataTypes.h"
14 #include "GeoWriter.h"
15 #include "GeoDataAbstractView.h"
16 #include "KmlElementDictionary.h"
17 #include "KmlObjectTagWriter.h"
18 
19 namespace Marble
20 {
21 
22 static GeoTagWriterRegistrar s_writerUpdate( GeoTagWriter::QualifiedName( GeoDataTypes::GeoDataUpdateType,
23  kml::kmlTag_nameSpaceOgc22 ), new KmlUpdateTagWriter );
24 
25 bool KmlUpdateTagWriter::write( const GeoNode *node, GeoWriter& writer ) const
26 {
27  const GeoDataUpdate *update = static_cast<const GeoDataUpdate*>( node );
28  KmlObjectTagWriter::writeIdentifiers( writer, update );
29  writer.writeStartElement( kml::kmlTag_Update );
30  writer.writeOptionalElement( kml::kmlTag_targetHref, update->targetHref() );
31 
32  if( update->change() && update->change()->size() > 0 ){
33  writer.writeStartElement( kml::kmlTag_Change );
34  QVector<GeoDataFeature*>::ConstIterator it = update->change()->constBegin();
35  QVector<GeoDataFeature*>::ConstIterator const end = update->change()->constEnd();
36 
37  for ( ; it != end; ++it ){
38  writeElement( *it, writer );
39  }
40  writer.writeEndElement();
41  } else if( update->create() && update->create()->size() > 0 ){
42  writer.writeStartElement( kml::kmlTag_Create );
43  QVector<GeoDataFeature*>::ConstIterator it = update->create()->constBegin();
44  QVector<GeoDataFeature*>::ConstIterator const end = update->create()->constEnd();
45 
46  for ( ; it != end; ++it ){
47  writeElement( *it, writer );
48  }
49  writer.writeEndElement();
50  } else if( update->getDelete() && update->getDelete()->size() > 0 ){
51  writer.writeStartElement( kml::kmlTag_Delete );
52  QVector<GeoDataFeature*>::ConstIterator it = update->getDelete()->constBegin();
53  QVector<GeoDataFeature*>::ConstIterator const end = update->getDelete()->constEnd();
54 
55  for ( ; it != end; ++it ){
56  writeElement( *it, writer );
57  }
58  writer.writeEndElement();
59  }
60 
61  writer.writeEndElement();
62  return true;
63 }
64 
65 }
Marble::GeoWriter::writeOptionalElement
void writeOptionalElement(const QString &key, const QString &value, const QString &defaultValue=QString())
Convenience method to write value if value is not equal to defaultValue.
Definition: GeoWriter.cpp:98
GeoDataAbstractView.h
Marble::kml::kmlTag_Delete
const char * kmlTag_Delete
Definition: KmlElementDictionary.cpp:57
KmlObjectTagWriter.h
Marble::GeoDataUpdate::targetHref
QString targetHref() const
Definition: GeoDataUpdate.cpp:78
Marble::GeoDataContainer::constBegin
QVector< GeoDataFeature * >::ConstIterator constBegin() const
Definition: GeoDataContainer.cpp:341
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
Marble::s_writerUpdate
static GeoTagWriterRegistrar s_writerUpdate(GeoTagWriter::QualifiedName(GeoDataTypes::GeoDataUpdateType, kml::kmlTag_nameSpaceOgc22), new KmlUpdateTagWriter)
Marble::KmlObjectTagWriter::writeIdentifiers
static void writeIdentifiers(GeoWriter &writer, const GeoDataObject *object)
Parses the id and targetId attributes and assign their values to the given object.
Definition: KmlObjectTagWriter.cpp:15
GeoWriter.h
Marble::GeoDataTypes::GeoDataUpdateType
const char * GeoDataUpdateType
Definition: GeoDataTypes.cpp:95
Marble::GeoDataContainer::constEnd
QVector< GeoDataFeature * >::ConstIterator constEnd() const
Definition: GeoDataContainer.cpp:346
Marble::kml::kmlTag_Create
const char * kmlTag_Create
Definition: KmlElementDictionary.cpp:55
KmlElementDictionary.h
Marble::GeoWriter
Standard Marble way of writing XML This class is intended to be a standardised way of writing XML for...
Definition: GeoWriter.h:29
GeoDataUpdate.h
Marble::GeoDataUpdate::create
GeoDataCreate * create() const
Definition: GeoDataUpdate.cpp:102
Marble::GeoTagWriter::QualifiedName
QPair< QString, QString > QualifiedName
Object Name and Namespace Pair This type is intended to be used in a similar way to.
Definition: GeoTagWriter.h:48
Marble::GeoDataContainer::size
int size() const
size of the container
Definition: GeoDataContainer.cpp:286
Marble::kml::kmlTag_Change
const char * kmlTag_Change
Definition: KmlElementDictionary.cpp:47
KmlUpdateTagWriter.h
Marble::kml::kmlTag_nameSpaceOgc22
const char * kmlTag_nameSpaceOgc22
Definition: KmlElementDictionary.cpp:34
Marble::GeoTagWriter::writeElement
bool writeElement(const GeoNode *object, GeoWriter &writer) const
Definition: GeoTagWriter.cpp:29
QVector
Marble::KmlUpdateTagWriter::write
virtual bool write(const GeoNode *node, GeoWriter &writer) const
Definition: KmlUpdateTagWriter.cpp:25
Marble::GeoDataUpdate
Definition: GeoDataUpdate.h:25
Marble::GeoDataUpdate::getDelete
GeoDataDelete * getDelete() const
Definition: GeoDataUpdate.cpp:116
Marble::GeoDataUpdate::change
GeoDataChange * change() const
Definition: GeoDataUpdate.cpp:88
GeoDataTypes.h
Marble::kml::kmlTag_Update
const char * kmlTag_Update
Definition: KmlElementDictionary.cpp:189
QXmlStreamWriter::writeEndElement
void writeEndElement()
QXmlStreamWriter::writeStartElement
void writeStartElement(const QString &qualifiedName)
Marble::kml::kmlTag_targetHref
const char * kmlTag_targetHref
Definition: KmlElementDictionary.cpp:180
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:40 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal