Class MapControl
Class, that uses the API of all other Mapsui MapControls
Inheritance
Implements
Inherited Members
Namespace: Mapsui.UI.Forms
Assembly: Mapsui.UI.Forms.dll
Syntax
public class MapControl : ContentView, IAnimatable, ITabStopElement, IViewController, IVisualElementController, IElementController, IGestureController, IGestureRecognizers, ILayout, ILayoutController, IMapControl, IDisposable, INotifyPropertyChanged
Constructors
| Edit this page View SourceMapControl()
Declaration
public MapControl()
Fields
| Edit this page View SourceUseDoubleTap
Declaration
public bool UseDoubleTap
Field Value
Type | Description |
---|---|
bool |
UseFling
Declaration
public bool UseFling
Field Value
Type | Description |
---|---|
bool |
UseGPU
Declaration
public static bool UseGPU
Field Value
Type | Description |
---|---|
bool |
_initialized
Declaration
protected readonly bool _initialized
Field Value
Type | Description |
---|---|
bool |
Properties
| Edit this page View SourceMap
Map holding data for which is shown in this MapControl
Declaration
public Map Map { get; set; }
Property Value
Type | Description |
---|---|
Map |
Performance
Object to save performance information about the drawing of the map
Declaration
public Performance? Performance { get; set; }
Property Value
Type | Description |
---|---|
Performance |
Remarks
If this is null, no performance information is saved.
PixelDensity
The number of pixel per device independent unit
Declaration
public float PixelDensity { get; }
Property Value
Type | Description |
---|---|
float |
ReSnapRotationDegrees
With how many degrees from 0 should map snap to 0 degrees
Declaration
public double ReSnapRotationDegrees { get; set; }
Property Value
Type | Description |
---|---|
double |
RenderCache
Declaration
public IRenderCache RenderCache { get; }
Property Value
Type | Description |
---|---|
IRenderCache |
Renderer
Renderer that is used from this MapControl
Declaration
public IRenderer Renderer { get; set; }
Property Value
Type | Description |
---|---|
IRenderer |
ScreenHeight
Declaration
public float ScreenHeight { get; }
Property Value
Type | Description |
---|---|
float |
ScreenWidth
Declaration
public float ScreenWidth { get; }
Property Value
Type | Description |
---|---|
float |
ShiftPessed
Declaration
public bool ShiftPessed { get; set; }
Property Value
Type | Description |
---|---|
bool |
UnSnapRotationDegrees
After how many degrees start rotation to take place
Declaration
public double UnSnapRotationDegrees { get; set; }
Property Value
Type | Description |
---|---|
double |
UpdateInterval
Interval between two redraws of the MapControl in ms
Declaration
public int UpdateInterval { get; set; }
Property Value
Type | Description |
---|---|
int |
Methods
| Edit this page View SourceCallHomeIfNeeded()
Declaration
public void CallHomeIfNeeded()
ClearTouchState()
Clears the Touch State
Declaration
public void ClearTouchState()
Dispose()
Declaration
public void Dispose()
Dispose(bool)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing |
~MapControl()
Declaration
protected ~MapControl()
ForceUpdate()
Force a update of control
Declaration
public void ForceUpdate()
Remarks
When this function is called, the control draws itself once
GetMapInfo(MPoint?, int)
Check, if a feature at a given screen position is hit
Declaration
public MapInfo? GetMapInfo(MPoint? screenPosition, int margin = 0)
Parameters
Type | Name | Description |
---|---|---|
MPoint | screenPosition | Screen position to check for widgets and features |
int | margin | An optional extra margin around the feature to enlarge the hit area. |
Returns
Type | Description |
---|---|
MapInfo |
GetSnapshot(IEnumerable<ILayer>?)
Create a snapshot form map as PNG image
Declaration
public byte[] GetSnapshot(IEnumerable<ILayer>? layers = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<ILayer> | layers | Layers that should be included in snapshot |
Returns
Type | Description |
---|---|
byte[] | Byte array with snapshot in png format. If there are any problems than returns null. |
OnPropertyChanged(string)
Method that is called when a bound property is changed.
Declaration
protected override void OnPropertyChanged(string propertyName = "")
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | The name of the bound property that changed. |
Overrides
Remarks
To be added.
OpenBrowser(string)
Public functions
Declaration
public void OpenBrowser(string url)
Parameters
Type | Name | Description |
---|---|---|
string | url |
Refresh(ChangeType)
Declaration
public void Refresh(ChangeType changeType = ChangeType.Discrete)
Parameters
Type | Name | Description |
---|---|---|
ChangeType | changeType |
RefreshData(ChangeType)
Refresh data of Map, but don't paint it
Declaration
public void RefreshData(ChangeType changeType = ChangeType.Discrete)
Parameters
Type | Name | Description |
---|---|---|
ChangeType | changeType |
RefreshGraphics()
Declaration
public void RefreshGraphics()
ResetWidgetCache()
Reset the widget cache. It may be necessary to call this explicitly after the widgets have changed.
Declaration
protected void ResetWidgetCache()
RunOnUIThread(Action)
Declaration
protected void RunOnUIThread(Action action)
Parameters
Type | Name | Description |
---|---|---|
Action | action |
StartUpdates(bool)
Start updates for control
Declaration
public void StartUpdates(bool refresh = true)
Parameters
Type | Name | Description |
---|---|---|
bool | refresh |
Remarks
When this function is called, the control is redrawn if needed
StopUpdates()
Stop updates for control
Declaration
public void StopUpdates()
Remarks
When this function is called, the control stops to redraw itself, even if it is needed
ToDeviceIndependentUnits(MPoint)
Converts coordinates in pixels to device independent units (or DIP or DP).
Declaration
public MPoint ToDeviceIndependentUnits(MPoint coordinateInPixels)
Parameters
Type | Name | Description |
---|---|---|
MPoint | coordinateInPixels | Coordinate in pixels |
Returns
Type | Description |
---|---|
MPoint | Coordinate in device independent units (or DIP or DP) |
ToPixels(MPoint)
Converts coordinates in device independent units (or DIP or DP) to pixels.
Declaration
public MPoint ToPixels(MPoint coordinateInDeviceIndependentUnits)
Parameters
Type | Name | Description |
---|---|---|
MPoint | coordinateInDeviceIndependentUnits | Coordinate in device independent units (or DIP or DP) |
Returns
Type | Description |
---|---|
MPoint | Coordinate in pixels |
Unsubscribe()
Unsubscribe from map events
Declaration
public void Unsubscribe()
Events
| Edit this page View SourceDoubleTap
DoubleTap is called, when user clicks with a mouse button or tap with a finger two or more times on map
Declaration
public event EventHandler<TappedEventArgs>? DoubleTap
Event Type
Type | Description |
---|---|
EventHandler<TappedEventArgs> |
Fling
Fling is called, when user release mouse button or lift finger while moving with a certain speed
Declaration
public event EventHandler<SwipedEventArgs>? Fling
Event Type
Type | Description |
---|---|
EventHandler<SwipedEventArgs> |
Hovered
Hover is called, when user move mouse over map without pressing mouse button
Declaration
public event EventHandler<HoveredEventArgs>? Hovered
Event Type
Type | Description |
---|---|
EventHandler<HoveredEventArgs> |
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> |
LongTap
LongTap is called, when user clicks with a mouse button or tap with a finger on map for 500 ms
Declaration
public event EventHandler<TappedEventArgs>? LongTap
Event Type
Type | Description |
---|---|
EventHandler<TappedEventArgs> |
PropertyChanged
Called whenever a property is changed
Declaration
public event PropertyChangedEventHandler? PropertyChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |
SingleTap
SingleTap is called, when user clicks with a mouse button or tap with a finger on map
Declaration
public event EventHandler<TappedEventArgs>? SingleTap
Event Type
Type | Description |
---|---|
EventHandler<TappedEventArgs> |
TouchAction
TouchAction is called, when user provoques a touch event
Declaration
public event EventHandler<SKTouchEventArgs>? TouchAction
Event Type
Type | Description |
---|---|
EventHandler<SKTouchEventArgs> |
TouchEnded
TouchEnd is called, when user release a mouse button or doesn't touch display anymore
Declaration
public event EventHandler<TouchedEventArgs>? TouchEnded
Event Type
Type | Description |
---|---|
EventHandler<TouchedEventArgs> |
TouchEntered
TouchEntered is called, when user moves an active touch onto the view
Declaration
public event EventHandler<TouchedEventArgs>? TouchEntered
Event Type
Type | Description |
---|---|
EventHandler<TouchedEventArgs> |
TouchExited
TouchExited is called, when user moves an active touch off the view
Declaration
public event EventHandler<TouchedEventArgs>? TouchExited
Event Type
Type | Description |
---|---|
EventHandler<TouchedEventArgs> |
TouchMove
TouchMove is called, when user move mouse over map (independent from mouse button state) or move finger on display
Declaration
public event EventHandler<TouchedEventArgs>? TouchMove
Event Type
Type | Description |
---|---|
EventHandler<TouchedEventArgs> |
TouchStarted
Event handlers
Declaration
public event EventHandler<TouchedEventArgs>? TouchStarted
Event Type
Type | Description |
---|---|
EventHandler<TouchedEventArgs> |
Zoomed
Zoom is called, when map should be zoomed
Declaration
public event EventHandler<ZoomedEventArgs>? Zoomed
Event Type
Type | Description |
---|---|
EventHandler<ZoomedEventArgs> |