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, .streetType],
mainPathSearchOptions: mainPathSearchOptions,
subPathSearchOptions: [subPathSearchOptionsLevel1, subPathSearchOptionsLevel2],
numberOfPaths: 4
)
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.
-
Initializes instance of
HorizonOptions
.Throws
InitializationError.noElementTypes
ifelementTypes
is empty.Declaration
Swift
public init( id: UUID = UUID(), elementTypes: [HorizonElementType], mainPathSearchOptions: MainPathSearchOptions = Defaults.mainPathSearchOptions, subPathSearchOptions: [SubPathSearchOptions] = [], numberOfPaths: Int = Defaults.numberOfPaths ) 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
-
Equatable method.
Declaration
Swift
public static func == (lhs: HorizonOptions, rhs: HorizonOptions) -> Bool
-
Hashable method.
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