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
  • Contains default values for HorizonOptions.

    See more

    Declaration

    Swift

    public enum Defaults
  • Types of horizon elements that are of interest.

    Declaration

    Swift

    public let elementTypes: [HorizonElementType]
  • Hashable method.

    Declaration

    Swift

    public func hash(into hasher: inout Hasher)
  • id

    Unique ID of the HorizonOptions

    Declaration

    Swift

    public let id: UUID
  • Initializes instance of HorizonOptions.

    Declaration

    Swift

    public init(
        id: UUID = UUID(),
        elementTypes: [HorizonElementType],
        mainPathSearchOptions: MainPathSearchOptions = Defaults.mainPathSearchOptions,
        subPathSearchOptions: [SubPathSearchOptions] = [],
        numberOfPaths: Int = Defaults.numberOfPaths
    ) throws
  • An error that occurs during the creation of the instance.

    See more

    Declaration

    Swift

    public enum InitializationError : Error
  • Search options MainPathSearchOptions for the main path.

    Declaration

    Swift

    public let mainPathSearchOptions: MainPathSearchOptions
  • Maximum number of paths the client can receive. The default value is Defaults.numberOfPaths.

    Declaration

    Swift

    public let numberOfPaths: Int
  • 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]