< Summary

Class:Itinero.MapMatching.MapMatch
Assembly:Itinero.MapMatching
File(s):/home/runner/work/routing2/routing2/src/Itinero.MapMatching/MapMatch.cs
Covered lines:16
Uncovered lines:6
Coverable lines:22
Total lines:64
Line coverage:72.7% (16 of 22)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)
Tag:251_23667616543

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
get_MatchedTrackPointIndices()100%10%
get_Source()100%10%
get_Profile()100%10%
get_Count()100%1100%
get_Item(...)100%1100%
GetEnumerator()100%2100%
System.Collections.IEnumerable.GetEnumerator()100%10%

File(s)

/home/runner/work/routing2/routing2/src/Itinero.MapMatching/MapMatch.cs

#LineLine coverage
 1using System.Collections;
 2using System.Collections.Generic;
 3using Itinero.Profiles;
 4using Itinero.Routes.Paths;
 5
 6namespace Itinero.MapMatching;
 7
 8/// <summary>
 9/// Represents the result of a matching.
 10/// </summary>
 11public class MapMatch : IReadOnlyList<Path>
 12{
 13    private readonly IReadOnlyList<Path> _paths;
 14
 2615    internal MapMatch(Track source, Profile profile,
 2616        IReadOnlyList<Path> paths, IReadOnlyList<int> matchedTrackPointIndices)
 2617    {
 2618        this.Source = source;
 2619        this.Profile = profile;
 2620        _paths = paths;
 2621        this.MatchedTrackPointIndices = matchedTrackPointIndices;
 2622    }
 23
 24    /// <summary>
 25    /// The track point indices that were matched. Each raw path [i] connects
 26    /// MatchedTrackPointIndices[i] to MatchedTrackPointIndices[i+1].
 27    /// </summary>
 028    public IReadOnlyList<int> MatchedTrackPointIndices { get; }
 29
 30    /// <summary>
 31    /// The source track.
 32    /// </summary>
 033    internal Track Source { get; }
 34
 35    /// <summary>
 36    /// Gets the profile used for matching.
 37    /// </summary>
 038    public Profile Profile { get; }
 39
 40    /// <summary>
 41    /// Gets the number of routes in this result.
 42    /// </summary>
 205443    public int Count => _paths.Count;
 44
 45    /// <summary>
 46    /// Gets the matched route at the given index.
 47    /// </summary>
 48    /// <param name="i">The index.</param>
 202849    public Path this[int i] => _paths[i];
 50
 51    /// <inheritdoc/>
 52    public IEnumerator<Path> GetEnumerator()
 2353    {
 409454        for (var i = 0; i < this.Count; i++)
 202455        {
 202456            yield return this[i];
 202457        }
 2358    }
 59
 60    IEnumerator IEnumerable.GetEnumerator()
 061    {
 062        return this.GetEnumerator();
 063    }
 64}