Class OverscaleCurtainRegionCache
A memoising ComputeRegions(IReadOnlyList<OverscaleCellInput>, double) for a caller that recomputes the curtain on every zoom step over a mostly unchanged set of cells (issue #691).
public sealed class OverscaleCurtainRegionCache
- Inheritance
-
OverscaleCurtainRegionCache
- Inherited Members
Remarks
A cell's curtain region (its coverage minus every strictly-finer overlapping
coverage) and its compilation resolution depend only on the cells, never on
the viewport. Only the overscale factor, and so which cells get a region,
depends on the resolution. This cache keeps the resolution-independent part
per cell. A call with the same cells as the previous one re-evaluates the
factors (cheap) and reuses every region it has already computed, instead of
running the NetTopologySuite Intersects / Difference overlay for
every overscaled cell against every finer cell again.
"The same cells" means the same count, and at each position a cell with the same Coverage instance, compilation-scale denominator and name. Anything else discards the cache, so the result is always what ComputeRegions(IReadOnlyList<OverscaleCellInput>, double) returns for the given cells and resolution. Regions are still computed lazily, the first time a cell is overscaled, so a cell that never is costs nothing.
Not thread-safe: use one instance per caller (the Viewer calls it on the UI thread).
Methods
ComputeRegions(IReadOnlyList<OverscaleCellInput>, double)
Computes the overscale-curtain regions for cells at
viewportResolution, identical to
ComputeRegions(IReadOnlyList<OverscaleCellInput>, double), reusing per-cell regions
computed by earlier calls over the same cells.
public IReadOnlyList<OverscaleRegion> ComputeRegions(IReadOnlyList<OverscaleCellInput> cells, double viewportResolution)
Parameters
cellsIReadOnlyList<OverscaleCellInput>The loaded, drawing, scale-bearing cells.
viewportResolutiondoubleThe current viewport resolution in Web-Mercator metres per pixel (must be positive and finite; otherwise an empty list is returned).
Returns
- IReadOnlyList<OverscaleRegion>
The curtain regions (never null), ordered by descending overscale factor.