Class LineCanvas
Facilitates box drawing and line intersection detection and rendering. Does not support diagonal lines.
public class LineCanvas : IDisposable
- Inheritance
-
LineCanvas
- Implements
- Inherited Members
Constructors
- LineCanvas()
Creates a new instance.
- LineCanvas(IEnumerable<StraightLine>)
Creates a new instance with the given
lines
.
Properties
- Lines
Gets the lines in the canvas.
- Viewport
Gets the rectangle that describes the bounds of the canvas. Location is the coordinates of the line that is furthest left/top and Size is defined by the line that extends the furthest right/bottom.
Methods
- AddLine(Point, int, Orientation, LineStyle, Attribute?)
Adds a new
length
long line to the canvas starting atstart
.Use positive
length
for the line to extend Right and negative for Left when Orientation is Horizontal.Use positive
length
for the line to extend Down and negative for Up when Orientation is Vertical.
- AddLine(StraightLine)
Adds a new line to the canvas
- Clear()
Clears all lines from the LineCanvas.
- ClearCache()
Clears any cached states from the canvas Call this method if you make changes to lines that have already been added.
- Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- GetCellMap()
Evaluates the lines that have been added to the canvas and returns a map containing the glyphs and their locations. The glyphs are the characters that should be rendered so that all lines connect up with the appropriate intersection symbols.
- GetMap()
Evaluates the lines that have been added to the canvas and returns a map containing the glyphs and their locations. The glyphs are the characters that should be rendered so that all lines connect up with the appropriate intersection symbols.
- GetMap(Rectangle)
Evaluates the lines that have been added to the canvas and returns a map containing the glyphs and their locations. The glyphs are the characters that should be rendered so that all lines connect up with the appropriate intersection symbols.
- Merge(LineCanvas)
Merges one line canvas into this one.
- RemoveLastLine()
Removes the last line added to the canvas
- ToString()
Returns the contents of the line canvas rendered to a string. The string will include all columns and rows, even if Viewport has negative coordinates. For example, if the canvas contains a single line that starts at (-1,-1) with a length of 2, the rendered string will have a length of 2.