< Summary

Class:Itinero.IO.Osm.Tiles.Parsers.Semantics.TagMapper
Assembly:Itinero.IO.Osm.Tiles
File(s):/home/runner/work/routing2/routing2/src/Itinero.IO.Osm.Tiles/Parsers/Semantics/TagMapper.cs
Covered lines:0
Uncovered lines:16
Coverable lines:16
Total lines:40
Line coverage:0% (0 of 16)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)
Tag:224_14471318300

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
Map(...)0%80%

File(s)

/home/runner/work/routing2/routing2/src/Itinero.IO.Osm.Tiles/Parsers/Semantics/TagMapper.cs

#LineLine coverage
 1using System.Collections.Generic;
 2using Newtonsoft.Json.Linq;
 3
 4namespace Itinero.IO.Osm.Tiles.Parsers.Semantics;
 5
 6internal static class TagMapper
 7{
 8    /// <summary>
 9    /// Reverse maps the given property using the given semantic mappings.
 10    /// </summary>
 11    /// <param name="property">The property to map.</param>
 12    /// <param name="reverseMappings">The reverse mappings.</param>
 13    /// <returns>True if there was a mapping for this tag.</returns>
 14    public static (string key, string value)? Map(this JProperty property,
 15        Dictionary<string, TagMapperConfig> reverseMappings)
 016    {
 017        if (!reverseMappings.TryGetValue(property.Name, out var mapperConfig))
 018        {
 019            return null;
 20        }
 21
 022        if (property.Value == null)
 023        {
 024            return (mapperConfig.OsmKey, null);
 25        }
 26
 027        var valueString = property.Value.ToInvariantString();
 028        if (mapperConfig.ReverseMapping == null)
 029        {
 030            return (mapperConfig.OsmKey, valueString);
 31        }
 32
 033        if (mapperConfig.ReverseMapping.TryGetValue(valueString, out var reverseMapped))
 034        {
 035            return (mapperConfig.OsmKey, reverseMapped);
 36        }
 37
 038        return null;
 039    }
 40}

Methods/Properties

Map(...)