< Summary

Class:Itinero.RoutingNetworkExtensions
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/RoutingNetworkExtensions.cs
Covered lines:14
Uncovered lines:9
Coverable lines:23
Total lines:89
Line coverage:60.8% (14 of 23)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)
Tag:224_14471318300

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
Snap(...)100%2100%
Snap(...)100%10%
Snap(...)100%1100%
Route(...)100%1100%
Route(...)100%10%
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
 6924    {
 6925        var s = new SnapperSettings();
 6926        settings?.Invoke(s);
 27
 6928        return new Snapper(routingNetwork, profiles, s.AnyProfile, s.CheckCanStopOn, s.OffsetInMeter, s.OffsetInMeterMax
 6929    }
 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 =
 039    {
 040        return routingNetwork.Snap(new[] { profile }, settings);
 041    }
 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)
 6951    {
 6952        return routingNetwork.Snap(ArraySegment<Profile>.Empty, settings);
 6953    }
 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)
 762    {
 763        return new Router(routingNetwork, new RoutingSettings
 764        {
 765            Profile = profile
 766        });
 767    }
 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)
 076    {
 077        return new Router(routingNetwork, settings);
 078    }
 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}