Пример #1
0
        public void GetDistance_WithPausePoint()
        {
            IList <GPSPoint> pkt = new List <GPSPoint>();

            pkt.Add(new GPSPoint(50.9313049f, 17.2975941f, 3, 4, 1));
            pkt.Add(new GPSPoint(50.9311333f, 17.29805f, 31, 41, 2));
            pkt.Add(new GPSPoint(50.9310341f, 17.2986717f, 32, 42, 3));
            pkt.Add(new GPSPoint(50.9312172f, 17.2992649f, 34, 44, 5));
            pkt.Add(GPSPoint.CreatePause(5.1f));
            pkt.Add(new GPSPoint(50.9329834f, 17.3020668f, 35, 45, 6));
            pkt.Add(new GPSPoint(50.933815f, 17.3040714f, 35, 45, 7));

            var distance = GPSTrackerHelper.GetDistance(pkt);

            Assert.AreEqual(296.89223243105414, distance);
        }
Пример #2
0
        void addNotAvailablePoint(bool isPause)
        {
            var lastPoint = viewModel.Points.LastOrDefault();

            if (lastPoint != null)
            {
                if (!lastPoint.IsNotAvailable() && !isPause)
                {
                    viewModel.Points.Add(GPSPoint.CreateNotAvailable((float)getCurrentDuration()));
                }
                else if (!lastPoint.IsPause() && isPause)
                {
                    viewModel.Points.Add(GPSPoint.CreatePause((float)getCurrentDuration()));
                }
            }
        }
        public void TestAltitudeCorrection_WithPause()
        {
            IList <GPSPoint> pkt = new List <GPSPoint>();

            pkt.Add(new GPSPoint(50.9313049f, 17.2975941f, 10, 4, 1));
            pkt.Add(new GPSPoint(50.9311333f, 17.29805f, 31, 41, 2));
            pkt.Add(new GPSPoint(50.9310341f, 17.2986717f, 38, 42, 3));
            pkt.Add(GPSPoint.CreatePause(42.1f));
            pkt.Add(new GPSPoint(50.9312172f, 17.2992649f, 33, 44, 5));
            pkt.Add(new GPSPoint(50.9329834f, 17.3020668f, 35, 45, 43));
            pkt.Add(new GPSPoint(50.933815f, 17.3040714f, 35, 62, 60));
            GPSTrackerHelper.CorrectGpsData(pkt);
            Assert.AreEqual(10, pkt[0].Altitude);
            Assert.AreEqual(20.5f, pkt[1].Altitude);
            Assert.AreEqual(22.833334f, pkt[2].Altitude);
            Assert.AreEqual(true, float.IsNaN(pkt[3].Altitude));
            Assert.AreEqual(33, pkt[4].Altitude);
            Assert.AreEqual(34, pkt[5].Altitude);
            Assert.AreEqual(34, pkt[6].Altitude);
        }