Class GridView1DIndexBase<T>
Exactly like GridViewBase<T>, except for the one indexer left to the user to implement is the one which takes a 1D array, and the position-based indexers are implemented off that.
Implements
Namespace: SadRogue.Primitives.GridViews
Assembly: TheSadRogue.Primitives.dll
Syntax
public abstract class GridView1DIndexBase<T> : Object, IGridView<T>
  Type Parameters
| Name | Description | 
|---|---|
| T | The type of value being stored.  | 
      
Remarks
This can be more convenient than GridViewBase<T> for use cases where 1D indices are easiest to work with, and is technically more efficient for cases such as wrapping a 1D array, where the backing data structure takes an index (although this should typically be considered a micro-optimization).
Constructors
GridView1DIndexBase()
Declaration
protected GridView1DIndexBase()
  Properties
Count
Declaration
public int Count { get; }
  Property Value
| Type | Description | 
|---|---|
| Int32 | 
Height
The height of the grid being represented.
Declaration
public abstract int Height { get; }
  Property Value
| Type | Description | 
|---|---|
| Int32 | 
Item[Point]
Given a position, returns the "value" associated with that location.
Declaration
public T this[Point pos] { get; }
  Parameters
| Type | Name | Description | 
|---|---|---|
| Point | pos | Location to retrieve the value for.  | 
      
Property Value
| Type | Description | 
|---|---|
| T | The "value" associated with the provided location.  | 
      
Item[Int32]
Given an 1-dimensional index, returns the value associated with the corresponding position in the map view.
Declaration
public abstract T this[int index1D] { get; }
  Parameters
| Type | Name | Description | 
|---|---|---|
| Int32 | index1D | 1D index of location to retrieve the "value" for.  | 
      
Property Value
| Type | Description | 
|---|---|
| T | The "value" associated with the given location.  | 
      
Remarks
Typically, this may be implemented in terms of Item[Point] by using FromIndex(Int32, Int32) to calculate the 2D position represented by that 1D index, and passing that position to the Item[Point] indexer to determine the value associated with the position.
Item[Int32, Int32]
Given an X and Y value, returns the "value" associated with that location.
Declaration
public T this[int x, int y] { get; }
  Parameters
| Type | Name | Description | 
|---|---|---|
| Int32 | x | X-value of location.  | 
      
| Int32 | y | Y-value of location.  | 
      
Property Value
| Type | Description | 
|---|---|
| T | The "value" associated with that location.  | 
      
Remarks
Typically, this can be implemented via Item[Point].
Width
The width of the grid being represented.
Declaration
public abstract int Width { get; }
  Property Value
| Type | Description | 
|---|---|
| Int32 |