ClassOpenStreetMapProvider
Provides map tile services using OpenStreetMap as the data source, implementing both IMapProvider and IMapTileProvider interfaces for map rendering and tile management.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.RadMap.dll
Syntax:
public class OpenStreetMapProvider : IMapProvider, ICloneable, IMapTileProvider
Inheritance: objectOpenStreetMapProvider
Implements:
Constructors
OpenStreetMapProvider()
Initializes a new instance of the OpenStreetMapProvider class with default tile downloader and memory cache provider.
Declaration
public OpenStreetMapProvider()
Fields
Properties
CacheProvider
Gets or sets the cache provider used for storing and retrieving downloaded map tiles to improve performance and reduce network requests.
Declaration
public IMapCacheProvider CacheProvider { get; set; }
Property Value
Implements
EnableCaching
Gets or sets a value indicating whether tile caching is enabled for this provider to store downloaded tiles locally.
Declaration
public bool EnableCaching { get; set; }
Property Value
Implements
Id
Gets the unique identifier for this map provider instance.
ImageUrl
Gets or sets the URL template used for downloading OpenStreetMap tiles, supporting placeholder tokens for coordinates and zoom level.
Initialized
Gets or sets a value indicating whether this OpenStreetMapProvider has completed its initialization process.
MaxZoomLevel
Gets or sets the maximum zoom level supported by this OpenStreetMap provider.
MinZoomLevel
Gets or sets the minimum zoom level supported by this OpenStreetMap provider.
Settings
Gets the settings that control tile rendering behavior.
Declaration
public MapTileProviderSettings Settings { get; }
Property Value
Implements
TileDownloader
Gets or sets the tile downloader responsible for asynchronously downloading map tiles from OpenStreetMap servers.
Declaration
public IMapTileDownloader TileDownloader { get; set; }
Property Value
Implements
Methods
Clone()
Creates a deep copy of this OpenStreetMapProvider instance with identical configuration settings.
Declaration
public virtual object Clone()
Returns
A new OpenStreetMapProvider object that is a copy of this instance.
Implements
GetCacheKey(int, int, int)
Generates a unique cache key string for storing and retrieving tile images based on tile coordinates and zoom level.
Declaration
protected virtual string GetCacheKey(int tileX, int tileY, int zoomLevel)
Parameters
tileX
The X coordinate of the tile.
tileY
The Y coordinate of the tile.
zoomLevel
The zoom level of the tile.
Returns
A string representing the unique cache key for the specified tile.
GetContent(IMapViewport)
Retrieves the visual elements representing map tiles for the current viewport, converting cached tile data to renderable map elements.
Declaration
public IEnumerable<MapVisualElement> GetContent(IMapViewport viewport)
Parameters
viewport
The IMapViewport defining the current view area and settings.
Returns
IEnumerable<MapVisualElement>
An enumerable collection of MapVisualElement objects representing the visible map tiles.
Implements
GetSupportedViews()
Gets the list of supported map views for this provider, returning null as OpenStreetMap uses a standard view.
Declaration
public List<MapViewInfo> GetSupportedViews()
Returns
List<MapViewInfo>
A list of MapViewInfo objects, or null if standard views are used.
Implements
GetTile(int, int, int)
Constructs the complete URL for retrieving a specific map tile from OpenStreetMap servers based on tile coordinates and zoom level.
Declaration
public Uri GetTile(int tileMatrixX, int tileMatrixY, int zoomLevel)
Parameters
tileMatrixX
The X coordinate of the tile in the tile matrix.
tileMatrixY
The Y coordinate of the tile in the tile matrix.
zoomLevel
The zoom level for the requested tile.
Returns
A Uri object representing the complete URL for the tile request.
GetTileImage(int, int, int)
Synchronously retrieves a map tile image for the specified coordinates and zoom level, utilizing cache when available.
Declaration
public Image GetTileImage(int tileMatrixX, int tileMatrixY, int zoomLevel)
Parameters
tileMatrixX
The X coordinate of the tile in the tile matrix.
tileMatrixY
The Y coordinate of the tile in the tile matrix.
zoomLevel
The zoom level for the requested tile.
Returns
An Image object containing the tile image data.
Implements
GetTileInfoImage(TileInfo)
Initiates the asynchronous loading of tile image data, either from cache or by downloading from OpenStreetMap servers.
Initialize()
Initializes the provider, marking it as ready for tile requests and raising the initialization complete event.
Declaration
public void Initialize()
Implements
OnFileLoadAsyncComplete(string, byte[])
Handles the completion of asynchronous file loading operations from the cache provider, updating tile content or initiating download if cache miss occurs.
OnInitializationComplete(EventArgs)
Raises the InitializationComplete event when provider initialization is successfully completed.
OnInitializationError(InitializationErrorEventArgs)
Raises the InitializationError event when an error occurs during provider initialization.
Declaration
protected virtual void OnInitializationError(InitializationErrorEventArgs e)
Parameters
e
An InitializationErrorEventArgs that contains the error information.
OnProviderUpdated(EventArgs)
Raises the ProviderUpdated event when provider content changes, such as when new tiles are available.
OnTileDownloadComplete(object, TileInfoEventArgs)
Handles the completion of tile download operations, updating cache storage and synchronizing tile content across wraparound instances.
Declaration
protected virtual void OnTileDownloadComplete(object sender, TileInfoEventArgs e)
Parameters
sender
The source of the event.
e
The TileInfoEventArgs containing the downloaded tile information and image data.
SetView(MapViewInfo)
Sets the active map view for this provider, currently not implemented for OpenStreetMap.
Declaration
public void SetView(MapViewInfo view)
Parameters
view
The MapViewInfo representing the desired map view.
Implements
ViewportChanged(IMapViewport, ViewportChangeAction)
Responds to viewport changes by calculating and managing the visible tiles required for the current view, handling tile loading and caching operations.
Declaration
public void ViewportChanged(IMapViewport viewport, ViewportChangeAction action)
Parameters
viewport
The IMapViewport representing the current view settings and visible area.
action
The ViewportChangeAction indicating the type of viewport change that occurred.
Implements
Events
InitializationComplete
Occurs when the provider initialization process is completed successfully.
Declaration
public event EventHandler InitializationComplete
Event Value
Implements
InitializationError
Occurs when an error is encountered during the provider initialization process.
Declaration
public event InitializationErrorEventHandler InitializationError
Event Value
Implements
ProviderUpdated
Occurs when the provider content is updated, typically after new tiles are loaded or downloaded.
Declaration
public event EventHandler ProviderUpdated
Event Value
Implements