Skip to content

Overlay

Namespace: ThinkGeo.Core

This class is the base class of all overlays in this overlay system.

public abstract class Overlay : System.IDisposable

Inheritance ObjectOverlay
Implements IDisposable

Remarks:

The Overlay has the similar concept as the layer. Different types of overlays stack over each other to form a map. An overlay object is responsible for getting the configuration infomation from the user.

Usually an overlay represents an image with transparent background that is laid upon other overlay such as LayerOverlay, WmsOverlay. While the MarkerOverlay will not be rendered as an image, it is actually represents a control that holds bunch of marker images on the map.

Properties

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

IsVisible

Gets or sets if this overlay is visible.

public bool IsVisible { get; set; }

Property Value

Boolean

RefreshTypeOnResize

public OverlayRefreshType RefreshTypeOnResize { get; set; }

Property Value

OverlayRefreshType

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

Refresh(TimeSpan, RequestDrawingBufferTimeType)

public void Refresh(TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)

Parameters

bufferTime TimeSpan

bufferTimeType RequestDrawingBufferTimeType

RefreshAsync(TimeSpan, RequestDrawingBufferTimeType)

public Task RefreshAsync(TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)

Parameters

bufferTime TimeSpan

bufferTimeType RequestDrawingBufferTimeType

Returns

Task

Refresh(RectangleShape, TimeSpan)

public void Refresh(RectangleShape extentToRefresh, TimeSpan bufferTime)

Parameters

extentToRefresh RectangleShape

bufferTime TimeSpan

RefreshAsync(RectangleShape, TimeSpan)

public Task RefreshAsync(RectangleShape extentToRefresh, TimeSpan bufferTime)

Parameters

extentToRefresh RectangleShape

bufferTime TimeSpan

Returns

Task

Refresh(RectangleShape, TimeSpan, RequestDrawingBufferTimeType)

public void Refresh(RectangleShape extentToRefresh, TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)

Parameters

extentToRefresh RectangleShape

bufferTime TimeSpan

bufferTimeType RequestDrawingBufferTimeType

RefreshAsync(RectangleShape, TimeSpan, RequestDrawingBufferTimeType)

public Task RefreshAsync(RectangleShape extentToRefresh, TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)

Parameters

extentToRefresh RectangleShape

bufferTime TimeSpan

bufferTimeType RequestDrawingBufferTimeType

Returns

Task

Refresh(IEnumerable<RectangleShape>, TimeSpan)

public void Refresh(IEnumerable<RectangleShape> extentsToRefresh, TimeSpan bufferTime)

Parameters

extentsToRefresh IEnumerable<RectangleShape>

bufferTime TimeSpan

RefreshAsync(IEnumerable<RectangleShape>, TimeSpan)

public Task RefreshAsync(IEnumerable<RectangleShape> extentsToRefresh, TimeSpan bufferTime)

Parameters

extentsToRefresh IEnumerable<RectangleShape>

bufferTime TimeSpan

Returns

Task

Refresh(IEnumerable<RectangleShape>, TimeSpan, RequestDrawingBufferTimeType)

public void Refresh(IEnumerable<RectangleShape> extentsToRefresh, TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)

Parameters

extentsToRefresh IEnumerable<RectangleShape>

bufferTime TimeSpan

bufferTimeType RequestDrawingBufferTimeType

RefreshAsync(IEnumerable<RectangleShape>, TimeSpan, RequestDrawingBufferTimeType)

public Task RefreshAsync(IEnumerable<RectangleShape> extentsToRefresh, TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)

Parameters

extentsToRefresh IEnumerable<RectangleShape>

bufferTime TimeSpan

bufferTimeType RequestDrawingBufferTimeType

Returns

Task

CreateDefaultGeoCanvas()

protected GeoCanvas CreateDefaultGeoCanvas()

Returns

GeoCanvas

CreateDefaultGeoCanvasCore()

protected GeoCanvas CreateDefaultGeoCanvasCore()

Returns

GeoCanvas

Initialize(MapArguments)

This method initializes overlay object.

