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.-
Declaration
Swift
public convenience init(ndsStoreUpdater: NDSStoreUpdater)
Parameters
ndsStoreUpdater
The
NDSStoreUpdater
that contains the offline map data.
-
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 specifiedCompositeRegion
s.Declaration
Swift
public func cancelAllMapOperations(for regionIDs: [CompositeRegionID])
Parameters
regionIDs
The list of
CompositeRegionID
s that were previously passed toschedule(operations:)
to schedule an operation. -
Finds the lowest-level of the parent
CompositeRegion
s that contains the givenRegionGraphNodeID
For the following region graph as an example,
findCompositeRegions(regionGraphNodeID: 3)
will returnSubRegion_0
andCountry_1
. Because thoseCompositeRegion
s are the lowest non-leaf regions with theRegionGraphNode
withRegionGraphNodeID
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
CompositeRegion
s. -
Calculates the uninstallation size of the specified composite regions.
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 anyCompositeRegionID
does not exist in theCompositeRegionGraph
,completion
will be called with theinvalidArgument
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.