Table of Contents

Class TabletopContentView

Namespace
LansMap.Map.Views
[DefaultExecutionOrder(100)]
public sealed class TabletopContentView : MonoBehaviour, IMapPointerSurface
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
TabletopContentView
Implements

Fields

MarkerOutlineColor

[Tooltip("Layer-wide SDF outline color for the bulk world-marker tier; alpha 0 disables.")]
public Color MarkerOutlineColor

Field Value

Color

MarkerOutlineWidthPx

[Tooltip("Layer-wide SDF outline width, in screen px, for the bulk world-marker tier.")]
public float MarkerOutlineWidthPx

Field Value

float

PointerCamera

[Tooltip("Camera for mouse picking. Default Camera.main. XR: call TryScreenPointFromRay with your own ray.")]
public Camera PointerCamera

Field Value

Camera

PrefabStandoff

[Tooltip("How far prefab markers stand off the surface along its normal, in plane-local units, on top of their altitude lift.")]
public float PrefabStandoff

Field Value

float

Prefabs

[Tooltip("Prefab-tier manager. Empty uses or adds one on this GameObject.")]
public WorldMarkerManager Prefabs

Field Value

WorldMarkerManager

SharedWorldStore

[NonSerialized]
public MarkerStore SharedWorldStore

Field Value

MarkerStore

StemWidthPx

[Tooltip("Width of the stem line, in screen px, when StemsEnabled draws one.")]
public float StemWidthPx

Field Value

float

StemsEnabled

[Tooltip("Thin line from each floating bulk marker down to its ground pixel, so its map position stays readable from oblique angles.")]
public bool StemsEnabled

Field Value

bool

Surface

[Tooltip("Surface whose texture this tabletop annotates. Defaults to one on this GameObject.")]
public SurfaceMapView Surface

Field Value

SurfaceMapView

WorldMarkerCapacity

[Tooltip("Initial capacity of the bulk world-marker tier; grows on demand.")]
public int WorldMarkerCapacity

Field Value

int

Properties

IsPlaneValid

False when the plane mesh carries no usable UV parameterisation, in which case nothing this component owns can be placed.

public bool IsPlaneValid { get; }

Property Value

bool

PrefabAnchor

Parent for prefab GameObjects on this table, created under the plane so a moving table carries them rigidly.

public Transform PrefabAnchor { get; }

Property Value

Transform

PrefabMarkers

Live prefab-tier handles, in spawn order.

public IReadOnlyList<WorldMarkerInstance> PrefabMarkers { get; }

Property Value

IReadOnlyList<WorldMarkerInstance>

WorldLabels

Billboarded world-space label tier: camera-facing SDF captions with a backing plate, attached to ids from WorldMarkers's Store.

public SurfaceWorldLabelLayer WorldLabels { get; }

Property Value

SurfaceWorldLabelLayer

Remarks

Created lazily, bound to WorldMarkers's store on first read so a caption and its marker always share one position.

WorldMarkers

Bulk world-marker tier: GPU instanced billboards standing at true altitude above the table; add markers through its Store.

public SurfaceWorldMarkerRenderer WorldMarkers { get; }

Property Value

SurfaceWorldMarkerRenderer

Remarks

Created lazily so tests and editor code can reach it before Start.

WorldPolygons

World-space polygon tier: filled areas drawn as real 3D geometry standing above the table; add polygons through its Store.

public PolygonLayer WorldPolygons { get; }

Property Value

PolygonLayer

Remarks

Created lazily so tests and editor code can reach it before Start.

WorldPolylines

World-space polyline tier: routes, borders and trails drawn as camera-facing ribbons standing above the table; add lines through its Store.

public PolylineLayer WorldPolylines { get; }

Property Value

PolylineLayer

Remarks

Created lazily so tests and editor code can reach it before Start.

Methods

Adopt(GameObject, double, double, double)

Adopts an existing GameObject (a primitive, a hand-built object) as a prefab-tier marker without instantiating anything, forwarding to WorldMarkerManager.

public WorldMarkerInstance Adopt(GameObject go, double lat, double lon, double altitudeMeters)

Parameters

go GameObject
lat double
lon double
altitudeMeters double

Returns

WorldMarkerInstance

