Skip to content

DashArray

Namespace: ThinkGeo.Core.Styling

A line-dasharray: the dash and gap run lengths, in line-width units, that repeat along a line.

public struct DashArray

Inheritance object → ValueType → DashArray

Remarks:

One representation - the array the style declares. and are the first pair, or the summed even and odd elements of a longer pattern, and are computed here rather than stored beside the array, so there is no way to hand out a pair that disagrees with the segments it came from.

Properties

Segments

The pattern the style declared, alternating dash and gap. Null when undashed.

public Single[] Segments { get; }

Property Value

Single[]

Constructors

DashArray(float, float)

Initializes a plain dash/gap pair.

DashArray(float dashLength, float gapLength)

Parameters

dashLength float

gapLength float

DashArray(Single[])

Initializes a pattern from the style's array. An odd element count is doubled, which is the SVG convention the style spec follows.

DashArray(Single[] segments)

Parameters

segments Single[]
Alternating dash and gap lengths, in line-width units.

Methods

FromGeoPen(GeoPen)

The pattern a classic GeoPen draws with. GeoPen.DashPattern is already in these units - each element a multiple of the pen's width, which is exactly what line-dasharray means - and it is the pen's one store: setting GeoPen.DashStyle to Dash, Dot, DashDot or DashDotDot writes that preset into it, and writing anything else into it is what makes the style report Custom. So the pen's four presets and its custom pattern all arrive through here without an enum to translate, and a solid pen gives the undashed default.

DashArray FromGeoPen(GeoPen pen)

Parameters

pen GeoPen

Returns

DashArray