static void Main(string[] args) { int num = 0; num = num + 2; IGNRepository ignService = new IGNRepository(Path.Combine(DATA_DIR_IGN, "IGN_ROUTE500_SNCF.mdf")); SncfRepository repo = new SncfRepository(DATA_DIR_SNCF, 1000); CoreService core = new CoreService(repo, ignService); core.MatchRoutesWithTronconsIGN(); //OldTests(repo); }
public CoreService(SncfRepository repo, IGNRepository railroads) { _sncfRepo = repo; _ignRepo = railroads; }
public void ShowStopAreasOnMap(SncfRepository _sncfRepo, IGNRepository _ignRepo, string wkt = null) { SqlGeography polyQuery = wkt == null ? null : SqlGeography.STGeomFromText(new SqlChars(new SqlString(wkt)), 4326); Dictionary <int, Noeud> noeuds = _ignRepo.GetAllNoeuds_LatLon(polyQuery); Dictionary <string, SqlGeography> geogListStopAreas = new Dictionary <string, SqlGeography>(); IEnumerable <StopArea> stopAreas = _sncfRepo.StopAreas; if (polyQuery != null) { stopAreas = stopAreas.Where(s => FromCoordToGeography(s.Coord).STIntersects(polyQuery).IsTrue); } foreach (var sp in stopAreas) { geogListStopAreas.Add(sp.Name + " " + sp.Id, FromCoordToGeography(sp.Coord)); } Dictionary <string, SqlGeography> geogListStopPoints = new Dictionary <string, SqlGeography>(); IEnumerable <StopPoint> stopPoints = _sncfRepo.StopPoints; if (polyQuery != null) { stopPoints = stopPoints.Where(s => FromCoordToGeography(s.Coord).STIntersects(polyQuery).IsTrue); } foreach (var sp in stopPoints) { geogListStopPoints.Add(sp.Name + " " + sp.Id, FromCoordToGeography(sp.Coord)); } SpatialTrace.Enable(); int i = 0; foreach (var g in noeuds) { if (i % 2 == 0) { SpatialTrace.SetLineColor(Colors.Blue); } else { SpatialTrace.SetLineColor(Colors.Red); } SpatialTrace.TraceGeometry(g.Value.Geometry, $"{g.Value.Id}: {g.Value.Toponyme}", $"{g.Value.Id}: {g.Value.Toponyme}"); i++; } //SpatialTrace.SetLineColor(Colors.Red); //SpatialTrace.TraceGeometry(geogList120, "Lignes 120", "Lignes 120"); SpatialTrace.Indent("Stop areas"); SpatialTrace.SetFillColor(Colors.Green); foreach (var kvp in geogListStopAreas) { SpatialTrace.TraceGeometry(kvp.Value, kvp.Key, kvp.Key); } SpatialTrace.Unindent(); SpatialTrace.Indent("Stop points"); SpatialTrace.SetFillColor(Colors.Violet); foreach (var kvp in geogListStopPoints) { SpatialTrace.TraceGeometry(kvp.Value, kvp.Key, kvp.Key); } SpatialTrace.Unindent(); SpatialTrace.ShowDialog(); SpatialTrace.Disable(); }