Remove(WorldMarkerInstance)

Removes a prefab marker and destroys its GameObject.

public void Remove(WorldMarkerInstance m)

Parameters

m WorldMarkerInstance

Spawn(GameObject, double, double, double)

Spawns a prefab marker standing on the table at a coordinate, lifted along the plane normal by its altitude at the map's own scale, forwarding to WorldMarkerManager so a screen to table switch keeps the same instances.

public WorldMarkerInstance Spawn(GameObject prefab, double lat, double lon, double altitudeMeters)

Parameters

prefab GameObject
lat double
lon double
altitudeMeters double

Returns

WorldMarkerInstance

TryGet(in MarkerRef, out WorldMarkerInstance)

Resolves a Prefab(int) handle this view spawned.

public bool TryGet(in MarkerRef markerRef, out WorldMarkerInstance marker)

Parameters

markerRef MarkerRef
marker WorldMarkerInstance

Returns

bool

TryGet(int, out WorldMarkerInstance)

Resolves a prefab handle this view spawned; stale after Remove+reuse.

public bool TryGet(int handle, out WorldMarkerInstance marker)

Parameters

handle int
marker WorldMarkerInstance

Returns

bool

TryGetPointerPosition(out ScreenPoint)

IMapPointerSurface for this table: builds the world ray from PointerCamera (or Camera.main) and the live mouse position, the same source MapInput.PointerPosition reads for a fullscreen map, then runs it through TryScreenPointFromRay(Ray, out ScreenPoint).

public bool TryGetPointerPosition(out ScreenPoint position)

Parameters

position ScreenPoint

Returns

bool

TryGetWorldMarkerLayer(out SurfaceWorldMarkerRenderer)

The world-marker layer if something has already created it; reading WorldMarkers constructs one.

public bool TryGetWorldMarkerLayer(out SurfaceWorldMarkerRenderer layer)

Parameters

layer SurfaceWorldMarkerRenderer

Returns

bool

TryPick(Ray, float, out MarkerRef)

Nearest floating world-bulk or tabletop-prefab marker along worldRay; painted-in-texture bulk is not this method - the surface Markers.TryPick still owns that.

public bool TryPick(Ray worldRay, float pickRadiusPx, out MarkerRef hit)

Parameters

worldRay Ray
pickRadiusPx float
hit MarkerRef

Returns

bool

Remarks

Ranking is along-ray world distance; a prefab collider wins a tie. Per-prefab collider raycast so the table mesh cannot steal the hit.

TryPick(Ray, float, out MarkerRef, out float)

Same as TryPick(Ray, float, out MarkerRef) plus the along-ray distance of the hit, in world units.

public bool TryPick(Ray worldRay, float pickRadiusPx, out MarkerRef hit, out float along)

Parameters

worldRay Ray
pickRadiusPx float
hit MarkerRef
along float

Returns

bool

TryPickWorldMarker(Ray, float, out int)

Picks the nearest bulk world marker along a world-space ray (a camera ray in an AR/VR scene), altitude-aware.

public bool TryPickWorldMarker(Ray worldRay, float pickRadiusPx, out int slot)

Parameters

worldRay Ray
pickRadiusPx float
slot int

Returns

bool

Remarks

TryScreenPointFromRay(Ray, out ScreenPoint)

The other direction from TryUv(ScreenPoint, out Vector2): the render-texture pixel a world-space ray hits on the table, or false when the ray misses the plane or lands off it.

public bool TryScreenPointFromRay(Ray worldRay, out ScreenPoint position)

Parameters

worldRay Ray
position ScreenPoint

Returns

bool

Remarks

This is the surface pointer seam - the counterpart to a fullscreen map's Screen.height-baked mouse position - so screen-space interaction code (hover, drag, measure, popups, cluster click-to-zoom) can read one ScreenPoint and stay unaware whether it came from the real screen or a table.

TryUv(ScreenPoint, out Vector2)

Render-texture pixel to the texture's UV space (v flipped: screen y runs down, texture v runs up, the same convention the prefab tier places with); false when the point is off the surface.

public bool TryUv(ScreenPoint s, out Vector2 uv)

Parameters

s ScreenPoint
uv Vector2

Returns

bool