Show / Hide Table of Contents

Class InheritedTypeGridView<T1, T2>

Grid view that translates from T1 to T2, assuming T2 inherits from T1, by simply casting.

Inheritance
object
SettableGridViewBase<T2>
SettableTranslationGridView<T1, T2>
InheritedTypeGridView<T1, T2>
Implements
ISettableGridView<T2>
IGridView<T2>
Inherited Members
SettableTranslationGridView<T1, T2>.ToString()
SettableTranslationGridView<T1, T2>.ToString(Func<T2, string>)
SettableTranslationGridView<T1, T2>.ToString(int, Func<T2, string>)
SettableTranslationGridView<T1, T2>.TranslateGet(T1)
SettableTranslationGridView<T1, T2>.TranslateGet(Point, T1)
SettableTranslationGridView<T1, T2>.TranslateSet(T2)
SettableTranslationGridView<T1, T2>.TranslateSet(Point, T2)
SettableTranslationGridView<T1, T2>.BaseGrid
SettableTranslationGridView<T1, T2>.Height
SettableTranslationGridView<T1, T2>.Width
SettableTranslationGridView<T1, T2>.this[Point]
SettableGridViewBase<T2>.Fill(T2)
SettableGridViewBase<T2>.Clear()
SettableGridViewBase<T2>.Height
SettableGridViewBase<T2>.Width
SettableGridViewBase<T2>.this[Point]
SettableGridViewBase<T2>.Count
SettableGridViewBase<T2>.this[int, int]
SettableGridViewBase<T2>.this[int]
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: GoRogue.GridViews
Assembly: GoRogue.dll
Syntax
public class InheritedTypeGridView<T1, T2> : SettableTranslationGridView<T1, T2>, ISettableGridView<T2>, IGridView<T2> where T1 : T2
Type Parameters
Name Description
T1

Base type of grid view to implement.

T2

Value inheriting from/implementing T1.

Remarks

This is useful to implement full co-variance/contra-variance with grid views, if you know that values that will be put into the grid will be of a particular type. An exception will occur if casting a value to T2 fails.

Constructors

View Source

InheritedTypeGridView(ISettableGridView<T1>)

Constructor. Takes an existing grid view to create a view from.

Declaration
public InheritedTypeGridView(ISettableGridView<T1> baseGrid)
Parameters
Type Name Description
ISettableGridView<T1> baseGrid

A grid view exposing your underlying map data.

View Source

InheritedTypeGridView(ISettableGridView<T1>, ISettableGridView<T2>)

Constructor. Takes an existing grid view to create a view from and applies view data to it.

Declaration
public InheritedTypeGridView(ISettableGridView<T1> baseGrid, ISettableGridView<T2> overlay)
Parameters
Type Name Description
ISettableGridView<T1> baseGrid

Your underlying map data.

ISettableGridView<T2> overlay

The view data to apply to the grid. Must have identical dimensions to baseGrid.

Remarks

Since this constructor must call TranslateSet to perform its function, do NOT call this constructor if the TranslateSet implementation depends on the derived class's constructor being completed to function properly.

Methods

View Source

TranslateGet(T1)

Translates your underlying data into the view type. Takes only a value from the underlying data. If a position is also needed to perform the translation, use TranslateGet(Point, T1) instead.

Declaration
protected override T2 TranslateGet(T1 value)
Parameters
Type Name Description
T1 value

The data value from your underlying data.

Returns
Type Description
T2

A value of the mapped data type.

Overrides
SadRogue.Primitives.GridViews.SettableTranslationGridView<T1, T2>.TranslateGet(T1)
View Source

TranslateSet(T2)

Translates the view type into the appropriate form for your underlying data. Takes only a value from the grid view itself. If a position is also needed to perform the translation, use SadRogue.Primitives.GridViews.SettableTranslationGridView<T1, T2>.TranslateSet(SadRogue.Primitives.Point, T2) instead.

Declaration
protected override T1 TranslateSet(T2 value)
Parameters
Type Name Description
T2 value

A value of the mapped data type.

Returns
Type Description
T1

The data value for your underlying representation.

Overrides
SadRogue.Primitives.GridViews.SettableTranslationGridView<T1, T2>.TranslateSet(T2)

Implements

ISettableGridView<T>
IGridView<T>

Extension Methods

Utility.Yield<T>(T)
  • View Source
In this article
Back to top Generated by DocFX