< Summary

Class:Itinero.Geo.Elevation.ElevationHandler
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Geo/Elevation/ElevationHandler.cs
Covered lines:8
Uncovered lines:0
Coverable lines:8
Total lines:36
Line coverage:100% (8 of 8)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)
Tag:224_14471318300

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
Elevation(...)50%2100%
get_Default()100%1100%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Geo/Elevation/ElevationHandler.cs

#LineLine coverage
 1namespace Itinero.Geo.Elevation;
 2
 3/// <summary>
 4/// The default elevation handler.
 5/// </summary>
 6public class ElevationHandler : IElevationHandler
 7{
 8    private readonly GetElevationDelegate _getElevation;
 9
 10    /// <summary>
 11    /// Creates a new elevation handler.
 12    /// </summary>
 13    /// <param name="getElevation">The function to get elevation from.</param>
 114    public ElevationHandler(GetElevationDelegate getElevation)
 115    {
 116        _getElevation = getElevation;
 117    }
 18
 19    /// <summary>
 20    /// A delegate to get elevation.
 21    /// </summary>
 22    public delegate float? GetElevationDelegate(double longitude, double latitude);
 23
 24    /// <summary>
 25    /// Add elevation to the given coordinate.
 26    /// </summary>
 27    public float? Elevation(double longitude, double latitude)
 128    {
 129        return _getElevation?.Invoke(longitude, latitude);
 130    }
 31
 32    /// <summary>
 33    /// Gets or sets the default elevation handler.
 34    /// </summary>
 20935    public static ElevationHandler? Default { get; set; }
 36}