Show / Hide Table of Contents

Class LambdaTranslationGridView<T1, T2>

A simple TranslationGridView<T1, T2> implementation that allows you to provide a function/lambda at construction to use as the TranslateGet(Point, T1) implementation. For a version offering "set" functionality, see LambdaSettableTranslationGridView<T1, T2>.

Inheritance
Object
GridViewBase<T2>
TranslationGridView<T1, T2>
LambdaTranslationGridView<T1, T2>
Implements
IGridView<T2>
Inherited Members
TranslationGridView<T1, T2>.ToString()
TranslationGridView<T1, T2>.ToString(Func<T2, String>)
TranslationGridView<T1, T2>.ToString(Int32, Func<T2, String>)
TranslationGridView<T1, T2>.TranslateGet(T1)
TranslationGridView<T1, T2>.TranslateGet(Point, T1)
TranslationGridView<T1, T2>.BaseGrid
TranslationGridView<T1, T2>.Height
TranslationGridView<T1, T2>.Width
TranslationGridView<T1, T2>.Item[Point]
GridViewBase<T2>.Height
GridViewBase<T2>.Width
GridViewBase<T2>.Item[Point]
GridViewBase<T2>.Count
GridViewBase<T2>.Item[Int32, Int32]
GridViewBase<T2>.Item[Int32]
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public sealed class LambdaTranslationGridView<T1, T2> : TranslationGridView<T1, T2>, IGridView<T2>
Type Parameters
Name Description
T1

The type of your underlying data.

T2

The type of the data being exposed by the grid view.

Constructors

LambdaTranslationGridView(IGridView<T1>, Func<T1, T2>)

Constructor. Takes an existing grid view to create a view from and a getter function taking only a value of type T1.

Declaration
public LambdaTranslationGridView(IGridView<T1> baseGrid, Func<T1, T2> getter)
Parameters
Type Name Description
IGridView<T1> baseGrid

Your underlying grid data.

Func<T1, T2> getter

The TranslateGet implementation.

Remarks

If a position is also needed to perform the translation, an overload is provided taking a corresponding function.

LambdaTranslationGridView(IGridView<T1>, Func<Point, T1, T2>)

Constructor. Takes an existing grid view to create a view from and a getter function taking a value of type T1 and its corresponding position.

Declaration
public LambdaTranslationGridView(IGridView<T1> baseGrid, Func<Point, T1, T2> getter)
Parameters
Type Name Description
IGridView<T1> baseGrid

Your underlying grid data.

Func<Point, T1, T2> getter

The TranslateGet implementation.

Methods

TranslateGet(Point, T1)

Translates your underlying data into the view type by calling the getter function specified in the class constructor.

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

Position corresponding to given value from your underlying data.

T1 value

The value from your underlying data.

Returns
Type Description
T2

A value of the mapped data type (via the getter specified in the class constructor).

Overrides
SadRogue.Primitives.GridViews.TranslationGridView<T1, T2>.TranslateGet(SadRogue.Primitives.Point, T1)

Implements

IGridView<T>

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