Exemple #1
0
        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);
        }
Exemple #2
0
        private static void OldTests(SncfRepository repo)
        {
            //ShowStopAreasOnMap(repo, "POLYGON((5.2734375 43.259580971072275,5.41351318359375 43.1614915129406,5.4986572265625 43.295574211963746,5.5810546875 43.42936191764414,5.90789794921875 43.57678451504994,5.877685546875 43.74766111392921,5.88043212890625 43.86064850339098,5.62225341796875 43.75559702541283,5.4327392578125 43.670230832122314,5.27069091796875 43.58474304793296,5.23773193359375 43.431356514362626,5.2734375 43.259580971072275))");

            // Saves data identified as "static", ie: does not change often and can save remote Hits
            // Warning : this does not respect API rules. Use at your own risk
            //repo.SaveStaticData();
            //Line line = sncfApi.GetLine("line:OCE:SN-87276055-87276139");

            //repo.GetAndSavedRelatedData_Detail<Route, RouteSchedule>(repo.Api, repo.Routes, "routes/{id}/route_schedules", DATA_DIR_SNCF, "route_schedules\\route.{id}.route_schedules.json");
            //repo.GetAndSavedRelatedData<Line, StopArea>(repo.Api, repo.Lines, "lines/{id}/stop_areas", DATA_DIR_SNCF, "lines.stop_areas.json");
            //repo.GetAndSavedRelatedData<Route, StopArea>(repo.Api, repo.Routes, "routes/{id}/stop_areas", DATA_DIR_SNCF, "routes.stop_areas.json");

            // TODO : get all route stop areas
            // we can then map to geo network with a little Dijkstra for each route
            // goal : for each network line, get all connected routes and lines

            string idStopArea_Meyrargues         = "stop_area:OCE:SA:87751370";
            string idStopArea_MarseilleStCharles = "stop_area:OCE:SA:87751008";
            string idStopArea_AixTgv             = "stop_area:OCE:SA:87319012";

            var stopPoints = repo.GetAllStopPointsForLinesStoppingAtStopArea(idStopArea_Meyrargues);

            stopPoints = repo.GetAllStopPointsForLinesStoppingAtStopArea(idStopArea_MarseilleStCharles);
            stopPoints = repo.GetAllStopPointsForLinesStoppingAtStopArea(idStopArea_AixTgv);


            repo.TestQueryWithStopAreaId(idStopArea_Meyrargues);
            repo.TestQueryWithStopAreaId(idStopArea_AixTgv);

            string str2Find = "MEYRARGUES";

            repo.TestQueryWithStopName(str2Find);
            str2Find = "AIX-EN-PROVENCE";
            repo.TestQueryWithStopName(str2Find);
            str2Find = "MARSEILLE";
            repo.TestQueryWithStopName(str2Find);
            str2Find = "NICE";
            repo.TestQueryWithStopName(str2Find);
        }
Exemple #3
0
 public CoreService(SncfRepository repo, IGNRepository railroads)
 {
     _sncfRepo = repo;
     _ignRepo  = railroads;
 }
Exemple #4
0
        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();
        }