• 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
KmlPhotoOverlayWriter.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 2012 Shou Ya <shouyatf@gmail.com>
9 // Copyright 2012 Dennis Nienhüser <earthwings@gentoo.org>
10 //
11 
12 #include "KmlPhotoOverlayWriter.h"
13 
14 #include "GeoDataPhotoOverlay.h"
15 #include "GeoDataTypes.h"
16 #include "GeoWriter.h"
17 #include "KmlElementDictionary.h"
18 
19 namespace Marble
20 {
21 
22 static GeoTagWriterRegistrar s_writerLookAt(
23  GeoTagWriter::QualifiedName( GeoDataTypes::GeoDataPhotoOverlayType,
24  kml::kmlTag_nameSpaceOgc22 ),
25  new KmlPhotoOverlayWriter );
26 
27 KmlPhotoOverlayWriter::KmlPhotoOverlayWriter() : KmlOverlayTagWriter( kml::kmlTag_PhotoOverlay )
28 {
29  // nothing to do
30 }
31 
32 bool KmlPhotoOverlayWriter::writeMid( const GeoNode *node, GeoWriter &writer ) const
33 {
34  KmlOverlayTagWriter::writeMid( node, writer );
35 
36  const GeoDataPhotoOverlay *photo_overlay =
37  static_cast<const GeoDataPhotoOverlay*>( node );
38 
39  // rotation
40  QString const rotation = QString::number( photo_overlay->rotation(), 'f', 3 );
41  writer.writeOptionalElement( kml::kmlTag_rotation, rotation, "0.000" );
42 
43  // ViewVolume
44  writer.writeStartElement( kml::kmlTag_ViewVolume );
45  writer.writeOptionalElement<qreal>( kml::kmlTag_leftFov, photo_overlay->viewVolume().leftFov(), 0 );
46  writer.writeOptionalElement<qreal>( kml::kmlTag_rightFov, photo_overlay->viewVolume().rightFov(), 0 );
47  writer.writeOptionalElement<qreal>( kml::kmlTag_bottomFov, photo_overlay->viewVolume().bottomFov(), 0 );
48  writer.writeOptionalElement<qreal>( kml::kmlTag_topFov, photo_overlay->viewVolume().topFov(), 0 );
49  writer.writeOptionalElement<qreal>( kml::kmlTag_near, photo_overlay->viewVolume().near(), 0 );
50  writer.writeEndElement();
51 
52  // ImagePyramid
53  writer.writeStartElement( kml::kmlTag_ImagePyramid );
54  writer.writeOptionalElement<int>( kml::kmlTag_tileSize, photo_overlay->imagePyramid().tileSize(), 256 );
55  writer.writeOptionalElement<int>( kml::kmlTag_maxWidth, photo_overlay->imagePyramid().maxWidth() );
56  writer.writeOptionalElement<int>( kml::kmlTag_maxHeight, photo_overlay->imagePyramid().maxHeight() );
57 
58  switch ( photo_overlay->imagePyramid().gridOrigin() )
59  {
60  case GeoDataImagePyramid::LowerLeft:
61  writer.writeElement( kml::kmlTag_gridOrigin, "lowerLeft" );
62  break;
63  case GeoDataImagePyramid::UpperLeft:
64  writer.writeElement( kml::kmlTag_gridOrigin, "upperLeft" );
65  break;
66  }
67  writer.writeEndElement();
68 
69  // Point
70  writeElement( &photo_overlay->point(), writer );
71 
72  // shape
73  switch ( photo_overlay->shape() )
74  {
75  case GeoDataPhotoOverlay::Rectangle:
76  break;
77  case GeoDataPhotoOverlay::Cylinder:
78  writer.writeElement( kml::kmlTag_shape, "cylinder" );
79  break;
80  case GeoDataPhotoOverlay::Sphere:
81  writer.writeElement( kml::kmlTag_shape, "sphere" );
82  break;
83  }
84 
85  return true;
86 }
87 
88 }
Marble::kml::kmlTag_rightFov
const char * kmlTag_rightFov
Definition: KmlElementDictionary.cpp:155
Marble::GeoDataPhotoOverlay::imagePyramid
GeoDataImagePyramid & imagePyramid()
Definition: GeoDataPhotoOverlay.cpp:106
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::s_writerLookAt
static GeoTagWriterRegistrar s_writerLookAt(GeoTagWriter::QualifiedName(GeoDataTypes::GeoDataGroundOverlayType, kml::kmlTag_nameSpaceOgc22), new KmlGroundOverlayWriter)
Marble::kml::kmlTag_bottomFov
const char * kmlTag_bottomFov
Definition: KmlElementDictionary.cpp:45
Marble::GeoDataPhotoOverlay::shape
Shape shape() const
Definition: GeoDataPhotoOverlay.cpp:136
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
Marble::kml::kmlTag_near
const char * kmlTag_near
Definition: KmlElementDictionary.cpp:127
Marble::GeoDataViewVolume::topFov
qreal topFov() const
Definition: GeoDataViewVolume.cpp:113
Marble::KmlOverlayTagWriter
Definition: KmlOverlayTagWriter.h:23
Marble::kml::kmlTag_PhotoOverlay
const char * kmlTag_PhotoOverlay
Definition: KmlElementDictionary.cpp:142
KmlPhotoOverlayWriter.h
Marble::kml::kmlTag_maxWidth
const char * kmlTag_maxWidth
Definition: KmlElementDictionary.cpp:117
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::GeoDataPhotoOverlay::viewVolume
GeoDataViewVolume & viewVolume()
Definition: GeoDataPhotoOverlay.cpp:91
Marble::GeoDataPhotoOverlay::Cylinder
Definition: GeoDataPhotoOverlay.h:44
QString::number
QString number(int n, int base)
Marble::GeoDataViewVolume::rightFov
qreal rightFov() const
Definition: GeoDataViewVolume.cpp:93
Marble::GeoDataImagePyramid::gridOrigin
GridOrigin gridOrigin() const
Definition: GeoDataImagePyramid.cpp:110
KmlElementDictionary.h
Marble::kml::kmlTag_ViewVolume
const char * kmlTag_ViewVolume
Definition: KmlElementDictionary.cpp:196
Marble::kml::kmlTag_tileSize
const char * kmlTag_tileSize
Definition: KmlElementDictionary.cpp:184
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
Marble::KmlPhotoOverlayWriter::KmlPhotoOverlayWriter
KmlPhotoOverlayWriter()
Definition: KmlPhotoOverlayWriter.cpp:27
Marble::GeoDataPhotoOverlay
Definition: GeoDataPhotoOverlay.h:27
Marble::GeoDataImagePyramid::maxHeight
int maxHeight() const
Definition: GeoDataImagePyramid.cpp:100
Marble::GeoDataPhotoOverlay::rotation
qreal rotation() const
Definition: GeoDataPhotoOverlay.cpp:81
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
QString
Marble::GeoDataPhotoOverlay::point
GeoDataPoint & point()
Definition: GeoDataPhotoOverlay.cpp:121
Marble::kml::kmlTag_topFov
const char * kmlTag_topFov
Definition: KmlElementDictionary.cpp:188
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
Marble::GeoDataImagePyramid::maxWidth
int maxWidth() const
Definition: GeoDataImagePyramid.cpp:90
Marble::GeoDataViewVolume::near
qreal near() const
Definition: GeoDataViewVolume.cpp:123
Marble::kml::kmlTag_leftFov
const char * kmlTag_leftFov
Definition: KmlElementDictionary.cpp:98
Marble::KmlOverlayTagWriter::writeMid
virtual bool writeMid(const GeoNode *node, GeoWriter &writer) const =0
Definition: KmlOverlayTagWriter.cpp:28
Marble::GeoDataViewVolume::bottomFov
qreal bottomFov() const
Definition: GeoDataViewVolume.cpp:103
Marble::GeoDataPhotoOverlay::Sphere
Definition: GeoDataPhotoOverlay.h:45
Marble::kml::kmlTag_shape
const char * kmlTag_shape
Definition: KmlElementDictionary.cpp:166
Marble::GeoDataImagePyramid::UpperLeft
Definition: GeoDataImagePyramid.h:40
GeoDataTypes.h
Marble::GeoDataPhotoOverlay::Rectangle
Definition: GeoDataPhotoOverlay.h:43
GeoDataPhotoOverlay.h
Marble::GeoDataViewVolume::leftFov
qreal leftFov() const
Definition: GeoDataViewVolume.cpp:83
Marble::kml::kmlTag_ImagePyramid
const char * kmlTag_ImagePyramid
Definition: KmlElementDictionary.cpp:87
Marble::kml::kmlTag_maxHeight
const char * kmlTag_maxHeight
Definition: KmlElementDictionary.cpp:114
Marble::KmlPhotoOverlayWriter::writeMid
bool writeMid(const GeoNode *node, GeoWriter &writer) const
Definition: KmlPhotoOverlayWriter.cpp:32
QXmlStreamWriter::writeEndElement
void writeEndElement()
QXmlStreamWriter::writeStartElement
void writeStartElement(const QString &qualifiedName)
Marble::GeoDataImagePyramid::LowerLeft
Definition: GeoDataImagePyramid.h:39
Marble::GeoDataTypes::GeoDataPhotoOverlayType
const char * GeoDataPhotoOverlayType
Definition: GeoDataTypes.cpp:65
Marble::kml::kmlTag_rotation
const char * kmlTag_rotation
Definition: KmlElementDictionary.cpp:157
Marble::kml::kmlTag_gridOrigin
const char * kmlTag_gridOrigin
Definition: KmlElementDictionary.cpp:78
Marble::GeoDataImagePyramid::tileSize
int tileSize() const
Definition: GeoDataImagePyramid.cpp:80
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