Exemplo n.º 1
0
        private void ApplyElevation(QuadTreeNode tile)
        {
            var data = DataByTile[tile];

            TileMatrix tileMatrix   = ElevationTileMatrixSet[tile.Depth];
            long       zoomLevel    = tile.Depth;
            long       matrixRow    = (long)Mathf.Floor((float)(tile.GeographicBounds.MinimumCoordinates.Latitude - Elevation.MinY) / tileMatrix.TilesHigh);
            long       matrixColumn = (long)Mathf.Floor((float)(tile.GeographicBounds.MinimumCoordinates.Longitude - Elevation.MinX) / tileMatrix.TilesWide);
            var        elevation    = Elevation.Tile(zoomLevel, matrixRow, matrixColumn);

            //File.WriteAllBytes("D:/elevtest.dat", elevation.Bytes);

            int meshDimension = (int)tileMatrix.TileWidth;
            var array         = TiffToFloatArray(elevation.Bytes, meshDimension);
            int vertexIndex   = 0;

            for (int row = 0; row < meshDimension; ++row)
            {
                for (int column = 0; column < meshDimension; ++column, ++vertexIndex)
                {
                    data.vertices[vertexIndex].y = array[vertexIndex];
                }
            }
        }