Class PluginMapSurface
- Namespace
- AcDream.Plugin.Abstractions
- Assembly
- AcDream.Plugin.Abstractions.dll
Thread-safe stateful map surface useful to hosts and test fixtures.
public sealed class PluginMapSurface : IPluginMapSurface, IDisposable
- Inheritance
-
PluginMapSurface
- Implements
- Inherited Members
Constructors
PluginMapSurface(PluginMapViewport)
Makes a surface showing the given part of the world.
public PluginMapSurface(PluginMapViewport viewport)
Parameters
viewportPluginMapViewportThe part of the world shown to begin with.
Properties
Background
The image drawn under the markers, or null before one is set.
public PluginMapImage? Background { get; }
Property Value
Markers
The markers last given to SetMarkers(IReadOnlyList<PluginMapMarker>).
public IReadOnlyList<PluginMapMarker> Markers { get; }
Property Value
Route
The route last given to SetRoute(IReadOnlyList<PluginMapPoint>).
public IReadOnlyList<PluginMapPoint> Route { get; }
Property Value
Viewport
The part of the world the map shows. Set it to pan or zoom.
public PluginMapViewport Viewport { get; set; }
Property Value
Methods
Dispose()
Drops the background, markers, route and every subscriber. Setting anything afterwards throws.
public void Dispose()
RaiseInput(PluginMapInput)
Delivers input to subscribers, if the surface is still active.
public void RaiseInput(PluginMapInput input)
Parameters
inputPluginMapInputThe pointer event to deliver.
Exceptions
- ObjectDisposedException
The surface has been disposed.
SetBackground(PluginMapImage)
Sets the image drawn under the markers.
public void SetBackground(PluginMapImage image)
Parameters
imagePluginMapImageThe image and its world bounds.
Exceptions
- ObjectDisposedException
The surface has been disposed.
SetMarkers(IReadOnlyList<PluginMapMarker>)
Replaces every marker on the map.
public void SetMarkers(IReadOnlyList<PluginMapMarker> markers)
Parameters
markersIReadOnlyList<PluginMapMarker>The new markers; an empty list clears them.
Remarks
The list is copied, so later changes to it do not reach the map.
Exceptions
- ObjectDisposedException
The surface has been disposed.
SetRoute(IReadOnlyList<PluginMapPoint>)
Replaces the route drawn on the map.
public void SetRoute(IReadOnlyList<PluginMapPoint> points)
Parameters
pointsIReadOnlyList<PluginMapPoint>The route's points in walking order; an empty list clears it.
Remarks
The list is copied, so later changes to it do not reach the map.
Exceptions
- ObjectDisposedException
The surface has been disposed.
Events
Input
Raised for each pointer event over the map.
public event Action<PluginMapInput>? Input