HorizonSnapshot
public struct HorizonSnapshot
Snapshot of the horizon.
Horizon snapshot holds state of the horizon for HorizonOptions
provided by user and
current position. Snapshot contains data such as:
- paths: List of
HorizonPath
including at least 1 main path and optional subpaths - state: Current
HorizonSnapshotState
holding incremental counter of horizon updates - mainPathID: ID of current main path, nil if current position is offroad
Horizon snapshot can be extracted from HorizonResult
, which can be obtained using
instance of HorizonEngine
, registering set of HorizonOptions
and making
call generateHorizon
.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Initializes instance of
HorizonSnapshot
.Declaration
Swift
public init( paths: [HorizonPath], state: HorizonSnapshotState, mainPathID: Int? )
-
The array of
HorizonPath
, consisting of the main path and zero or more sub-paths. The main path is where the vehicle is located. A sub-path is any path in the horizon snapshot that is not the main path.Declaration
Swift
public let paths: [HorizonPath]
-
The
HorizonSnapshotState
.Declaration
Swift
public let state: HorizonSnapshotState
-
Returns the main horizon path. The main path is the path on which the first on-road
HorizonPosition
is located.Declaration
Swift
public func mainPath() -> HorizonPath?
Return Value
Main
HorizonPath
. Nil if there is no on-road position. -
Returns the list of horizon sub-paths. A sub-path is any path that is not the main path.
Declaration
Swift
public func subPaths() -> [HorizonPath]
Return Value
List of horizon sub-paths
HorizonPath
. Empty list if there is no sub-path. -
Returns the horizon elements that are ahead of the given position on the path to which the position belongs, within the given distance. Elements of the same type are provided in increasing order of the start offset and end offset.
Declaration
Swift
public func elementsAhead( position: HorizonPosition, distanceAhead: Measurement<UnitLength> ) -> [HorizonElement]
Return Value
List of horizon
HorizonElements
ahead of the given position on the path to which the position belongs, within the given distance. The list is empty if the position does not have a valid path id or there is no path in the snapshot with the same id as the one stored in the position. -
Returns the horizon elements of the given types that are ahead of the given position on the path to which the position belongs, within the given distance. Elements of the same type are provided in increasing order of the start offset and end offset.
Declaration
Swift
public func elementsAhead( position: HorizonPosition, distanceAhead: Measurement<UnitLength>, types: [HorizonElementType] ) -> [HorizonElement]
Return Value
List of horizon
HorizonElement
of the given types ahead of the given position on the path to which the position belongs, within the given distance. The list is empty if the position does not have a valid path id or there is no path in the snapshot with the same id as the one stored in the position. -
Returns the horizon elements of the given type that are ahead of the given position on the path to which the position belongs, within the given distance. The elements are provided in increasing order of the start offset and end offset.
Declaration
Swift
public func elementsAhead( position: HorizonPosition, distanceAhead: Measurement<UnitLength>, type: HorizonElementType ) -> [HorizonElement]
Return Value
List of horizon
HorizonElement
of the given type ahead of the given position on the path to which the position belongs, within the given distance. The list is empty if the position does not have a valid path ID or there is no path in the snapshot with the same id as the one stored in the position. -
Calculates the tree distance to the given horizon element from set position. Negative values indicate elements the vehicle has already passed. Positive values indicate elements ahead of the vehicle.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public func distance( to element: HorizonElement, from position: HorizonPosition ) -> Measurement<UnitLength>?
Return Value
The tree distance to the horizon element.
-
Returns the coordinates of the element on the path. If the element is a spot element, the returned list contains one point. If the element is a segment element, the returned list contains a list of points in the sequence from the element start to end, including also all intermediate points. If the element is not in the snapshot, the returned list is empty.
Important
This is a Public Preview API. It may be changed or removed at any time.
Declaration
Swift
public func elementGeometry(element: HorizonElement) -> [CLLocationCoordinate2D]
Parameters
element
An instance of
HorizonElement
.Return Value
List of
CLLocationCoordinate2D
of the element.