public void TestEdgeBasedIslandNetwork02_PedestrianIsConnected() { var routerDb = new RouterDb(); routerDb.LoadTestNetwork( System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( "Itinero.Test.test_data.networks.network2.geojson")); routerDb.Sort(); routerDb.Compress(); var profile = Itinero.Osm.Vehicles.Vehicle.Pedestrian.Fastest(); var islandDetector = new EdgeBasedIslandDetector(routerDb.Network, (p) => { var edgeProfile = routerDb.EdgeProfiles.Get(p); return(profile.Factor(edgeProfile)); }); islandDetector.Run(); Assert.IsTrue(islandDetector.HasRun); Assert.IsTrue(islandDetector.HasSucceeded); var labels = islandDetector.IslandLabels; Assert.IsNotNull(labels); Assert.AreEqual(3, labels.Count); Assert.AreEqual(0, labels[0]); Assert.AreEqual(0, labels[1]); Assert.AreEqual(0, labels[2]); }
public void TestEdgeBasedIslandNetwork18_CarIsConnected() { var routerDb = new RouterDb(); routerDb.LoadTestNetwork( System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream( "Itinero.Test.test_data.networks.network18.geojson")); routerDb.Sort(); routerDb.Compress(); var profile = Itinero.Osm.Vehicles.Vehicle.Car.Fastest(); var islandDetector = new EdgeBasedIslandDetector(routerDb.Network, (p) => { var edgeProfile = routerDb.EdgeProfiles.Get(p); return(profile.Factor(edgeProfile)); }, routerDb.GetRestrictions(profile)); islandDetector.Run(); Assert.IsTrue(islandDetector.HasRun); Assert.IsTrue(islandDetector.HasSucceeded); var labels = islandDetector.IslandLabels; Assert.IsNotNull(labels); Assert.AreEqual(routerDb.Network.EdgeCount, labels.Count); for (uint i = 0; i < 7; i++) { Assert.AreEqual(0, labels[i]); } for (uint i = 7; i < labels.Count; i++) { Assert.AreEqual(7, labels[i]); } }