Table of Contents

Struct MapViewState

Namespace
LansMap.Core.View

The complete map view: where it is centered, how far in, which way it faces and how far it is tilted. This is the whole of the map's user-visible state.

public readonly struct MapViewState
Inherited Members

Remarks

Nothing in the scene rotates and the camera never moves. Every visual change comes from this value being turned into one transform from Web Mercator to clip space, which is why the map stays pixel-stable at high zoom where moving a camera through float world coordinates would jitter.

Constructors

MapViewState(LatLon, double, double)

Creates a flat, top-down view state.

public MapViewState(LatLon center, double zoom, double rotationDeg)

Parameters

center LatLon

Viewport center.

zoom double

Fractional zoom, 0 to Max.

rotationDeg double

Bearing in degrees, counterclockwise.

MapViewState(LatLon, double, double, double)

Creates a view state, rejecting out-of-range values.

public MapViewState(LatLon center, double zoom, double rotationDeg, double pitchDeg)

Parameters

center LatLon

Viewport center.

zoom double

Fractional zoom, 0 to Max.

rotationDeg double

Bearing in degrees, counterclockwise.

pitchDeg double

Tilt in degrees, 0 to MaxPitchDeg.

Exceptions

ArgumentOutOfRangeException

Zoom is NaN or outside its range, rotation is NaN, or pitch is NaN or outside 0 to MaxPitchDeg.

Fields

MaxPitchDeg

The steepest tilt allowed, 85 degrees.

public const double MaxPitchDeg = 85

Field Value

double

Remarks

Tilt beyond PrecisionPitchLimitDeg is fully functional and its tile cost is bounded, but it is outside the sub-pixel positioning budget; see that constant before using it with markers raised above the ground.

Past about 71.6 degrees the true horizon is on screen under the fixed camera model (vertical field of view 36.87 degrees, camera 1.5 screen-heights from the view center). The map still stops drawing ground well before that line, at MaxViewDistanceFactor, so the screen above it is sky rather than wrong ground - at 85 degrees that is about 42 percent of the viewport. See ScreenMapView.HorizonFadeEnabled for fading that edge into sky instead of showing it as a hard line. A screen position above the drawn ground resolves through ScreenToLatLon(ScreenPoint) to the coordinate at the far edge, never to a point mirrored through the horizon.

PrecisionPitchLimitDeg

The steepest tilt at which the 0.25 screen-pixel positioning budget is verified, 70 degrees.

public const double PrecisionPitchLimitDeg = 70

Field Value

double

Remarks

Up to this tilt the re-anchor budget is asserted over every drawn corner, and separately over visible content, with no measured breach. Between here and MaxPitchDeg the map draws correctly and costs the same, but positioning is no longer held to that budget: a marker raised on the order of kilometres above the ground can shift against the basemap by more than a pixel when the renderer re-anchors, which reads as a sudden jump against the otherwise still map. The basemap itself, and markers at or near ground level, are not affected at that scale - measured at the steepest tilt, a ground-level marker stays around a sixth of a pixel.

No numeric bound is published above this limit. The worst error there is a sampled maximum that has not converged, so any figure would be a floor on what has been seen, not a ceiling on what can happen. Applications that place raised markers and need the budget should clamp tilt to this value; the interaction component's own default cap of 60 degrees already sits below it.

Properties

Center

Geographic position at the center of the viewport.

public LatLon Center { get; }

Property Value

LatLon

PitchDeg

Camera tilt in degrees, 0 = straight down, up to MaxPitchDeg.

public double PitchDeg { get; }

Property Value

double

RotationDeg

Bearing in degrees, counterclockwise, 0 = north up. Not normalized: 370 and 10 are both accepted and behave identically.

public double RotationDeg { get; }

Property Value

double

Zoom

Fractional zoom, 0 to Max. Fractional values are supported: 14.5 renders zoom-14 tiles scaled up rather than snapping to a level.

public double Zoom { get; }

Property Value

double