Class Navigator
Inherited Members
Namespace: Mapsui
Assembly: Mapsui.dll
Syntax
public class Navigator
Properties
| Edit this page View SourceLimiter
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
Overrides the default zoom bounds which are derived from the Map resolutions.
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 |
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 zoom into the map
Declaration
public bool RotationLock { get; set; }
Property Value
Type | Description |
---|---|
bool |
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 an not rotate 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 |
Drag(MPoint, MPoint)
To pan the map when dragging with mouse or single finger. This method is called from the MapControl and is usually not called from user code. This method does not call Navigated. So, Navigated needs to be called from the MapControl on mouse/touch up.
Declaration
public void Drag(MPoint positionScreen, MPoint previousPositionScreen)
Parameters
Type | Name | Description |
---|---|---|
MPoint | positionScreen | Screen position of the dragging mouse or finger. |
MPoint | previousPositionScreen | Previous position of the dragging mouse or finger. |
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. |
MouseWheelZoom(int, MPoint)
Declaration
public void MouseWheelZoom(int mouseWheelDelta, MPoint centerOfZoomInScreenCoordinates)
Parameters
Type | Name | Description |
---|---|---|
int | mouseWheelDelta | |
MPoint | centerOfZoomInScreenCoordinates |
MouseWheelZoomContinuous(double, MPoint)
Declaration
public void MouseWheelZoomContinuous(double scaleFactor, MPoint centerOfZoomInScreenCoordinates)
Parameters
Type | Name | Description |
---|---|---|
double | scaleFactor | |
MPoint | centerOfZoomInScreenCoordinates |
Pinch(MPoint, MPoint, double, double)
To change the map viewport when using multiple fingers. This method is called from the MapControl and is usually not called from user code. This method does not call Navigated. So, Navigated needs to be called from the MapControl on mouse/touch up.
Declaration
public void Pinch(MPoint currentPinchCenter, MPoint previousPinchCenter, double deltaResolution, double deltaRotation = 0)
Parameters
Type | Name | Description |
---|---|---|
MPoint | currentPinchCenter | The center of the current position of touch positions. |
MPoint | previousPinchCenter | The previous center of the current position of touch positions. |
double | deltaResolution | The change in resolution cause by moving the fingers together or further apart. |
double | deltaRotation | The change in rotation of the finger positions. |
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(MPoint, long, Easing?)
Zoom in to a given point
Declaration
public void ZoomIn(MPoint centerOfZoom, long duration = -1, Easing? easing = null)
Parameters
Type | Name | Description |
---|---|---|
MPoint | 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 resolutionin in the Navigator.Resolutions list.
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(MPoint, long, Easing?)
Zoom out to a given point
Declaration
public void ZoomOut(MPoint centerOfZoom, long duration = -1, Easing? easing = null)
Parameters
Type | Name | Description |
---|---|---|
MPoint | 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.
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, MPoint, long, Easing?)
Zoom to a given resolution with a given point as center
Declaration
public void ZoomTo(double resolution, MPoint centerOfZoomInScreenCoordinates, long duration = -1, Easing? easing = null)
Parameters
Type | Name | Description |
---|---|---|
double | resolution | Resolution to zoom |
MPoint | centerOfZoomInScreenCoordinates | 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 SourceRefreshDataRequest
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? RefreshDataRequest
Event Type
Type | Description |
---|---|
EventHandler |
ViewportChanged
Declaration
public event PropertyChangedEventHandler? ViewportChanged
Event Type
Type | Description |
---|---|
PropertyChangedEventHandler |