feat(proj): init

This commit is contained in:
vl.arkhangelskii
2026-09-21 03:53:15 +03:00
commit 3e34f391b3
258 changed files with 20968 additions and 0 deletions
@@ -0,0 +1,66 @@
using Microsoft.Extensions.Logging.Abstractions;
using TileServer.Domain.Tiles;
using TileServer.Infrastructure.Tiles;
using TileServer.Infrastructure.Tiles.Mvt;
namespace TileServer.UnitTests;
public sealed class VectorTileOverzoomerTests
{
[Fact]
public void Overzoom_MapsParentPointIntoNwChild()
{
var parent = EncodePoint(100, 100, "poi");
var overzoomer = new VectorTileOverzoomer(NullLogger<VectorTileOverzoomer>.Instance);
var child = overzoomer.Overzoom(parent, new TileCoordinate(0, 0, 0), new TileCoordinate(1, 0, 0));
var decoded = MvtCodec.Decode(child);
var layer = Assert.Single(decoded.Layers);
Assert.Equal("poi", layer.Name);
var feature = Assert.Single(layer.Features);
var path = Assert.Single(MvtCodec.DecodeGeometry(feature.Geometry));
var point = Assert.Single(path);
Assert.Equal(200, point.X);
Assert.Equal(200, point.Y);
}
[Fact]
public void Overzoom_DropsPointOutsideChild()
{
var parent = EncodePoint(100, 100, "poi");
var overzoomer = new VectorTileOverzoomer(NullLogger<VectorTileOverzoomer>.Instance);
var child = overzoomer.Overzoom(parent, new TileCoordinate(0, 0, 0), new TileCoordinate(1, 1, 1));
var decoded = MvtCodec.Decode(child);
Assert.Empty(decoded.Layers);
}
private static TileData EncodePoint(int x, int y, string layerName)
{
var tile = new MvtTile
{
Layers =
[
new MvtLayer
{
Name = layerName,
Extent = 4096,
Version = 2,
Keys = ["class"],
Values = [new MvtValue { StringValue = "test" }],
Features =
[
new MvtFeature
{
Id = 1,
Type = MvtCodec.Point,
Tags = [0, 0],
Geometry = MvtCodec.EncodeGeometry([[(x, y)]], close: false)
}
]
}
]
};
return MvtCodec.EncodeGzip(tile);
}
}