• 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
TileId.h
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 2008, 2010 Jens-Michael Hoffmann <jensmh@gmx.de>
9 // Copyright 2012 Bernhard Beschow <bbeschow@cs.tu-berlin.de>
10 //
11 
12 #ifndef MARBLE_TILEID_H
13 #define MARBLE_TILEID_H
14 
15 #include <QHash>
16 #include <QString>
17 
18 #include "marble_export.h"
19 #include "GeoDataCoordinates.h"
20 #include "GeoDataLatLonBox.h"
21 #include "GeoSceneTextureTile.h"
22 
23 namespace Marble
24 {
25 class GeoDataCoordinates;
26 
27 class MARBLE_EXPORT TileId
28 {
29  public:
30  TileId( QString const & mapThemeId, int zoomLevel, int tileX, int tileY );
31  TileId( uint mapThemeIdHash, int zoomLevel, int tileX, int tileY );
32  TileId();
33 
34  int zoomLevel() const;
35  int x() const;
36  int y() const;
37  uint mapThemeIdHash() const;
38 
39  bool operator==( TileId const& rhs ) const;
40  bool operator<( TileId const& rhs ) const;
41 
42  GeoDataLatLonBox toLatLonBox( const GeoSceneTiled *textureLayer ) const;
43  static TileId fromCoordinates( const GeoDataCoordinates& coords, int popularity );
44 
45  private:
46  uint m_mapThemeIdHash;
47  int m_zoomLevel;
48  int m_tileX;
49  int m_tileY;
50 };
51 
52 uint qHash( TileId const& );
53 
54 
55 // inline definitions
56 
57 inline int TileId::zoomLevel() const
58 {
59  return m_zoomLevel;
60 }
61 
62 inline int TileId::x() const
63 {
64  return m_tileX;
65 }
66 
67 inline int TileId::y() const
68 {
69  return m_tileY;
70 }
71 
72 inline uint TileId::mapThemeIdHash() const
73 {
74  return m_mapThemeIdHash;
75 }
76 
77 inline bool TileId::operator==( TileId const& rhs ) const
78 {
79  return m_zoomLevel == rhs.m_zoomLevel
80  && m_tileX == rhs.m_tileX
81  && m_tileY == rhs.m_tileY
82  && m_mapThemeIdHash == rhs.m_mapThemeIdHash;
83 }
84 
85 inline bool TileId::operator<( TileId const& rhs ) const
86 {
87  if (m_zoomLevel < rhs.m_zoomLevel)
88  return true;
89  else if (m_zoomLevel == rhs.m_zoomLevel
90  && m_tileX < rhs.m_tileX)
91  return true;
92  else if (m_zoomLevel == rhs.m_zoomLevel
93  && m_tileX == rhs.m_tileX
94  && m_tileY < rhs.m_tileY)
95  return true;
96  else if (m_zoomLevel == rhs.m_zoomLevel
97  && m_tileX == rhs.m_tileX
98  && m_tileY == rhs.m_tileY
99  && m_mapThemeIdHash < rhs.m_mapThemeIdHash)
100  return true;
101  return false;
102 }
103 
104 inline uint qHash( TileId const& tid )
105 {
106  const quint64 tmp = (( quint64 )( tid.zoomLevel() ) << 36 )
107  + (( quint64 )( tid.x() ) << 18 )
108  + ( quint64 )( tid.y() );
109  return ::qHash( tmp ) ^ tid.mapThemeIdHash();
110 }
111 
112 }
113 
114 #ifndef QT_NO_DEBUG_STREAM
115 QDebug operator<<( QDebug, const Marble::TileId & );
116 #endif
117 
118 #endif
GeoDataCoordinates.h
Marble::GeoDataCoordinates
A 3d point representation.
Definition: GeoDataCoordinates.h:52
Marble::qHash
uint qHash(TileId const &)
Definition: TileId.h:104
Marble::TileId::zoomLevel
int zoomLevel() const
Definition: TileId.h:57
Marble::qHash
uint qHash(const GeoDataLatLonAltBox &r)
Definition: GeoDataLatLonAltBox.h:149
Marble::TileId::y
int y() const
Definition: TileId.h:67
operator<<
QDebug operator<<(QDebug, const Marble::TileId &)
Definition: TileId.cpp:92
Marble::GeoSceneTiled
Definition: GeoSceneTiled.h:43
Marble::operator==
bool operator==(const DownloadPolicyKey &lhs, const DownloadPolicyKey &rhs)
Definition: DownloadPolicy.h:49
MARBLE_EXPORT
#define MARBLE_EXPORT
Definition: marble_export.h:20
Marble::TileId::operator<
bool operator<(TileId const &rhs) const
Definition: TileId.h:85
Marble::TileId::mapThemeIdHash
uint mapThemeIdHash() const
Definition: TileId.h:72
Marble::TileId::x
int x() const
Definition: TileId.h:62
GeoDataLatLonBox.h
Marble::TileId
Definition: TileId.h:27
marble_export.h
GeoSceneTextureTile.h
Marble::TileId::operator==
bool operator==(TileId const &rhs) const
Definition: TileId.h:77
Marble::GeoDataLatLonBox
A class that defines a 2D bounding box for geographic data.
Definition: GeoDataLatLonBox.h:51
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:53 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