Table of Contents

Class SurfaceMapView

Namespace
LansMap.Map.Views

Renders the live map into a RenderTexture on a world-space surface such as a scene plane or tabletop.

public sealed class SurfaceMapView : BaseMapView, ITilePipelineTarget, IMapFlyTarget
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
SurfaceMapView
Implements
Inherited Members

Fields

ArcMode

[Tooltip("When FlyTo takes the zoom-out-then-in arc: Auto only for far off-screen jumps, Never, or Always.")]
public FlyToArcMode ArcMode

Field Value

FlyToArcMode

CacheDirectoryName

[Tooltip("Raster disk-cache folder. Unique per surface; two maps must not share a file.")]
public string CacheDirectoryName

Field Value

string

CapacityMode

[Tooltip("Automatic (default) sizes the tile array from this surface, max tilt, and GPU memory. Manual uses LayerCount.")]
public TileCapacityMode CapacityMode

Field Value

TileCapacityMode

DiskCacheMB

[Tooltip("Disk cache cap, megabytes. 24 is enough for a small surface; do not use the fullscreen default.")]
public int DiskCacheMB

Field Value

int

ElevationEnabled

[Tooltip("Fetches real terrain height for ElevationSampler (see the tabletop terrain demo). Draws this surface's own tiles flat either way. Read at pipeline build; set before Play, or switch providers to apply.")]
public bool ElevationEnabled

Field Value

bool

FadeAllLoads

True fades every tile load, not just level transitions; see ScreenMapView.FadeAllLoads.

[Tooltip("Fade every tile load, not just level transitions. Shipping default true.")]
public bool FadeAllLoads

Field Value

bool

LabelFadeSeconds

Seconds a label fades in on winning declutter and out on losing it; 0 pops instantly.

[Tooltip("Seconds a label takes to fade in or out when decluttering changes which labels win. 0.3 default. 0 = instant. Can change while running.")]
public double LabelFadeSeconds

Field Value

double

LabelFont

[Tooltip("Optional font for marker labels and place labels; empty = built-in LegacyRuntime.ttf.")]
public Font LabelFont

Field Value

Font

LabelSizePx

[Tooltip("Marker label font size in pixels.")]
public int LabelSizePx

Field Value

int

LayerCount

[Tooltip("Resident tile capacity in texture array layers. Read only when Capacity Mode is Manual.")]
public int LayerCount

Field Value

int

MaxFlySeconds

[Tooltip("Longest fly-to animation, seconds; long jumps saturate here.")]
public double MaxFlySeconds

Field Value

double

MemoryPolicy

[NonSerialized]
public TileMemoryPolicy MemoryPolicy

Field Value

TileMemoryPolicy

PlaceLabelCacheDirectoryName

[Tooltip("Place-label disk-cache folder. Must be unique per surface; do not share with the raster cache or another map.")]
public string PlaceLabelCacheDirectoryName

Field Value

string

PlaceLabelsEnabled

[Tooltip("Upright place names over the surface. Off by default.")]
public bool PlaceLabelsEnabled

Field Value

bool

ProviderConfig

[Tooltip("Tile source. Default OpenStreetMap is for trying the asset; pick your own before you ship.")]
public TileProviderConfig ProviderConfig

Field Value

TileProviderConfig

Retina512Tiles

[Tooltip("Request 512 px @2x tiles where the selected provider serves them.")]
public bool Retina512Tiles

Field Value

bool

SharedGroundStore

[NonSerialized]
public MarkerStore SharedGroundStore

Field Value

MarkerStore

TargetRenderer

[Tooltip("Renderer that receives the map texture; defaults to this GameObject's.")]
public Renderer TargetRenderer

Field Value

Renderer

TextureHeight

[Tooltip("RenderTexture height in pixels.")]
public int TextureHeight

Field Value

int

TextureWidth

[Tooltip("RenderTexture width in pixels.")]
public int TextureWidth

Field Value

int

TileFadeSeconds

Seconds a tile crossfades in on load or level transition; 0 pops instantly.

[Tooltip("Seconds a tile takes to fade in on load or level transition. 0.2 default. 0 = instant. Can change while running.")]
public double TileFadeSeconds

Field Value

double

TileMemoryBudgetMB

[Tooltip("GPU memory for this surface's tiles, megabytes. 0 = from the device. Set this low on a minimap.")]
public int TileMemoryBudgetMB

Field Value

int

TileMipsEnabled

[Tooltip("Mip chains and trilinear. About +33% tile memory. On by default. Set before Play.")]
public bool TileMipsEnabled

Field Value

bool

TileUserAgent

[NonSerialized]
public string TileUserAgent

Field Value

string

WebGpuDirectUploadEnabled

[Tooltip("Browser only, experimental: skip a memory copy by uploading decoded tiles straight to the GPU. Off by default. Requires Web Worker Decode. Set before Play.")]
public bool WebGpuDirectUploadEnabled

Field Value

bool

WebWorkerDecodeEnabled

[Tooltip("Browser only: decode tiles in a background worker so zooming stays smooth. Off by default. Set before Play.")]
public bool WebWorkerDecodeEnabled

Field Value

bool

Properties

CurrentView

The transform answering every projection question for this view this frame; cached by the subclass, never allocate per read.

public override MapViewTransform CurrentView { get; }

Property Value

