Class Navigator
Inherited Members
Namespace: Mapsui
Assembly: Mapsui.dll
Syntax
public class Navigator
Constructors
| Edit this page View SourceNavigator()
Declaration
public Navigator()
Properties
| Edit this page View SourceHasExecutedPostponedCalls
Declaration
public bool HasExecutedPostponedCalls { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Limiter
Declaration
public IViewportLimiter Limiter { get; set; }
Property Value
| Type | Description |
|---|---|
| IViewportLimiter |
MouseWheelAnimation
Declaration
public MouseWheelAnimation MouseWheelAnimation { get; }
Property Value
| Type | Description |
|---|---|
| MouseWheelAnimation |
OverridePanBounds
Overrides the default pan bounds which come from the Map extent.
Declaration
public MRect? OverridePanBounds { get; set; }
Property Value
| Type | Description |
|---|---|
| MRect |
OverrideResolutions
Overrides the default resolutions which are derived from the Map.Layers resolutions.
Declaration
public IReadOnlyList<double>? OverrideResolutions { get; set; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<double> |
OverrideZoomBounds
Declaration
public MMinMax? OverrideZoomBounds { get; set; }
Property Value
| Type | Description |
|---|---|
| MMinMax |
PanBounds
The bounds to restrict panning. Exactly how these bounds affects panning depends on the implementation of the IViewportLimiter.
Declaration
public MRect? PanBounds { get; }
Property Value
| Type | Description |
|---|---|
| MRect |
PanLock
When true the user can not pan (move) the map.
Declaration
public bool PanLock { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
ReSnapRotation
With how many degrees from 0 should map snap to 0 degrees
Declaration
public double ReSnapRotation { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Resolutions
List of resolutions that can be used when going to a new zoom level. In the most common case these resolutions correspond to the resolutions of the background layer of the map. In the Mapsui samples this is usually the openstreetmap layer, but there are also situations where this is no background layer with resolutions. Or where one app switches between different background layers with different resolutions. Also note that when pinch zooming these resolutions are not used.
Declaration
public IReadOnlyList<double> Resolutions { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyList<double> |
RotationLock
When true the user can not rotate the map
Declaration
public bool RotationLock { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
UnSnapRotation
Overrides the default zoom bounds which are derived from the Map resolutions.
Declaration
public double UnSnapRotation { get; set; }
Property Value
| Type | Description |
|---|---|
| double |
Viewport
Declaration
public Viewport Viewport { get; }
Property Value
| Type | Description |
|---|---|
| Viewport |
ZoomBounds
The bounds of zooming, i.e. the smallest and biggest resolutions. How these bounds affect zooming depends on the implementation of the IViewportLimiter.
Declaration
public MMinMax? ZoomBounds { get; }
Property Value
| Type | Description |
|---|---|
| MMinMax |
ZoomLock
When true the user can not zoom the map
Declaration
public bool ZoomLock { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
| Edit this page View SourceCenterOn(MPoint, long, Easing?)
Change center of the viewport
Declaration
public void CenterOn(MPoint center, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| MPoint | center | New center point of the viewport |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | Function for easing |
CenterOn(double, double, long, Easing?)
Change center of the viewport to X/Y coordinates
Declaration
public void CenterOn(double x, double y, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| double | x | X value of the new center |
| double | y | Y value of the new center |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | Function for easing |
CenterOnAndZoomTo(MPoint, double, long, Easing?)
Navigate to center and change resolution with animation
Declaration
public void CenterOnAndZoomTo(MPoint center, double resolution, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| MPoint | center | New center to move to |
| double | resolution | New resolution to use |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
Fling(double, double, long)
Animate Fling of the viewport. This method is called from the MapControl and is usually not called from user code. This method does not call Navigated.
Declaration
public void Fling(double velocityX, double velocityY, long maxDuration)
Parameters
| Type | Name | Description |
|---|---|---|
| double | velocityX | VelocityX from SwipedEventArgs> |
| double | velocityY | VelocityX from SwipedEventArgs> |
| long | maxDuration | Maximum duration of fling deceleration> |
FlyTo(MPoint, double, long)
Fly to the given center with zooming out to given resolution and in again
Declaration
public void FlyTo(MPoint center, double maxResolution, long duration = 500)
Parameters
| Type | Name | Description |
|---|---|---|
| MPoint | center | MPoint to fly to |
| double | maxResolution | Maximum resolution to zoom out |
| long | duration | Duration for animation in milliseconds. |
Manipulate(Manipulation?)
Declaration
public void Manipulate(Manipulation? manipulation)
Parameters
| Type | Name | Description |
|---|---|---|
| Manipulation | manipulation |
MouseWheelZoom(int, ScreenPosition)
Declaration
public void MouseWheelZoom(int mouseWheelDelta, ScreenPosition centerOfZoom)
Parameters
| Type | Name | Description |
|---|---|---|
| int | mouseWheelDelta | |
| ScreenPosition | centerOfZoom |
MouseWheelZoomContinuous(double, ScreenPosition)
Declaration
public void MouseWheelZoomContinuous(double scaleFactor, ScreenPosition centerOfZoom)
Parameters
| Type | Name | Description |
|---|---|---|
| double | scaleFactor | |
| ScreenPosition | centerOfZoom |
RotateTo(double, long, Easing?)
Change rotation of the viewport
Declaration
public void RotateTo(double rotation, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| double | rotation | New rotation in degrees of the viewport> |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
SetSize(double, double)
Declaration
public void SetSize(double width, double height)
Parameters
| Type | Name | Description |
|---|---|---|
| double | width | |
| double | height |
SetViewport(Viewport, long, Easing?)
Declaration
public void SetViewport(Viewport viewport, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Viewport | viewport | |
| long | duration | |
| Easing | easing |
SetViewportAnimations(List<AnimationEntry<Viewport>>)
Declaration
public void SetViewportAnimations(List<AnimationEntry<Viewport>> animations)
Parameters
| Type | Name | Description |
|---|---|---|
| List<AnimationEntry<Viewport>> | animations |
UpdateAnimations()
Declaration
public bool UpdateAnimations()
Returns
| Type | Description |
|---|---|
| bool |
ZoomIn(ScreenPosition, long, Easing?)
Zoom in to a given point
Declaration
public void ZoomIn(ScreenPosition centerOfZoom, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ScreenPosition | centerOfZoom | Center of zoom. This is the one point in the map that stays on the same location while zooming in.For instance, in mouse wheel zoom animation the position of the mouse pointer can be the center of zoom. |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
ZoomIn(long, Easing?)
Zoom in to the next resolution in the Navigator.Resolutions list. Respects ZoomLock.
Declaration
public void ZoomIn(long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
ZoomOut(ScreenPosition, long, Easing?)
Zoom out to a given point
Declaration
public void ZoomOut(ScreenPosition centerOfZoom, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ScreenPosition | centerOfZoom | Center of zoom. This is the one point in the map that stays on the same location while zooming in. For instance, in mouse wheel zoom animation the position of the mouse pointer can be the center of zoom. |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
ZoomOut(long, Easing?)
Zoom out to the next resolution in the Navigator.Resolutions list. Respects ZoomLock.
Declaration
public void ZoomOut(long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
ZoomTo(double, ScreenPosition, long, Easing?)
Zoom to a given resolution with a given point as center
Declaration
public void ZoomTo(double resolution, ScreenPosition centerOfZoomScreen, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| double | resolution | Resolution to zoom |
| ScreenPosition | centerOfZoomScreen | Center of zoom in screen coordinates. This is the one point in the map that stays on the same location while zooming in. For instance, in mouse wheel zoom animation the position of the mouse pointer can be the center of zoom. Note, that the centerOfZoom is in screen coordinates not world coordinates, this is because this is most convenient for the main use case, zoom with the mouse position as center. |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The easing of the animation when duration is > 0 |
ZoomTo(double, long, Easing?)
Change resolution of the viewport
Declaration
public void ZoomTo(double resolution, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| double | resolution | New resolution to use |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
ZoomToBox(MRect?, MBoxFit, long, Easing?)
Zooms the viewport to show the box. The boxFit parameter can be used to deal with a difference in the width/height ratio between the viewport and the box. The center and resolution will change accordingly.
Declaration
public void ZoomToBox(MRect? box, MBoxFit boxFit = MBoxFit.Fit, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| MRect | box | The box to show in the viewport. |
| MBoxFit | boxFit | The way the box should be fit into the view. |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
ZoomToLevel(int)
Zooms to the level indicated. The level is the index of the resolution in the Navigator.Resolutions list.
Declaration
public void ZoomToLevel(int level)
Parameters
| Type | Name | Description |
|---|---|---|
| int | level | The index of the Navigator.Resolutions list. |
ZoomToPanBounds(MBoxFit, long, Easing?)
Navigate to the PanBounds.
Declaration
public void ZoomToPanBounds(MBoxFit boxFit = MBoxFit.Fill, long duration = -1, Easing? easing = null)
Parameters
| Type | Name | Description |
|---|---|---|
| MBoxFit | boxFit | Scale method to use to determine resolution |
| long | duration | Duration for animation in milliseconds. |
| Easing | easing | The type of easing function used to transform from begin tot end state |
Events
| Edit this page View SourceFetchRequested
Called when a data refresh is needed. This directly after a non-animated viewport change is made and after an animation has completed.
Declaration
public event EventHandler<FetchRequestedEventArgs>? FetchRequested
Event Type
| Type | Description |
|---|---|
| EventHandler<FetchRequestedEventArgs> |
ViewportChanged
Declaration
public event Navigator.ViewportChangedEventHandler? ViewportChanged
Event Type
| Type | Description |
|---|---|
| Navigator.ViewportChangedEventHandler |