SegmentDataLoader
public class SegmentDataLoader
extension SegmentDataLoader: NativeBase
extension SegmentDataLoader: Hashable
Provides the protocol for the access to the segments data available in the local OCM map. Please be aware that the methods within this class load map data synchronously. In the event of absent data in the disk cache, the data will be retrieved from the remote server. To mitigate the potential freezing of the calling thread, it is advisable to proactively prefetch map data around the working area.
Note: This is a beta release of this feature, so there could be a few bugs and unexpected behaviors. Related APIs may change for new releases without a deprecation process.
-
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init() throws -
Creates a new instance of this class.
Throws
InstantiationErrorIndicates what went wrong when the instantiation was attempted.Declaration
Swift
public init(sdkEngine: SDKNativeEngine) throwsParameters
sdkEngineA SDKEngine instance.
-
Loads the segments around a certain coordinates. Returns an empty list in case no segments could be found around the coordinates.
Throws
MapDataLoaderErrorSpecifies reason, why list of a list of segments is not returned.Declaration
Swift
public func getSegmentsAroundCoordinates(_ coordinates: GeoCoordinates, radiusInMeters: Double) throws -> [OCMSegmentId]Parameters
coordinatesThe location to explore
radiusInMetersThe radius of the search. Only values between 1m and 5000m are accepted.
Return Value
The list of segments around the given position. The segments are sorted by distance from the point. Throws if it’s not possible to return list of a list of segments.
-
Synchronously load the data for the given map segment.
Throws
MapDataLoaderErrorSpecifies reason, why list of data of a segment is not returned.Declaration
Swift
public func loadData(segment: OCMSegmentId, options: SegmentDataLoaderOptions) throws -> SegmentDataParameters
segmentThe segment to load.
optionsRequest options
Return Value
Requested data of a segment.
-
Synchronously load the data for the given map directed segment.
Throws
MapDataLoaderErrorSpecifies reason, why list of data of a segment is not returned.Declaration
Swift
public func loadDirectedSegmentData(segment: DirectedOCMSegmentId, options: SegmentDataLoaderOptions) throws -> SegmentDataParameters
segmentThe directed segment to load.
optionsRequest options
Return Value
Requested data of a segment.
-
Synchronously load the optional image providing guidance of a directed or non directed segment.
Throws
MapDataLoaderErrorSpecifies reason, why list of data of a segment is not returned.Declaration
Swift
public func downloadFile(fileReferences: [FileReference], downloadingOptions: DownloadingFileOptions) throws -> [Data]Parameters
fileReferencesProvides information for a file reference.
downloadingOptionsProvides information regarding downloading configuration.
Return Value
Requested data of a segment.