ElectronicHorizonDataLoader (API Reference)
Class ElectronicHorizonDataLoader
Loads map data for segments that belong to the ElectronicHorizonEngine paths.
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.
Offline availability: This property is available online and offline.
-
Constructor Summary
ConstructorsConstructorDescriptionElectronicHorizonDataLoader(SDKNativeEngine sdkEngine, SegmentDataLoaderOptions options, int segmentDataCacheSize) Creates a new instance ofElectronicHorizonDataLoader. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddElectronicHorizonDataLoaderStatusListener(ElectronicHorizonDataLoaderStatusListener electronicHorizonListener) Adds anElectronicHorizonDataLoaderStatusListenerto the subscription list.getSegment(DirectedOCMSegmentId segmentId) Returns loaded data for the given segment identifier.voidloadData(ElectronicHorizonUpdate electronicHorizonUpdate) Requests data for all added segments and removes cached data for segments that are not part of the horizon anymore.voidremoveElectronicHorizonDataLoaderStatusListener(ElectronicHorizonDataLoaderStatusListener electronicHorizonListener) Removes anElectronicHorizonDataLoaderStatusListenerfrom the subscription list.
-
Constructor Details
-
ElectronicHorizonDataLoader
public ElectronicHorizonDataLoader(@NonNull SDKNativeEngine sdkEngine, @NonNull SegmentDataLoaderOptions options, int segmentDataCacheSize) throws InstantiationErrorException Creates a new instance of
ElectronicHorizonDataLoader. The constructor accepts options to configure the data loader. For more information, seeSegmentDataLoaderOptions. The cache size limits the number of segments that the loader can keep in memory at the same time.- Parameters:
sdkEngine-The
SDKNativeEngineinstance that provides shared services, such as networking and map data.options-The
SegmentDataLoaderOptionsinstance that configures how segment data is requested.segmentDataCacheSize-The maximum number of segments that the loader can cache.
- Throws:
InstantiationErrorException-InstantiationErrorExceptionIf the data loader cannot be created.
-
-
Method Details
-
loadData
Requests data for all added segments and removes cached data for segments that are not part of the horizon anymore.
- Parameters:
electronicHorizonUpdate-The update that contains the segments to add to the cache and the segments to remove from the cache.
-
getSegment
@NonNull public ElectronicHorizonDataLoaderResult getSegment(@NonNull DirectedOCMSegmentId segmentId) Returns loaded data for the given segment identifier. The result contains either the loaded data or an error code.
- Parameters:
segmentId-The segment identifier for which to return the loaded data from the cache.
- Returns:
The result object that contains either the loaded segment data or an error code.
-
addElectronicHorizonDataLoaderStatusListener
public void addElectronicHorizonDataLoaderStatusListener(@NonNull ElectronicHorizonDataLoaderStatusListener electronicHorizonListener) Adds an
ElectronicHorizonDataLoaderStatusListenerto the subscription list.- Parameters:
electronicHorizonListener-The listener that receives data loader status updates.
-
removeElectronicHorizonDataLoaderStatusListener
public void removeElectronicHorizonDataLoaderStatusListener(@NonNull ElectronicHorizonDataLoaderStatusListener electronicHorizonListener) Removes an
ElectronicHorizonDataLoaderStatusListenerfrom the subscription list.- Parameters:
electronicHorizonListener-The listener that should no longer receive data loader status updates.
-