Ejemplo n.º 1
0
        public IEnumerator AllParameters()
        {
            MapMatchingResource resource = new MapMatchingResource();

            resource.Profile     = Profile.MapboxWalking;
            resource.Geometries  = Geometries.Polyline6;
            resource.Coordinates = new Vector2d[]
            {
                new Vector2d(48.28585, 16.55267),
                new Vector2d(48.28933, 16.55211)
            };
            resource.Timestamps = new long[]
            {
                946684800,
                946684980
            };
            resource.Radiuses = new uint[] { 50, 50 };
            //set Steps to true to get turn-by-turn-instructions
            resource.Steps = true;
            //need to pass 'Overview.Full' to get 'Congestion'
            resource.Overview    = Overview.Full;
            resource.Annotations = Annotations.Distance | Annotations.Duration | Annotations.Speed | Annotations.Congestion;
            resource.Tidy        = true;
            resource.Language    = InstructionLanguages.German;


            MapMatcher          mapMatcher       = new MapMatcher(_fs, _timeout);
            MapMatchingResponse matchingResponse = null;

            mapMatcher.Match(
                resource,
                (MapMatchingResponse response) =>
            {
                matchingResponse = response;
            }
                );

            IEnumerator enumerator = _fs.WaitForAllRequests();

            while (enumerator.MoveNext())
            {
                yield return(null);
            }

            commonBasicResponseAsserts(matchingResponse);

            Directions.Leg leg = matchingResponse.Matchings[0].Legs[0];
            Assert.IsNotNull(leg.Annotation, "Annotation is NULL");
            Assert.IsNotNull(leg.Annotation.Distance, "Distance is NULL");
            Assert.IsNotNull(leg.Annotation.Duration, "Duration is NULL");
            Assert.IsNotNull(leg.Annotation.Speed, "Speed is NULL");
            Assert.IsNotNull(leg.Annotation.Congestion, "Congestion is NULL");

            Directions.Step step1 = matchingResponse.Matchings[0].Legs[0].Steps[1];
            Assert.IsTrue(step1.Maneuver.Instruction.Contains("Sie haben Ihr Ziel erreicht"), "Step[1]:Instruction not as expected");
        }
Ejemplo n.º 2
0
        public IEnumerator Annotation()
        {
            MapMatchingResource resource = new MapMatchingResource();

            resource.Coordinates = new Vector2d[]
            {
                new Vector2d(48.1974721043879, 16.36202484369278),
                new Vector2d(48.197922645046546, 16.36285901069641)
            };
            //need to pass 'Overview.Full' to get 'Congestion'
            resource.Overview    = Overview.Full;
            resource.Annotations = Annotations.Distance | Annotations.Duration | Annotations.Speed | Annotations.Congestion;

            MapMatcher          mapMatcher       = new MapMatcher(_fs, _timeout);
            MapMatchingResponse matchingResponse = null;

            mapMatcher.Match(
                resource,
                (MapMatchingResponse response) =>
            {
                matchingResponse = response;
            }
                );

            IEnumerator enumerator = _fs.WaitForAllRequests();

            while (enumerator.MoveNext())
            {
                yield return(null);
            }

            commonBasicResponseAsserts(matchingResponse);

            Directions.Leg leg = matchingResponse.Matchings[0].Legs[0];
            Assert.IsNotNull(leg.Annotation, "Annotation is NULL");
            Assert.IsNotNull(leg.Annotation.Distance, "Distance is NULL");
            Assert.IsNotNull(leg.Annotation.Duration, "Duration is NULL");
            Assert.IsNotNull(leg.Annotation.Speed, "Speed is NULL");
            Assert.IsNotNull(leg.Annotation.Congestion, "Congestion is NULL");

            Assert.GreaterOrEqual(leg.Annotation.Distance[1], 42, "Annotation has wrong distnce");
        }