public void Initialize(MapArguments mapArguments)

Parameters

mapArguments MapArguments
This parameter maintains current map information for calculating mechanism.

Remarks:

This is a wrapper method for the virtual method InitializeCore.

InitializeCore(MapArguments)

This method initializes overlay object.

protected void InitializeCore(MapArguments mapArguments)

Parameters

mapArguments MapArguments
This parameter maintains current map information for calculating mechanism.

Remarks:

When implementing this method, consider initializing the overlay canvas such as setting its z-index, setting current map reference to the CurrentMap property.

Refresh(RectangleShape)

public void Refresh(RectangleShape extent)

Parameters

extent RectangleShape

RefreshAsync(RectangleShape, CancellationToken)

public Task RefreshAsync(RectangleShape extent, CancellationToken cancellationToken)

Parameters

extent RectangleShape

cancellationToken CancellationToken

Returns

Task

RefreshCore(RectangleShape)

protected void RefreshCore(RectangleShape extent)

Parameters

extent RectangleShape

RefreshAsyncCore(RectangleShape, CancellationToken)

protected Task RefreshAsyncCore(RectangleShape extent, CancellationToken cancellationToken)

Parameters

extent RectangleShape

cancellationToken CancellationToken

Returns

Task

Refresh()

This method refreshes all the content in the OverlayCanvas. For example, LayerOverlay with multiple tiles; when the style of one layer is changed, call Refresh to refresh all the tiles to accept new styles.

public void Refresh()

Remarks:

The difference from Draw() method is that Refresh() method refreshes all the elements while Draw() does not.

RefreshAsync(CancellationToken)

This method refreshes all the content in the OverlayCanvas. For example, LayerOverlay with multiple tiles; when the style of one layer is changed, call Refresh to refresh all the tiles to accept new styles.

public Task RefreshAsync(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task

Remarks:

The difference from Draw() method is that Refresh() method refreshes all the elements while Draw() does not.

RefreshCore()

This method refreshes all the content in the OverlayCanvas. For example, LayerOverlay with multiple tiles; when the style of one layer is changed, call Refresh to refresh all the tiles to accept new styles.

protected void RefreshCore()

Remarks:

The difference from Draw() method is that Refresh() method refreshes all the elements while Draw() does not.

RefreshAsyncCore(CancellationToken)

This method refreshes all the content in the OverlayCanvas. For example, LayerOverlay with multiple tiles; when the style of one layer is changed, call Refresh to refresh all the tiles to accept new styles.

protected Task RefreshAsyncCore(CancellationToken cancellationToken)

Parameters

cancellationToken CancellationToken

Returns

Task

Remarks:

The difference from DrawAsync() method is that RefreshAsync() method refreshes all the elements while DrawAsync() does not.

PositionExistingTiles(RectangleShape)

internal void PositionExistingTiles(RectangleShape targetExtent)

Parameters

targetExtent RectangleShape

PositionExistingTilesCore(RectangleShape)

protected void PositionExistingTilesCore(RectangleShape targetExtent)

Parameters

targetExtent RectangleShape

Close()

public void Close()

CloseCore()

protected void CloseCore()

CloseAsync()

public Task CloseAsync()

Returns

Task

CloseAsyncCore()

protected Task CloseAsyncCore()

Returns

Task

Open()

public void Open()

OpenCore()

protected void OpenCore()

OpenAsync()

public Task OpenAsync()

Returns

Task

OpenAsyncCore()

protected Task OpenAsyncCore()

Returns

Task

Draw(RectangleShape)

This method draws the overlay with the provided extent in world coordinate.

public void Draw(RectangleShape targetExtent)

Parameters

targetExtent RectangleShape
This parameter indicates an extent in world coordinate for drawing the overlay.

DrawAsync(RectangleShape)

This method draws the overlay with the provided extent in world coordinate.

public Task DrawAsync(RectangleShape targetExtent)

Parameters

targetExtent RectangleShape
This parameter indicates an extent in world coordinate for drawing the overlay.

Returns

Task

Draw(RectangleShape, OverlayRefreshType)

This method draws the overlay with the provided extent in world coordinate.

public void Draw(RectangleShape targetExtent, OverlayRefreshType refreshType)

Parameters

targetExtent RectangleShape
This parameter indicates an extent in world coordinate for drawing the overlay.

refreshType OverlayRefreshType

        This parameter indicates whether the elements of this overlay needs to be refreshed.
        For example, TileOverlay is formed by tiles.
        When panning the map around, the existing tile doesn't need to be redraw,
        the only thing we need to do is modifying the position of these tiles.
        On another hand, when click to change the style of the overlay,
        we need to redraw the tile images to change the appearance. So we need refresh mode.

DrawAsync(RectangleShape, OverlayRefreshType, CancellationToken)

This method draws the overlay with the provided extent in world coordinate.

public Task DrawAsync(RectangleShape targetExtent, OverlayRefreshType refreshType, CancellationToken cancellationToken)

Parameters

targetExtent RectangleShape
This parameter indicates an extent in world coordinate for drawing the overlay.

refreshType OverlayRefreshType

        This parameter indicates whether the elements of this overlay needs to be refreshed.
        For example, TileOverlay is formed by tiles.
        When panning the map around, the existing tile doesn't need to be redraw,
        the only thing we need to do is modifying the position of these tiles.
        On another hand, when click to change the style of the overlay,
        we need to redraw the tile images to change the appearance. So we need refresh mode.

cancellationToken CancellationToken

Returns

Task

DrawCore(RectangleShape, OverlayRefreshType)

This method draws the overlay with the provided extent in world coordinate.

protected void DrawCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType)

