Table of Contents

Class InstrumentedMemoryLayer

Namespace
EncDotNet.S100.Renderers.Mapsui
Assembly
EncDotNet.S100.Renderers.Mapsui.dll

Mapsui.Layers.MemoryLayer subclass that records per-frame timing and selectivity metrics each time Mapsui asks for the layer's visible features. Used by MapsuiDisplayListRenderer so we can quantify how much of a render frame is spent in the layer's extent-filter loop versus downstream Skia drawing — i.e. whether a spatial index (e.g. an STRtree-backed provider) would actually help real-world S-100 datasets.

public sealed class InstrumentedMemoryLayer : MemoryLayer, ILayer, IAnimatable, INotifyPropertyChanged, IDisposable
Inheritance
BaseLayer
MemoryLayer
InstrumentedMemoryLayer
Implements
ILayer
IAnimatable
Inherited Members
MemoryLayer.FeaturesWereModified()
MemoryLayer.Features
MemoryLayer.SortFeatures
MemoryLayer.Extent
BaseLayer.NextId()
BaseLayer.DataHasChanged()
BaseLayer.ToString()
BaseLayer.Dispose()
BaseLayer.UpdateAnimations()
BaseLayer.Id
BaseLayer.Tag
BaseLayer.MinVisible
BaseLayer.MaxVisible
BaseLayer.Enabled
BaseLayer.Name
BaseLayer.Opacity
BaseLayer.Busy
BaseLayer.Style
BaseLayer.Attribution
BaseLayer.Resolutions
BaseLayer.CustomLayerRendererName
BaseLayer.PropertyChanged
BaseLayer.DataChanged

Remarks

Mapsui's base Mapsui.Layers.MemoryLayer implements GetFeatures as an O(N) linear extent test on every render frame. This subclass re-implements the same filter while wrapping it in a Stopwatch measurement and emitting:

  • s100.layer.getfeatures.duration (ms)
  • s100.layer.getfeatures.visible.count (K)
  • s100.layer.getfeatures.total.count (N)

Each metric is tagged with s100.product when the renderer is configured by a dataset processor, so per-product percentiles can be read directly from the OTLP / console exporter.

Constructors

InstrumentedMemoryLayer(string?)

Creates a new instrumented layer. product is attached as the s100.product dimension on each emitted metric; pass null for ad-hoc / one-shot use.

public InstrumentedMemoryLayer(string? product = null)

Parameters

product string

Properties

RequestRedraw

Per-session redraw sink. The S-100 vector renderers rasterise cached / scene / tile output on background threads and, when a settled image publishes, call RequestRepaint() to bring it on screen. A session stamps this with an action that invalidates the attached map (see MapsuiDatasetLayerSession / S100MapsuiOptions.RedrawMarshal); when null the renderer falls back to Mapsui.Layers.BaseLayer.DataHasChanged(). This replaces the former process-global static redraw hooks with a per-layer (hence per-map) seam.

public Action? RequestRedraw { get; set; }

Property Value

Action

Methods

GetFeatures(MRect?, double)

Get all features in a given MRect for a given resolution

public override IEnumerable<IFeature> GetFeatures(MRect? rect, double resolution)

Parameters

rect MRect
resolution double

Resolution of viewport

Returns

IEnumerable<IFeature>

Remarks

Replicates GetFeatures(MRect, double)'s extent-filter behaviour (Mapsui grows the query rect by SymbolStyle.DefaultWidth * 2 * resolution to keep large symbols on edge features visible). Returns a materialised list rather than yielding lazily so the recorded duration reflects the filter pass alone, not downstream consumer work.

RequestRepaint()

Requests a single repaint after a background publish: invokes RequestRedraw when a session wired one, otherwise falls back to Mapsui.Layers.BaseLayer.DataHasChanged() so a session-less render (e.g. a headless one-shot) still refreshes.

public void RequestRepaint()