Skip to content

TileOverlay

Namespace: ThinkGeo.Core

Represents an overlay that maintains tiles.

public abstract class TileOverlay : Overlay, System.IDisposable

Inheritance ObjectOverlayTileOverlay
Implements IDisposable

Properties

ImageFormat

Gets and sets drawing format for the tiles.

public GeoImageFormat ImageFormat { get; set; }

Property Value

GeoImageFormat

JpegQuality

Gets or sets the image quality when the TileImageFormat is Jpeg; otherwise this property has no effects. Its default value is 80.

public int JpegQuality { get; set; }

Property Value

Int32

IsCacheOnly

Gets or sets a value indicating whether this instance is cache only.

public bool IsCacheOnly { get; set; }

Property Value

Boolean
true if this instance is cache only; otherwise, false.

Opacity

public double Opacity { get; set; }

Property Value

Double

IsVisible

Gets or sets if this overlay is visible.

public bool IsVisible { get; set; }

Property Value

Boolean

DrawingQuality

public DrawingQuality DrawingQuality { get; set; }

Property Value

DrawingQuality

TileSizeMode

Gets or sets the tile size mode.

public TileSizeMode TileSizeMode { get; set; }

Property Value

TileSizeMode

        The tile size mode.

TileType

Gets and sets the overlay is formed by multiple tiles or single tile.

public TileType TileType { get; set; }

Property Value

TileType

TileWidth

Gets and sets the width of the tile.

public int TileWidth { get; set; }

Property Value

Int32

TileHeight

Gets and sets the height of the tile.

public int TileHeight { get; set; }

Property Value

Int32

TileCache

Gets and sets a tile cache object for saving the tiles.

public RasterTileCache TileCache { get; set; }

Property Value

RasterTileCache

TileSnappingMode

Gets or sets the tileView snapping mode.

public TileSnappingMode TileSnappingMode { get; set; }

Property Value

TileSnappingMode

TileBuffer

This property gets and sets the number of extra rows and colums of tiles on each side which will surround the minimum grid tiles to cover the map.

public int TileBuffer { get; set; }

Property Value

Int32

MaxExtent

This property gets or sets the max extent of matrix to calculate the tiles.

public RectangleShape MaxExtent { get; set; }

Property Value

RectangleShape

Remarks:

By default, MaxExtent is null; the matrix is created depending on the GeographyUnit of current map. When it's DecimalDegree, the matrix' is calculated as (-180, 90, 180, -90) as MaxExtent. While it's not DecimalDegree, the matrix is (-20037508.2314698, 20037508.2314698, 20037508.2314698, -20037508.2314698); It's allowed to modify it to customize the matrix.

WrappingMode

Thie property gets or sets whether allow wrap date line.

public WrappingMode WrappingMode { get; set; }

Property Value

WrappingMode

WrappingExtent

public RectangleShape WrappingExtent { get; set; }

Property Value

RectangleShape

CanRefreshRegion

public bool CanRefreshRegion { get; protected set; }

Property Value

Boolean

IsBase

public bool IsBase { get; set; }

Property Value

Boolean

Name

Gets or sets the name of this overaly.

public string Name { get; set; }

Property Value

String

MapArguments

Gets or sets current map information which will be used for calculating mechanism.

public MapArguments MapArguments { get; set; }

Property Value

MapArguments

OverlayCanvas

Gets or sets the actual canvas which maintains all the visual elements on the overlay.

public Canvas OverlayCanvas { get; set; }

Property Value

Canvas

DrawingExceptionMode

This property gets and sets the DrawingExceptionMode used when an exception occurs during drawing.

public DrawingExceptionMode DrawingExceptionMode { get; set; }

Property Value

DrawingExceptionMode

Attribution

public string Attribution { get; set; }

Property Value

String

IsEmpty

This property gets if this overlay is empty or not.

public bool IsEmpty { get; }

Property Value

Boolean

Remarks:

This property enhances the performance of the overlay while drawing. If is true, we will skip drawing this overlay and continue drawing the next overlay.

AutoRefreshInterval

public TimeSpan AutoRefreshInterval { get; set; }

Property Value

TimeSpan

Methods

AdjustExtentForWrapDateline(RectangleShape)

protected RectangleShape AdjustExtentForWrapDateline(RectangleShape targetDrawingExtent)

Parameters

targetDrawingExtent RectangleShape

Returns

RectangleShape

ClearTiles()

Clears the tiles.

public void ClearTiles()

DrawAsyncCore(RectangleShape, OverlayRefreshType, CancellationToken)

