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.

  • 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 more

    Declaration

    Swift

    public enum InitializationError : Error