コード例 #1
0
        public static GeoDistance ElevationBetweenPoints(IEnumerable <IGeoPoint> points, int direction = 0)
        {
            double m = 0;
            var    a = points.First();

            foreach (var b in points)
            {
                if (a != b)                 // skip first
                {
                    if (a.Elevation.HasValue && b.Elevation.HasValue)
                    {
                        var d = b.Elevation.Value - a.Elevation.Value;
                        if (direction == 0)
                        {
                            m += Math.Abs(d);
                        }
                        else if (direction < 0 && d < 0)
                        {
                            m += Math.Abs(d);
                        }
                        else if (direction > 0 && d > 0)
                        {
                            m += Math.Abs(d);
                        }
                    }
                    a = b;                     // go next
                }
            }
            return(GeoDistance.FromMeters(m));
        }
コード例 #2
0
        public static GeoDistance BetweenPoints(IEnumerable <IGeoPoint> points, bool includeElevation = false)
        {
            double m = 0;
            var    a = points.First();

            foreach (var b in points)
            {
                if (a != b)                 // skip first
                {
                    m += GeoDistance.DistanceMeters(a, b, includeElevation);
                    a  = b;                    // go next
                }
            }
            return(GeoDistance.FromMeters(m));
        }
コード例 #3
0
        public static GeoDistance BetweenPoints(IGeoPoint a, IGeoPoint b, bool includeElevation = false)
        {
            var m = GeoDistance.DistanceMeters(a, b, includeElevation);

            return(GeoDistance.FromMeters(m));
        }
コード例 #4
0
        public static GeoDistance BetweenPoints(IGeoLatLon a, IGeoLatLon b)
        {
            var m = GeoDistance.DistanceMeters(a, b);

            return(GeoDistance.FromMeters(m));
        }
コード例 #5
0
        //public decimal NauticalMiles { get { return _meters * _nauticalMeter; } }
        //public decimal NauticalMeters { get { return _meters * _nauticalMile; } }

        public void Add(GeoDistance d)
        {
            _meters += d._meters;
        }