NDSStore

public final class NDSStore : UpdatableDataStore, UnifiedMapDataStoreAccessProvider

Implements access to operations with an offline NDS map.

Important

This is a Public Preview API. It may be changed or removed at any time.

Lifecycle

  • Creates an instance of NDSStore.

    Declaration

    Swift

    public init?(
        mapDataPath: String,
        keystorePath: String? = nil,
        accessPermit: NDSStoreAccessPermit? = nil,
        ndsStoreUpdateConfig: NDSStoreUpdateConfig? = nil,
        sync: MapDataStoreAccessSyncing = NDSStoreAccessSync(),
        geopoliticalView: String? = nil
    )

    Parameters

    mapDataPath

    The path to the nds store, the directory that contains the ‘ROOT.NDS’ file. The directory and its content must be accessible. In case map updates are configured, that location also needs to be writable.

    keystorePath

    Path to the keystore file containing encryption keys for the NDS store files. If the NDS store is encrypted, the keystore file is required.

    accessPermit

    The access permit for the NDS store. If the keystore file is encrypted, this permit is required.

    ndsStoreUpdateConfig

    The configuration for the updates of the NDS store. If not specified, map updates are not configured and the methods of the NDSStore are no-ops.

    sync

    An instance of MapDataStoreAccessSyncing that synchronizes access to onboard map data.

    geopoliticalView

    Set the country’s view regarding how disputed territorial areas are used. The value must be a country code in ISO 3166-1 alpha-2 form (e.g., “TR”). If not provided or no special view is defined in the map for the given country, the international geopolitical view is used.

Public

  • The geopolitical view in ISO 3166-1 alpha-2 form. See more documentation in geopoliticalView.

    Declaration

    Swift

    public let geopoliticalView: String?
  • Synchronizes access to the map data.

    Declaration

    Swift

    public let sync: MapDataStoreAccessSyncing
  • Handler for the map data store access.

    Declaration

    Swift

    public var storeAccess: NDSStoreAccess { get }
  • Enables or disables map updates. Default value is false.

    When updates are enabled, automatic update operations (including map extension and repair of unusable regions) are started, according to the configuration.

    If map updates are disabled, this component will not write to the map for any reason. Automatic updates will not run. Updates that were running are safely interrupted. In such case, call to this method will block until all ongoing updates, if any, have stopped.

    Note

    When an update of the map is interrupted unexpectedly (e.g. power loss), the region that was being updated could become unusable.

    Declaration

    Swift

    public var updatesEnabled: Bool { get set }
  • Sets current position.

    Declaration

    Swift

    public func updatePosition(_ position: CLLocationCoordinate2D)

    Parameters

    position

    The new value for current position.

  • Sets the active route.

    Note

    Updating the active route triggers map update if along route update is enabled. and the polyline differs from the previous one.

    Declaration

    Swift

    public func updateActiveRoute(_ polyline: [CLLocationCoordinate2D])

    Parameters

    polyline

    The polyline representing the new active route.

  • Adds observer that is called when a region is successfully updated with new content.

    The observer is called when a region is updated or installed (added) via an automatic or manual task. It is not called when the map is replaced.

    Declaration

    Swift

    public func addMapUpdateObserver(_ observer: MapUpdateObserver)

    Parameters

    observer

    The observer to be registered.

  • Removes previously registered observer.

    Declaration

    Swift

    public func removeMapUpdateObserver(_ observer: MapUpdateObserver)

    Parameters

    observer

    The registered observer.

  • Adds observer that is called when an automatic update fails due to an irrecoverable error.

    Declaration

    Swift

    public func addAutomaticMapUpdateFailureObserver(_ observer: AutomaticMapUpdateFailureObserver)

    Parameters

    observer

    The observer to be registered.

  • Removes previously registered observer.

    Declaration

    Swift

    public func removeAutomaticMapUpdateFailureObserver(_ observer: AutomaticMapUpdateFailureObserver)

    Parameters

    observer

    The registered observer.

  • Adds an observer for information about the state of the map.

    Note

    The observer is called with the current region graph as soon as it is added. The first observer that is added triggers the process of determining the region graph. If the region graph cannot be determined, an error is returned. In that case, the observer will be called when and if the error is resolved.

    Declaration

    Swift

    public func addRegionGraphObserver(_ observer: RegionGraphObserver)

    Parameters

    observer

    The observer to be added.

  • Removes a previously registered observer.

    Declaration

    Swift

    public func removeRegionGraphObserver(_ observer: RegionGraphObserver)

    Parameters

    observer

    The registered observer.

  • Schedules the given operations to be performed on the offline map.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func schedule(operations: [MapOperation])

    Parameters

    operations

    The operations to be performed on the offline map.

  • Requests cancelation of all operations scheduled with schedule(operations:) for the specified updatable regions.

    If the operations for a node have been successfully canceled, then the errorCode of the corresponding lastCompletedOperation is set to canceled.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func cancelAllMapOperations(for nodeIDs: [RegionGraphNodeID])

    Parameters

    nodeIDs

    The list of node IDs that were previously passed to schedule(operations:) to schedule an operation.

  • Finds the updatable regions within radius of position.

    Note

    When cancelled with cancel(), callback will not be called.

    Important

    This is a Public Preview API. It may be changed or removed at any time.

    Declaration

    Swift

    public func findRegionsAroundPosition(
        position: CLLocationCoordinate2D,
        radius: Measurement<UnitLength>,
        callback: @escaping (Result<RegionsAroundPosition, MapUpdateError>) -> ()
    )
        -> Cancellable?

    Parameters

    position

    The position around which to get the regions.

    radius

    The radius of the circle around the position to search for regions.

    callback

    Invoked when the operation has been finished either successfully, with an error. It is called from main thread.

    Return Value

    The Cancellable operation. When map updates are not configured, nil is returned instead.