Parameters

targetExtent RectangleShape
This parameter indicates an extent in world coordinate for drawing the overlay.

overlayRefreshType OverlayRefreshType

         This parameter indicates whether the elements of this overlay needs to be refreshed.

         For example, TileOverlay is formed by tiles.
         When panning or zooming the map, the existing tile doesn't need to be redraw,
         because the styles are the same as the previous states.
         the only thing we need to do is modifying the position of these tiles.
         On another hand, when click to change the style of the overlay,
         we need to redraw the tile images to change the appearance. So we need refresh mode.

DrawAsyncCore(RectangleShape, OverlayRefreshType, CancellationToken)

This method draws the overlay with the provided extent in world coordinate.

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

Parameters

targetExtent RectangleShape
This parameter indicates an extent in world coordinate for drawing the overlay.

overlayRefreshType OverlayRefreshType

         This parameter indicates whether the elements of this overlay needs to be refreshed.

         For example, TileOverlay is formed by tiles.
         When panning or zooming the map, the existing tile doesn't need to be redraw,
         because the styles are the same as the previous states.
         the only thing we need to do is modifying the position of these tiles.
         On another hand, when click to change the style of the overlay,
         we need to redraw the tile images to change the appearance. So we need refresh mode.

cancellationToken CancellationToken

Returns

Task

DrawAttribution(GeoCanvas)

internal void DrawAttribution(GeoCanvas canvas)

Parameters

canvas GeoCanvas

DrawAttributionCore(GeoCanvas)

protected void DrawAttributionCore(GeoCanvas canvas)

Parameters

canvas GeoCanvas

OnDrawingAttribution(DrawingAttributionOverlayEventArgs)

protected void OnDrawingAttribution(DrawingAttributionOverlayEventArgs args)

Parameters

args DrawingAttributionOverlayEventArgs

OnDrawnAttribution(DrawnAttributionOverlayEventArgs)

protected void OnDrawnAttribution(DrawnAttributionOverlayEventArgs args)

Parameters

args DrawnAttributionOverlayEventArgs

PanTo(RectangleShape)

This method pans the overlay to the provided world extent.

public void PanTo(RectangleShape targetExtent)

Parameters

targetExtent RectangleShape
This parameter is the target world extent for panning.

Remarks:

Some overlay doesn't need to continously drawing all the tile. For example, MarkerOverlay is formed by markers. When mouse down to pan, the markers don't need to redraw, we can only change its position. When mouse up to end panning, we can redraw the overlay for better performance.

