Class MbglMap
- Namespace
- MapLibreNative.Maui
Wraps mbgl_map_t*. Dispose on the render thread.
public sealed class MbglMap : IDisposable
- Inheritance
-
MbglMap
Constructors
MbglMap(MbglFrontend, MbglRunLoop, string?, string?, float, Action<string, string?>?, string?, ulong)
public MbglMap(MbglFrontend frontend, MbglRunLoop runLoop, string? cachePath = null, string? assetPath = null, float pixelRatio = 1, Action<string, string?>? observer = null, string? apiKey = null, ulong maxCacheSizeBytes = 0)
Parameters
frontendMbglFrontendrunLoopMbglRunLoopcachePathstringassetPathstringpixelRatiofloatobserverAction<string, string>?apiKeystringmaxCacheSizeBytesulong
Properties
Bearing
public double Bearing { get; }
Property Value
Center
public (double Lat, double Lon) Center { get; }
Property Value
IsFullyLoaded
public bool IsFullyLoaded { get; }
Property Value
IsGestureInProgress
public bool IsGestureInProgress { get; }
Property Value
IsPanning
True while a pan transition/animation is running.
public bool IsPanning { get; }
Property Value
IsRotating
True while a rotate transition/animation is running.
public bool IsRotating { get; }
Property Value
IsScaling
True while a zoom/scale transition/animation is running.
public bool IsScaling { get; }
Property Value
Pitch
public double Pitch { get; }
Property Value
Zoom
public double Zoom { get; }
Property Value
Methods
CameraForBounds(double, double, double, double, double, double, double, double)
Returns the CameraOptions (lat, lon, zoom, bearing, pitch) that fits the given bounds with optional screen padding (top, left, bottom, right in pixels).
public (double Lat, double Lon, double Zoom, double Bearing, double Pitch) CameraForBounds(double latSw, double lonSw, double latNe, double lonNe, double padTop = 0, double padLeft = 0, double padBottom = 0, double padRight = 0)
Parameters
latSwdoublelonSwdoublelatNedoublelonNedoublepadTopdoublepadLeftdoublepadBottomdoublepadRightdouble
Returns
CameraForLatLngs(IReadOnlyList<(double Lat, double Lon)>, double, double, double, double)
public CameraResult CameraForLatLngs(IReadOnlyList<(double Lat, double Lon)> points, double padTop = 0, double padLeft = 0, double padBottom = 0, double padRight = 0)
Parameters
pointsIReadOnlyList<(double Lat, double Lon)>padTopdoublepadLeftdoublepadBottomdoublepadRightdouble
Returns
CancelTransitions()
public void CancelTransitions()
Dispose()
public void Dispose()
DumpDebugLogs()
public void DumpDebugLogs()
EaseTo(double, double, double, double, double, double, double, double, double, long)
public void EaseTo(double lat, double lon, double zoom, double bearing, double pitch, double padTop, double padLeft, double padBottom, double padRight, long durationMs)
Parameters
latdoublelondoublezoomdoublebearingdoublepitchdoublepadTopdoublepadLeftdoublepadBottomdoublepadRightdoubledurationMslong
EaseTo(double, double, double, double, double, long)
public void EaseTo(double lat, double lon, double zoom, double bearing, double pitch, long durationMs)
Parameters
FlyTo(double, double, double, double, double, double, double, double, double, long)
public void FlyTo(double lat, double lon, double zoom, double bearing, double pitch, double padTop, double padLeft, double padBottom, double padRight, long durationMs)
Parameters
latdoublelondoublezoomdoublebearingdoublepitchdoublepadTopdoublepadLeftdoublepadBottomdoublepadRightdoubledurationMslong
FlyTo(double, double, double, double, double, long)
public void FlyTo(double lat, double lon, double zoom, double bearing, double pitch, long durationMs)
Parameters
GetBounds()
public BoundOptions GetBounds()
Returns
GetCamera(double, double, double, double)
Reads the full camera state in one call, optionally offset by edge padding.
public CameraResult GetCamera(double padTop = 0, double padLeft = 0, double padBottom = 0, double padRight = 0)
Parameters
Returns
GetClusterChildren(string, string)
Returns the direct children of a cluster as a GeoJSON FeatureCollection string, or null.
public string? GetClusterChildren(string sourceId, string clusterFeatureJson)
Parameters
Returns
GetClusterExpansionZoom(string, string)
Returns the zoom level at which the given cluster (a Feature returned by a rendered-features query on a clustered GeoJSON source) expands, or null.
public double? GetClusterExpansionZoom(string sourceId, string clusterFeatureJson)
Parameters
Returns
GetClusterLeaves(string, string, uint, uint)
Returns up to limit leaf features of a cluster
(from offset) as a GeoJSON FeatureCollection string, or null.
public string? GetClusterLeaves(string sourceId, string clusterFeatureJson, uint limit = 10, uint offset = 0)
Parameters
Returns
GetDebugOptions()
Get the current debug overlay bitmask (MbglDebugOptions).
public int GetDebugOptions()
Returns
GetFeatureState(string, string, string?)
public string? GetFeatureState(string sourceId, string featureId, string? sourceLayerId = null)
Parameters
Returns
GetPrefetchZoomDelta()
public int GetPrefetchZoomDelta()
Returns
GetStyle()
public MbglStyle GetStyle()
Returns
JumpTo(double, double, double, double, double)
public void JumpTo(double lat, double lon, double zoom, double bearing = 0, double pitch = 0)
Parameters
JumpTo(double, double, double, double, double, double, double, double, double)
public void JumpTo(double lat, double lon, double zoom, double bearing, double pitch, double padTop, double padLeft, double padBottom, double padRight)
Parameters
latdoublelondoublezoomdoublebearingdoublepitchdoublepadTopdoublepadLeftdoublepadBottomdoublepadRightdouble
LatLngBoundsForCamera()
public (double LatSW, double LonSW, double LatNE, double LonNE) LatLngBoundsForCamera()
Returns
LatLngForPixel(double, double)
public (double Lat, double Lon) LatLngForPixel(double x, double y)
Parameters
Returns
LatLngsForPixels(IReadOnlyList<(double X, double Y)>)
public (double Lat, double Lon)[] LatLngsForPixels(IReadOnlyList<(double X, double Y)> pixels)
Parameters
Returns
MoveBy(double, double, long)
public void MoveBy(double dx, double dy, long durationMs = 0)
Parameters
OnDoubleTap(double, double)
public void OnDoubleTap(double x, double y)
Parameters
OnPanEnd()
public void OnPanEnd()
OnPanMove(double, double)
public void OnPanMove(double dx, double dy)
Parameters
OnPanStart(double, double)
public void OnPanStart(double x, double y)
Parameters
OnPinch(double, double, double)
public void OnPinch(double scaleFactor, double cx, double cy)
Parameters
OnScroll(double, double, double)
public void OnScroll(double delta, double cx, double cy)
Parameters
PitchBy(double, long)
public void PitchBy(double deltaDegrees, long durationMs = 0)
Parameters
PixelForLatLng(double, double)
public (double X, double Y) PixelForLatLng(double lat, double lon)
Parameters
Returns
PixelsForLatLngs(IReadOnlyList<(double Lat, double Lon)>)
public (double X, double Y)[] PixelsForLatLngs(IReadOnlyList<(double Lat, double Lon)> points)
Parameters
Returns
QueryFeatureExtensions(string, string, string, string, string?)
Query a feature extension. For clustered GeoJSON sources use extension
"supercluster" with field "children", "leaves", or
"expansion-zoom". Returns JSON (a FeatureCollection or a bare value), or null.
public string? QueryFeatureExtensions(string sourceId, string featureJson, string extension, string extensionField, string? argsJson = null)
Parameters
Returns
QueryRenderedFeaturesAtPoint(double, double, string?)
Query rendered features at a screen point. Returns a GeoJSON FeatureCollection string, or null if the renderer is not ready.
public string? QueryRenderedFeaturesAtPoint(double x, double y, string? layerIds = null)
Parameters
Returns
QueryRenderedFeaturesInBox(double, double, double, double, string?)
Query rendered features in a screen bounding box.
public string? QueryRenderedFeaturesInBox(double x1, double y1, double x2, double y2, string? layerIds = null)
Parameters
Returns
QuerySourceFeatures(string, string?, string?)
Query all features in a source's data, regardless of visibility. Returns a GeoJSON FeatureCollection string, or null if the renderer is not ready.
public string? QuerySourceFeatures(string sourceId, string? sourceLayerIds = null, string? filterJson = null)
Parameters
sourceIdstringsourceLayerIdsstringComma-separated source-layer names — required for vector sources, ignored for GeoJSON sources.
filterJsonstringOptional style-spec filter expression JSON.
Returns
ReduceMemoryUse()
public void ReduceMemoryUse()
RemoveFeatureState(string, string?, string?, string?)
public void RemoveFeatureState(string sourceId, string? featureId = null, string? stateKey = null, string? sourceLayerId = null)
Parameters
RotateBy(double, double, double, double)
public void RotateBy(double x0, double y0, double x1, double y1)
Parameters
ScaleBy(double, double, double, long)
Multiply the map scale by scale (2.0 = one zoom level in),
optionally about a screen anchor point (NaN = viewport centre).
public void ScaleBy(double scale, double anchorX = NaN, double anchorY = NaN, long durationMs = 0)
Parameters
SetBounds(double, double, double, double, double, double, double, double)
Set geographic constraints and zoom/pitch limits. Pass NaN for any parameter to leave it unconstrained.
public void SetBounds(double latSw = NaN, double lonSw = NaN, double latNe = NaN, double lonNe = NaN, double minZoom = NaN, double maxZoom = NaN, double minPitch = NaN, double maxPitch = NaN)
Parameters
latSwdoublelonSwdoublelatNedoublelonNedoubleminZoomdoublemaxZoomdoubleminPitchdoublemaxPitchdouble
SetConstrainMode(int)
public void SetConstrainMode(int mode)
Parameters
modeint0=None 1=HeightOnly 2=WidthAndHeight 3=Screen
SetDebugOptions(int)
Set the debug overlay bitmask. Pass None to disable all.
public void SetDebugOptions(int options)
Parameters
optionsint
SetFeatureState(string, string, string, string?)
public void SetFeatureState(string sourceId, string featureId, string stateJson, string? sourceLayerId = null)
Parameters
SetGestureInProgress(bool)
public void SetGestureInProgress(bool inProgress)
Parameters
inProgressbool
SetMaxZoom(double)
public void SetMaxZoom(double zoom)
Parameters
zoomdouble
SetMinZoom(double)
public void SetMinZoom(double zoom)
Parameters
zoomdouble
SetNorthOrientation(int)
public void SetNorthOrientation(int orientation)
Parameters
orientationint0=Upwards 1=Rightwards 2=Downwards 3=Leftwards
SetPrefetchZoomDelta(int)
public void SetPrefetchZoomDelta(int delta)
Parameters
deltaint
SetProjectionMode(bool, double, double)
public void SetProjectionMode(bool axonometric = false, double xSkew = 0, double ySkew = 1)
Parameters
SetSize(int, int)
public void SetSize(int widthPx, int heightPx)
Parameters
SetStyleJson(string)
public void SetStyleJson(string json)
Parameters
jsonstring
SetStyleUrl(string)
public void SetStyleUrl(string url)
Parameters
urlstring
SetTileLodMinRadius(double)
public void SetTileLodMinRadius(double radius)
Parameters
radiusdouble
SetTileLodMode(int)
public void SetTileLodMode(int mode)
Parameters
modeint0=Default 1=Distance
SetTileLodPitchThreshold(double)
public void SetTileLodPitchThreshold(double thresholdRadians)
Parameters
thresholdRadiansdouble
SetTileLodScale(double)
public void SetTileLodScale(double scale)
Parameters
scaledouble
SetTileLodZoomShift(double)
public void SetTileLodZoomShift(double shift)
Parameters
shiftdouble
SetViewportMode(int)
public void SetViewportMode(int mode)
Parameters
modeint0=Default 1=FlippedY
TriggerRepaint()
public void TriggerRepaint()