Show / Hide Table of Contents

Class AutoSyncMultiSpatialMap<T>

A version of MultiSpatialMap<T> which takes items that implement IPositionable, and uses that interface's properties/events to automatically ensure items are recorded at the proper positions in the spatial map when they move and that the position fields are updated if the spatial map's move functions are used.

Inheritance
Object
AutoSyncAdvancedMultiSpatialMap<T>
AutoSyncMultiSpatialMap<T>
Implements
ISpatialMap<T>
IReadOnlySpatialMap<T>
IEnumerable<ItemPositionPair<T>>
IEnumerable
Inherited Members
AutoSyncAdvancedMultiSpatialMap<T>.GetEnumerator()
AutoSyncAdvancedMultiSpatialMap<T>.AsReadOnly()
AutoSyncAdvancedMultiSpatialMap<T>.CanAdd(T)
AutoSyncAdvancedMultiSpatialMap<T>.CanAdd(T, Point)
AutoSyncAdvancedMultiSpatialMap<T>.CanAdd(T, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.Add(T)
AutoSyncAdvancedMultiSpatialMap<T>.Add(T, Point)
AutoSyncAdvancedMultiSpatialMap<T>.Add(T, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.TryAdd(T)
AutoSyncAdvancedMultiSpatialMap<T>.TryAdd(T, Point)
AutoSyncAdvancedMultiSpatialMap<T>.TryAdd(T, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.CanMove(T, Point)
AutoSyncAdvancedMultiSpatialMap<T>.CanMove(T, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.CanMoveAll(Point, Point)
AutoSyncAdvancedMultiSpatialMap<T>.CanMoveAll(Int32, Int32, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.Move(T, Point)
AutoSyncAdvancedMultiSpatialMap<T>.Move(T, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.TryMove(T, Point)
AutoSyncAdvancedMultiSpatialMap<T>.TryMove(T, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.MoveAll(Point, Point)
AutoSyncAdvancedMultiSpatialMap<T>.TryMoveAll(Point, Point)
AutoSyncAdvancedMultiSpatialMap<T>.MoveAll(Int32, Int32, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.TryMoveAll(Int32, Int32, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.MoveValid(Point, Point)
AutoSyncAdvancedMultiSpatialMap<T>.MoveValid(Point, Point, List<T>)
AutoSyncAdvancedMultiSpatialMap<T>.MoveValid(Int32, Int32, Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.MoveValid(Int32, Int32, Int32, Int32, List<T>)
AutoSyncAdvancedMultiSpatialMap<T>.Contains(T)
AutoSyncAdvancedMultiSpatialMap<T>.Contains(Point)
AutoSyncAdvancedMultiSpatialMap<T>.Contains(Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.GetItemsAt(Point)
AutoSyncAdvancedMultiSpatialMap<T>.IReadOnlySpatialMap<T>.GetItemsAt(Point)
AutoSyncAdvancedMultiSpatialMap<T>.GetItemsAt(Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.IReadOnlySpatialMap<T>.GetItemsAt(Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.GetPositionOfOrNull(T)
AutoSyncAdvancedMultiSpatialMap<T>.TryGetPositionOf(T, Point)
AutoSyncAdvancedMultiSpatialMap<T>.GetPositionOf(T)
AutoSyncAdvancedMultiSpatialMap<T>.ToString(Func<T, String>)
AutoSyncAdvancedMultiSpatialMap<T>.ToString()
AutoSyncAdvancedMultiSpatialMap<T>.Clear()
AutoSyncAdvancedMultiSpatialMap<T>.Remove(T)
AutoSyncAdvancedMultiSpatialMap<T>.TryRemove(T)
AutoSyncAdvancedMultiSpatialMap<T>.Remove(Point)
AutoSyncAdvancedMultiSpatialMap<T>.TryRemove(Point)
AutoSyncAdvancedMultiSpatialMap<T>.Remove(Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.TryRemove(Int32, Int32)
AutoSyncAdvancedMultiSpatialMap<T>.Count
AutoSyncAdvancedMultiSpatialMap<T>.Items
AutoSyncAdvancedMultiSpatialMap<T>.Positions
AutoSyncAdvancedMultiSpatialMap<T>.ItemAdded
AutoSyncAdvancedMultiSpatialMap<T>.ItemMoved
AutoSyncAdvancedMultiSpatialMap<T>.ItemRemoved
Namespace: SadRogue.Primitives.SpatialMaps
Assembly: TheSadRogue.Primitives.dll
Syntax
public sealed class AutoSyncMultiSpatialMap<T> : AutoSyncAdvancedMultiSpatialMap<T>, ISpatialMap<T>, IReadOnlySpatialMap<T>, IEnumerable<ItemPositionPair<T>>, IEnumerable where T : class, IHasID, IPositionable
Type Parameters
Name Description
T

The type of object that will be contained by this spatial map.

Remarks

This class automatically keeps the spatial map position of each object synced up with their Position property; you may either use the Move functions of the spatial map, in which case the Position fields of the objects are updated as appropriate, or you may change the Position field, in which case the spatial map position is updated to match.

If you want to manually control the positions of items in the spatial map, you should use MultiSpatialMap<T> instead.

Constructors

AutoSyncMultiSpatialMap(IListPool<T>, IEqualityComparer<Point>, Int32)

Constructor.

Declaration
public AutoSyncMultiSpatialMap(IListPool<T> listPool, IEqualityComparer<Point> pointComparer = null, int initialCapacity = 32)
Parameters
Type Name Description
IListPool<T> listPool

The list pool implementation to use. Specify NoPoolingListPool<T> to disable pooling entirely. This implementation may be shared with other spatial maps if you wish, however be aware that no thread safety is implemented by the default list pool implementations or the spatial map itself.

IEqualityComparer<Point> pointComparer

Equality comparer to use for comparison and hashing of points, as object are added to/removed from/moved around the spatial map. Be especially mindful of the efficiency of its GetHashCode function, as it will determine the efficiency of many MultiSpatialMap functions. Defaults to the default equality comparer for Point, which uses a fairly efficient generalized hashing algorithm.

Int32 initialCapacity

The initial maximum number of elements the spatial map can hold before it has to internally resize data structures. Defaults to 32.

AutoSyncMultiSpatialMap(IEqualityComparer<Point>, Int32)

Constructor.

Declaration
public AutoSyncMultiSpatialMap(IEqualityComparer<Point> pointComparer = null, int initialCapacity = 32)
Parameters
Type Name Description
IEqualityComparer<Point> pointComparer

Equality comparer to use for comparison and hashing of points, as object are added to/removed from/moved around the spatial map. Be especially mindful of the efficiency of its GetHashCode function, as it will determine the efficiency of many MultiSpatialMap functions. Defaults to the default equality comparer for Point, which uses a fairly efficient generalized hashing algorithm.

Int32 initialCapacity

The initial maximum number of elements the spatial map can hold before it has to internally resize data structures. Defaults to 32.

Implements

ISpatialMap<T>
IReadOnlySpatialMap<T>
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable

Extension Methods

PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>)
PropertyChangedEventHelpers.SafelySetProperty<TObject, TProperty>(TObject, ref TProperty, TProperty, EventHandler<ValueChangedEventArgs<TProperty>>, EventHandler<ValueChangedEventArgs<TProperty>>)
In This Article
Back to top Generated by DocFX