Exemplo n.º 1
0
        override protected void DrawRasterParentLayer(IParentRasterLayer rLayer, ICancelTracker cancelTracker, IRasterLayer rootLayer)
        {
            if (rLayer is ILayer && ((ILayer)rLayer).Class is IRasterClass)
            {
                ((IRasterClass)((ILayer)rLayer).Class).BeginPaint(this.Display, cancelTracker);
            }
            else if (rLayer is IRasterClass)
            {
                ((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 = ((IParentRasterLayer)rLayer).ChildLayers(this, filterClause))
            {
                ILayer child;

                while ((child = cursor.NextRasterLayer) != null)
                //foreach (ILayer child in ((IParentRasterLayer)rLayer).ChildLayers(this, filterClause))
                {
                    if (!cancelTracker.Continue)
                    {
                        break;
                    }
                    if (child.Class is IParentRasterLayer)
                    {
                        DrawRasterParentLayer((IParentRasterLayer)child.Class, cancelTracker, rootLayer);
                        continue;
                    }
                    if (!(child is IRasterLayer))
                    {
                        continue;
                    }
                    IRasterLayer cLayer = (IRasterLayer)child;

                    RenderRasterLayerThread rlt = new RenderRasterLayerThread(this, cLayer, rootLayer, cancelTracker);
                    rlt.Render();

                    if (child.Class is IDisposable)
                    {
                        ((IDisposable)child.Class).Dispose();
                    }
                }
            }
            if (rLayer is ILayer && ((ILayer)rLayer).Class is IRasterClass)
            {
                ((IRasterClass)((ILayer)rLayer).Class).EndPaint(cancelTracker);
            }
            else if (rLayer is IRasterClass)
            {
                ((IRasterClass)rLayer).EndPaint(cancelTracker);
            }
        }
Exemplo n.º 2
0
        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();
                }
            }
        }