LineStipple

Description

`struct` `Tinman.Terrain.Util.LineStipple`

A line stipple pattern.

Line stipple patterns defined by a sequence of non-zero intervals, which depicts the alternating pattern segments, for example:

```0                   18   length, in pattern-units
|                   |
#######...###.......
\_____/\_/\_/\_____/
6    3  3    6        segments```

The first and last segments of a pattern with an odd number of segments will always have the same parity. So the LineStipple always generates patterns that have an even number of segments (zero segments represent the solid pattern).

Public / Constants

Dash

`public` `static` `readonly` `attribute` `Dash` → `(LineStipple)`

Dashed line pattern: `[- ]`

Empty

`public` `static` `readonly` `attribute` `Empty` → `(LineStipple)`

Empty (i.e. solid) line pattern: `[-]`

Public / Constructors

Morse

`public` `static` `method` `Morse` → `(1)`

character in : char

The character (letter or digit).

returns → LineStipple

The character in in Morse code or Empty if the given character in is neither a letter nor a digit.

Creates a new instance of LineStipple that represents the given character in in Morse code.

Recommendation ITU-R M.1677-1
International Morse code
https://www.itu.int/rec/R-REC-M.1677-1-200910-I/

Public / Methods

`[Pure]`
`public` `method` `Add1` → `(1)`

in : int32

`[>0]`
The pattern segment length.

returns → LineStipple

The resulting LineStipple value.

Add segments to this line pattern.

Two pattern segments of equal length are appended:

```|                   |
#######...###.......#####.....
\__________________/\___/\___/
current pattern    n    n```

`[Pure]`
`public` `method` `Add2` → `(2)`

in : int32

`[>0]`
Length of the first pattern segment, in pattern units.

in : int32

`[>0]`
Length of the second pattern segment, in pattern units.

returns → LineStipple

The resulting LineStipple value.

Adds segments to this line pattern.

Two pattern segments are appended:

```|                   |
#######...###.......###.......
\__________________/\_/\_____/
current pattern   a    b```

Length

`[Pure]`
`public` `method` `Length1` → `(2)`

index in : int32

`[0..LineStipple.Count-1]`
The pattern segment index.

length in : int32

`[>=1]`
The pattern segment length, in pattern units.

returns → LineStipple

The resulting LineStipple value.

Sets the length of the index in-th pattern segment.

`[Pure]`
`public` `method` `Length2` → `(1)`

index in : int32

`[0..LineStipple.Count-1]`
The pattern segment index.

returns → int32

The pattern segment length.

Returns the length of the index in-th pattern segment.

Unit

`[Pure]`
`public` `method` `Unit` → `(1)`

scale in : float64

`[>0]`
Scale factor from pattern units to render units.

returns → LineStipple

The resulting LineStipple value.

Specifies the render unit.

Public / Attributes

Count

`public` `attribute` `Count` → `(get)`

value : int32

`[>=0]`
The number of segments.

Returns the number of line pattern segments.

Is​Empty

`public` `attribute` `IsEmpty` → `(get)`

value : bool

`true` if this line pattern is solid,
`false` if not.

Is this the solid line pattern?

Last

`public` `attribute` `Last` → `(get)`

value : int32

`[>=0]`
The length of the last pattern segment, in pattern units.

Returns the length of the last pattern segment.

The last segment is always empty.

Range

`public` `attribute` `Range` → `(get)`

value : int32

The value `max` of the pattern range [0..max[, in pattern units.

Returns the pattern range.

Scale

`public` `attribute` `Scale` → `(get)`

value : float64

`[>0]`
The scale factor.

Scale factor from pattern units to render units.