< Summary

Class:Itinero.RoutingNetworkExtensions
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/RoutingNetworkExtensions.cs
Covered lines:20
Uncovered lines:3
Coverable lines:23
Total lines:89
Line coverage:86.9% (20 of 23)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)
Tag:251_23667616543

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
Snap(...)100%2100%
Snap(...)100%1100%
Snap(...)100%1100%
Route(...)100%1100%
Route(...)100%1100%
Search(...)100%10%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/RoutingNetworkExtensions.cs

#LineLine coverage
 1using System;
 2using System.Collections.Generic;
 3using Itinero.Network;
 4using Itinero.Profiles;
 5using Itinero.Routing;
 6using Itinero.Search;
 7using Itinero.Snapping;
 8
 9namespace Itinero;
 10
 11/// <summary>
 12/// Contains extension methods as entry points to snapping or routing.
 13/// </summary>
 14public static class RoutingNetworkExtensions
 15{
 16    /// <summary>
 17    /// Creates a snapper.
 18    /// </summary>
 19    /// <param name="routingNetwork">The routing network.</param>
 20    /// <param name="profiles">Zero or more profiles.</param>
 21    /// <param name="settings">The settings.</param>
 22    /// <returns>A snapper.</returns>
 23    public static ISnapper Snap(this RoutingNetwork routingNetwork, IEnumerable<Profile> profiles, Action<SnapperSetting
 15124    {
 15125        var s = new SnapperSettings();
 15126        settings?.Invoke(s);
 27
 15128        return new Snapper(routingNetwork, profiles, s.AnyProfile, s.CheckCanStopOn, s.OffsetInMeter, s.OffsetInMeterMax
 15129    }
 30
 31    /// <summary>
 32    /// Creates a snapper.
 33    /// </summary>
 34    /// <param name="routingNetwork">The routing network.</param>
 35    /// <param name="profile">The vehicle profile.</param>
 36    /// <param name="settings">The settings.</param>
 37    /// <returns>A snapper.</returns>
 38    public static ISnapper Snap(this RoutingNetwork routingNetwork, Profile profile, Action<SnapperSettings>? settings =
 6939    {
 6940        return routingNetwork.Snap(new[] { profile }, settings);
 6941    }
 42
 43    /// <summary>
 44    /// Creates a snapper.
 45    /// </summary>
 46    /// <param name="routingNetwork">The routing network.</param>
 47    /// <param name="profile">The vehicle profile.</param>
 48    /// <param name="settings">The settings.</param>
 49    /// <returns>A snapper.</returns>
 50    public static ISnapper Snap(this RoutingNetwork routingNetwork, Action<SnapperSettings>? settings = null)
 8251    {
 8252        return routingNetwork.Snap(ArraySegment<Profile>.Empty, settings);
 8253    }
 54
 55    /// <summary>
 56    /// Creates a router.
 57    /// </summary>
 58    /// <param name="routingNetwork">The routing network.</param>
 59    /// <param name="profile">The vehicle profile.</param>
 60    /// <returns>The router.</returns>
 61    public static IRouter Route(this RoutingNetwork routingNetwork, Profile profile)
 1962    {
 1963        return new Router(routingNetwork, new RoutingSettings
 1964        {
 1965            Profile = profile
 1966        });
 1967    }
 68
 69    /// <summary>
 70    /// Creates a router.
 71    /// </summary>
 72    /// <param name="routingNetwork">The routing network.</param>
 73    /// <param name="settings">The settings.</param>
 74    /// <returns>The router.</returns>
 75    public static IRouter Route(this RoutingNetwork routingNetwork, RoutingSettings settings)
 1133176    {
 1133177        return new Router(routingNetwork, settings);
 1133178    }
 79
 80    /// <summary>
 81    /// Creates a query to search the network.
 82    /// </summary>
 83    /// <param name="routingNetwork">The routing network to search.</param>
 84    /// <returns>A query.</returns>
 85    public static IRoutingNetworkQuery Search(this RoutingNetwork routingNetwork)
 086    {
 087        return new RoutingNetworkQuery(routingNetwork);
 088    }
 89}