Public Member Functions | Static Public Attributes | Protected Slots | Protected Member Functions | Protected Attributes | Static Protected Attributes | List of all members
tile_map::BingSource Class Reference

#include <bing_source.h>

Inheritance diagram for tile_map::BingSource:
Inheritance graph
[legend]

Public Member Functions

 BingSource (const QString &name)
 
virtual size_t GenerateTileHash (int32_t level, int64_t x, int64_t y)
 
virtual QString GenerateTileUrl (int32_t level, int64_t x, int64_t y)
 
QString GetApiKey () const
 
virtual QString GetType () const
 
void SetApiKey (const QString &api_key)
 
- Public Member Functions inherited from tile_map::TileSource
virtual const QString & GetBaseUrl () const
 
virtual int32_t GetMaxZoom () const
 
virtual int32_t GetMinZoom () const
 
virtual const QString & GetName () const
 
virtual bool IsCustom () const
 
virtual void SetBaseUrl (const QString &base_url)
 
virtual void SetCustom (bool is_custom)
 
virtual void SetMaxZoom (int32_t max_zoom)
 
virtual void SetMinZoom (int32_t min_zoom)
 
virtual void SetName (const QString &name)
 
virtual ~TileSource ()
 

Static Public Attributes

static const QString BING_TYPE = "bing"
 

Protected Slots

void ReplyFinished (QNetworkReply *reply)
 

Protected Member Functions

QString GenerateQuadKey (int32_t level, int64_t x, int64_t y) const
 
- Protected Member Functions inherited from tile_map::TileSource
 TileSource ()
 

Protected Attributes

QString api_key_
 
boost::hash< std::string > hash_
 
QNetworkAccessManager network_manager_
 
boost::random::mt19937 rng_
 
std::vector< QString > subdomains_
 
QString tile_url_
 
- Protected Attributes inherited from tile_map::TileSource
QString base_url_
 
bool is_custom_
 
int32_t max_zoom_
 
int32_t min_zoom_
 
QString name_
 

Static Protected Attributes

static const std::string BING_IMAGE_URL_KEY = "imageUrl"
 
static const std::string BING_IMAGE_URL_SUBDOMAIN_KEY = "imageUrlSubdomains"
 
static const std::string BING_RESOURCE_KEY = "resources"
 
static const std::string BING_RESOURCE_SET_KEY = "resourceSets"
 
static const std::string BING_STATUS_CODE_KEY = "statusCode"
 

Additional Inherited Members

- Signals inherited from tile_map::TileSource
void ErrorMessage (const std::string &error_msg) const
 
void InfoMessage (const std::string &info_msg) const
 

Detailed Description

Definition at line 47 of file bing_source.h.

Constructor & Destructor Documentation

tile_map::BingSource::BingSource ( const QString &  name)
explicit

Initializes a Bing map source with a given name.

Note that currently, only a single, hard-coded Bing map source is supported. There's only one Bing Maps, after all. In the future, though, it would probably make sense to extend its functionality to allow pulling different tile sets from Bing.

Parameters
nameThe name the source will appear as in the combo box.

Definition at line 49 of file bing_source.cpp.

Member Function Documentation

QString tile_map::BingSource::GenerateQuadKey ( int32_t  level,
int64_t  x,
int64_t  y 
) const
protected

Bing Maps identifies tiles using a quadkey that is generated from the zoom level and x and y coordinates. Details on how the quadkey is generated can be found here: https://msdn.microsoft.com/en-us/library/bb259689.aspx

Parameters
levelThe zoom level
xThe X coordinate
yThe Y coordinate
Returns
The quadkey that represents the tile at the requested location

Definition at line 106 of file bing_source.cpp.

size_t tile_map::BingSource::GenerateTileHash ( int32_t  level,
int64_t  x,
int64_t  y 
)
virtual

Generates a unique hash that identifies the tile as the given coordinates.

Note that Bing Maps tiles could potentially be pulled from one of many different servers, depending on the subdomain list given to us after we authenticate with our API Key. That means the exact URL to any given tile should not be used as part of the hash, because there are many valid URLs for a tile.

Parameters
levelThe zoom level
xThe X coordinate
yThe Y coordinate
Returns
A hash that uniquely identifies this tile

Implements tile_map::TileSource.

Definition at line 63 of file bing_source.cpp.

QString tile_map::BingSource::GenerateTileUrl ( int32_t  level,
int64_t  x,
int64_t  y 
)
virtual

Generates a URL that will retrieve a tile for the given coordinates.

Since Bing can give us a list of subdomains to pull tiles from, the exact subdomain for a tile is chosen at random every time this function is called. That means you are not guaranteed to get the same URL for a tile every time you call this function.

Parameters
levelThe zoom level
xThe X coordinate
yThe Y coordinate
Returns
A URL that points to this tile

Implements tile_map::TileSource.

Definition at line 69 of file bing_source.cpp.

QString tile_map::BingSource::GetApiKey ( ) const

Definition at line 86 of file bing_source.cpp.

QString tile_map::BingSource::GetType ( ) const
virtual

Returns a string identifying the type of map source ("wmts", "bing", etc.)

Returns

Implements tile_map::TileSource.

Definition at line 81 of file bing_source.cpp.

void tile_map::BingSource::ReplyFinished ( QNetworkReply *  reply)
protectedslot

Definition at line 127 of file bing_source.cpp.

void tile_map::BingSource::SetApiKey ( const QString &  api_key)

Bing requires an API key in order to access its tiles. The key provided will determine the URL we use to retrieve map tiles, so setting the API key will also cause this object to make a network request to the Bing Map server to get the appropriate URL.

More information about getting an API key: https://msdn.microsoft.com/en-us/library/ff428642.aspx

Parameters
api_keyA valid Bing Maps key

Definition at line 91 of file bing_source.cpp.

Member Data Documentation

QString tile_map::BingSource::api_key_
protected

Definition at line 126 of file bing_source.h.

const std::string tile_map::BingSource::BING_IMAGE_URL_KEY = "imageUrl"
staticprotected

Definition at line 133 of file bing_source.h.

const std::string tile_map::BingSource::BING_IMAGE_URL_SUBDOMAIN_KEY = "imageUrlSubdomains"
staticprotected

Definition at line 134 of file bing_source.h.

const std::string tile_map::BingSource::BING_RESOURCE_KEY = "resources"
staticprotected

Definition at line 136 of file bing_source.h.

const std::string tile_map::BingSource::BING_RESOURCE_SET_KEY = "resourceSets"
staticprotected

Definition at line 135 of file bing_source.h.

const std::string tile_map::BingSource::BING_STATUS_CODE_KEY = "statusCode"
staticprotected

Definition at line 137 of file bing_source.h.

const QString tile_map::BingSource::BING_TYPE = "bing"
static

Definition at line 107 of file bing_source.h.

boost::hash<std::string> tile_map::BingSource::hash_
protected

Definition at line 127 of file bing_source.h.

QNetworkAccessManager tile_map::BingSource::network_manager_
protected

Definition at line 128 of file bing_source.h.

boost::random::mt19937 tile_map::BingSource::rng_
protected

Definition at line 129 of file bing_source.h.

std::vector<QString> tile_map::BingSource::subdomains_
protected

Definition at line 130 of file bing_source.h.

QString tile_map::BingSource::tile_url_
protected

Definition at line 131 of file bing_source.h.


The documentation for this class was generated from the following files:


tile_map
Author(s): Marc Alban
autogenerated on Thu Jun 6 2019 19:25:35