#include <bing_source.h>
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) |
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 Attributes | |
QString | api_key_ |
boost::hash< std::string > | hash_ |
QNetworkAccessManager | network_manager_ |
boost::random::mt19937 | rng_ |
std::vector< QString > | subdomains_ |
QString | tile_url_ |
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" |
Definition at line 47 of file bing_source.h.
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.
name | The name the source will appear as in the combo box. |
Definition at line 49 of file bing_source.cpp.
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
level | The zoom level |
x | The X coordinate |
y | The Y coordinate |
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.
level | The zoom level |
x | The X coordinate |
y | The Y coordinate |
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.
level | The zoom level |
x | The X coordinate |
y | The Y coordinate |
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.)
Implements tile_map::TileSource.
Definition at line 81 of file bing_source.cpp.
void tile_map::BingSource::ReplyFinished | ( | QNetworkReply * | reply | ) | [protected, slot] |
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
api_key | A valid Bing Maps key |
Definition at line 91 of file bing_source.cpp.
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" [static, protected] |
Definition at line 133 of file bing_source.h.
const std::string tile_map::BingSource::BING_IMAGE_URL_SUBDOMAIN_KEY = "imageUrlSubdomains" [static, protected] |
Definition at line 134 of file bing_source.h.
const std::string tile_map::BingSource::BING_RESOURCE_KEY = "resources" [static, protected] |
Definition at line 136 of file bing_source.h.
const std::string tile_map::BingSource::BING_RESOURCE_SET_KEY = "resourceSets" [static, protected] |
Definition at line 135 of file bing_source.h.
const std::string tile_map::BingSource::BING_STATUS_CODE_KEY = "statusCode" [static, protected] |
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.