Draws current overlay with provided world extent.

protected Task DrawAsyncCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, CancellationToken cancellationToken)

Parameters

targetExtent RectangleShape
A world extent for drawing.

overlayRefreshType OverlayRefreshType

cancellationToken CancellationToken

Returns

Task

PositionExistingTilesCore(RectangleShape)

protected void PositionExistingTilesCore(RectangleShape targetExtent)

Parameters

targetExtent RectangleShape

PrefillDataToTiles(IEnumerable<TileView>)

protected void PrefillDataToTiles(IEnumerable<TileView> tiles)

Parameters

tiles IEnumerable<TileView>

PrefillDataToTilesCore(IEnumerable<TileView>)

protected void PrefillDataToTilesCore(IEnumerable<TileView> tiles)

Parameters

tiles IEnumerable<TileView>

OnDrawTilesProgressChanged(DrawTilesProgressChangedTileOverlayEventArgs)

Occurs when Tiles' download progress is changed.

protected void OnDrawTilesProgressChanged(DrawTilesProgressChangedTileOverlayEventArgs args)

Parameters

args DrawTilesProgressChangedTileOverlayEventArgs
Event arguments for DownloadProgress event.

OnDrawingTile(DrawingTileTileOverlayEventArgs)

This method raises before a tile is drawing.

protected void OnDrawingTile(DrawingTileTileOverlayEventArgs args)

Parameters

args DrawingTileTileOverlayEventArgs
This is an event argument for DrawingTile event.

OnDrawnTile(DrawnTileTileOverlayEventArgs)

This method raises after a tile is drawn.

protected void OnDrawnTile(DrawnTileTileOverlayEventArgs args)

Parameters

args DrawnTileTileOverlayEventArgs
This is an event argument for DrawnTile event.

GetTileCore()

Chooses a tile object to form the TileOverlay.

When overriding this method, consider the initialize parameters setting on the tile.

protected TileView GetTileCore()

Returns

TileView
A tile object to form the TileOverlay.

SaveStateCore()

This method saves overlay state to a byte array.

protected Byte[] SaveStateCore()

Returns

Byte[]
A byte array indicates current overlay state.

LoadStateCore(Byte[])

This method restore the overlay state back from the specified state.

protected void LoadStateCore(Byte[] state)

Parameters

state Byte[]
This parameter indicates the state for restore the overlay.

DrawTileAsync(TileView, MapArguments, CancellationToken)

protected Task DrawTileAsync(TileView tileView, MapArguments mapArguments, CancellationToken cancellationToken)

Parameters

tileView TileView

mapArguments MapArguments

cancellationToken CancellationToken

Returns

Task

DrawTileAsyncCore(GeoCanvas, TileView)

Redraws a specified tile with the provided world extent.

protected Task DrawTileAsyncCore(GeoCanvas geoCanvas, TileView tile)

Parameters

geoCanvas GeoCanvas
A geoCanvas for drawing the passed tile.

tile TileView
A TileView object that is created by the GetTile() method to draw.

Returns

Task

GetDrawingCells(RectangleShape, Int32)

This method gets the cells for drawing in the passed world extent.

protected Dictionary<string, MatrixCell> GetDrawingCells(RectangleShape targetExtent, int tileBuffer)

Parameters

targetExtent RectangleShape
A world extent for getting the drawing cells.

tileBuffer Int32

Returns

Dictionary<String, MatrixCell>
A dictionary of cells for drawing in the passed world extent.

GetDrawingCellsCore(RectangleShape, Int32)

This method gets the cells for drawing in the passed world extent.

protected Dictionary<string, MatrixCell> GetDrawingCellsCore(RectangleShape targetExtent, int tileBuffer)

Parameters

targetExtent RectangleShape
A world extent for getting the drawing cells.

tileBuffer Int32

Returns

Dictionary<String, MatrixCell>
A dictionary of cells for drawing in the passed world extent.

Remarks:

When overriding this method, consider that the TileBuffer affects the passed world extent.

GetTileMatrix(Double)

public TileMatrix GetTileMatrix(double scale)

Parameters

scale Double

Returns

TileMatrix

GetTileMatrixCore(Double)

protected TileMatrix GetTileMatrixCore(double scale)

Parameters

scale Double

Returns

TileMatrix

DrawException(GeoCanvas, Exception)

This method will draw on the canvas when the layer.Draw throw exception and the DrawExceptionMode is set to DrawException instead of ThrowException.

protected void DrawException(GeoCanvas canvas, Exception e)

