예제 #1
0
        /// <summary>
        /// No data so return an empty tile
        /// </summary>
        /// <returns></returns>
        private bool BuildEmptyTile()
        {
            _log.LogDebug($"#Tile#.({TileX},{TileY}) Execute End. Returning empty tile. Zoom:{TileZ}, GridSize{QMConstants.FlatResolutionGridSize}");
            // Even empty tiles must have header info correctly calculated
            if (ElevData.GridSize == QMConstants.NoGridSize)
            {
                ElevData = new ElevationData(LowestElevation, QMConstants.FlatResolutionGridSize); // elevation grid
            }
            ElevData.MakeEmptyTile(TileBoundaryLL, HasLighting);
            if (ElevData.HasLighting)
            {
                ComputeNormalMap();
            }

            QMTileBuilder tileBuilder = new QMTileBuilder()
            {
                TileData = ElevData,
                GridSize = ElevData.GridSize
            };

            if (!tileBuilder.BuildQuantizedMeshTile())
            {
                _log.LogError($"Tile.({TileX},{TileY}) failed to build empty tile. Error code: {tileBuilder.BuildTileFaultCode}");
                return(false);
            }

            QMTileResponse.ResultStatus = RequestErrorStatus.OK;
            QMTileResponse.data         = tileBuilder.QuantizedMeshTile; // return QM tile in response
            ResultStatus = RequestErrorStatus.OK;
            return(true);
        }
예제 #2
0
        public void TileBuilder_BuildTile()
        {
            LLBoundingBox TileBoundaryLL = MapGeo.TileXYZToRectLL(0, 0, 20, out var yFlip);
            ElevationData elevData       = new ElevationData(0, 5);

            elevData.MakeEmptyTile(TileBoundaryLL, false);
            QMTileBuilder tileBuilder = new QMTileBuilder()
            {
                TileData = elevData,
                GridSize = elevData.GridSize
            };

            var res = tileBuilder.BuildQuantizedMeshTile();

            res.Should().Be(true);
            tileBuilder.QuantizedMeshTile.Should().HaveCountGreaterOrEqualTo(162);
            tileBuilder.QuantizedMeshTile.Should().HaveCountLessOrEqualTo(164);
        }