public void TestCHDepthFirstEnumerator()
        {
            const string embeddedString = "OsmSharp.Test.Unittests.test_network_real1.osm";

            // creates a new interpreter.
            var interpreter = new OsmRoutingInterpreter();

            // do the data processing.
            var original = CHEdgeGraphOsmStreamTarget.Preprocess(new XmlOsmStreamSource(
                                                                   Assembly.GetExecutingAssembly()
                                                                           .GetManifestResourceStream(embeddedString)),
                                                               interpreter,
                                                               Vehicle.Car);
            // add the downward edges.
            original.AddDownwardEdges();

            // enumerate using depth-first search.
            CHDepthFirstEnumerator enumerator =
                new CHDepthFirstEnumerator(original);
            HashSet<uint> vertices = new HashSet<uint>(
                enumerator.Select(x => x.VertexId));
            for (uint vertexId = 1; vertexId < original.VertexCount + 1; vertexId++)
            {
                Assert.IsTrue(vertices.Contains(vertexId));
            }
        }
示例#2
0
        public void TestCHDepthFirstEnumerator()
        {
            const string embeddedString = "OsmSharp.Test.Unittests.test_network_real1.osm";

            // creates a new interpreter.
            var interpreter = new OsmRoutingInterpreter();

            // do the data processing.
            var original = CHEdgeGraphOsmStreamTarget.Preprocess(new XmlOsmStreamSource(
                                                                     Assembly.GetExecutingAssembly()
                                                                     .GetManifestResourceStream(embeddedString)),
                                                                 interpreter,
                                                                 Vehicle.Car);

            // add the downward edges.
            original.AddDownwardEdges();

            // enumerate using depth-first search.
            CHDepthFirstEnumerator enumerator =
                new CHDepthFirstEnumerator(original);
            HashSet <uint> vertices = new HashSet <uint>(
                enumerator.Select(x => x.VertexId));

            for (uint vertexId = 1; vertexId < original.VertexCount + 1; vertexId++)
            {
                Assert.IsTrue(vertices.Contains(vertexId));
            }
        }