Parameters

canvas GeoCanvas
The target canvas to draw the layer.

e Exception
The exception thrown when layer.Draw().

Remarks:

This method can be overriden its logic by rewrite the DrawExceptionCore.

DrawExceptionCore(GeoCanvas, Exception)

This method will draw on the canvas when the layer.Draw throw exception and the DrawExceptionMode is set to DrawException instead of ThrowException.

protected void DrawExceptionCore(GeoCanvas canvas, Exception e)

Parameters

canvas GeoCanvas
The target canvas to draw the layer.

e Exception
The exception thrown when layer.Draw().

OnDrawingException(DrawingExceptionTileOverlayEventArgs)

protected void OnDrawingException(DrawingExceptionTileOverlayEventArgs e)

Parameters

e DrawingExceptionTileOverlayEventArgs

OnDrawnException(DrawnExceptionTileOverlayEventArgs)

protected void OnDrawnException(DrawnExceptionTileOverlayEventArgs e)

Parameters

e DrawnExceptionTileOverlayEventArgs

OnTileTypeChanged(TileTypeChangedTileOverlayEventArgs)

protected void OnTileTypeChanged(TileTypeChangedTileOverlayEventArgs e)

Parameters

e TileTypeChangedTileOverlayEventArgs

OnTileTypeChanging(TileTypeChangingTileOverlayEventArgs)

protected void OnTileTypeChanging(TileTypeChangingTileOverlayEventArgs e)

Parameters

e TileTypeChangingTileOverlayEventArgs

GetBufferedExtent(RectangleShape, Double, Int32)

internal RectangleShape GetBufferedExtent(RectangleShape targetExtent, double resolution, int tileBuffer)

Parameters

targetExtent RectangleShape

resolution Double

tileBuffer Int32

Returns

RectangleShape

GetTile(RectangleShape, Int32, Int32, Int64, Int64, Int32, Double)

internal TileView GetTile(RectangleShape targetExtent, int tileScreenWidth, int tileScreenHeight, long tileColumnIndex, long tileRowIndex, int zoomLevelIndex, double scale)

Parameters

targetExtent RectangleShape

tileScreenWidth Int32

tileScreenHeight Int32

tileColumnIndex Int64

tileRowIndex Int64

zoomLevelIndex Int32

scale Double

Returns

TileView

GetSortedCells(Dictionary<String, MatrixCell>, RectangleShape)

protected Dictionary<string, MatrixCell> GetSortedCells(Dictionary<string, MatrixCell> cells, RectangleShape targetExtent)

Parameters

cells Dictionary<String, MatrixCell>

targetExtent RectangleShape

Returns

Dictionary<String, MatrixCell>

GetSortedCellsCore(Dictionary<String, MatrixCell>, RectangleShape)

protected Dictionary<string, MatrixCell> GetSortedCellsCore(Dictionary<string, MatrixCell> cells, RectangleShape targetExtent)

Parameters

cells Dictionary<String, MatrixCell>

targetExtent RectangleShape

Returns

Dictionary<String, MatrixCell>

Events

DrawTilesProgressChanged

This event raises when download progress is changed.

public event EventHandler<DrawTilesProgressChangedTileOverlayEventArgs> DrawTilesProgressChanged;

DrawingTile

This event raises before the tile is drawing.

public event EventHandler<DrawingTileTileOverlayEventArgs> DrawingTile;

DrawnTile

This event raises after the tile is drawn.

public event EventHandler<DrawnTileTileOverlayEventArgs> DrawnTile;

DrawingException

public event EventHandler<DrawingExceptionTileOverlayEventArgs> DrawingException;

DrawnException

public event EventHandler<DrawnExceptionTileOverlayEventArgs> DrawnException;

TileTypeChanged

public event EventHandler<TileTypeChangedTileOverlayEventArgs> TileTypeChanged;

TileTypeChanging

public event EventHandler<TileTypeChangingTileOverlayEventArgs> TileTypeChanging;

Drawing

This event raises before the overlay is drawing.

public event EventHandler<DrawingOverlayEventArgs> Drawing;

Drawn

This event raises after the overlay is drawn.

public event EventHandler<DrawnOverlayEventArgs> Drawn;

DrawingAttribution

public event EventHandler<DrawingAttributionOverlayEventArgs> DrawingAttribution;

DrawnAttribution

public event EventHandler<DrawnAttributionOverlayEventArgs> DrawnAttribution;

ThrowingException

public event EventHandler<ThrowingExceptionOverlayEventArgs> ThrowingException;