Class CoverageLandClip
Builds a destination-space SKPath from S-101 LandArea
surface geometries so a coverage renderer can clip the (non-normative) S-104
water-level surface to water areas at output-pixel resolution rather
than at the (often very coarse) grid-cell resolution (issue #483).
public static class CoverageLandClip
- Inheritance
-
CoverageLandClip
- Inherited Members
Remarks
Real S-104 grids can be extremely coarse — e.g. the Rotterdam dcf2 forecast is a 5×6 (~1 km) grid over the whole port — so a per-cell land mask can only clip in kilometre-sized blocks and cannot follow the coastline. Clipping the up-scaled surface raster with the land polygons in the destination pixel space instead cuts the surface cleanly along the true shoreline regardless of how few grid cells the surface has.
The returned path uses an even–odd fill so interior rings (water enclosed by land, e.g. an inland basin) are excluded from the land region and therefore keep the surface. Callers apply it with Difference so the surface is removed over land and preserved over water.
Methods
BuildLandPath(IReadOnlyList<FeatureGeometry>, Func<double, double, SKPoint>)
Builds the land clip path in destination pixel space, or null when there is nothing to clip.
public static SKPath? BuildLandPath(IReadOnlyList<FeatureGeometry> landAreas, Func<double, double, SKPoint> projectLonLat)
Parameters
landAreasIReadOnlyList<FeatureGeometry>Land-area geometries in WGS84
(latitude, longitude); only Surface entries with at least three vertices contribute. Curves and points are ignored.projectLonLatFunc<double, double, SKPoint>Projects a WGS84
(longitude, latitude)pair to a destination pixel coordinate — the same projection the surface raster is drawn through, so the clip registers with the raster.