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

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • writers
  • kml
KmlPlacemarkTagWriter.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 2009 Andrew Manson <g.real.ate@gmail.com>
9 //
10 
11 #include "KmlPlacemarkTagWriter.h"
12 
13 #include "KmlElementDictionary.h"
14 #include "GeoDataPlacemark.h"
15 #include "GeoDataExtendedData.h"
16 #include "GeoDataTimeStamp.h"
17 #include "GeoDataTypes.h"
18 #include "GeoWriter.h"
19 
20 namespace Marble
21 {
22 
23 //needs to handle a specific doctype. different versions different writer classes?
24 //don't use the tag dictionary for tag names, because with the writer we are using
25 // the object type strings instead
26 //FIXME: USE object strings provided by idis
27 static GeoTagWriterRegistrar s_writerPlacemark( GeoTagWriter::QualifiedName(GeoDataTypes::GeoDataPlacemarkType,
28  kml::kmlTag_nameSpace22),
29  new KmlPlacemarkTagWriter() );
30 
31 
32 bool KmlPlacemarkTagWriter::write( const GeoNode *node,
33  GeoWriter& writer ) const
34 {
35  const GeoDataPlacemark *placemark = static_cast<const GeoDataPlacemark*>(node);
36  writer.writeStartElement( kml::kmlTag_Placemark );
37 
38  writer.writeOptionalElement( "name", placemark->name() );
39  writer.writeElement( kml::kmlTag_visibility, QString::number( placemark->isVisible() ) );
40  writer.writeOptionalElement( kml::kmlTag_styleUrl, placemark->styleUrl() );
41 
42  if( !placemark->description().isEmpty() ) {
43  writer.writeStartElement( "description" );
44  if( placemark->descriptionIsCDATA() ) {
45  writer.writeCDATA( placemark->description() );
46  } else {
47  writer.writeCharacters( placemark->description() );
48  }
49  writer.writeEndElement();
50  }
51 
52 
53  if( !placemark->extendedData().isEmpty() ){
54  writeElement( &placemark->extendedData(), writer );
55  }
56 
57  if( placemark->geometry() ) {
58  writeElement( placemark->geometry(), writer );
59  }
60 
61  if( placemark->lookAt() ){
62  writeElement( placemark->lookAt(), writer );
63  }
64 
65  if( placemark->timeStamp().when().isValid() )
66  writeElement( &placemark->timeStamp(), writer );
67 
68  writer.writeEndElement();
69  return true;
70 }
71 
72 }
Marble::GeoDataPlacemark::lookAt
const GeoDataLookAt * lookAt() const
Returns GeoDataLookAt object if lookAt is setup earlier otherwise It will convert GeoDataCoordinates ...
Definition: GeoDataPlacemark.cpp:68
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
Marble::GeoDataFeature::timeStamp
GeoDataTimeStamp & timeStamp() const
Return the timestamp of the feature.
Definition: GeoDataFeature.cpp:613
Marble::kml::kmlTag_visibility
const char * kmlTag_visibility
Definition: KmlElementDictionary.cpp:197
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
GeoDataTimeStamp.h
Marble::GeoDataTypes::GeoDataPlacemarkType
const char * GeoDataPlacemarkType
Definition: GeoDataTypes.cpp:62
Marble::s_writerPlacemark
static GeoTagWriterRegistrar s_writerPlacemark(GeoTagWriter::QualifiedName(GeoDataTypes::GeoDataPlacemarkType, kml::kmlTag_nameSpace22), new KmlPlacemarkTagWriter())
Marble::GeoDataFeature::isVisible
bool isVisible() const
Return whether this feature is visible or not.
Definition: GeoDataFeature.cpp:581
Marble::GeoDataFeature::description
QString description() const
Return the text description of the feature.
Definition: GeoDataFeature.cpp:513
Marble::kml::kmlTag_nameSpace22
const char * kmlTag_nameSpace22
Definition: KmlElementDictionary.cpp:33
GeoDataExtendedData.h
Marble::GeoDataFeature::styleUrl
QString styleUrl() const
Return the styleUrl of the feature.
Definition: GeoDataFeature.cpp:551
Marble::GeoDataPlacemark::geometry
GeoDataGeometry * geometry() const
The geometry of the GeoDataPlacemark is to be rendered to the marble map along with the icon at the c...
Definition: GeoDataPlacemark.cpp:63
Marble::kml::kmlTag_styleUrl
const char * kmlTag_styleUrl
Definition: KmlElementDictionary.cpp:179
Marble::GeoWriter::writeElement
void writeElement(const QString &namespaceUri, const QString &key, const QString &value)
Convenience method to write value with key prefixed format namespaceUri.
Definition: GeoWriter.cpp:84
GeoWriter.h
Marble::kml::kmlTag_Placemark
const char * kmlTag_Placemark
Definition: KmlElementDictionary.cpp:143
Marble::GeoDataExtendedData::isEmpty
bool isEmpty() const
return wthethe QHash is empty or not
Definition: GeoDataExtendedData.cpp:79
Marble::GeoDataFeature::descriptionIsCDATA
bool descriptionIsCDATA() const
test if the description is CDATA or not CDATA allows for special characters to be included in XML and...
Definition: GeoDataFeature.cpp:524
KmlElementDictionary.h
Marble::GeoDataTimeStamp::when
QDateTime when() const
return the when time of timestamp
Definition: GeoDataTimeStamp.cpp:53
Marble::GeoWriter
Standard Marble way of writing XML This class is intended to be a standardised way of writing XML for...
Definition: GeoWriter.h:28
Marble::KmlPlacemarkTagWriter::write
virtual bool write(const GeoNode *node, GeoWriter &writer) const
Definition: KmlPlacemarkTagWriter.cpp:32
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
GeoDataPlacemark.h
KmlPlacemarkTagWriter.h
Marble::GeoTagWriter::writeElement
bool writeElement(const GeoNode *object, GeoWriter &writer) const
Definition: GeoTagWriter.cpp:29
Marble::GeoDataFeature::name
QString name() const
The name of the feature.
Definition: GeoDataFeature.cpp:480
GeoDataTypes.h
Marble::GeoDataFeature::extendedData
GeoDataExtendedData & extendedData() const
Return the ExtendedData assigned to the feature.
Definition: GeoDataFeature.cpp:653
Marble::GeoDataPlacemark
a class representing a point of interest on the map
Definition: GeoDataPlacemark.h:54
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:50 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
  • kstars
  • libkdeedu
  •   keduvocdocument
  • 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