Beispiel #1
0
        public SQuantizedExtent3D ComputeQuantizedTileExtent(IGridCoord tile, IQuantizedExtentGrid grid)
        {
            var min = new SQuantizedPoint3D(
                (grid.CellSizeX * tile.Col + MinX),
                (grid.CellSizeY * tile.Row + MinY),
                MinZ
                );

            var max = new SQuantizedPoint3D(
                (Math.Min(min.X + grid.CellSizeX, MaxX)),
                (Math.Min(min.Y + grid.CellSizeY, MaxY)),
                MaxZ
                );

            return(new SQuantizedExtent3D(min, max));
        }
Beispiel #2
0
        public IEnumerable <SimpleGridCoord> GetCellCoordsInScaledRange(int scaledX, int scaledY, IQuantizedExtentGrid scaledGrid)
        {
            var startX = (ushort)Math.Floor(scaledX * scaledGrid.CellSizeX / (double)CellSizeX);
            var startY = (ushort)Math.Floor(scaledY * scaledGrid.CellSizeY / (double)CellSizeY);

            var endX = (ushort)Math.Ceiling((scaledX + 1) * scaledGrid.CellSizeX / (double)CellSizeX);
            var endY = (ushort)Math.Ceiling((scaledY + 1) * scaledGrid.CellSizeY / (double)CellSizeY);

            if (endX > SizeX)
            {
                endX = SizeX;
            }
            if (endY > SizeY)
            {
                endY = SizeY;
            }

            for (var y = startY; y < endY; y++)
            {
                for (var x = startX; x < endX; x++)
                {
                    if (!EqualityComparer <T> .Default.Equals(Data[y, x], default(T)))
                    {
                        yield return(new SimpleGridCoord(y, x));
                    }
                }
            }
        }