HorizonSnapshot
public struct HorizonSnapshot
Snapshot of the horizon.
Snapshot of the horizon provided by the HorizonEngine for a set of registered
HorizonOptions. These options define the extent of the paths HorizonPath on the horizon and
which map attributes are collected for those paths.
Horizon snapshot holds state of the horizon for HorizonOptions provided by user and
current position. Snapshot contains data such as:
- paths: List of horizon paths
HorizonPath, consisting of the main path and zero or more sub-paths. The main path is the path on which the likeliest map-matched on-road position is located. If there is no on-road map-matched position candidate, there is no main path either. This is because no horizon can be provided if there is no on-road map-matched position. SeeHorizonPositionfor more details. A sub-path is any path in the horizon snapshot that is not the main path. For a horizon snapshot to contain sub-paths, the optionsHorizonOptionsfor which it was generated must specify sub-path search optionsSubPathSearchOptionsfor at least one sub-path level. - state: The horizon snapshot state
HorizonSnapshotState - mainPathID: The ID of the main path
HorizonPath. Nil if there is no on-road map-matched position candidate. SeeHorizonPositionfor more details.
-
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 likeliest map-matched on-road position is located. If there is no on-road map-matched position candidate, there is no main path either because no horizon can be provided. See
HorizonPositionfor more details.Declaration
Swift
public func mainPath() -> HorizonPath?Return Value
The main horizon path
HorizonPath. Nil if there is no main path because no horizon can be generated (there is no on-road map-matched position candidate). SeeHorizonPositionfor more details. -
Returns the list of horizon sub-paths. A sub-path is any path that is not the main path. For a horizon snapshot to contain sub-paths, the options
HorizonOptionsfor which it was generated must specify sub-path search optionsSubPathSearchOptionsfor at least one sub-path level.Declaration
Swift
public func subPaths() -> [HorizonPath]Return Value
The list of horizon sub-paths
HorizonPath. Empty list if there are no sub-paths in the horizon. -
Returns the horizon elements
HorizonElementthat are ahead of the given positionHorizonPositionon the pathHorizonPathto which the position belongs, within the given distance. Elements of the same typeHorizonElementTypeare provided in increasing order of the start offsetHorizonElement.startOffset.Declaration
Swift
public func elementsAhead( position: HorizonPosition, distanceAhead: Measurement<UnitLength> ) -> [HorizonElement]Return Value
The list of horizon elements
HorizonElementahead of the given position on the pathHorizonPathto which the position belongs, within the given distance. The list is empty if the position does not have a valid path IDHorizonPath.pathIDor there is no path in the snapshot with the same ID as the one stored in the position. -
Returns the horizon elements
HorizonElementof the given typesHorizonElementTypethat are ahead of the given positionHorizonPositionon the pathHorizonPathto which the position belongs, within the given distance. Elements of the same type are provided in increasing order of the start offsetHorizonElement.startOffset .Declaration
Swift
public func elementsAhead( position: HorizonPosition, distanceAhead: Measurement<UnitLength>, types: [HorizonElementType] ) -> [HorizonElement]Return Value
The list of horizon elements
HorizonElementof the given types ahead of the given position on the pathHorizonPathto which the position belongs, within the given distance. The list is empty if the position does not have a valid path IDHorizonPath.pathID or there is no path in the snapshot with the same ID as the one stored in the position. -
Returns the horizon elements
HorizonElementof the given typesHorizonElementTypethat are ahead of the given positionHorizonPositionon the pathHorizonPathto which the position belongs, within the given distance. Elements of the same type are provided in increasing order of the start offsetHorizonElement.startOffset.Declaration
Swift
public func elementsAhead( position: HorizonPosition, distanceAhead: Measurement<UnitLength>, type: HorizonElementType ) -> [HorizonElement]Return Value
The list of horizon elements
HorizonElementof the given types ahead of the given position on the pathHorizonPathto which the position belongs, within the given distance. The list is empty if the position does not have a valid path IDHorizonPath.pathID or there is no path in the snapshot with the same ID as the one stored in the position. -
Returns the tree distance from the specified position
HorizonPositionto the start offsetHorizonElement.startOffset of the given horizon elementHorizonElement.The distance is strictly positive for elements in front of the position, i.e.
- Elements on the position path
HorizonPathin front of the positionHorizonPosition(the start offsetHorizonElement.startOffset of the element is greater than the position offsetHorizonPosition.offset). - Elements on sub-paths that the vehicle can reach by successively deviating to child paths.
The distance is strictly negative for elements behind the vehicle that the vehicle has moved past, i.e.:
- Elements on the position path
HorizonPaththat are completely behind the positionHorizonPositionor overlap the position, but start before the position (the start offsetHorizonElement.startOffset of the element is less than the position offsetHorizonPosition.offset). - Elements on sub-paths that the vehicle has deviated from at some point in the past.
The distance is 0 for elements that start at the position
HorizonPosition(the start offsetHorizonElement.startOffset of the element on the position pathHorizonPathis the same as the position offsetHorizonPosition.offset).The distance is null if any of the following is true:
- The position
HorizonPositiondoes not have a valid path IDHorizonPath.pathID - There is no path
HorizonPathin the snapshot with the same ID as the one stored in the position - The given element does not exist in the snapshot
- The given element is an element behind the position that the vehicle has not moved past, i.e., elements on sub-paths behind the vehicle that the vehicle has not taken.
Declaration
Swift
public func distance( to element: HorizonElement, from position: HorizonPosition ) -> Measurement<UnitLength>?Return Value
The tree distance to the given horizon element.
- Elements on the position path
-
Returns the coordinates
CLLocationCoordinate2Dof the given elementHorizonElementon the pathHorizonPath. If the element is a spot element, the returned list contains a single point. If the element is a segment element, the returned list contains a sequence of points from the element start to the element end, including all the intermediate points. If the element is not in the snapshot, the returned list is empty.Declaration
Swift
public func elementGeometry(element: HorizonElement) -> [CLLocationCoordinate2D]Parameters
elementThe horizon element
HorizonElementto return geometry for.Return Value
The list of coordinates
CLLocationCoordinate2Dfor the given element.
TomTom SDK for iOS (0.53.1)
HorizonSnapshot