public void ShouldReturnProperValue(DecodeTestData testData)
            {
                // arrange
                var sut = new PolylineEncoder(PolylineEncoding.Polyline5);

                // act
                var actualResult = sut.Decode(testData.Polyline);

                // assert
                actualResult.Should().BeEquivalentTo(testData.ExpectedResult);
            }
            public void NullString_ShouldReturnNullCollection()
            {
                // arrange
                var sut = new PolylineEncoder(PolylineEncoding.Polyline5);

                // act
                var actualResult = sut.Decode(null);

                // assert
                actualResult.Should().BeNull();
            }
            public void EmptyString_ShouldReturnEmptyCollection()
            {
                // arrange
                var sut = new PolylineEncoder(PolylineEncoding.Polyline5);

                // act
                var actualResult = sut.Decode(string.Empty);

                // assert
                actualResult.Should().BeEmpty();
            }
        private static IEnumerable <LatLng> AssembleHQPolyline(DirectionRoute route)
        {
            var hdRoute = new List <LatLng>();

            foreach (var leg in route.Legs)
            {
                foreach (var step in leg.Steps)
                {
                    hdRoute.AddRange(PolylineEncoder.Decode(step.Polyline.Points));
                }
            }

            return(hdRoute);
        }
Exemplo n.º 5
0
        public void decode_coords_1()
        {
            string value = "_p~iF~ps|U_ulLnnqC_mqNvxq`@";

            LatLng[] expected = new LatLng[] {
                new LatLng(38.5, -120.2),
                new LatLng(40.7, -120.95),
                new LatLng(43.252, -126.453)
            };

            IEnumerable <LatLng> actual2 = PolylineEncoder.Decode(value);

            LatLng[] actual = actual2.ToArray();

            Assert.AreEqual(expected.Length, actual.Length, "Length");

            for (int i = 0; i < actual.Length; i++)
            {
                Assert.AreEqual(expected[i].Latitude, actual[i].Latitude);
                Assert.AreEqual(expected[i].Longitude, actual[i].Longitude);
            }
        }
Exemplo n.º 6
0
 static GeoPolyline ToGeoPolyline(this Polyline polyline)
 {
     return(new GeoPolyline(
                PolylineEncoder.Decode(polyline.Points)
                .Select(pt => new GeoCoordinates(pt.Latitude, pt.Longitude))));
 }
Exemplo n.º 7
0
 public static GeoPolyline ToGeo(this Polyline polyline)
 {
     return(new GeoPolyline(from latLng in PolylineEncoder.Decode(polyline.Points) select latLng.ToGeo()));
 }
        private static IEnumerable <LatLng> AssembleOverviewPolyline(DirectionRoute route)
        {
            var line = route.OverviewPolyline;

            return(PolylineEncoder.Decode(line.Points));
        }