コード例 #1
0
ファイル: Program.cs プロジェクト: norcis/Osrm.Client
        private static void Match4x(OsrmClient osrm)
        {
            var locations = new LocationWithTimestamp[] {
                new LocationWithTimestamp(52.542648, 13.393252, 1424684612),
                new LocationWithTimestamp(52.543079, 13.394780, 1424684616),
                new LocationWithTimestamp(52.542107, 13.397389, 1424684620)
            };

            var request = new MatchRequest()
            {
                Locations    = locations,
                Instructions = true,
                Classify     = true
            };

            var result = osrm.Match(request);
        }
コード例 #2
0
        public void Location_Equals()
        {
            var a1 = new LocationWithTimestamp(52.542648, 13.393252, 1424684612);
            var a2 = new LocationWithTimestamp(52.542648, 13.393252, 1424684612);
            var a3 = new LocationWithTimestamp(52.542648, 13.393252);

            Assert.IsTrue(a1 == a2);
            Assert.IsFalse(a1 == a3);
            Assert.IsTrue(a1.Equals(a2));
            Assert.IsFalse(a1.Equals(a3));

            var b1 = new Location(12.542648, 13.393252);
            var b2 = new Location(12.542648, 13.393252);
            var b3 = new Location(12.542648, 99.393252);

            Assert.IsTrue(b1 == b2);
            Assert.IsFalse(b1 == b3);
            Assert.IsTrue(b1.Equals(b2));
            Assert.IsFalse(b1.Equals(b3));
        }
コード例 #3
0
        public void Match_Response()
        {
            var locations = new LocationWithTimestamp[] {
                new LocationWithTimestamp(52.542648, 13.393252, 1424684612),
                new LocationWithTimestamp(52.543079, 13.394780, 1424684616),
                new LocationWithTimestamp(52.542107, 13.397389, 1424684620)
            };

            var request = new MatchRequest()
            {
                Locations    = locations,
                Instructions = true,
                Classify     = true
            };

            var result = osrm.Match(request);

            CheckStatus200(result);
            Assert.IsTrue(result.Matchings.Length > 0);
            Assert.IsTrue(result.Matchings[0].Instructions.Length > 0);
            Assert.IsNotNull(result.Matchings[0].Confidence);
        }