public GraphicsEngine.ArgbColor GetPixel(IRasterPaintContext context, double X, double Y) { //return Color.Beige; if (context?.Bitmap == null) { return(GraphicsEngine.ArgbColor.Transparent); } int x, y; _tfw.World2Image(X, Y, out x, out y); if (x < 0 || y < 0 || x >= _iWidth || y >= _iHeight) { return(GraphicsEngine.ArgbColor.Transparent); } return(context.Bitmap.GetPixel(x, y)); }
async override protected Task DrawRasterParentLayer(IParentRasterLayer rLayer, ICancelTracker cancelTracker, IRasterLayer rootLayer) { IRasterPaintContext paintContext = null; try { if (rLayer is ILayer && ((ILayer)rLayer).Class is IRasterClass) { paintContext = await((IRasterClass)((ILayer)rLayer).Class).BeginPaint(this.Display, cancelTracker); } else if (rLayer is IRasterClass) { paintContext = await((IRasterClass)rLayer).BeginPaint(this.Display, cancelTracker); } string filterClause = String.Empty; if (rootLayer is IRasterCatalogLayer) { filterClause = ((((IRasterCatalogLayer)rootLayer).FilterQuery != null) ? ((IRasterCatalogLayer)rootLayer).FilterQuery.WhereClause : String.Empty); } using (IRasterLayerCursor cursor = await rLayer.ChildLayers(this, filterClause)) { ILayer child; while ((child = await cursor.NextRasterLayer()) != null) //foreach (ILayer child in ((IParentRasterLayer)rLayer).ChildLayers(this, filterClause)) { if (!cancelTracker.Continue) { break; } if (child.Class is IParentRasterLayer) { await DrawRasterParentLayer((IParentRasterLayer)child.Class, cancelTracker, rootLayer); continue; } if (!(child is IRasterLayer)) { continue; } IRasterLayer cLayer = (IRasterLayer)child; RenderRasterLayer rlt = new RenderRasterLayer(this, cLayer, rootLayer, cancelTracker); await rlt.Render(); if (child.Class is IDisposable) { ((IDisposable)child.Class).Dispose(); } } } } finally { if (paintContext != null) { paintContext.Dispose(); } } }