Show / Hide Table of Contents

Class SpatialMap<T>

An implementation of ISpatialMap<T> that allows only one item at each position at a time. If you need multiple items to be able to reside at one location at the same time, use MultiSpatialMap<T> or LayeredSpatialMap<T> instead.

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

The type of object that will be contained by this SpatialMap. Must implement IHasID and be a reference-type.

Remarks

See the ISpatialMap<T> for documentation on the practical purpose of spatial maps.

The objects stored in a SpatialMap<T> must implement IHasID. This is used internally to keep track of the objects, since uints are easily (and efficiently) hashable. If you cannot or do not wish to implement this interface, use AdvancedSpatialMap<T> instead.

Constructors

SpatialMap(IEqualityComparer<Point>, Int32)

Constructor.

Declaration
public SpatialMap(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 SpatialMap functions. Defaults to the default equality comparer for Point.

Int32 initialCapacity

The initial maximum number of elements the SpatialMap 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