HorizonOptions
public struct HorizonOptions
extension HorizonOptions: Hashable
Horizon configuration options.
Horizon options define the extent of the HorizonPath
in the horizon and the map attributes to be collected
for these paths. A set of horizon options consists of the following:
- the set of
HorizonElementType
the client is interested in, - the path search options for the main path,
- the path search options for sub-paths,
- the maximum number of paths the client can receive,
- minimum length of the horizon ahead for which a horizon snapshot update is triggered.
To specify horizon options, create an instance of this class:
let mainPathSearchOptions = try MainPathSearchOptions(
searchTime: .tt.minutes(10),
searchDistancePolicy: ExplicitDistancePolicy(
searchDistance: PathSearchDistance(
maxHorizonLength: .tt.kilometers(5)
)
)
)
let subPathSearchOptionsLevel1 = try SubPathSearchOptions(
searchTime: .tt.minutes(5),
searchDistance: PathSearchDistance(
maxHorizonLength: .tt.kilometers(2)
)
)
let subPathSearchOptionsLevel2 = try SubPathSearchOptions(
searchTime: .tt.minutes(3),
searchDistance: PathSearchDistance(
maxHorizonLength: .tt.kilometers(1)
)
)
let horizonOptions = try HorizonOptions(
id: UUID(),
elementTypes: [.speedLimitsType, .regionType],
mainPathSearchOptions: mainPathSearchOptions,
subPathSearchOptions: [subPathSearchOptionsLevel1, subPathSearchOptionsLevel2],
numberOfPaths: 4
minDistanceAhead: .tt.meters(400)
)
For more information on horizon element types and horizon paths see HorizonEngine
.
A client application can register multiple sets of horizon options and request the engine to provide data for all
or only some of the registered option sets. The engine generates a separate HorizonResult
for each
set of options in the request. The client can also update horizon configuration by registering a new set of options
or unregistering a previously registered set.
To register a set of horizon options, call the HorizonEngine
.registerHorizonOptions
function.
To unregister a set of horizon options, call the HorizonEngine
.unregisterHorizonOptions
function.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Initializes instance of
HorizonOptions
.Declaration
Swift
public init( id: UUID, elementTypes: [HorizonElementType], mainPathSearchOptions: MainPathSearchOptions, subPathSearchOptions: [SubPathSearchOptions], numberOfPaths: Int = Defaults.numberOfPaths, minDistanceAhead: Measurement<UnitLength> = Defaults.minDistanceAhead ) throws
-
Contains default values for
See moreHorizonOptions
.Declaration
Swift
public enum Defaults
-
Unique ID of the HorizonOptions
Declaration
Swift
public let id: UUID
-
Types of horizon elements that are of interest.
Declaration
Swift
public let elementTypes: [HorizonElementType]
-
Search options
MainPathSearchOptions
for the main path.Declaration
Swift
public let mainPathSearchOptions: MainPathSearchOptions
-
Search options
SubPathSearchOptions
for sub-path levels. The container element at index i encodes search options for path level i + 1. The horizon is extended to the deepest sub-path level, as specified by the search options for sub-path levels.Declaration
Swift
public let subPathSearchOptions: [SubPathSearchOptions]
-
Maximum number of paths the client can receive. The default value is
Defaults.numberOfPaths
.Declaration
Swift
public let numberOfPaths: Int
-
The minimum length of the horizon ahead for which a horizon snapshot update is triggered. If the distance between the vehicle and the end of the horizon snapshot since the last snapshot update is less than this value, the client will receive a new horizon snapshot. If the
ExplicitDistancePolicy
is used for the main path, a value for the minimum distance ahead that is greater than the main path search distance will result in the snapshot being updated on every tick. To trigger update of the horizon snapshot on every tick, regardless of the search distance policy used for the main path, default value isDefaults.minDistanceAhead
in meters.Declaration
Swift
public let minDistanceAhead: Measurement<UnitLength>
-
Declaration
Swift
public static func == (lhs: HorizonOptions, rhs: HorizonOptions) -> Bool
-
Declaration
Swift
public func hash(into hasher: inout Hasher)
-
An error that occurs during the creation of the instance.
See moreDeclaration
Swift
public enum InitializationError : Error