TrafficLineObjectModel

class TrafficLineObjectModel(val data: TrafficLinePointObject)

Model wrapper for traffic line objects (accidents, road works, intermediate points) that tracks their visibility state for animation purposes.

This class implements a "delayed removal" pattern to support smooth exit animations in the UI. When an object passes behind the user's position, it cannot be immediately removed from the list because the UI needs time to animate its disappearance. Instead, the object is marked for removal via isRemoved, allowing the UI layer to observe this state change and trigger the exit animation.

Lifecycle:

  1. Object is created and added to the visible list with isRemoved = false

  2. When the object passes behind the user, ViewModel sets isRemoved = true

  3. UI observes this change and starts the exit animation

  4. On the next update cycle, the object is removed from the list entirely

Constructors

Link copied to clipboard
constructor(data: TrafficLinePointObject)

Properties

Link copied to clipboard
val data: TrafficLinePointObject

The underlying traffic line point object containing position and type information.

Link copied to clipboard
val isRemoved: MutableStateFlow<Boolean>

Indicates whether this traffic object has passed behind the user and should be removed.