MapViewTransform

ElevationSampler

Ground height source this view's live terrain fetch has resolved, or null for a flat map (elevation off, or no live fetch has landed yet).

public override IElevationSampler ElevationSampler { get; }

Property Value

IElevationSampler

Remarks

Both subclasses build through the one TilePipelineHost elevation fetch/lifecycle and forward its ElevationTileSet.Sampler here - one data source for whichever render mechanism each subclass actually uses (a displaced tile mesh on a fullscreen map, a world-space mesh draped over a tabletop's flat texture).

IsFlying

public bool IsFlying { get; }

Property Value

bool

LayerStack

The ordered layer stack (named layers plus externally-registered overlays) this view draws every frame - see RegisterExternalOverlay(IMapScreenSpaceOverlay).

protected override MapLayerStack LayerStack { get; }

Property Value

MapLayerStack

Remarks

Each subclass owns a different concrete draw path (ScreenMapView through its MapDrawCoordinator, SurfaceMapView through its own render-into-texture loop), so this exposes whichever MapLayerStack instance actually backs it rather than assuming one shared implementation.

Markers

Bulk marker tier; non-null on both shipped map types from the moment the component exists.

public override MarkerLayer Markers { get; protected set; }

Property Value

MarkerLayer

Remarks

ScreenMapView builds it in Awake; SurfaceMapView creates it lazily on first read. Virtual so a subclass may choose either.

Output

public RenderTexture Output { get; }

Property Value

RenderTexture

Polygons

Polygon tier; see Markers for the lifetime contract.

public override PolygonLayer Polygons { get; protected set; }

Property Value

PolygonLayer

Polylines

Polyline tier; see Markers for the lifetime contract.

public override PolylineLayer Polylines { get; protected set; }

Property Value

PolylineLayer

ResolvedUserAgent

public string ResolvedUserAgent { get; }

Property Value

string

Methods

ApplyTileDependencies()

protected override void ApplyTileDependencies()

CancelFly()

Stops an in-flight FlyTo(double, double, double?, double), leaving the view where it is.

public void CancelFly()

EffectiveLayerCount(int, int, TileTextureFormat)

Layer count that will actually be allocated: requested clamped down to the memory budget, never raised.

public int EffectiveLayerCount(int requested, int tileSizePx, TileTextureFormat format = TileTextureFormat.RGBA32)

Parameters

requested int

Requested layer count before the budget clamp.

tileSizePx int

Tile size in px used to convert the megabyte budget into layers.

format TileTextureFormat

Uncompressed GPU format when blockBytesPer4x4 is 0.

Returns

int

EffectiveLayerCount(int, int, TileTextureFormat, int)

Layer count that will actually be allocated, including block-compressed tiles.

public int EffectiveLayerCount(int requested, int tileSizePx, TileTextureFormat format, int blockBytesPer4x4)

Parameters

requested int

Requested layer count before the budget clamp.

tileSizePx int

Tile size in px used to convert the megabyte budget into layers.

format TileTextureFormat

Uncompressed GPU format when blockBytesPer4x4 is not positive.

blockBytesPer4x4 int

Bytes per 4x4 compressed block; 0 or negative uses the uncompressed arithmetic.

Returns

int

FlyTo(double, double, double?, double)

Animated fly to a coordinate, same arc as ScreenMapView's, snapping immediately when durationSeconds is not positive.

public void FlyTo(double lat, double lon, double? zoom = null, double durationSeconds = 0.3)

Parameters

lat double

Target latitude in degrees WGS84.

lon double

Target longitude in degrees WGS84.

zoom double?

Target zoom in Web Mercator zoom units; null keeps the current zoom.

durationSeconds double

Requested hop duration in seconds; nearby targets honor this exactly, far off-screen jumps take a longer zoom-out-then-in arc at their own pace, capped by MaxFlySeconds. See ArcMode to force or disable the arc.

RequestedLayerCount(int)

Layer count this surface asks for before the memory budget clamps it: Manual uses LayerCount; Automatic derives it from the render-target size and ignores tileSizePx.

public int RequestedLayerCount(int tileSizePx)

Parameters

tileSizePx int

Accepted to match ITilePipelineTarget; Automatic reads the pipeline's tile size instead.

Returns

int

ResolvedElevationCoverageTiles()

The resolved elevation coverage tiles for this view, from the current view location and zoom; null if elevation is off.

protected override IEnumerable<TileCoord> ResolvedElevationCoverageTiles()

Returns

IEnumerable<TileCoord>

Remarks

Used by drift detection and the pipeline's initial build.

SetProvider(TileProvider, string, string)

Switches the tile provider and rebuilds the tile pipeline; before Start only the serialized fields change.

public void SetProvider(TileProvider provider, string style = "", string apiKey = null)

Parameters

provider TileProvider

Tile source preset.

style string

Provider style name; empty is the provider default.

apiKey string

API key; null leaves the current key unchanged.

WorstCaseFootprint(int, int)

Worst-case visible tile count for a viewport of screenW x screenH under this surface's settings at max pitch.

public int WorstCaseFootprint(int screenW, int screenH)

Parameters

screenW int

Viewport width in texture px.

screenH int

Viewport height in texture px.

Returns

int

Events

ViewChanged

public event Action<MapViewChange> ViewChanged

Event Type

Action<MapViewChange>