Class CoverageContours
Turns the value-based ContourStyles of an ICoverageStyle into Isolines over a sampled coverage, ready for an IsolineCoverageSubLayer, which both renderers draw (lines of constant pixel width with labels along them).
public static class CoverageContours
- Inheritance
-
CoverageContours
- Inherited Members
Remarks
The lines are traced with marching squares (IsolineTracer) through the field's values in the StyledCoverageLayer that CoveragePipeline sampled, so they follow the viewport subset and stride the pipeline chose. No-data nodes break the lines.
Only contours whose Value lies within the sample's range are traced, so a style can list every level it might ever need (every 4 hPa from 860 to 1100, say) at no cost.
Methods
Trace(StyledCoverageLayer, string, IReadOnlyList<ContourStyle>, Func<ContourStyle, string>?, Func<double, double, (double Longitude, double Latitude)>?)
Traces each of contours through the
fieldName values of layer.
public static IReadOnlyList<Isoline> Trace(StyledCoverageLayer layer, string fieldName, IReadOnlyList<ContourStyle> contours, Func<ContourStyle, string>? formatLabel = null, Func<double, double, (double Longitude, double Latitude)>? nativeToWgs84 = null)
Parameters
layerStyledCoverageLayerThe sampled coverage, from ProcessAsync(ICoverageSource, ICoverageStyle, Viewport?, ICrsTransform?, MarinerSettings?, CancellationToken).
fieldNamestringThe field the contours are traced on; its unit is the contours' Unit.
contoursIReadOnlyList<ContourStyle>The contours, e.g. Contours.
formatLabelFunc<ContourStyle, string>The label of a contour with ShowLabel set; the value in the invariant culture when null. A contour without ShowLabel gets an empty label and is drawn unlabelled.
nativeToWgs84Func<double, double, (double Longitude, double Latitude)>Converts the grid's native coordinates (x, y) to WGS-84 (longitude, latitude), or null when the grid is geographic (EPSG:4326), as weather grids are.
Returns
- IReadOnlyList<Isoline>
The isolines, in EPSG:3857 metres, in the order of
contours.
Exceptions
- KeyNotFoundException
The sample has no field called
fieldName.