PanToCore(RectangleShape)

This method pans the overlay to the provided world extent.

protected void PanToCore(RectangleShape targetExtent)

Parameters

targetExtent RectangleShape
This parameter is the target world extent for panning.

Remarks:

Some overlay doesn't need to continously drawing all the tile. For example, MarkerOverlay is formed by markers. When mouse down to pan, the markers don't need to redraw, we can only change its position. When mouse up to end panning, we can redraw the overlay for better performance.

OnDrawing(DrawingOverlayEventArgs)

This method raises before the overlay is drawing.

protected void OnDrawing(DrawingOverlayEventArgs e)

Parameters

e DrawingOverlayEventArgs
This parameter is the event argument for Drawing event.

OnDrawn(DrawnOverlayEventArgs)

This method raises after the overlay is drawn.

protected void OnDrawn(DrawnOverlayEventArgs e)

Parameters

e DrawnOverlayEventArgs
This parameter is the event argument for Drawn event.

OnReadyForOverlaysDrawnEvent(DrawnOverlayEventArgs)

internal void OnReadyForOverlaysDrawnEvent(DrawnOverlayEventArgs e)

Parameters

e DrawnOverlayEventArgs

GetBoundingBox()

This method gets a bounding box of the Overlay.

public RectangleShape GetBoundingBox()

Returns

RectangleShape
A RectangleShape indicating the bounding box of this overlay

Remarks:

This method is the concrete wrapper for the abstract method GetBoundingBoxCore. This method returns the bounding box of the Overlay.

As this is a concrete public method that wraps a Core method, we reserve the right to add events and other logic to pre- or post-process data returned by the Core version of the method. In this way, we leave our framework open on our end, but also allow you the developer to extend our logic to suit your needs. If you have questions about this, please contact our support team as we would be happy to work with you on extending our framework.

GetBoundingBoxCore()

This method returns the bounding box of the Overlay.

protected RectangleShape GetBoundingBoxCore()

Returns

RectangleShape
This method returns the bounding box of the Overlay.

Remarks:

This method returns the bounding box of the Overlay.

SaveState()

This method saves overlay state to a byte array.

public Byte[] SaveState()

Returns

Byte[]
A byte array indicates current overlay state.

SaveStateCore()

This method saves overlay state to a byte array.

protected Byte[] SaveStateCore()

Returns

Byte[]
A byte array indicates current overlay state.

LoadState(Byte[])

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

public void LoadState(Byte[] state)

Parameters

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

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.

Finalize()

Finalizer of this Overlay object.

protected void Finalize()

Dispose()

This method dispose unmanaged resource used in this class.

public void Dispose()

Dispose(Boolean)

This method dispose unmanaged resource used in this class.

protected void Dispose(bool disposing)

Parameters

disposing Boolean

OnDrawingExceptionModeChanged()

internal void OnDrawingExceptionModeChanged()

OnRefreshing(OverlayRefreshType)

internal void OnRefreshing(OverlayRefreshType refreshType)

Parameters

refreshType OverlayRefreshType

OnThrowingException(ThrowingExceptionOverlayEventArgs)

protected void OnThrowingException(ThrowingExceptionOverlayEventArgs e)

Parameters

e ThrowingExceptionOverlayEventArgs

Refresh(IEnumerable<RectangleShape>)

public void Refresh(IEnumerable<RectangleShape> extentsToRefresh)

Parameters

extentsToRefresh IEnumerable<RectangleShape>

RefreshAsync(IEnumerable<RectangleShape>)

public Task RefreshAsync(IEnumerable<RectangleShape> extentsToRefresh)

Parameters

extentsToRefresh IEnumerable<RectangleShape>

Returns

Task

Refresh(TimeSpan)

public void Refresh(TimeSpan bufferTime)

Parameters

bufferTime TimeSpan

RefreshAsync(TimeSpan)

public Task RefreshAsync(TimeSpan bufferTime)

Parameters

bufferTime TimeSpan

Returns

Task

Events

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;