fix(graph): add all roads
This commit is contained in:
@@ -33,7 +33,7 @@ public sealed class RoadGraphTests
|
||||
[InlineData(6, "motorway")]
|
||||
[InlineData(8, "trunk")]
|
||||
[InlineData(10, "primary")]
|
||||
[InlineData(12, "tertiary")]
|
||||
[InlineData(11, "tertiary")]
|
||||
public void HighwaysForZoom_IncludesMajorClasses(int z, string highway)
|
||||
{
|
||||
var list = RoadGraphZoomPolicy.HighwaysForZoom(z);
|
||||
@@ -42,8 +42,8 @@ public sealed class RoadGraphTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HighwaysForZoom_AllClassesAtStreetLevel()
|
||||
=> Assert.Null(RoadGraphZoomPolicy.HighwaysForZoom(13));
|
||||
public void HighwaysForZoom_AllClassesFromZ12()
|
||||
=> Assert.Null(RoadGraphZoomPolicy.HighwaysForZoom(12));
|
||||
}
|
||||
|
||||
public sealed class RoadGraphMvtTests
|
||||
@@ -105,9 +105,36 @@ public sealed class RoadGraphMvtTests
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ClipSegment_KeepsCrossingLine()
|
||||
public void Encode_Polyline_KeepsIntermediateVertex()
|
||||
{
|
||||
Assert.True(RoadGraphMvtEncoder.ClipSegment((-100, 100), (5000, 2000), out var a, out var b));
|
||||
Assert.NotEqual(a, b);
|
||||
var tile = TileCoordinate.FromLonLat(37.6173, 55.7558, 14);
|
||||
var edge = new RoadGraphEdge(
|
||||
1, 10, 11, "residential", null, false, 180,
|
||||
37.6173, 55.7558, 37.6190, 55.7568,
|
||||
[
|
||||
new RoadGraphPoint(37.6173, 55.7558),
|
||||
new RoadGraphPoint(37.6182, 55.7565),
|
||||
new RoadGraphPoint(37.6190, 55.7568)
|
||||
]);
|
||||
var data = new RoadGraphMvtEncoder().Encode([edge], tile);
|
||||
var decoded = MvtCodec.Decode(data);
|
||||
var feature = Assert.Single(Assert.Single(decoded.Layers).Features);
|
||||
var paths = MvtCodec.DecodeGeometry(feature.Geometry);
|
||||
var path = Assert.Single(paths);
|
||||
Assert.True(path.Count >= 3);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ClipPolyline_SplitsWhenLeavingTile()
|
||||
{
|
||||
var paths = RoadGraphMvtEncoder.ClipPolyline(
|
||||
[
|
||||
(100, 100),
|
||||
(200, 200),
|
||||
(8000, 8000),
|
||||
(100, 200)
|
||||
]);
|
||||
Assert.NotEmpty(paths);
|
||||
Assert.All(paths, path => Assert.True(path.Count >= 2));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user