Show / Hide Table of Contents

Class LambdaSettableTranslationGridView<T1, T2>

A simple SettableTranslationGridView<T1, T2> implementation that allows you to provide functions/lambdas for the translation functions. For a version offering only "get" functionality, see LambdaTranslationGridView<T1, T2>.

Inheritance
Object
SettableGridViewBase<T2>
SettableTranslationGridView<T1, T2>
LambdaSettableTranslationGridView<T1, T2>
Implements
ISettableGridView<T2>
IGridView<T2>
Inherited Members
SettableTranslationGridView<T1, T2>.ToString()
SettableTranslationGridView<T1, T2>.ToString(Func<T2, String>)
SettableTranslationGridView<T1, T2>.ToString(Int32, 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>.Item[Point]
SettableGridViewBase<T2>.Fill(T2)
SettableGridViewBase<T2>.Clear()
SettableGridViewBase<T2>.Height
SettableGridViewBase<T2>.Width
SettableGridViewBase<T2>.Item[Point]
SettableGridViewBase<T2>.Count
SettableGridViewBase<T2>.Item[Int32, Int32]
SettableGridViewBase<T2>.Item[Int32]
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public sealed class LambdaSettableTranslationGridView<T1, T2> : SettableTranslationGridView<T1, T2>, ISettableGridView<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

LambdaSettableTranslationGridView(ISettableGridView<T1>, ISettableGridView<T2>, Func<T1, T2>, Func<T2, T1>)

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

Declaration
public LambdaSettableTranslationGridView(ISettableGridView<T1> baseGrid, ISettableGridView<T2> overlay, Func<T1, T2> getter, Func<T2, T1> setter)
Parameters
Type Name Description
ISettableGridView<T1> baseGrid

Your underlying grid data.

ISettableGridView<T2> overlay

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

Func<T1, T2> getter

The TranslateGet implementation.

Func<T2, T1> setter

The TranslateSet implementation.

LambdaSettableTranslationGridView(ISettableGridView<T1>, ISettableGridView<T2>, Func<Point, T1, T2>, Func<Point, T2, T1>)

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

Declaration
public LambdaSettableTranslationGridView(ISettableGridView<T1> baseGrid, ISettableGridView<T2> overlay, Func<Point, T1, T2> getter, Func<Point, T2, T1> setter)
Parameters
Type Name Description
ISettableGridView<T1> baseGrid

Your underlying grid data.

ISettableGridView<T2> overlay

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

Func<Point, T1, T2> getter

The TranslateGet implementation.

Func<Point, T2, T1> setter

The TranslateSet implementation.

LambdaSettableTranslationGridView(ISettableGridView<T1>, Func<T1, T2>, Func<T2, T1>)

Constructor. Takes an existing grid view to create a view from, and getter/setter functions taking only a value from the underlying representation.

Declaration
public LambdaSettableTranslationGridView(ISettableGridView<T1> baseGrid, Func<T1, T2> getter, Func<T2, T1> setter)
Parameters
Type Name Description
ISettableGridView<T1> baseGrid

Your underlying grid data.

Func<T1, T2> getter

The TranslateGet implementation.

Func<T2, T1> setter

The TranslateSet implementation.

Remarks

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

LambdaSettableTranslationGridView(ISettableGridView<T1>, Func<Point, T1, T2>, Func<Point, T2, T1>)

Constructor. Takes an existing grid view to create a view from, and getter/setter functions taking a map value and its corresponding position.

Declaration
public LambdaSettableTranslationGridView(ISettableGridView<T1> baseGrid, Func<Point, T1, T2> getter, Func<Point, T2, T1> setter)
Parameters
Type Name Description
ISettableGridView<T1> baseGrid

Your underlying grid data.

Func<Point, T1, T2> getter

The TranslateGet implementation.

Func<Point, T2, T1> setter

The TranslateSet implementation.

Methods

TranslateGet(Point, T1)

Translates your grid 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 data value of your underlying representation.

T1 value

The data value from your grid.

Returns
Type Description
T2

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

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

TranslateSet(Point, T2)

Translates the view type into the appropriate form for your grid data, by calling the setter function specified in the class constructor.

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

Position corresponding to the given mapped data type.

T2 value

A value of the mapped data type.

Returns
Type Description
T1

The value to apply to the underlying representation via the setter specified in the class constructor.

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

Implements

ISettableGridView<T>
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