Exemplo n.º 1
0
        // same as above
        public static BoundingRect2 GeographicTilingSchemeTileXYToRectangle(int x, int y, int level)
        {
            double southE = -1.4844222297453324;
            double northE = 1.4844222297453322;
            double eastE  = 3.141592653589793;
            double westE  = -3.141592653589793;

            //    y = MapUtil.FlipY(y, level);
            var rectangle = new BoundingRect2()
            {
                East = eastE, North = northE, South = southE, West = westE
            };

            var xTiles = GetNumberOfXTilesAtLevel(level);
            var yTiles = GetNumberOfYTilesAtLevel(level);

            var xTileWidth = ComputeWidth(rectangle) / xTiles;
            var west       = x * xTileWidth + rectangle.West;
            var east       = (x + 1) * xTileWidth + rectangle.West;

            var yTileHeight = ComputeHeight(rectangle) / yTiles;
            var north       = rectangle.North - y * yTileHeight;
            var south       = rectangle.North - (y + 1) * yTileHeight;

            // Y is south to north in this case
            //     var south = rectangle.South + y * yTileHeight;
            //    var north = rectangle.South + (y + 1) * yTileHeight;

            return(new BoundingRect2(west, south, east, north));
        }
Exemplo n.º 2
0
        // special Cesium Code

        public static double ComputeWidth(BoundingRect2 rectangle)
        {
            var east = rectangle.East;
            var west = rectangle.West;

            if (east < west)
            {
                east += Math.PI * 2;
            }
            return(east - west);
        }
Exemplo n.º 3
0
 public static double ComputeHeight(BoundingRect2 rectangle)
 {
     return(rectangle.North - rectangle.South);
 }