TileProviders Class Reference

Holds the list of tile providers associated with Tiles class. More...

Collaboration diagram for TileProviders:
Collaboration graph

Public Member Functions

bool Add (int Id, string Name, string urlPattern, tkTileProjection Projection, int minZoom=0, int maxZoom=17)
 Adds a custom tile provider. More...
 
void Clear (bool ClearCache)
 Removes custom providers from the list. More...
 
string get_ErrorMsg (int ErrorCode)
 Gets the description of the specific error code. More...
 
Extents get_GeographicBounds (int Index)
 Gets the geographic bounds of the specified provider. More...
 
int get_Id (int Index)
 Gets provider ID by its index in the list. More...
 
int get_IndexByProvider (tkTileProvider Provider)
 Gets the index of default provider in the list. More...
 
int get_IndexByProviderId (int ProviderId)
 Gets the index of provider in the list by its ID. More...
 
bool get_IsCustom (int Index)
 Gets a value indicating whether given provider is a custom one. More...
 
string get_Language (int Index)
 Gets language settings for a given provider. More...
 
int get_MaxZoom (int Index)
 Gets maximum zoom level provided by tile server. More...
 
int get_MinZoom (int Index)
 Gets minimum zoom level provided by tile server. More...
 
string get_Name (int Index)
 Gets name of the specific provider. More...
 
tkTileProjection get_Projection (int Index)
 Gets server projection for specified provider. More...
 
string get_UrlPattern (int Index)
 Gets URL pattern for custom provider. More...
 
string get_Version (int Index)
 Get a version string for specified provider. More...
 
bool Remove (int ProviderId, bool ClearCache)
 Removes specified custom provider from the list. More...
 
void set_GeographicBounds (int Index, Extents pVal)
 Sets the geographic bounds of the specified provider. More...
 
void set_Language (int Index, string newVal)
 Sets language settings for a given provider. More...
 
void set_Name (int Index, string newVal)
 Sets name of the specific providers. More...
 
void set_Version (int Index, string retVal)
 Sets a version string for specified provider. More...
 

Properties

int Count [get]
 Gets the number of providers in the list. More...
 
ICallback GlobalCallback [get, set]
 Gets or sets a Callback object which handles progress and error messages. More...
 
int LastErrorCode [get]
 Gets the code of last error which took place inside this object. More...
 

Detailed Description

Holds the list of tile providers associated with Tiles class.

New API 4.9.0:
Added in version 4.9.0

Member Function Documentation

◆ Add()

bool TileProviders.Add ( int  Id,
string  Name,
string  urlPattern,
tkTileProjection  Projection,
int  minZoom = 0,
int  maxZoom = 17 
)

Adds a custom tile provider.

Parameters
IdUnique ID to to access this provider later on (including caching).
NameArbitrary name of provider.
urlPatternUrl pattern for provider. The pattern may include the following varying components: {zoom}, {x}, {y}, {switch:n1,n2,n3}. For example, the following can be used to setup OpenStreetMap as custom provider: "https://{switch:a,b,c}.tile.openstreetmap.org/{zoom}/{x}/{y}.png".
ProjectionProjection used by tile server. Projection must not necessarily match the map projection. MapWinGIS will try to do the transformation even if projection don't match, though these may lead to distortions and gaps between tiles.
minZoomMinimum zoom level provided by server.
maxZoomMaximum zoom level provided by server.
Returns
True on success and false otherwise

◆ Clear()

void TileProviders.Clear ( bool  ClearCache)

Removes custom providers from the list.

Parameters
ClearCacheTrue in case cached tiles, both from RAM and disk, for custom providers should be removed as well.

◆ get_ErrorMsg()

string TileProviders.get_ErrorMsg ( int  ErrorCode)

Gets the description of the specific error code.

Parameters
ErrorCodeThe error code returned by LastErrorCode property.
Returns
String with the description.

◆ get_GeographicBounds()

Extents TileProviders.get_GeographicBounds ( int  Index)

Gets the geographic bounds of the specified provider.

Parameters
IndexThe index of the provider.
Returns
Geographic bounds in decimal degrees.
New API 4.9.4:
Added in version 4.9.4

◆ get_Id()

int TileProviders.get_Id ( int  Index)

Gets provider ID by its index in the list.

Parameters
IndexThe index of provider in the list.
Returns
ID of the provider.

For default providers the index in the list and ID are the same. For custom providers any unique ID can be specified on creation, which may not match the index in the list.

