Table of Contents

Class SvgPivotMetrics

Namespace
EncDotNet.S100.Portrayals
Assembly
EncDotNet.S100.Portrayals.dll

Pivot and bounding-box metrics extracted from an S-100 Part 9 SVG symbol, used by renderers that center symbol bitmaps on an anchor (instead of on the SVG's pivot point) to recover the spec-mandated placement.

public sealed class SvgPivotMetrics
Inheritance
SvgPivotMetrics
Inherited Members

Remarks

S-100 Part 9 §11.5 places a point symbol so that the symbol's pivotPoint coincides with the feature anchor. The IHO portrayal catalogue encodes the pivot as a <circle class="pivotPoint" cx cy> element with the rendered glyph laid out in an asymmetric viewBox around it. Composite symbols (e.g. multi-digit soundings drawn from SOUNDG/SOUNDS pieces) rely on this pivot convention so that adjacent glyphs sit side-by-side rather than on top of each other.

Map renderers that center an SVG's bounding box on the anchor (such as Mapsui's ImageStyle) ignore the pivot, so the per-symbol shift returned by PivotToBoundsCenterMm must be added to the renderer's offset to restore the correct placement.

Properties

PivotToBoundsCenterMm

Offset, in millimetres, from the SVG's pivot point to the centre of its viewBox rectangle (i.e. viewBoxCenter - pivot).

public (double X, double Y) PivotToBoundsCenterMm { get; }

Property Value

(double X, double Y)

Remarks

Add this offset to a renderer's symbol offset to translate a bounds-centred SVG so that its pivot lands on the original anchor. SVG user units in S-100 symbols are millimetres, matching the width="…mm" declaration on the root element.

RelativeOffset

Pivot-to-bounds-centre offset expressed as a fraction of the viewBox size (range typically [-0.5, +0.5] per axis). Suitable for renderers whose symbol-offset API is relative to the rendered symbol size (e.g. Mapsui's RelativeOffset).

public (double X, double Y) RelativeOffset { get; }

Property Value

(double X, double Y)

Remarks

X = +0.5 means the pivot sits at the left edge of the viewBox; X = -0.5 means it sits at the right edge. Adding this offset to a "0 = centred" relative-offset property shifts the symbol so the pivot — not the bbox centre — coincides with the feature anchor.

Methods

TryParse(string)

Parses the viewBox and the <circle class="pivotPoint"> element from an S-100 SVG symbol and returns its pivot-to-bounds-centre offset. Returns null when the SVG cannot be parsed, has no viewBox, or has no recognisable pivot element (in which case callers should treat the offset as zero).

public static SvgPivotMetrics? TryParse(string svgContent)

Parameters

svgContent string

Returns

SvgPivotMetrics