Class Map
Map class
Inherited Members
Namespace: Mapsui
Assembly: Mapsui.dll
Syntax
public class Map : INotifyPropertyChanged, IDisposable
Remarks
Map holds all map related info like the target CRS, layers, widgets and so on.
Constructors
| Edit this page View SourceMap()
Initializes a new map
Declaration
public Map()
Properties
| Edit this page View SourceBackColor
Map background color (defaults to transparent)
Declaration
public Color BackColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color |
CRS
Coordinate reference system (projection type of map). Default: "EPSG:3857" (SphericalMercator).
Declaration
public string? CRS { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Extent
Gets the extent of the map based on the extent of all the layers in the layers collection
Declaration
public MRect? Extent { get; }
Property Value
| Type | Description |
|---|---|
| MRect | Full map extent |
FetchMachine
Declaration
public FetchMachine FetchMachine { get; }
Property Value
| Type | Description |
|---|---|
| FetchMachine |
Layers
A collection of layers. The first layer in the list is drawn first, the last one on top.
Declaration
public LayerCollection Layers { get; }
Property Value
| Type | Description |
|---|---|
| LayerCollection |
Navigator
Handles all manipulations of the map viewport
Declaration
public Navigator Navigator { get; }
Property Value
| Type | Description |
|---|---|
| Navigator |
Performance
Declaration
public Performance Performance { get; }
Property Value
| Type | Description |
|---|---|
| Performance |
RenderService
Declaration
public RenderService RenderService { get; set; }
Property Value
| Type | Description |
|---|---|
| RenderService |
Widgets
List of Widgets belonging to map
Declaration
public ConcurrentQueue<IWidget> Widgets { get; }
Property Value
| Type | Description |
|---|---|
| ConcurrentQueue<IWidget> |
Methods
| Edit this page View SourceAbortFetch()
Abort fetching of all layers
Declaration
public void AbortFetch()
ClearCache()
Clear cache of all layers
Declaration
public void ClearCache()
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | disposing |
GetWidgetsOfMapAndLayers()
Declaration
public IEnumerable<IWidget> GetWidgetsOfMapAndLayers()
Returns
| Type | Description |
|---|---|
| IEnumerable<IWidget> |
OnMapInfo(MapInfoEventArgs)
This method is to invoke the Info event from the Map. This method is called by the MapControl/MapView and should usually not be called from user code.
Declaration
public void OnMapInfo(MapInfoEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| MapInfoEventArgs | e |
OnViewportSizeInitialized()
Declaration
public void OnViewportSizeInitialized()
Refresh(ChangeType)
Refresh data of the map and than repaint it
Declaration
public void Refresh(ChangeType changeType = ChangeType.Discrete)
Parameters
| Type | Name | Description |
|---|---|---|
| ChangeType | changeType |
RefreshData(ChangeType, Viewport?)
Refresh data of Map, but don't paint it
Declaration
public void RefreshData(ChangeType changeType = ChangeType.Discrete, Viewport? viewport = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ChangeType | changeType | |
| Viewport? | viewport |
RefreshData(Viewport)
Declaration
public void RefreshData(Viewport viewport)
Parameters
| Type | Name | Description |
|---|---|---|
| Viewport | viewport |
RefreshGraphics()
Declaration
public void RefreshGraphics()
UpdateAnimations()
Declaration
public bool UpdateAnimations()
Returns
| Type | Description |
|---|---|
| bool |
Events
| Edit this page View SourceDataChanged
DataChanged should be triggered by any data changes of any of the child layers
Declaration
public event DataChangedEventHandler? DataChanged
Event Type
| Type | Description |
|---|---|
| DataChangedEventHandler |
Info
Called whenever the map is clicked. The MapInfoEventArgs contain the features that were hit in the layers that have IsMapInfoLayer set to true.
Declaration
public event EventHandler<MapInfoEventArgs>? Info
Event Type
| Type | Description |
|---|---|
| EventHandler<MapInfoEventArgs> |
Remarks
The Tapped event is preferred over the Info event. This event is kept for backwards compatibility.
PointerMoved
Event that is triggered when on pointer move. Can be a drag or hover.
Declaration
public event EventHandler<MapEventArgs>? PointerMoved
Event Type
| Type | Description |
|---|---|
| EventHandler<MapEventArgs> |
PointerPressed
Event that is triggered when on pointer down.
Declaration
public event EventHandler<MapEventArgs>? PointerPressed
Event Type
| Type | Description |
|---|---|
| EventHandler<MapEventArgs> |
PointerReleased
Event that is triggered when on pointer up.
Declaration
public event EventHandler<MapEventArgs>? PointerReleased
Event Type
| Type | Description |
|---|---|
| EventHandler<MapEventArgs> |
PropertyChanged
Called whenever a property changed
Declaration
public event PropertyChangedEventHandler? PropertyChanged
Event Type
| Type | Description |
|---|---|
| PropertyChangedEventHandler |
RefreshGraphicsRequest
Declaration
public event EventHandler? RefreshGraphicsRequest
Event Type
| Type | Description |
|---|---|
| EventHandler |
Tapped
Event that is triggered when the map is tapped. Can be a single tap, double tap or long press.
Declaration
public event EventHandler<MapEventArgs>? Tapped
Event Type
| Type | Description |
|---|---|
| EventHandler<MapEventArgs> |
ViewportInitialized
Called when the viewport is initialized
Declaration
public event EventHandler? ViewportInitialized
Event Type
| Type | Description |
|---|---|
| EventHandler |