Class ThinnedSymbolLayer
A Mapsui layer of scaled point symbols (S-111 current arrows) that thins itself for the zoom it is drawn at. Each time Mapsui asks for the visible features, the layer runs SymbolThinning for the current resolution and returns only the symbols that keep the required on-screen spacing, so arrow density stays legible from a whole-bay view down to a harbour.
public sealed class ThinnedSymbolLayer : BaseLayer, ILayer, IAnimatable, INotifyPropertyChanged, IDisposable
- Inheritance
-
BaseLayerThinnedSymbolLayer
- Implements
-
ILayerIAnimatable
- Inherited Members
-
BaseLayer.NextId()BaseLayer.DataHasChanged()BaseLayer.ToString()BaseLayer.Dispose()BaseLayer.UpdateAnimations()BaseLayer.IdBaseLayer.TagBaseLayer.MinVisibleBaseLayer.MaxVisibleBaseLayer.EnabledBaseLayer.NameBaseLayer.OpacityBaseLayer.BusyBaseLayer.StyleBaseLayer.AttributionBaseLayer.ResolutionsBaseLayer.SortFeaturesBaseLayer.CustomLayerRendererNameBaseLayer.PropertyChangedBaseLayer.DataChanged
Remarks
A regular grid (constructed with rows × cols symbols) is thinned with
ThinGrid(int, int, ReadOnlySpan<double>, ReadOnlySpan<double>, ReadOnlySpan<float>, ReadOnlySpan<float>, double, SymbolRect, double, List<int>) over the displayed field, as S-98
Appendix G-1.1 describes. Scattered points (a station series or an
ungeorectified mesh, constructed with rows = 0) are thinned with
ThinPoints(ReadOnlySpan<double>, ReadOnlySpan<double>, ReadOnlySpan<double>, ReadOnlySpan<double>, double, List<int>) over every point, so the selection
only changes with zoom and stays put while panning.
Features are created lazily, once per symbol, through the supplied factory and reused across frames. The last query is cached, so repeated paints of an unchanged view cost nothing.
Constructors
ThinnedSymbolLayer(int, int, double[], double[], float[], float[], double, double, Func<int, IFeature?>)
Creates a thinned symbol layer.
public ThinnedSymbolLayer(int rows, int cols, double[] x, double[] y, float[] scale, float[] priority, double lengthPixelsPerScale, double maxRatio, Func<int, IFeature?> featureFactory)
Parameters
rowsintNumber of grid rows when the symbols form a regular grid (row-major, with
colscolumns); 0 for scattered points.colsintNumber of grid columns; ignored when
rowsis 0.xdouble[]Per-symbol EPSG:3857 x.
ydouble[]Per-symbol EPSG:3857 y.
scalefloat[]Per-symbol scale relative to
lengthPixelsPerScale; NaN or non-positive for a cell without a symbol.priorityfloat[]Per-symbol thinning priority (higher is kept first; for S-111, speed).
lengthPixelsPerScaledoubleOn-screen length, in pixels, of a symbol at scale 1.
maxRatiodoubleThe thinning ratio
Rmax.featureFactoryFunc<int, IFeature>Creates the feature for a symbol index; may return null to skip it.
Properties
Extent
Returns the envelope of all available data in the layer
public override MRect? Extent { get; }
Property Value
- MRect
SymbolCount
Total number of symbol positions (drawn or not) the layer holds.
public int SymbolCount { get; }
Property Value
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
rectMRectresolutiondoubleResolution of viewport
Returns
- IEnumerable<IFeature>