< Summary

Class:Itinero.Routing.Isochrones.IsochroneSettings
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Routing/Isochrones/IsochroneSettings.cs
Covered lines:18
Uncovered lines:5
Coverable lines:23
Total lines:85
Line coverage:78.2% (18 of 23)
Covered branches:12
Total branches:22
Branch coverage:54.5% (12 of 22)
Tag:284_38118444584

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
get_CellSizeMeters()100%1100%
get_TargetCellsAcross()100%1100%
get_MinCellSizeMeters()100%1100%
get_MaxCells()100%1100%
get_Margin()100%1100%
get_Denoise()100%1100%
get_ReachRadiusMeters()100%1100%
get_FillHolesBelowSquareMeters()100%1100%
Validate()54.54%2266.66%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Routing/Isochrones/IsochroneSettings.cs

#LineLine coverage
 1using System;
 2
 3namespace Itinero.Routing.Isochrones;
 4
 5/// <summary>
 6/// How finely to resolve an isochrone, and how far past it to search.
 7/// </summary>
 8public class IsochroneSettings
 9{
 10    /// <summary>
 11    /// Grid resolution in metres, or null to scale it to the area reached.
 12    /// </summary>
 13    /// <remarks>
 14    /// A fixed size is too coarse for a short walk and too fine for an hour's drive. Coarsened
 15    /// further if <see cref="MaxCells"/> would be exceeded.
 16    /// </remarks>
 4817    public double? CellSizeMeters { get; set; }
 18
 19    /// <summary>Cells across the reached area when <see cref="CellSizeMeters"/> is null.</summary>
 3720    public int TargetCellsAcross { get; set; } = 400;
 21
 22    /// <summary>Floor on the scaled cell size, in metres.</summary>
 3723    public double MinCellSizeMeters { get; set; } = 20.0;
 24
 25    /// <summary>
 26    /// Ceiling on grid cells, so a large bound coarsens rather than allocating without limit.
 27    /// </summary>
 5228    public long MaxCells { get; set; } = 8_000_000;
 29
 30    /// <summary>
 31    /// How far past the outermost band to keep searching, as a share of that band.
 32    /// </summary>
 33    /// <remarks>
 34    /// The boundary is interpolated between a point inside it and one outside, so stopping at
 35    /// the band leaves nothing to interpolate against and the contour pulls inward.
 36    /// </remarks>
 5037    public double Margin { get; set; } = 0.15;
 38
 39    /// <summary>
 40    /// Drop any ring enclosing less than this share of the band's largest ring.
 41    /// </summary>
 42    /// <remarks>
 43    /// Single cells get picked up where a road clips the corner of one. 0 keeps everything.
 44    /// </remarks>
 5545    public double Denoise { get; set; } = 0.01;
 46
 47    /// <summary>
 48    /// How far off a road still counts as reached, in metres. 0 marks only the roads.
 49    /// </summary>
 50    /// <remarks>
 51    /// Without this a band is a set of ribbons as wide as one grid cell, which only reads as an
 52    /// area where roads are closer together than that. Valhalla gets the same effect from cells
 53    /// of 110-550 m, where the ribbon is a cell wide; separating the two keeps the boundary as
 54    /// accurate as the grid while the fill is wide enough to join.
 55    /// </remarks>
 7056    public double ReachRadiusMeters { get; set; } = 150.0;
 57
 58    /// <summary>
 59    /// Fill unreached pockets smaller than this, in square metres. 0 keeps every pocket.
 60    /// </summary>
 61    /// <remarks>
 62    /// The surface only knows costs along roads, so without this every city block comes back as
 63    /// a hole and the band describes a street network rather than an area. The default fills a
 64    /// block of roughly 220 m a side and leaves genuinely unreachable ground — water, a closed
 65    /// estate — as the hole it is.
 66    /// </remarks>
 5867    public double FillHolesBelowSquareMeters { get; set; } = 50_000.0;
 68
 69    internal void Validate()
 1770    {
 1771        if (this.CellSizeMeters is <= 0)
 072            throw new ArgumentOutOfRangeException(nameof(this.CellSizeMeters));
 1773        if (this.TargetCellsAcross < 2)
 074            throw new ArgumentOutOfRangeException(nameof(this.TargetCellsAcross));
 1775        if (this.MinCellSizeMeters <= 0)
 076            throw new ArgumentOutOfRangeException(nameof(this.MinCellSizeMeters));
 1777        if (this.MaxCells < 4) throw new ArgumentOutOfRangeException(nameof(this.MaxCells));
 1778        if (this.Margin < 0) throw new ArgumentOutOfRangeException(nameof(this.Margin));
 1779        if (this.Denoise is < 0 or > 1) throw new ArgumentOutOfRangeException(nameof(this.Denoise));
 1780        if (this.FillHolesBelowSquareMeters < 0)
 081            throw new ArgumentOutOfRangeException(nameof(this.FillHolesBelowSquareMeters));
 1782        if (this.ReachRadiusMeters < 0)
 083            throw new ArgumentOutOfRangeException(nameof(this.ReachRadiusMeters));
 1784    }
 85}