holoride
Search Results for

    Show / Hide Table of Contents

    Class TileDataService<T>

    Downloads and caches tiles to the hard drive.

    Inheritance
    object
    TileDataService<T>
    TileImageServiceRoadMask
    Implements
    ITileDataService<T>
    ITileDataProvider<T>
    Namespace: Holoride.ElasticSDK
    Assembly: Holoride.ElasticSDK.Library.Runtime.dll
    Syntax
    public abstract class TileDataService<T> : ITileDataService<T>, ITileDataProvider<T>
    Type Parameters
    Name Description
    T

    Constructors

    TileDataService(TileDataServiceConfiguration)

    Instantiates a TileDataService.

    Declaration
    protected TileDataService(TileDataServiceConfiguration configuration)
    Parameters
    Type Name Description
    TileDataServiceConfiguration configuration

    Fields

    CacheVersion

    Version of the cached files. Used in case of incompatibility with previously downloaded files.

    Declaration
    protected readonly int CacheVersion
    Field Value
    Type Description
    int

    Configuration

    Configuration for this service.

    Declaration
    protected readonly TileDataServiceConfiguration Configuration
    Field Value
    Type Description
    TileDataServiceConfiguration

    VersionedCacheSubDirectory

    The fully qualified path to the tile data cache, of the specific service, based on its name and version.

    Declaration
    protected readonly string VersionedCacheSubDirectory
    Field Value
    Type Description
    string

    Methods

    CacheMapTileDataAsync(TileAreaDescription, IProgress<float>, CancellationToken)

    Declaration
    public UniTask<LoadResourceResult> CacheMapTileDataAsync(TileAreaDescription tileAreaDescription, IProgress<float> onProgressUpdate = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    TileAreaDescription tileAreaDescription
    IProgress<float> onProgressUpdate
    CancellationToken cancellationToken
    Returns
    Type Description
    Cysharp.Threading.Tasks.UniTask<T><LoadResourceResult>

    CacheMapTileDataAsync(int, Vector2Int, IProgress<float>, CancellationToken)

    Declaration
    public UniTask<LoadResourceResult> CacheMapTileDataAsync(int zoomLevel, Vector2Int tilePos, IProgress<float> onProgressUpdate = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int zoomLevel
    Vector2Int tilePos
    IProgress<float> onProgressUpdate
    CancellationToken cancellationToken
    Returns
    Type Description
    Cysharp.Threading.Tasks.UniTask<T><LoadResourceResult>

    Deserialize(byte[], out T)

    Defines how the downloaded data is deserialized. This function will be called on the Unity main thread.

    Declaration
    protected virtual bool Deserialize(byte[] data, out T result)
    Parameters
    Type Name Description
    byte[] data

    The downloaded data.

    T result

    The deserialized object.

    Returns
    Type Description
    bool

    Whether the object was deserialized successfully.

    Deserialize(Stream, out T)

    Defines how the downloaded data is deserialized. This function will be called on the Unity main thread.

    Declaration
    protected virtual bool Deserialize(Stream data, out T result)
    Parameters
    Type Name Description
    Stream data

    The downloaded data.

    T result

    The deserialized object.

    Returns
    Type Description
    bool

    Whether the object was deserialized successfully.

    DeserializeAsync(byte[], out T)

    Defines how the downloaded data is deserialized. This function is an alternative to the Deserialize function and will be called in an extra thread. Therefore, it is not applicable for Unity objects.

    Declaration
    protected virtual bool DeserializeAsync(byte[] data, out T result)
    Parameters
    Type Name Description
    byte[] data

    The downloaded data.

    T result

    The deserialized object.

    Returns
    Type Description
    bool

    Whether the object was deserialized successfully.

    DeserializeAsync(Stream, out T)

    Defines how the downloaded data is deserialized. This function is an alternative to the Deserialize function and will be called in an extra thread. Therefore, it is not applicable for Unity objects.

    Declaration
    protected virtual bool DeserializeAsync(Stream data, out T result)
    Parameters
    Type Name Description
    Stream data

    The downloaded data.

    T result

    The deserialized object.

    Returns
    Type Description
    bool

    Whether the object was deserialized successfully.

    GetFileName(int, Vector2Int)

    The file name based on a given tile position and zoom level.

    Declaration
    protected abstract string GetFileName(int zoomLevel, Vector2Int tilePos)
    Parameters
    Type Name Description
    int zoomLevel

    The zoom level the tile position refers to.

    Vector2Int tilePos

    The tile position of the tile which should get downloaded.

    Returns
    Type Description
    string

    The file name.

    GetWebRequest(int, Vector2Int, CancellationToken)

    The download URL based on a given tile position and zoom level.

    Declaration
    protected abstract UniTask<Func<UnityWebRequest>> GetWebRequest(int zoomLevel, Vector2Int tilePos, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int zoomLevel

    The zoom level the tile position refers to.

    Vector2Int tilePos

    The tile position of the tile which should get downloaded.

    CancellationToken cancellationToken

    The token to monitor for cancellation requests.

    Returns
    Type Description
    Cysharp.Threading.Tasks.UniTask<T><Func<UnityWebRequest>>

    The download url.

    PrepareTileData(int, Vector2Int, IProgress<float>, CancellationToken, string, bool)

    This only exists for Elastic SDK tests; it will go a way in a future refactor. Do not override this method outside of tests. It is only visible to all sub-classes due to C# limitations, not by design.

    Declaration
    protected virtual Task<LoadResourceResult> PrepareTileData(int zoomLevel, Vector2Int tilePos, IProgress<float> onProgressUpdate, CancellationToken cancellationToken, string fileName, bool retryUntilDownloadedSucceeded = true)
    Parameters
    Type Name Description
    int zoomLevel
    Vector2Int tilePos
    IProgress<float> onProgressUpdate
    CancellationToken cancellationToken
    string fileName
    bool retryUntilDownloadedSucceeded
    Returns
    Type Description
    Task<LoadResourceResult>

    RequestMapTileDataAsync(int, Vector2Int, Action<T>, CancellationToken)

    Declaration
    public UniTask RequestMapTileDataAsync(int zoomLevel, Vector2Int tilePos, Action<T> onTileLoaded, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int zoomLevel
    Vector2Int tilePos
    Action<T> onTileLoaded
    CancellationToken cancellationToken
    Returns
    Type Description
    Cysharp.Threading.Tasks.UniTask

    Implements

    ITileDataService<T>
    ITileDataProvider<T>
    In This Article

    Back to top
    ©   holoride
    Privacy   Imprint