< Summary

Class:Itinero.Routing.IHasSourcesExtensions
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Routing/IHasSourcesExtensions.cs
Covered lines:0
Uncovered lines:42
Coverable lines:42
Total lines:104
Line coverage:0% (0 of 42)
Covered branches:0
Total branches:0
Tag:230_15134869466

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
To(...)100%10%
To(...)100%10%
To(...)100%10%
To(...)100%10%
To(...)100%10%
To(...)100%10%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Routing/IHasSourcesExtensions.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using Itinero.Geo.Directions;
 3using Itinero.Snapping;
 4
 5namespace Itinero.Routing;
 6
 7/// <summary>
 8/// Has sources extensions.
 9/// </summary>
 10public static class IHasSourcesExtensions
 11{
 12    /// <summary>
 13    /// Configures the router to route to the given point.
 14    /// </summary>
 15    /// <param name="hasSources">The router with sources.</param>
 16    /// <param name="target">The target.</param>
 17    /// <returns>A configured router.</returns>
 18    public static IRouterManyToOne To(this IHasSources hasSources, SnapPoint target)
 019    {
 020        return new Router(hasSources.Network, hasSources.Settings)
 021        {
 022            Sources = hasSources.Sources,
 023            Target = (target, null)
 024        };
 025    }
 26
 27    /// <summary>
 28    /// Configures the router to route to the given point.
 29    /// </summary>
 30    /// <param name="hasSources">The router with sources.</param>
 31    /// <param name="target">The target.</param>
 32    /// <returns>A configured router.</returns>
 33    public static IRouterManyToOne To(this IHasSources hasSources,
 34        (SnapPoint snapPoint, DirectionEnum? direction) target)
 035    {
 036        return new Router(hasSources.Network, hasSources.Settings)
 037        {
 038            Sources = hasSources.Sources,
 039            Target = target.ToDirected(hasSources.Network)
 040        };
 041    }
 42
 43    /// <summary>
 44    /// Configures the router to route to the given point.
 45    /// </summary>
 46    /// <param name="hasSources">The router with sources.</param>
 47    /// <param name="target">The target.</param>
 48    /// <returns>A configured router.</returns>
 49    public static IRouterManyToOne To(this IHasSources hasSources, (SnapPoint snapPoint, bool? direction) target)
 050    {
 051        return new Router(hasSources.Network, hasSources.Settings)
 052        {
 053            Sources = hasSources.Sources,
 054            Target = target
 055        };
 056    }
 57
 58    /// <summary>
 59    /// Configures the router to route to the given point.
 60    /// </summary>
 61    /// <param name="hasSources">The router with sources.</param>
 62    /// <param name="targets">The targets.</param>
 63    /// <returns>A configured router.</returns>
 64    public static IRouterManyToMany To(this IHasSources hasSources, IReadOnlyList<SnapPoint> targets)
 065    {
 066        return new Router(hasSources.Network, hasSources.Settings)
 067        {
 068            Sources = hasSources.Sources,
 069            Targets = targets.ToDirected()
 070        };
 071    }
 72
 73    /// <summary>
 74    /// Configures the router to route to the given point.
 75    /// </summary>
 76    /// <param name="hasSources">The router with sources.</param>
 77    /// <param name="targets">The targets.</param>
 78    /// <returns>A configured router.</returns>
 79    public static IRouterManyToMany To(this IHasSources hasSources,
 80        IReadOnlyList<(SnapPoint snapPoint, DirectionEnum? directed)> targets)
 081    {
 082        return new Router(hasSources.Network, hasSources.Settings)
 083        {
 084            Sources = hasSources.Sources,
 085            Targets = targets.ToDirected(hasSources.Network)
 086        };
 087    }
 88
 89    /// <summary>
 90    /// Configures the router to route to the given point.
 91    /// </summary>
 92    /// <param name="hasSources">The router with sources.</param>
 93    /// <param name="targets">The targets.</param>
 94    /// <returns>A configured router.</returns>
 95    public static IRouterManyToMany To(this IHasSources hasSources,
 96        IReadOnlyList<(SnapPoint snapPoint, bool? directed)> targets)
 097    {
 098        return new Router(hasSources.Network, hasSources.Settings)
 099        {
 0100            Sources = hasSources.Sources,
 0101            Targets = targets
 0102        };
 0103    }
 104}