Skip to content

tile_cache.cpp

file src/app/map/tile_cache.cpp ยท Applications

Memory, disk and network lookup, download queue, failure memory and disk writes of TileCache.

Source src/app/map/tile_cache.cpp

Namespaces

Namespace Description
nmeasim::app::map The slippy-map view of the desktop application, part of nmeasim::app.

Summary

File-local functions

Name Description
default_user_agent() Returns the User-Agent the cache identifies itself with.
is_not_found() Returns whether a finished reply means that the server does not have the tile at all.

File-local variables

Name Description
kMemoryTiles Capacity of the memory cache in tiles; 512 tiles of 256 by 256 pixels take about 128 MiB as 32-bit pixmaps.
kMaxConcurrentDownloads Largest number of downloads running at once, kept low as the tile usage policy asks.
kTransferTimeoutMs Time in milliseconds a download may go without receiving data before it is aborted.
kMaxRetryDelay Longest delay before a failed tile is requested again, however often it failed; long enough to spare the server, short enough that a map left open recovers after an outage.

File-local functions

default_user_agent()

QString default_user_agent()

Returns the User-Agent the cache identifies itself with.

Returns QString: NMEASimulatorX/<version> (+<project page>), the form the OpenStreetMap tile usage policy asks for: the application, its version and a way to contact its authors.

Declared in src/app/map/tile_cache.cpp:41

is_not_found()

bool is_not_found(const QNetworkReply& reply)

Returns whether a finished reply means that the server does not have the tile at all.

Parameters

Name Type Description
reply const QNetworkReply& Finished reply.

Returns bool: true for HTTP 404 (Not Found) and 410 (Gone), which asking again will not change.

Declared in src/app/map/tile_cache.cpp:52

File-local variables

kMemoryTiles

int kMemoryTiles{512}

Capacity of the memory cache in tiles; 512 tiles of 256 by 256 pixels take about 128 MiB as 32-bit pixmaps.

Declared in src/app/map/tile_cache.cpp:28

kMaxConcurrentDownloads

int kMaxConcurrentDownloads{4}

Largest number of downloads running at once, kept low as the tile usage policy asks.

Declared in src/app/map/tile_cache.cpp:30

kTransferTimeoutMs

int kTransferTimeoutMs{15000}

Time in milliseconds a download may go without receiving data before it is aborted.

Declared in src/app/map/tile_cache.cpp:32

kMaxRetryDelay

std::chrono::milliseconds kMaxRetryDelay{std::chrono::minutes{10}}

Longest delay before a failed tile is requested again, however often it failed; long enough to spare the server, short enough that a map left open recovers after an outage.

Declared in src/app/map/tile_cache.cpp:35