Esempio n. 1
0
        public void TestOneSegment()
        {
            var route = new Route()
            {
                Shape = new Coordinate[]
                {
                    new Coordinate(51.267819164340295f, 4.801352620124817f),
                    new Coordinate(51.268218575855880f, 4.801352620124817f)
                },
                ShapeMeta = new Route.Meta[]
                {
                    new Route.Meta()
                    {
                        Shape = 0
                    },
                    new Route.Meta()
                    {
                        Shape = 1
                    }
                },
                TotalDistance = 0,
                TotalTime     = 0
            };

            var generator = new InstructionCarGenerator(route, new MockLanguageReference());

            generator.Run();

            var instructions = generator.Instructions;

            Assert.IsNotNull(instructions);
            Assert.AreEqual(2, instructions.Count);
            Assert.AreEqual("start", instructions[0].Type);
            Assert.AreEqual("stop", instructions[1].Type);
        }
Esempio n. 2
0
        public void TestRightTurn()
        {
            var route = new Route()
            {
                Shape = new Coordinate[]
                {
                    new Coordinate(51.267436531565470f, 4.8017871379852295f),
                    new Coordinate(51.267879579750364f, 4.8017871379852295f),
                    new Coordinate(51.267879579750364f, 4.8025381565093985f)
                },
                ShapeMeta = new Route.Meta[]
                {
                    new Route.Meta()
                    {
                        Shape = 0
                    },
                    new Route.Meta()
                    {
                        Shape = 1
                    },
                    new Route.Meta()
                    {
                        Shape = 2
                    }
                },
                Branches = new Route.Branch[]
                {
                    new Route.Branch()
                    {
                        Shape      = 1,
                        Coordinate = new Coordinate(51.267879579750364f, 4.801073670387268f)
                    }
                },
                TotalDistance = 0,
                TotalTime     = 0
            };

            var generator = new InstructionCarGenerator(route, new MockLanguageReference());

            generator.Run();

            var instructions = generator.Instructions;

            Assert.IsNotNull(instructions);
            Assert.AreEqual(3, instructions.Count);
            Assert.AreEqual("start", instructions[0].Type);
            Assert.AreEqual("turn", instructions[1].Type);
            Assert.AreEqual("stop", instructions[2].Type);
        }
Esempio n. 3
0
        public void TestRoundabout()
        {
            var route = new Route()
            {
                Shape = new Coordinate[]
                {
                    new Coordinate(51.267258639804595f, 4.801588654518127f),
                    new Coordinate(51.267718471813710f, 4.801631569862366f),
                    new Coordinate(51.267946707890620f, 4.802243113517761f),
                    new Coordinate(51.268309198153570f, 4.801674485206603f),
                    new Coordinate(51.268903273234820f, 4.801695942878722f),
                },
                ShapeMeta = new Route.Meta[]
                {
                    new Route.Meta()
                    {
                        Shape = 0
                    },
                    new Route.Meta()
                    {
                        Shape = 1
                    },
                    new Route.Meta()
                    {
                        Shape      = 2,
                        Attributes = new AttributeCollection(
                            new Attribute("junction", "roundabout"))
                    },
                    new Route.Meta()
                    {
                        Shape      = 3,
                        Attributes = new AttributeCollection(
                            new Attribute("junction", "roundabout"))
                    },
                    new Route.Meta()
                    {
                        Shape = 4
                    }
                },
                Branches = new Route.Branch[]
                {
                    new Route.Branch()
                    {
                        Shape      = 2,
                        Coordinate = new Coordinate(51.26800712313301f, 4.801154136657715f)
                    },
                    new Route.Branch()
                    {
                        Shape      = 3,
                        Coordinate = new Coordinate(51.26795006429507f, 4.803010225296020f)
                    }
                },
                TotalDistance = 0,
                TotalTime     = 0
            };

            var generator = new InstructionCarGenerator(route, new MockLanguageReference());

            generator.Run();

            var instructions = generator.Instructions;

            Assert.IsNotNull(instructions);
            Assert.AreEqual(3, instructions.Count);
            Assert.AreEqual("start", instructions[0].Type);
            Assert.AreEqual("roundabout", instructions[1].Type);
            Assert.AreEqual("stop", instructions[2].Type);
        }