◆ get_IndexByProvider()

int TileProviders.get_IndexByProvider ( tkTileProvider  Provider)

Gets the index of default provider in the list.

Parameters
ProviderProvider to find index for.
Returns
The index of provider in the list.

◆ get_IndexByProviderId()

int TileProviders.get_IndexByProviderId ( int  ProviderId)

Gets the index of provider in the list by its ID.

Parameters
ProviderIdId of the provider.
Returns
The index of provider in the list.

◆ get_IsCustom()

bool TileProviders.get_IsCustom ( int  Index)

Gets a value indicating whether given provider is a custom one.

Parameters
IndexIndex of provider in the list.
Returns
True if provider is custom, false if it is a default one.

◆ get_Language()

string TileProviders.get_Language ( int  Index)

Gets language settings for a given provider.

Parameters
IndexIndex of provider in list.

The setting will be included in http request and if supported by tile provider it may actually change language information is displayed on map with.

Returns
Language settings, e.g. "en", "fr", "ru", etc. "en" is used by default.
New API 4.9.1:
Added in version 4.9.1

◆ get_MaxZoom()

int TileProviders.get_MaxZoom ( int  Index)

Gets maximum zoom level provided by tile server.

Parameters
IndexIndex of the provider in the list.
Returns
Maximum zoom.

Zoom level is hardcoded for default providers and passed as a parameter on creation for custom providers. Server isn't queried to check whether the values are correct.

◆ get_MinZoom()

int TileProviders.get_MinZoom ( int  Index)

Gets minimum zoom level provided by tile server.

Parameters
IndexIndex of the provider in the list.
Returns
Minimum zoom.

◆ get_Name()

string TileProviders.get_Name ( int  Index)

Gets name of the specific provider.

Parameters
IndexIndex of the provider in the list.
Returns
Name of the provider.

◆ get_Projection()

tkTileProjection TileProviders.get_Projection ( int  Index)

Gets server projection for specified provider.

Parameters
IndexIndex of the provider in the list.
Returns
Server projection.

◆ get_UrlPattern()

string TileProviders.get_UrlPattern ( int  Index)

Gets URL pattern for custom provider.

Parameters
IndexIndex of the provider in the list.
Returns
URL pattern for custom providers and empty string for default ones.

◆ get_Version()

string TileProviders.get_Version ( int  Index)

Get a version string for specified provider.

Parameters
IndexIndex of the provider in the list.
Returns
Version string.

Many tile servers include version as a parameter of HTTP request. Tiles may not load if the obsolete version is passed.

◆ Remove()

bool TileProviders.Remove ( int  ProviderId,
bool  ClearCache 
)

Removes specified custom provider from the list.

Parameters
ProviderIdId of provider to be removed.
ClearCacheTrue in case cached tiles should be removed as well.
Returns
True if specified provider was removed, and false otherwise.

It's not allowed to remove default providers.

◆ set_GeographicBounds()

void TileProviders.set_GeographicBounds ( int  Index,
Extents  pVal 
)

Sets the geographic bounds of the specified provider.

Parameters
IndexThe index.
pValThe p value.
New API 4.9.4:
Added in version 4.9.4

◆ set_Language()

void TileProviders.set_Language ( int  Index,
string  newVal 
)

Sets language settings for a given provider.

Parameters
IndexIndex of provider in list.
newValLanguage settings, e.g. "en", "fr", "ru", etc.

The setting will be included in http request and if supported by tile provider it may actually change language information is displayed on map with.

New API 4.9.1:
Added in version 4.9.1

◆ set_Name()

void TileProviders.set_Name ( int  Index,
string  newVal 
)

Sets name of the specific providers.

Parameters
IndexIndex of the provider in the list.
newValNew name of the provider.

Providers are cached by ID therefore renaming of provider won't affect its cache.

◆ set_Version()

void TileProviders.set_Version ( int  Index,
string  retVal 
)

Sets a version string for specified provider.

Parameters
IndexIndex of the provider in the list.
retValVersion string.

Property Documentation

◆ Count

int TileProviders.Count
get

Gets the number of providers in the list.

◆ GlobalCallback

ICallback TileProviders.GlobalCallback
getset

Gets or sets a Callback object which handles progress and error messages.

Deprecated:
v4.9.3 Use GlobalSettings.ApplicationCallback instead.

◆ LastErrorCode

int TileProviders.LastErrorCode
get

Gets the code of last error which took place inside this object.