/// <summary> /// This method overrides from its base class TileOverlay. /// It actually requests image for the passed tile with the passed world extent. /// </summary> /// <param name="tile">A tile object that creating by the GetTileCore method. It's the tile which needs to be draw in this mehtod.</param> /// <param name="targetExtent">A world extent that to draw the passed tile object.</param> protected override void DrawTileCore(Wpf.Tile tile, RectangleShape targetExtent) { LayerTile layerTile = tile as LayerTile; if (layerTile != null) { layerTile.TileCache = TileCache; layerTile.DrawingLayers.Clear(); layerTile.DrawingLayers.Add(wktLayer); Bitmap nativeImage = new Bitmap((int)tile.Width, (int)tile.Height); PlatformGeoCanvas geoCanvas = new PlatformGeoCanvas(); geoCanvas.BeginDrawing(nativeImage, targetExtent, MapArguments.MapUnit); if (tile.IsAsync) { layerTile.DrawAsync(geoCanvas); } else { layerTile.Draw(geoCanvas); geoCanvas.EndDrawing(); layerTile.CommitDrawing(geoCanvas, MapUtils.GetImageSourceFromNativeImage(nativeImage)); } } }
protected override void DrawTileCore(GeoCanvas geoCanvas) { base.DrawTileCore(geoCanvas); LayerTile layerTile = OverlayCanvas.Children.OfType <LayerTile>().FirstOrDefault(tmpTile => tmpTile.GetValue(FrameworkElement.NameProperty).Equals("DefaultLayerTile")); if (layerTile != null) { layerTile.DrawingLayers.Insert(0, ShapeLayer); layerTile.Draw(geoCanvas); } }
private LayerTile DrawHighlightTile(RectangleShape targetExtent, LayerTile tile) { tile.DrawingLayers.Clear(); if (highlightFeatureLayer.InternalFeatures.Count > 0) { tile.DrawingLayers.Add(highlightFeatureLayer); } GeoCanvas geoCanvas = new PlatformGeoCanvas() { CompositingQuality = CompositingQuality.HighSpeed, DrawingQuality = DrawingQuality.HighSpeed, SmoothingMode = SmoothingMode.HighSpeed }; Bitmap bitmap = new Bitmap((int)tile.Width, (int)tile.Height); geoCanvas.BeginDrawing(bitmap, targetExtent, MapArguments.MapUnit); tile.Draw(geoCanvas); geoCanvas.EndDrawing(); tile.CommitDrawing(geoCanvas, MapSuiteSampleHelper.GetImageSourceFromNativeImage(bitmap)); return(tile); }
private void RedrawTile(LayerTile layerTile) { int tileSW = (int)MapArguments.ActualWidth; int tileSH = (int)MapArguments.ActualHeight; GeoCanvas geoCanvas = null; object nativeImage = null; if (RenderMode == RenderMode.DrawingVisual) { geoCanvas = new DrawingVisualGeoCanvas(); nativeImage = new RenderTargetBitmap(tileSW, tileSH, geoCanvas.Dpi, geoCanvas.Dpi, PixelFormats.Pbgra32); } else { nativeImage = new System.Drawing.Bitmap(tileSW, tileSH); geoCanvas = new PlatformGeoCanvas(); } geoCanvas.BeginDrawing(nativeImage, layerTile.TargetExtent, MapArguments.MapUnit); layerTile.Draw(geoCanvas); geoCanvas.EndDrawing(); layerTile.CommitDrawing(geoCanvas, GetImageSourceFromNativeImage(nativeImage)); }
private LayerTile DrawHighlightTile(RectangleShape targetExtent, LayerTile tile) { tile.DrawingLayers.Clear(); if (highlightFeatureLayer.InternalFeatures.Count > 0) { tile.DrawingLayers.Add(highlightFeatureLayer); } GeoCanvas geoCanvas = new GdiPlusGeoCanvas() { CompositingQuality = CompositingQuality.HighSpeed, DrawingQuality = DrawingQuality.HighSpeed, SmoothingMode = SmoothingMode.HighSpeed }; Bitmap bitmap = new Bitmap((int)tile.Width, (int)tile.Height); geoCanvas.BeginDrawing(bitmap, targetExtent, MapArguments.MapUnit); tile.Draw(geoCanvas); geoCanvas.EndDrawing(); tile.CommitDrawing(geoCanvas, MapSuiteSampleHelper.GetImageSourceFromNativeImage(bitmap)); return tile; }