Class TileLayer
Layer, which displays a map consisting of individual tiles
Inherited Members
Namespace: Mapsui.Tiling.Layers
Assembly: Mapsui.Tiling.dll
Syntax
public class TileLayer : BaseLayer, ILayer, IAnimatable, INotifyPropertyChanged, IFetchableSource, IDisposable
Constructors
| Edit this page View SourceTileLayer(ITileSource, int, int, IDataFetchStrategy?, IRenderFetchStrategy?, int, int, Func<TileInfo, Task<IFeature?>>?, HttpClient?)
Create tile layer for given tile source
Declaration
public TileLayer(ITileSource tileSource, int minTiles = 200, int maxTiles = 300, IDataFetchStrategy? dataFetchStrategy = null, IRenderFetchStrategy? renderFetchStrategy = null, int minExtraTiles = -1, int maxExtraTiles = -1, Func<TileInfo, Task<IFeature?>>? fetchTileAsFeature = null, HttpClient? httpClient = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ITileSource | tileSource | Tile source to use for this layer |
| int | minTiles | Minimum number of tiles to cache |
| int | maxTiles | Maximum number of tiles to cache |
| IDataFetchStrategy | dataFetchStrategy | Strategy to get list of tiles for given extent |
| IRenderFetchStrategy | renderFetchStrategy | |
| int | minExtraTiles | Number of minimum extra tiles for memory cache |
| int | maxExtraTiles | Number of maximum extra tiles for memory cache |
| Func<TileInfo, Task<IFeature>> | fetchTileAsFeature | Fetch tile as feature |
| HttpClient | httpClient | A custom HttpClient (may include custom header parameters etc) |
Properties
| Edit this page View SourceExtent
Returns the envelope of all available data in the layer
Declaration
public override MRect? Extent { get; }
Property Value
| Type | Description |
|---|---|
| MRect |
Overrides
| Edit this page View SourceResolutions
List of native resolutions
Declaration
public override IReadOnlyList<double> Resolutions { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<double> |
Overrides
| Edit this page View SourceTileSource
TileSource
Declaration
public ITileSource TileSource { get; }
Property Value
| Type | Description |
|---|---|
| ITileSource |
Methods
| Edit this page View SourceClearCache()
Clears the cache of this layer. Call this if source data has was invalidated or the layer is removed.
Declaration
public void ClearCache()
Dispose(bool)
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
Overrides
| Edit this page View SourceGetFeatures(MRect, double)
Get all features in a given MRect for a given resolution
Declaration
public override IEnumerable<IFeature> GetFeatures(MRect extent, double resolution)
Parameters
| Type | Name | Description |
|---|---|---|
| MRect | extent | Bounding box |
| double | resolution | Resolution of viewport |
Returns
| Type | Description |
|---|---|
| IEnumerable<IFeature> |
Overrides
| Edit this page View SourceGetFetchJobs(int, int)
Gets the fetch requests for this layer. The requests are based on the viewport stored within the layer.
Declaration
public FetchJob[] GetFetchJobs(int activeFetches, int availableFetchSlots)
Parameters
| Type | Name | Description |
|---|---|---|
| int | activeFetches | |
| int | availableFetchSlots | Number of available fetch slots in the caller. It is the maximum number of fetch jobs the method should return. |
Returns
| Type | Description |
|---|---|
| FetchJob[] |
OnFetchRequested()
Declaration
protected virtual void OnFetchRequested()
ViewportChanged(FetchInfo)
Informs the layer that the viewport has changed and it should update its data accordingly.
Declaration
public virtual void ViewportChanged(FetchInfo fetchInfo)
Parameters
| Type | Name | Description |
|---|---|---|
| FetchInfo | fetchInfo |
Events
| Edit this page View SourceFetchRequested
Indicates to the listener that it should fetch data again. This event is raised when there was a change in source data, so only relevant for dynamic data. The fetches triggered by viewport changes do not depend on it.
Declaration
public event EventHandler<FetchRequestedEventArgs>? FetchRequested
Event Type
| Type | Description |
|---|---|
| EventHandler<FetchRequestedEventArgs> |