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;
        }
Ejemplo n.º 2
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;
        }