CompositeRegionsUpdater

public final class CompositeRegionsUpdater

A helper class that facilitates the map-management activities on regions in a group-level.

It provides a simplified graph of regions for UI visualization, and various functions to allow performing map operations on these regions.

Important

This is a Public Preview API. It may be changed or removed at any time.
  • Adds an observer for information about the CompositeRegionGraph and the state information.

    The first observer that is added triggers the process of determining the CompositeRegionGraph. If the map regions cannot be determined, CompositeRegionObserver.onCompositeRegionGraphChanged will be called with an error. The observer will be called when and if the error is resolved.

    Declaration

    Swift

    public func addCompositeRegionObserver(_ observer: CompositeRegionObserver)

    Parameters

    observer

    The observer to be added.

  • Removes the given observer.

    This call is a no-op if the given listener was not added earlier.

    Declaration

    Swift

    public func removeCompositeRegionObserver(_ observer: CompositeRegionObserver)

    Parameters

    observer

    The observer to be removed.

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

    Declaration

    Swift

    public func schedule(operations: [CompositeRegionOperation])

    Parameters

    operations

    The operations to be performed on the offline map.

  • Requests the cancellation of all operations scheduled with schedule(operations:) for the specified CompositeRegions.

    Declaration

    Swift

    public func cancelAllMapOperations(for regionIDs: [CompositeRegionID])

    Parameters

    regionIDs

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

  • Finds the lowest-level of the parent CompositeRegions that contains the given RegionGraphNodeID

    For the following region graph as an example, findCompositeRegions(regionGraphNodeID: 3) will return SubRegion_0 and Country_1. Because those CompositeRegions are the lowest non-leaf regions with the RegionGraphNode with RegionGraphNodeID 3.

    Continental: 0, 1, 2, 3, 4, 5, 6, 7
    |--- Country_0: 1, 2, 3, 4
    |     |--- SubRegion_0: 1, 2, 3
    |            |--- LeafRegion_0: 1
    |            |--- LeafRegion_1: 2
    |            |--- SharedLeafRegion_0: 3
    |     |--- SubRegion_1: 4
    |            |--- LeafRegion_2: 4
    |--- Country_1: 3, 5, 6, 7
    |     |--- LeafRegion_3: 5
    |     |--- LeafRegion_4: 6
    |     |--- LeafRegion_5: 7
    |     |--- SharedLeafRegion_0: 3
    

    Declaration

    Swift

    public func findCompositeRegions(regionGraphNodeID: RegionGraphNodeID) -> Set<CompositeRegion>

    Parameters

    regionGraphNodeID

    The region graph node ID that can be from NDSStore/findRegionsAroundPosition(position:radius:callback:)

    Return Value

    a set of CompositeRegions.

  • Calculates the uninstallation size of the specified composite regions.

    Note

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

    Note

    The calculated size may not be accurate if any composite region is currently undergoing a map operation.

    Important

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

    Declaration

    Swift

    public func calculateUninstallSize(
        compositeRegionIDs: Set<CompositeRegionID>,
        completion: @escaping (Result<Measurement<UnitInformationStorage>, MapUpdateError>) -> ()
    )
        -> Cancellable

    Parameters

    compositeRegionIDs

    The set of CompositeRegionID for calculating the uninstall size. If any CompositeRegionID does not exist in the CompositeRegionGraph, completion will be called with the invalidArgument error.

    completion

    Invoked when the operation has been finished either successfully or unsuccessfully (with an error). It is executed on the main thread.

    Return Value

    The Cancellable operation.