コード例 #1
0
 protected MapMode()
 {
     _TileWrap    = TileWrap.None;
     SizeChanged += new SizeChangedEventHandler(MapMode_SizeChanged);
     _TilePyramidRenderableCanvas = new Canvas();
     Children.Add(_TilePyramidRenderableCanvas);
     _TilePyramidRenderable              = new TilePyramidRenderable(_TilePyramidRenderableCanvas);
     _TilePyramidRenderable.NeedsRender += new EventHandler(_TilePyramidRenderable_NeedsRender);
 }
コード例 #2
0
        public RasterTileSource(long logicalFinestLodWidth, long logicalFinestLodHeight, int tileWidth, int tileHeight, int logicalMinimumLevelOfDetail, RasterTileDownloader rasterTileDownloader, TileWrap tileWrap, int log2DuplicatePyramidCount, bool useGlobalMemoryCache = true)
        {
            if (logicalFinestLodWidth <= 0L)
            {
                throw new ArgumentOutOfRangeException(nameof(logicalFinestLodWidth));
            }
            if (logicalFinestLodHeight <= 0L)
            {
                throw new ArgumentOutOfRangeException(nameof(logicalFinestLodHeight));
            }
            if (tileWidth <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(tileWidth));
            }
            if (tileHeight <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(tileHeight));
            }
            if (rasterTileDownloader is null)
            {
                throw new ArgumentNullException(nameof(rasterTileDownloader));
            }
            if (tileWrap == TileWrap.None)
            {
                throw new ArgumentException("tileWrap must horizontal, vertical, or both.");
            }
            if (log2DuplicatePyramidCount < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(log2DuplicatePyramidCount));
            }
            finestLodWidth       = logicalFinestLodWidth << log2DuplicatePyramidCount;
            finestLodHeight      = logicalFinestLodHeight << log2DuplicatePyramidCount;
            this.tileWidth       = tileWidth;
            this.tileHeight      = tileHeight;
            minimumLevelOfDetail = logicalMinimumLevelOfDetail + log2DuplicatePyramidCount;
            var logicalTilePyramidDescriptor = new TilePyramidDescriptor(logicalFinestLodWidth, logicalFinestLodHeight, logicalMinimumLevelOfDetail, tileWidth, tileHeight);

            tileIdTransform = tileId =>
            {
                var lod = tileId.LevelOfDetail - log2DuplicatePyramidCount;
                var detailWidthInTiles  = logicalTilePyramidDescriptor.GetLevelOfDetailWidthInTiles(lod);
                var detailHeightInTiles = logicalTilePyramidDescriptor.GetLevelOfDetailHeightInTiles(lod);
                return(new TileId(tileId.LevelOfDetail - log2DuplicatePyramidCount, tileWrap == TileWrap.Horizontal || tileWrap == TileWrap.Both ? tileId.X % detailWidthInTiles : tileId.X, tileWrap == TileWrap.Vertical || tileWrap == TileWrap.Both ? tileId.Y % detailHeightInTiles : tileId.Y));
            };
            transform = VectorMath.TranslationMatrix3D(tileWrap == TileWrap.Horizontal || tileWrap == TileWrap.Both ? -finestLodWidth / 2L : 0.0, tileWrap == TileWrap.Vertical || tileWrap == TileWrap.Both ? -finestLodHeight / 2L : 0.0, 0.0) * VectorMath.ScalingMatrix3D(1 << log2DuplicatePyramidCount, 1 << log2DuplicatePyramidCount, 1.0);
            ConstructCommon(rasterTileDownloader, useGlobalMemoryCache);
        }