Esempio n. 1
0
        public override void Calculate(TrackPoint nextPoint)
        {
            base.Calculate(nextPoint);
            var timeSpanSeconds = (nextPoint.DateTime - CurrentPoint.DateTime).TotalSeconds;

            if (timeSpanSeconds > TimeFilter || timeSpanSeconds == 0)
            {
                return;
            }
            var deltaS = CurrentPoint.GetGeoCoordinate().GetDistanceTo(nextPoint.GetGeoCoordinate());
            var deltaT = (nextPoint.DateTime - CurrentPoint.DateTime).TotalSeconds;
            var speed  = deltaS / deltaT;

            speeds.Add(speed);
            switch (CurrentDirection)
            {
            case AltitudeDirection.Climbing:
                climbingSpeeds.Add(speed);
                break;

            case AltitudeDirection.Descent:
                descentSpeeds.Add(speed);
                break;

            case AltitudeDirection.Flat:
                flatSpeeds.Add(speed);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            CurrentPoint = nextPoint;
        }
        public override void Calculate(TrackPoint nextPoint)
        {
            base.Calculate(nextPoint);

            var timeSpanSeconds = (nextPoint.DateTime - CurrentPoint.DateTime).TotalSeconds;

            if (timeSpanSeconds > TimeFilter || timeSpanSeconds == 0)
            {
                return;
            }
            var distance = CurrentPoint.GetGeoCoordinate().GetDistanceTo(nextPoint.GetGeoCoordinate());

            _totalDistance += distance;
            switch (CurrentDirection)
            {
            case AltitudeDirection.Climbing:
                _climbDistance += distance;
                break;

            case AltitudeDirection.Descent:
                _descentDistance += distance;
                break;

            case AltitudeDirection.Flat:
                _flatDistance += distance;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            CurrentPoint = nextPoint;
        }
Esempio n. 3
0
        private static double CalculateSlope(TrackPoint previousPoint, TrackPoint currentPoint)
        {
            var deltaH = previousPoint.Altitude - currentPoint.Altitude;
            var deltaS = previousPoint.GetGeoCoordinate().GetDistanceTo(currentPoint.GetGeoCoordinate());

            return(deltaH / deltaS);
        }