Example #1
0
        internal void Recalculate()
        {
            TransformCoordinates();
            _SpeedVector = new GPXVector();
            _Speed = 0;
            _DirectionVector = new GPXVector();

            if (_PreviousWaypoint == null)
            {
                _DistanceVector = new GPXVector();
                _Distance = 0;
                _TrackDistanceFromStart = 0;
            }
            else
            {
                _DistanceVector = this - _PreviousWaypoint;
                _Distance = _DistanceVector.GetLength(this.latField);
                _TrackDistanceFromStart = _PreviousWaypoint.GetTrackDistanceFromStart() + _Distance;

                if (_Distance > 0.01)
                    _DirectionVector = _DistanceVector / _Distance;
                else
                    _DirectionVector = new GPXVector();

                //if ((this.timeFieldSpecified) && (_PreviousWaypoint.timeFieldSpecified))
                //{
                TimeSpan ts = this.Time.Subtract(_PreviousWaypoint.Time);
                double timeDiff = ts.Ticks / 10000000;
                if (timeDiff != 0)
                {
                    _SpeedVector = _DistanceVector / timeDiff;
                    _Speed = _SpeedVector.GetLength(this.latField);
                }
                //}
            }
        }
Example #2
0
 public void AdjustPoint(GPXVector vector)
 {
     AdjustPoint(vector.DeltaLongitude, vector.DeltaLatitude, vector.DeltaElevation);
 }
Example #3
0
 internal void RelateToStartPoint(ref WayPoint start) //, out GPXVector distanceVector, out double time)
 {
     _DistanceFromStart = this - start;
     _TimeSinceStart = this.Time.Subtract(start.Time);
 }