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