Class RectangleEdgePositionsList
An arbitrary list of any number of positions on the perimeter of a rectangle. Commonly used to represent a list of doors or edges of rooms by some map generation steps.
Inherited Members
Namespace: GoRogue.MapGeneration
Assembly: GoRogue.dll
Syntax
public class RectangleEdgePositionsList : IEnumerable<Point>, IEnumerable
Constructors
View SourceRectangleEdgePositionsList(Rectangle)
Creates a empty list of perimeter for a given rectangle.
Declaration
public RectangleEdgePositionsList(Rectangle rectangle)
Parameters
Type | Name | Description |
---|---|---|
Rectangle | rectangle | The rectangle the structure stores perimeter positions for. |
Fields
View SourceRectangle
The rectangle whose edge positions are being stored.
Declaration
public readonly Rectangle Rectangle
Field Value
Type | Description |
---|---|
Rectangle |
Properties
View SourceBottomPositions
Positions of doors on the bottom wall of the rectangle.
Declaration
public IReadOnlyList<Point> BottomPositions { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<Point> |
this[Direction]
Retrieves a read-only list of stored positions on the given side. Direction specified must be a cardinal.
Declaration
public IReadOnlyList<Point> this[Direction side] { get; }
Parameters
Type | Name | Description |
---|---|---|
Direction | side | Side to get stored positions for. |
Property Value
Type | Description |
---|---|
IReadOnlyList<Point> | A read-only list of stored positions on the given side. |
LeftPositions
Positions of doors on the bottom wall of the rectangle.
Declaration
public IReadOnlyList<Point> LeftPositions { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<Point> |
Positions
Positions being stored, with no duplicate locations.
Declaration
public IEnumerable<Point> Positions { get; }
Property Value
Type | Description |
---|---|
IEnumerable<Point> |
RightPositions
Positions of doors on the right wall of the rectangle.
Declaration
public IReadOnlyList<Point> RightPositions { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<Point> |
TopPositions
Positions on the top edge of the rectangle.
Declaration
public IReadOnlyList<Point> TopPositions { get; }
Property Value
Type | Description |
---|---|
IReadOnlyList<Point> |
Methods
View SourceAdd(Point)
Adds the given position to the appropriate lists of positions.
Declaration
public void Add(Point perimeterPosition)
Parameters
Type | Name | Description |
---|---|---|
Point | perimeterPosition | Position to add. |
AddRange(params Point[])
Adds the given positions to the appropriate lists of positions.
Declaration
public void AddRange(params Point[] perimeterPositions)
Parameters
Type | Name | Description |
---|---|---|
Point[] | perimeterPositions | Positions to add. |
AddRange(IEnumerable<Point>)
Adds the given positions to the appropriate lists of positions.
Declaration
public void AddRange(IEnumerable<Point> perimeterPositions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Point> | perimeterPositions | Positions to add. |
Contains(Point)
Returns whether or not the structure contains the given position.
Declaration
public bool Contains(Point position)
Parameters
Type | Name | Description |
---|---|---|
Point | position |
Returns
Type | Description |
---|---|
bool | Whether or not the structure contains the position specified. |
GetEnumerator()
Gets an enumerator of all positions in the data structure.
Declaration
public IEnumerator<Point> GetEnumerator()
Returns
Type | Description |
---|---|
IEnumerator<Point> |
Remove(Point)
Removes the given position from the data structure.
Declaration
public void Remove(Point perimeterPosition)
Parameters
Type | Name | Description |
---|---|---|
Point | perimeterPosition | Position to remove. |
RemoveRange(params Point[])
Removes the given positions from the data structure.
Declaration
public void RemoveRange(params Point[] perimeterPositions)
Parameters
Type | Name | Description |
---|---|---|
Point[] | perimeterPositions | Positions to remove. |
RemoveRange(IEnumerable<Point>)
Removes the given positions from the data structure.
Declaration
public void RemoveRange(IEnumerable<Point> perimeterPositions)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<Point> | perimeterPositions | Positions to remove. |