• 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
  • dgml
DgmlTextureTagWriter.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 2011 Utku Aydın <utkuaydin34@gmail.com>
9 //
10 
11 #include "DgmlTextureTagWriter.h"
12 
13 #include "GeoSceneTypes.h"
14 #include "GeoWriter.h"
15 #include "GeoSceneTiled.h"
16 #include "DownloadPolicy.h"
17 #include "DgmlElementDictionary.h"
18 #include "ServerLayout.h"
19 
20 namespace Marble
21 {
22 
23 static GeoTagWriterRegistrar s_writerTexture( GeoTagWriter::QualifiedName( GeoSceneTypes::GeoSceneTiledType, dgml::dgmlTag_nameSpace20 ),
24  new DgmlTextureTagWriter() );
25 
26 bool DgmlTextureTagWriter::write(const GeoNode *node, GeoWriter& writer) const
27 {
28  const GeoSceneTiled *texture = static_cast<const GeoSceneTiled*>( node );
29  writer.writeStartElement( dgml::dgmlTag_Texture );
30  writer.writeAttribute( "name", texture->name() );
31  writer.writeAttribute( "expire", QString::number( texture->expire() ) );
32 
33  writer.writeStartElement( dgml::dgmlTag_SourceDir );
34  writer.writeAttribute( "format", texture->fileFormat() );
35  if( texture->expire() ) {
36  writer.writeAttribute( "expire", QString::number( texture->expire() ) );
37  }
38  writer.writeCharacters( texture->sourceDir() );
39  writer.writeEndElement();
40  writer.writeOptionalElement( dgml::dgmlTag_InstallMap, texture->installMap() );
41 
42  writer.writeStartElement( dgml::dgmlTag_StorageLayout );
43  if( texture->hasMaximumTileLevel() )
44  {
45  writer.writeAttribute( "maximumTileLevel", QString::number( texture->maximumTileLevel() ) );
46  writer.writeAttribute( "levelZeroColumns", QString::number( texture->levelZeroColumns() ) );
47  writer.writeAttribute( "levelZeroRows", QString::number( texture->levelZeroRows() ) );
48  writer.writeAttribute( "mode", texture->serverLayout()->name() );
49  }
50  writer.writeEndElement();
51 
52  if ( texture->downloadUrls().size() > 0 )
53  {
54  for( int i = 0; i < texture->downloadUrls().size(); ++i )
55  {
56  QString protocol = texture->downloadUrls().at(i).toString().left( texture->downloadUrls().at(i).toString().indexOf( ':' ) );
57  QString host = QString( texture->downloadUrls().at(i).host() );
58  QString path = QString( texture->downloadUrls().at(i).path() );
59 #if QT_VERSION < 0x050000
60  QString query = QUrl::fromEncoded( texture->downloadUrls().at(i).encodedQuery() ).toString();
61 #else
62  QString query = texture->downloadUrls().at(i).query(QUrl::FullyEncoded);
63 #endif
64 
65  writer.writeStartElement( dgml::dgmlTag_DownloadUrl );
66  writer.writeAttribute( "protocol", protocol );
67  writer.writeAttribute( "host", host );
68  writer.writeAttribute( "path", path );
69  writer.writeAttribute( "query", query );
70  writer.writeEndElement();
71  }
72  }
73 
74  foreach( DownloadPolicy const *policy, texture->downloadPolicies() )
75  {
76  writer.writeStartElement( dgml::dgmlTag_DownloadPolicy );
77 
78  if( policy->key().usage() == DownloadBrowse )
79  {
80  writer.writeAttribute( "usage", "Browse" );
81  writer.writeAttribute( "maximumConnections", QString::number( policy->maximumConnections() ) );
82  }
83 
84  else if( policy->key().usage() == DownloadBulk )
85  {
86  writer.writeAttribute( "usage", "Bulk" );
87  writer.writeAttribute( "maximumConnections", QString::number( policy->maximumConnections() ) );
88  }
89 
90  writer.writeEndElement();
91  }
92 
93  writer.writeStartElement( dgml::dgmlTag_Projection );
94  if( texture->projection() == GeoSceneTiled::Mercator ) {
95  writer.writeAttribute( "name", "Mercator" );
96  } else if ( texture->projection() == GeoSceneTiled::Equirectangular ) {
97  writer.writeAttribute( "name", "Equirectangular" );
98  }
99  writer.writeEndElement();
100 
101  writer.writeEndElement();
102  return true;
103 }
104 
105 }
Marble::dgml::dgmlTag_DownloadUrl
const char * dgmlTag_DownloadUrl
Definition: DgmlElementDictionary.cpp:44
GeoSceneTypes.h
Marble::dgml::dgmlTag_StorageLayout
const char * dgmlTag_StorageLayout
Definition: DgmlElementDictionary.cpp:68
Marble::GeoSceneTiled::installMap
QString installMap() const
Definition: GeoSceneTiled.cpp:66
Marble::GeoSceneTiled::Equirectangular
Definition: GeoSceneTiled.h:47
Marble::GeoSceneTypes::GeoSceneTiledType
const char * GeoSceneTiledType
Definition: GeoSceneTypes.cpp:33
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::DownloadPolicy
Definition: DownloadPolicy.h:55
Marble::dgml::dgmlTag_DownloadPolicy
const char * dgmlTag_DownloadPolicy
Definition: DgmlElementDictionary.cpp:43
Marble::GeoNode
A shared base class for all classes that are mapped to a specific tag (ie.
Definition: GeoDocument.h:60
Marble::ServerLayout::name
virtual QString name() const =0
Returns the name of the server layout to be used as the value in the mode attribute in the DGML file...
Marble::dgml::dgmlTag_Projection
const char * dgmlTag_Projection
Definition: DgmlElementDictionary.cpp:62
Marble::GeoSceneAbstractDataset::fileFormat
QString fileFormat() const
Definition: GeoSceneAbstractDataset.cpp:43
Marble::GeoSceneTiled::levelZeroColumns
int levelZeroColumns() const
Definition: GeoSceneTiled.cpp:97
Marble::GeoSceneTiled
Definition: GeoSceneTiled.h:43
Marble::DownloadBrowse
Browsing mode, normal operation of Marble, like a web browser.
Definition: MarbleGlobal.h:162
Marble::dgml::dgmlTag_Texture
const char * dgmlTag_Texture
Definition: DgmlElementDictionary.cpp:71
DgmlTextureTagWriter.h
Marble::GeoSceneTiled::projection
Projection projection() const
Definition: GeoSceneTiled.cpp:169
Marble::dgml::dgmlTag_InstallMap
const char * dgmlTag_InstallMap
Definition: DgmlElementDictionary.cpp:51
Marble::GeoSceneTiled::maximumTileLevel
int maximumTileLevel() const
Definition: GeoSceneTiled.cpp:117
GeoWriter.h
Marble::GeoSceneAbstractDataset::name
QString name() const
Definition: GeoSceneAbstractDataset.cpp:38
Marble::GeoSceneTiled::downloadPolicies
QList< const DownloadPolicy * > downloadPolicies() const
Definition: GeoSceneTiled.cpp:248
DownloadPolicy.h
Marble::DgmlTextureTagWriter::write
virtual bool write(const GeoNode *node, GeoWriter &writer) const
Definition: DgmlTextureTagWriter.cpp:26
Marble::DownloadPolicy::key
DownloadPolicyKey key() const
Definition: DownloadPolicy.cpp:89
Marble::dgml::dgmlTag_SourceDir
const char * dgmlTag_SourceDir
Definition: DgmlElementDictionary.cpp:66
Marble::DownloadPolicy::maximumConnections
int maximumConnections() const
Definition: DownloadPolicy.cpp:79
Marble::dgml::dgmlTag_nameSpace20
const char * dgmlTag_nameSpace20
Definition: DgmlElementDictionary.cpp:31
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::DownloadPolicyKey::usage
DownloadUsage usage() const
Definition: DownloadPolicy.cpp:51
DgmlElementDictionary.h
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::GeoSceneTiled::sourceDir
QString sourceDir() const
Definition: GeoSceneTiled.cpp:56
Marble::GeoSceneTiled::levelZeroRows
int levelZeroRows() const
Definition: GeoSceneTiled.cpp:107
Marble::GeoSceneTiled::Mercator
Definition: GeoSceneTiled.h:47
ServerLayout.h
Marble::GeoSceneTiled::downloadUrls
QVector< QUrl > downloadUrls() const
Definition: GeoSceneTiled.cpp:127
Marble::GeoSceneTiled::hasMaximumTileLevel
bool hasMaximumTileLevel() const
Definition: GeoSceneTiled.h:125
GeoSceneTiled.h
Marble::s_writerTexture
static GeoTagWriterRegistrar s_writerTexture(GeoTagWriter::QualifiedName(GeoSceneTypes::GeoSceneTiledType, dgml::dgmlTag_nameSpace20), new DgmlTextureTagWriter())
Marble::GeoSceneTiled::serverLayout
const ServerLayout * serverLayout() const
Definition: GeoSceneTiled.cpp:92
Marble::GeoSceneAbstractDataset::expire
int expire() const
Definition: GeoSceneAbstractDataset.cpp:53
Marble::DownloadBulk
Bulk download, for example "File/Download region".
Definition: MarbleGlobal.h:161
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:49 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