Show / Hide Table of Contents

Class UnboundedViewport<T>

Class like Viewport<T>, however the view area is in no way bounded to the edges of the underlying map. Instead, if you access a position that cannot map to any valid position in the underlying map view, a (specified) default value is returned.

Inheritance
System.Object
UnboundedViewport<T>
Implements
IMapView<T>
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: GoRogue.MapViews
Assembly: GoRogue.dll
Syntax
public class UnboundedViewport<T> : IMapView<T>
Type Parameters
Name Description
T

The type being exposed by the UnboundedViewport.

Constructors

| Improve this Doc View Source

UnboundedViewport(IMapView<T>, T)

Constructor. Takes the map view to represent. The viewport will represent the entire given map view.

Declaration
public UnboundedViewport(IMapView<T> mapView, T defaultValue = null)
Parameters
Type Name Description
IMapView<T> mapView

The map view to represent.

T defaultValue

The value to return if a position is accessed that is outside the actual underlying map view.

| Improve this Doc View Source

UnboundedViewport(IMapView<T>, Rectangle, T)

Constructor. Takes the parent map view, and the initial subsection of that map view to represent.

Declaration
public UnboundedViewport(IMapView<T> mapView, Rectangle viewArea, T defaultValue = null)
Parameters
Type Name Description
IMapView<T> mapView

The map view being represented.

Rectangle viewArea

The initial subsection of that map to represent.

T defaultValue

The value to return if a position is accessed that is outside the actual underlying map view.

Fields

| Improve this Doc View Source

DefaultValue

The value to return if a position is accessed that is outside the actual underlying map view.

Declaration
public readonly T DefaultValue
Field Value
Type Description
T

Properties

| Improve this Doc View Source

Height

The height of the area being represented.

Declaration
public int Height { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Item[Coord]

Given a position in relative coordinates, returns the "value" associated with that location in absolute coordinates.

Declaration
public virtual T this[Coord relativePosition] { get; }
Parameters
Type Name Description
Coord relativePosition

Viewport-relative position of the location to retrieve the value for.

Property Value
Type Description
T

The "value" associated with the absolute location represented on the underlying map view, or DefaultValue if the absolute position does not exist in the underlying map view.

| Improve this Doc View Source

Item[Int32]

Given a position in relative 1d-array-index style, returns the "value" associated with that location in absolute coordinates.

Declaration
public T this[int relativeIndex1D] { get; }
Parameters
Type Name Description
System.Int32 relativeIndex1D

Viewport-relative position of the location to retrieve the value for, as a 1D array index.

Property Value
Type Description
T

The "value" associated with the absolute location represented on the underlying map view, or DefaultValue if the absolute position does not exist in the underlying map view.

| Improve this Doc View Source

Item[Int32, Int32]

Given an X and Y value in relative coordinates, returns the "value" associated with that location in absolute coordinates.

Declaration
public virtual T this[int relativeX, int relativeY] { get; }
Parameters
Type Name Description
System.Int32 relativeX

Viewport-relative X-value of location.

System.Int32 relativeY

Viewport-relative Y-value of location.

Property Value
Type Description
T

The "value" associated with the absolute location represented on the underlying map view, or DefaultValue if the absolute position does not exist in the underlying map view.

| Improve this Doc View Source

MapView

The map view that this UnboundedViewport is exposing values from.

Declaration
public IMapView<T> MapView { get; }
Property Value
Type Description
IMapView<T>
| Improve this Doc View Source

ViewArea

The area of the base MapView that this Viewport is exposing. Although this property does not explicitly expose a set accessor, it is returning a reference and as such may be assigned to. This viewport is NOT bounded to base map edges -- for this functionality, see the Viewport<T> class.

Declaration
public Rectangle ViewArea { get; }
Property Value
Type Description
Rectangle
| Improve this Doc View Source

Width

The height of the area being represented.

Declaration
public int Width { get; }
Property Value
Type Description
System.Int32

Methods

| Improve this Doc View Source

ToString()

Returns a string representation of the UnboundedViewport.

Declaration
public override string ToString()
Returns
Type Description
System.String

A string representation of the UnboundedViewport.

Overrides
System.Object.ToString()
| Improve this Doc View Source

ToString(Func<T, String>)

Returns a string representation of the map view, using elementStringifier to determine what string represents each value.

Declaration
public string ToString(Func<T, string> elementStringifier)
Parameters
Type Name Description
System.Func<T, System.String> elementStringifier

Function determining the string representation of each element.

Returns
Type Description
System.String

A string representation of the UnboundedViewport.

Remarks

This could be used, for example, on an UnboundedViewport of boolean values, to output '#' for false values, and '.' for true values.

| Improve this Doc View Source

ToString(Int32, Func<T, String>)

Prints the values in the UnboundedViewport, using the function specified to turn elements into strings, and using the "field length" specified.

Declaration
public string ToString(int fieldSize, Func<T, string> elementStringifier = null)
Parameters
Type Name Description
System.Int32 fieldSize

The size of the field to give each value. A positive-number right-aligns the text within the field, while a negative number left-aligns the text.

System.Func<T, System.String> elementStringifier

Function to use to convert each element to a string. null defaults to the ToString function of type T.

Returns
Type Description
System.String

A string representation of the UnboundedViewport.

Remarks

Each element of type T will have spaces added to cause it to take up exactly fieldSize characters, provided fieldSize is less than the length of the element's string represention.

Implements

IMapView<T>

Extension Methods

Utility.Yield<T>(T)
IMapViewExtensions.Bounds<T>(IMapView<T>)
IMapViewExtensions.Contains<T>(IMapView<T>, Int32, Int32)
IMapViewExtensions.Contains<T>(IMapView<T>, Coord)
IMapViewExtensions.ExtendToString<T>(IMapView<T>, String, String, Func<T, String>, String, String, String, String)
IMapViewExtensions.ExtendToString<T>(IMapView<T>, Int32, String, String, Func<T, String>, String, String, String, String)
IMapViewExtensions.Positions<T>(IMapView<T>)
IMapViewExtensions.RandomItem<T>(IMapView<T>, IGenerator)
IMapViewExtensions.RandomItem<T>(IMapView<T>, Func<Coord, T, Boolean>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, T, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, IEnumerable<T>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, HashSet<T>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, IGenerator, T[])
IMapViewExtensions.RandomPosition<T>(IMapView<T>, Func<Coord, T, Boolean>, IGenerator)
IMapViewExtensions.RandomPosition<T>(IMapView<T>, IGenerator)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX