Example #1
0
        /// <summary>
        /// Return list of latitudes in bounding box
        ///     UTM Longitude: each 6 degrees
        /// </summary>
        /// <param name="pBoundingBox">
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        private static IEnumerable<double> CalculateVisibleLongitudeLines(GeographicBoundingBox pBoundingBox)
        {
            var result = new List<double>();

            // first zone intersection inside the southwest corner of the map window
            // longitude coordinate is straight-forward...
            double x1 = Math.Floor((pBoundingBox.WestBoundLongitude / 6.0) + 1) * 6.0;
            result.Add(pBoundingBox.WestBoundLongitude);
            if (pBoundingBox.WestBoundLongitude < pBoundingBox.EastBoundLongitude)
            {
                // normal case
                for (double currentLongitude = x1, j = 1;
                     currentLongitude < pBoundingBox.EastBoundLongitude;
                     currentLongitude += 6, j++)
                {
                    result.Add(currentLongitude);
                }
            }
            else
            {
                Debug.Assert(false, "Boundingbox problem with map");
            }

            result.Add(pBoundingBox.EastBoundLongitude);
            return result.Distinct();
        }
Example #2
0
        /// <summary>
        /// Return list of latitudes in bounding box
        ///     UTM Latitude: each 8 degrees
        /// </summary>
        /// <param name="pBoundingBox">
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable"/>.
        /// </returns>
        private static IEnumerable<double> CalculateVisibleLatitudeLines(GeographicBoundingBox pBoundingBox)
        {
            var result = new List<double>();
            result.Add(pBoundingBox.SouthBoundLatitude);
            double y1 = (pBoundingBox.SouthBoundLatitude < -80)
                            ? -80
                            : (Math.Floor((pBoundingBox.SouthBoundLatitude / 8) + 1) * 8.0);

            for (var currentLatitude = y1; currentLatitude < pBoundingBox.NorthBoundLatitude; currentLatitude += 8)
            {
                if (currentLatitude <= 72)
                {
                    result.Add(currentLatitude);
                }
                else if (currentLatitude <= 80)
                {
                    result.Add(84);
                }
            }

            result.Add(pBoundingBox.NorthBoundLatitude);
            return result.Distinct();
        }