Class SpatialCoordinateServiceBase<TKey>
Inheritance
SpatialCoordinateServiceBase<TKey>
Assembly: cs.temp.dll.dll
Syntax
public abstract class SpatialCoordinateServiceBase<TKey> : DisposableBase, ISpatialCoordinateService, IDisposable
Type Parameters
Fields
disposedCTS
Declaration
protected readonly CancellationTokenSource disposedCTS
Field Value
Type |
Description |
CancellationTokenSource |
|
knownCoordinates
Declaration
protected readonly ConcurrentDictionary<TKey, ISpatialCoordinate> knownCoordinates
Field Value
Properties
IsTracking
Gets or sets whether this coordinate service should be discovering/tracking coordinates.
Declaration
public bool IsTracking { get; }
Property Value
KnownCoordinates
Gets a set of all known coordinates to this service.
Declaration
public IEnumerable<ISpatialCoordinate> KnownCoordinates { get; }
Property Value
SupportsDiscovery
Declaration
protected virtual bool SupportsDiscovery { get; }
Property Value
Methods
OnDiscoverCoordinatesAsync(CancellationToken, TKey[])
Implement this method for the logic begin and end tracking (when CancellationToken is cancelled).
Declaration
protected abstract Task OnDiscoverCoordinatesAsync(CancellationToken cancellationToken, TKey[] idsToLocate = null)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
|
TKey[] |
idsToLocate |
|
Returns
OnManagedDispose()
Declaration
protected override void OnManagedDispose()
Overrides
OnNewCoordinate(TKey, ISpatialCoordinate)
Adds a coordinate to be tracked by this service.
Declaration
protected void OnNewCoordinate(TKey id, ISpatialCoordinate spatialCoordinate)
Parameters
OnRemoveCoordinate(TKey)
Removes a tracked coordinate from this service.
Declaration
protected void OnRemoveCoordinate(TKey id)
Parameters
Type |
Name |
Description |
TKey |
id |
The ide of the coordinate to remove.
|
TryCreateCoordinateAsync(Vector3, Quaternion, CancellationToken)
Attempts to create a new coordinate with this service.
Declaration
public virtual Task<ISpatialCoordinate> TryCreateCoordinateAsync(Vector3 worldPosition, Quaternion worldRotation, CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
Vector3 |
worldPosition |
|
Quaternion |
worldRotation |
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<ISpatialCoordinate> |
The coordinate if the coordinate was succesfully created, otherwise null.
|
TryDeleteCoordinateAsync(TKey, CancellationToken)
Declaration
public virtual Task<bool> TryDeleteCoordinateAsync(TKey key, CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
TKey |
key |
|
CancellationToken |
cancellationToken |
|
Returns
TryDiscoverCoordinatesAsync(CancellationToken, TKey[])
Declaration
public Task<bool> TryDiscoverCoordinatesAsync(CancellationToken cancellationToken, params TKey[] ids)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
|
TKey[] |
ids |
|
Returns
TryGetKnownCoordinate(TKey, out ISpatialCoordinate)
Declaration
public bool TryGetKnownCoordinate(TKey id, out ISpatialCoordinate spatialCoordinate)
Parameters
Returns
TryParse(String, out TKey)
Declaration
protected abstract bool TryParse(string id, out TKey result)
Parameters
Type |
Name |
Description |
String |
id |
|
TKey |
result |
|
Returns
Events
CoordinatedDiscovered
Triggered when a new coordinate is discovered or created with this service.
Declaration
public event Action<ISpatialCoordinate> CoordinatedDiscovered
Event Type
CoordinateRemoved
Triggered when a new coordinate is removed from this service.
Declaration
public event Action<ISpatialCoordinate> CoordinateRemoved
Event Type
Explicit Interface Implementations
ISpatialCoordinateService.TryDeleteCoordinateAsync(String, CancellationToken)
Attempts to asynchronously delete a coordinate with this space given an Id.
Declaration
Task<bool> ISpatialCoordinateService.TryDeleteCoordinateAsync(string id, CancellationToken cancellationToken)
Parameters
Type |
Name |
Description |
String |
id |
The id representing the coordinate.
|
CancellationToken |
cancellationToken |
|
Returns
Type |
Description |
Task<Boolean> |
True if the coordinate was succesfully deleted.
|
ISpatialCoordinateService.TryDiscoverCoordinatesAsync(CancellationToken, String[])
Begins search for coordinates, optionally priortizing a set of ids.
Declaration
Task<bool> ISpatialCoordinateService.TryDiscoverCoordinatesAsync(CancellationToken cancellationToken, string[] idsToLocate)
Parameters
Type |
Name |
Description |
CancellationToken |
cancellationToken |
The CancellationToken to be used for cancellation (stopping) of the discovery task.
|
String[] |
idsToLocate |
|
Returns
Type |
Description |
Task<Boolean> |
The set of coordinates discovered during this session.
|
ISpatialCoordinateService.TryGetKnownCoordinate(String, out ISpatialCoordinate)
Declaration
bool ISpatialCoordinateService.TryGetKnownCoordinate(string id, out ISpatialCoordinate spatialCoordinate)
Parameters
Returns
Implements