VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtCDBTileKey.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright(c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 
9 #pragma once
10 
11 #include <string>
12 
13 #include <osgEarth/GeoData>
14 
15 namespace osgEarth
16 {
17  class Map;
18 }
19 
20 namespace makVrv { namespace oe { namespace CDB
21 {
22  class CDBTileCache;
23 
28  class CDBTileKey
29  {
30  public:
31 
34  CDBTileKey(int lod, int lon, int lat, int rref, int uref);
35 
37  CDBTileKey(const CDBTileKey& rhs);
38 
40  std::string str() const;
41 
43  int getLon() const;
44 
46  int getLat() const;
47 
49  int getURef() const;
50 
52  int getRRef() const;
53 
55  int getLOD() const;
56 
58  const osgEarth::GeoExtent& getExtent() const;
59 
61  bool getChildren( std::vector< CDBTileKey >& children ) const;
62 
64  static int calcDLonZone(double coord_y);
65 
67  static void getTileDimensions(int lod, int lon, int lat, int rref, int uref, double& out_width, double& out_height);
68 
70  static void createRootKeys(const CDBTileCache& tileCache, std::vector< CDBTileKey >& rootKeys);
71 
73  static double getApproximateLodGridSpacing(int lod);
74 
76  osg::BoundingSphere getBounds(const osgEarth::Map* map) const;
77 
79  bool equals(int lod, int uref, int rref) const;
80 
82  bool equals(const CDBTileKey& key) const;
83 
85  size_t getLatLongHash(void) const;
86 
87  size_t getFullHash(void) const;
88  protected:
89 
91  int myLod;
92 
94  int myURef;
95 
97  int myRRef;
98 
100  int myLon;
101 
103  int myLat;
104 
106  osgEarth::GeoExtent myExtent;
107  };
108 
110  std::ostream& operator<<(std::ostream& os, const CDBTileKey& key);
111 
114  {
115  size_t operator()(const makVrv::oe::CDB::CDBTileKey& tileKey) const { return tileKey.getLatLongHash(); }
116  };
117 
120  {
122  {
123  return lhs.getLatLongHash() == rhs.getLatLongHash();
124  }
125  };
126 
129  {
130  size_t operator()(const makVrv::oe::CDB::CDBTileKey& tileKey) const { return tileKey.getFullHash(); }
131  };
132 
135  {
137  {
138  if (lhs.getLat() != rhs.getLat()) return false;
139  if (lhs.getLon() != rhs.getLon()) return false;
140  if (lhs.getLOD() != rhs.getLOD()) return false;
141  if (lhs.getURef() != rhs.getURef()) return false;
142  if (lhs.getRRef() != rhs.getRRef()) return false;
143  return true;
144  }
145  };
146 
147 } } } // namespace makVrv::oe::CDB
const osgEarth::GeoExtent & getExtent() const
Get the extent of this CDBTileKey.
Tile Key equal operation.
Definition: DtCDBTileKey.h:134
CDB Tile cache manager Used by CDBTileSource to try to avoid reading the the same CDB tile many time ...
Definition: DtCDBTileCache.h:34
Hold the unique CDB tile key information CDB LOD goes from -10 to 23. Negative keys to zero are all 1...
Definition: DtCDBTileKey.h:28
size_t operator()(const makVrv::oe::CDB::CDBTileKey &tileKey) const
Definition: DtCDBTileKey.h:130
int getURef() const
Get the upper direction index of this CDBTileKey.
osgEarth::GeoExtent myExtent
Tile Extent.
Definition: DtCDBTileKey.h:106
static double getApproximateLodGridSpacing(int lod)
Return the Approximate Lod Grid Spacing for the current LOD (see table 2-4 in CDB spec 3...
int myLod
Tile Level Of Detail.
Definition: DtCDBTileKey.h:91
bool equals(int lod, int uref, int rref) const
Checks lod, uref and rref.
Latitude Longitude equal operation.
Definition: DtCDBTileKey.h:119
static void getTileDimensions(int lod, int lon, int lat, int rref, int uref, double &out_width, double &out_height)
Gets the width and height in degrees of a CDBTileKey.
static void createRootKeys(const CDBTileCache &tileCache, std::vector< CDBTileKey > &rootKeys)
Creates the root CDBTileKeys at lod -10.
bool operator()(const makVrv::oe::CDB::CDBTileKey &lhs, const makVrv::oe::CDB::CDBTileKey &rhs) const
Definition: DtCDBTileKey.h:136
osg::BoundingSphere getBounds(const osgEarth::Map *map) const
Gets the bounding sphere for a given TileKey.
int myLon
Tile Longitude.
Definition: DtCDBTileKey.h:100
std::ostream & operator<<(std::ostream &os, const CDBTileKey &key)
Output the CDB Tile Key stream representation.
Latitude Longitude hash key.
Definition: DtCDBTileKey.h:113
int myLat
Tile Latitude.
Definition: DtCDBTileKey.h:103
int myRRef
Tile Right index Reference.
Definition: DtCDBTileKey.h:97
int getLat() const
Get the lat coordinate of this CDBTileKey.
int myURef
Tile Upper index Reference.
Definition: DtCDBTileKey.h:94
bool operator()(const makVrv::oe::CDB::CDBTileKey &lhs, const makVrv::oe::CDB::CDBTileKey &rhs) const
Definition: DtCDBTileKey.h:121
Complete tile key hash.
Definition: DtCDBTileKey.h:128
int getLOD() const
Get the level of detail for this CDBTileKey.
CDBTileKey(int lod, int lon, int lat, int rref, int uref)
CTOR Creates a new CDBTileKey.
std::string str() const
Get the string representation of this key.
static int calcDLonZone(double coord_y)
Gets the longitude zone for the given y coordinate.
size_t operator()(const makVrv::oe::CDB::CDBTileKey &tileKey) const
Definition: DtCDBTileKey.h:115
size_t getFullHash(void) const
size_t getLatLongHash(void) const
Utility function to get hash off of lat, lon.
int getLon() const
Get the lon coordinate of this CDBTileKey.
int getRRef() const
Get the right direction index this CDBTileKey.
bool getChildren(std::vector< CDBTileKey > &children) const
Gets the children of this CDBTileKey.

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)