< Summary

Class:Itinero.Snapping.SnapPoint
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/Snapping/SnapPoint.cs
Covered lines:6
Uncovered lines:4
Coverable lines:10
Total lines:50
Line coverage:60% (6 of 10)
Covered branches:0
Total branches:4
Branch coverage:0% (0 of 4)
Tag:224_14471318300

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
.ctor(...)100%1100%
get_EdgeId()100%1100%
get_Offset()100%1100%
get_IsVertex()0%40%
ToString()100%10%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/Snapping/SnapPoint.cs

#LineLine coverage
 1using Itinero.Network;
 2
 3namespace Itinero.Snapping;
 4
 5/// <summary>
 6/// Represents a unique location on an edge in the routing network.
 7/// </summary>
 8/// <remarks>
 9/// The location is defined by the edge id and it's offset as an unsigned 16 bit int:
 10/// - offset=0 => first vertex of the edge.
 11/// - offset=X => offset relative to ushort.MaxValue.
 12/// - offset=ushort.MaxValue => the last vertex of the edge.
 13/// </remarks>
 14public readonly struct SnapPoint
 15{
 16    /// <summary>
 17    /// Creates a new snap point.
 18    /// </summary>
 19    /// <param name="edgeId">The edge id.</param>
 20    /// <param name="offset">The offset.</param>
 21    public SnapPoint(EdgeId edgeId, ushort offset)
 10022    {
 10023        this.EdgeId = edgeId;
 10024        this.Offset = offset;
 10025    }
 26
 27    /// <summary>
 28    /// Gets the edge id.
 29    /// </summary>
 31630    public EdgeId EdgeId { get; }
 31
 32    /// <summary>
 33    /// Gets the offset.
 34    /// </summary>
 33935    public ushort Offset { get; }
 36
 37    /// <summary>
 38    /// Returns true if this snap point is exactly at a vertex location.
 39    /// </summary>
 040    public bool IsVertex => this.Offset is 0 or ushort.MaxValue;
 41
 42    /// <summary>
 43    /// Gets a description of this snap point.
 44    /// </summary>
 45    /// <returns></returns>
 46    public override string ToString()
 047    {
 048        return $"{this.EdgeId} @ {this.Offset}";
 049    }
 50}