OpenDataVisualizer/Schaad.OpenData.Tests/DirectionTargetTestShould.cs
Claudio Schaad 8de869b023 Fix roundabout arm geometry for untargetable directions
Stations like "WEINFELDEN Kreisel West - Umfahrung" have directions
such as "zur Umfahrung" or "von Egelseestrasse" that cannot be
geocoded, so their dots were drawn on a nearby side road or around
the roundabout ring.

- Derive the roundabout centre from all stations sharing the name
  before " - " and point each arm outward from it
- Prefer road segments named like the station's address when
  following an arm; reject arms that don't get away from the centre
- Parse "zur", "zum", "Richtung" and "vom" direction prefixes
- Treat only swissTLM3D object kinds 12-19 as non-roads; kind 20 is
  a regular road (e.g. Dunantstrasse in Weinfelden)
- Bump the geometry cache to v7 so all stations are rebuilt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 20:50:48 +01:00

30 lines
860 B
C#

using Schaad.OpenData.Traffic.Geometry;
namespace Schaad.OpenData.Tests;
public class DirectionTargetTestShould
{
[Fact]
public void ParseDestinationWhenDirectionStartsWithNach()
{
DirectionTarget.Parse("nach Kreuzlingen").ShouldBe(new DirectionTarget("Kreuzlingen", true));
}
[Fact]
public void ParseOriginWhenDirectionStartsWithVon()
{
DirectionTarget.Parse("von Frauenfeld").ShouldBe(new DirectionTarget("Frauenfeld", false));
}
[Fact]
public void ParseDestinationWhenDirectionStartsWithZur()
{
DirectionTarget.Parse("zur Umfahrung").ShouldBe(new DirectionTarget("Umfahrung", true));
}
[Fact]
public void TreatPlainNameAsDestinationWhenDirectionHasNoPrefix()
{
DirectionTarget.Parse("Diessenhofen").ShouldBe(new DirectionTarget("Diessenhofen", true));
}
}