コード例 #1
0
        /// <inheritdoc cref="ToGeodeticCoordinates(Size, bool)"/>
        /// <param name="number"><see cref="Number"/> to convert</param>
        /// <param name="tileSize"></param>
        /// <param name="tmsCompatible"></param>
        public static (GeodeticCoordinate minCoordinate, GeodeticCoordinate maxCoordinate) ToGeodeticCoordinates(
            Number number, Size tileSize, bool tmsCompatible)
        {
            #region Preconditions checks

            if (number == null)
            {
                throw new ArgumentNullException(nameof(number));
            }
            if (tileSize == null)
            {
                throw new ArgumentNullException(nameof(tileSize));
            }

            #endregion

            if (!tmsCompatible)
            {
                number = Flip(number);
            }

            double resolution = GeodeticCoordinate.Resolution(number.Z, tileSize);

            GeodeticCoordinate minCoordinate = new GeodeticCoordinate(number.X * tileSize.Width * resolution - 180.0,
                                                                      number.Y * tileSize.Height * resolution - 90.0);
            GeodeticCoordinate maxCoordinate = new GeodeticCoordinate((number.X + 1) * tileSize.Width * resolution - 180.0,
                                                                      (number.Y + 1) * tileSize.Height * resolution - 90.0);

            return(minCoordinate, maxCoordinate);
        }
コード例 #2
0
 public void ResolutionNotSquareTileSize() => Assert.Throws <ArgumentException>(() =>
 {
     Size size  = new Size(10, 20);
     double res = GeodeticCoordinate.Resolution(10, size);
 });
コード例 #3
0
 public void ResolutionSmallZ() => Assert.Throws <ArgumentOutOfRangeException>(() =>
 {
     double res = GeodeticCoordinate.Resolution(-1, Tile.DefaultSize);
 });
コード例 #4
0
 public void ResolutionNullTileSize() => Assert.Throws <ArgumentNullException>(() =>
 {
     double res = GeodeticCoordinate.Resolution(10, null);
 });
コード例 #5
0
 public void ResolutionNormal() => Assert.DoesNotThrow(() =>
 {
     double res = GeodeticCoordinate.Resolution(10, Tile.DefaultSize);
 });