示例#1
0
        public double?GetElevationDifFrom(GpxPoint other)
        {
            if (Elevation == null && other.Elevation == null)
            {
                return(null);
            }

            return(Elevation - other.Elevation);
        }
示例#2
0
        public GpxPointCollection <GpxPoint> ToGpxPoints()
        {
            GpxPointCollection <GpxPoint> points = new GpxPointCollection <GpxPoint>();

            foreach (T gpxPoint in Points_)
            {
                GpxPoint point = new GpxPoint
                {
                    Longitude = gpxPoint.Longitude,
                    Latitude  = gpxPoint.Latitude,
                    Elevation = gpxPoint.Elevation,
                    Time      = gpxPoint.Time
                };

                points.Add(point);
            }

            return(points);
        }
示例#3
0
        public double GetDistanceFrom(GpxPoint other)
        {
            double thisLatitude   = this.Latitude;
            double otherLatitude  = other.Latitude;
            double thisLongitude  = this.Longitude;
            double otherLongitude = other.Longitude;

            double deltaLatitude  = Math.Abs(this.Latitude - other.Latitude);
            double deltaLongitude = Math.Abs(this.Longitude - other.Longitude);

            thisLatitude   *= RADIAN;
            otherLatitude  *= RADIAN;
            deltaLongitude *= RADIAN;

            double cos = Math.Cos(deltaLongitude) * Math.Cos(thisLatitude) * Math.Cos(otherLatitude) +
                         Math.Sin(thisLatitude) * Math.Sin(otherLatitude);

            return(EARTH_RADIUS * Math.Acos(cos > 1 ? 1 : cos));
        }