Ejemplo n.º 1
0
        private List <ViewerControl.PaintKit> AssembleLayer(PaintSpecification e, LatLonZoom llz, IDisplayableSource tileSource, int stackOrder)
        {
            List <ViewerControl.PaintKit> list = new List <ViewerControl.PaintKit>();
            CoordinateSystemIfc           defaultCoordinateSystem = tileSource.GetDefaultCoordinateSystem();
            TileDisplayDescriptorArray    tileArrayDescriptor     = defaultCoordinateSystem.GetTileArrayDescriptor(llz, e.Size);
            AsyncRef asyncRef;

            try
            {
                asyncRef = (AsyncRef)tileSource.GetUserBounds(null, (FutureFeatures)7).Realize("ViewerControl.PaintLayer boundsRef");
            }
            catch (Exception ex)
            {
                ViewerControl.MessagePainter item = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? ex.ToString() : "X", stackOrder == 0);
                foreach (TileDisplayDescriptor current in tileArrayDescriptor)
                {
                    list.Add(new ViewerControl.PaintKit(current.paintLocation)
                    {
                        annotations =
                        {
                            item
                        }
                    });
                }
                return(list);
            }
            Region clipRegion = null;

            if (asyncRef.present == null)
            {
                asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.BoundsRefAvailable));
                asyncRef.SetInterest(524290);
            }
            if ((this.ShowSourceCrop == null || this.ShowSourceCrop.Enabled) && asyncRef.present is IBoundsProvider)
            {
                clipRegion = ((IBoundsProvider)asyncRef.present).GetRenderRegion().GetClipRegion(defaultCoordinateSystem.GetUnclippedMapWindow(this.center().llz, e.Size), this.center().llz.zoom, defaultCoordinateSystem);
                this.UpdateUserRegion();
            }
            new PersistentInterest(asyncRef);
            int num = 0;

            foreach (TileDisplayDescriptor current2 in tileArrayDescriptor)
            {
                ViewerControl.PaintKit paintKit = new ViewerControl.PaintKit(current2.paintLocation);
                D.Sayf(10, "count {0} tdd {1}", new object[]
                {
                    num,
                    current2.tileAddress
                });
                num++;
                if (e.SynchronousTiles)
                {
                    D.Sayf(0, "PaintLayer({0}, tdd.ta={1})", new object[]
                    {
                        tileSource.GetHashCode(),
                        current2.tileAddress
                    });
                }
                bool    arg_1F5_0 = e.SynchronousTiles;
                Present present   = tileSource.GetImagePrototype(null, (FutureFeatures)15).Curry(new ParamDict(new object[]
                {
                    TermName.TileAddress,
                    current2.tileAddress
                })).Realize("ViewerControl.PaintLayer imageAsyncRef");
                AsyncRef  asyncRef2 = (AsyncRef)present;
                Rectangle rectangle = Rectangle.Intersect(e.ClipRectangle, current2.paintLocation);
                int       interest  = rectangle.Height * rectangle.Width + 524296;
                asyncRef2.SetInterest(interest);
                if (asyncRef2.present == null)
                {
                    ViewerControl.AsyncNotifier @object = new ViewerControl.AsyncNotifier(this);
                    asyncRef2.AddCallback(new AsyncRecord.CompleteCallback(@object.AsyncRecordComplete));
                }
                this.activeTiles.Add(asyncRef2);
                asyncRef2 = (AsyncRef)asyncRef2.Duplicate("ViewerControl.PaintLayer");
                if (e.SynchronousTiles)
                {
                    D.Assert(false, "unimpl");
                }
                if (asyncRef2.present == null)
                {
                    D.Assert(!e.SynchronousTiles);
                }
                bool flag;
                if (asyncRef2.present != null && asyncRef2.present is ImageRef)
                {
                    flag = false;
                    ImageRef imageRef = (ImageRef)asyncRef2.present.Duplicate("tpc");
                    paintKit.meatyParts.Add(new ViewerControl.ImagePainter(imageRef, clipRegion));
                }
                else
                {
                    if (asyncRef2.present != null && asyncRef2.present is BeyondImageBounds)
                    {
                        flag = false;
                    }
                    else
                    {
                        if (asyncRef2.present != null && asyncRef2.present is PresentFailureCode)
                        {
                            flag = false;
                            PresentFailureCode           presentFailureCode = (PresentFailureCode)asyncRef2.present;
                            ViewerControl.MessagePainter item2 = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? StringUtils.breakLines(presentFailureCode.ToString()) : "X", stackOrder == 0);
                            paintKit.annotations.Add(item2);
                        }
                        else
                        {
                            flag = true;
                            ViewerControl.MessagePainter item3 = new ViewerControl.MessagePainter(stackOrder * 12, stackOrder.ToString(), stackOrder == 0);
                            if (stackOrder == 0)
                            {
                                paintKit.meatyParts.Add(item3);
                            }
                            else
                            {
                                paintKit.annotations.Add(item3);
                            }
                        }
                    }
                }
                this.tilesRequired++;
                if (!flag)
                {
                    this.tilesAvailable++;
                }
                if ((flag && stackOrder == 0) || MapDrawingOption.IsEnabled(this.ShowTileBoundaries))
                {
                    paintKit.annotations.Add(new ViewerControl.TileBoundaryPainter());
                }
                if (MapDrawingOption.IsEnabled(this.ShowTileNames))
                {
                    paintKit.annotations.Add(new ViewerControl.TileNamePainter(current2.tileAddress.ToString()));
                }
                asyncRef2.Dispose();
                list.Add(paintKit);
            }
            return(list);
        }
Ejemplo n.º 2
0
 private List<ViewerControl.PaintKit> AssembleLayer(PaintSpecification e, LatLonZoom llz, IDisplayableSource tileSource, int stackOrder)
 {
     List<ViewerControl.PaintKit> list = new List<ViewerControl.PaintKit>();
     CoordinateSystemIfc defaultCoordinateSystem = tileSource.GetDefaultCoordinateSystem();
     TileDisplayDescriptorArray tileArrayDescriptor = defaultCoordinateSystem.GetTileArrayDescriptor(llz, e.Size);
     AsyncRef asyncRef;
     try
     {
         asyncRef = (AsyncRef)tileSource.GetUserBounds(null, (FutureFeatures)7).Realize("ViewerControl.PaintLayer boundsRef");
     }
     catch (Exception ex)
     {
         ViewerControl.MessagePainter item = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? ex.ToString() : "X", stackOrder == 0);
         foreach (TileDisplayDescriptor current in tileArrayDescriptor)
         {
             list.Add(new ViewerControl.PaintKit(current.paintLocation)
             {
                 annotations =
                 {
                     item
                 }
             });
         }
         return list;
     }
     Region clipRegion = null;
     if (asyncRef.present == null)
     {
         asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.BoundsRefAvailable));
         asyncRef.SetInterest(524290);
     }
     if ((this.ShowSourceCrop == null || this.ShowSourceCrop.Enabled) && asyncRef.present is IBoundsProvider)
     {
         clipRegion = ((IBoundsProvider)asyncRef.present).GetRenderRegion().GetClipRegion(defaultCoordinateSystem.GetUnclippedMapWindow(this.center().llz, e.Size), this.center().llz.zoom, defaultCoordinateSystem);
         this.UpdateUserRegion();
     }
     new PersistentInterest(asyncRef);
     int num = 0;
     foreach (TileDisplayDescriptor current2 in tileArrayDescriptor)
     {
         ViewerControl.PaintKit paintKit = new ViewerControl.PaintKit(current2.paintLocation);
         D.Sayf(10, "count {0} tdd {1}", new object[]
         {
             num,
             current2.tileAddress
         });
         num++;
         if (e.SynchronousTiles)
         {
             D.Sayf(0, "PaintLayer({0}, tdd.ta={1})", new object[]
             {
                 tileSource.GetHashCode(),
                 current2.tileAddress
             });
         }
         bool arg_1F5_0 = e.SynchronousTiles;
         Present present = tileSource.GetImagePrototype(null, (FutureFeatures)15).Curry(new ParamDict(new object[]
         {
             TermName.TileAddress,
             current2.tileAddress
         })).Realize("ViewerControl.PaintLayer imageAsyncRef");
         AsyncRef asyncRef2 = (AsyncRef)present;
         Rectangle rectangle = Rectangle.Intersect(e.ClipRectangle, current2.paintLocation);
         int interest = rectangle.Height * rectangle.Width + 524296;
         asyncRef2.SetInterest(interest);
         if (asyncRef2.present == null)
         {
             ViewerControl.AsyncNotifier @object = new ViewerControl.AsyncNotifier(this);
             asyncRef2.AddCallback(new AsyncRecord.CompleteCallback(@object.AsyncRecordComplete));
         }
         this.activeTiles.Add(asyncRef2);
         asyncRef2 = (AsyncRef)asyncRef2.Duplicate("ViewerControl.PaintLayer");
         if (e.SynchronousTiles)
         {
             D.Assert(false, "unimpl");
         }
         if (asyncRef2.present == null)
         {
             D.Assert(!e.SynchronousTiles);
         }
         bool flag;
         if (asyncRef2.present != null && asyncRef2.present is ImageRef)
         {
             flag = false;
             ImageRef imageRef = (ImageRef)asyncRef2.present.Duplicate("tpc");
             paintKit.meatyParts.Add(new ViewerControl.ImagePainter(imageRef, clipRegion));
         }
         else
         {
             if (asyncRef2.present != null && asyncRef2.present is BeyondImageBounds)
             {
                 flag = false;
             }
             else
             {
                 if (asyncRef2.present != null && asyncRef2.present is PresentFailureCode)
                 {
                     flag = false;
                     PresentFailureCode presentFailureCode = (PresentFailureCode)asyncRef2.present;
                     ViewerControl.MessagePainter item2 = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? StringUtils.breakLines(presentFailureCode.ToString()) : "X", stackOrder == 0);
                     paintKit.annotations.Add(item2);
                 }
                 else
                 {
                     flag = true;
                     ViewerControl.MessagePainter item3 = new ViewerControl.MessagePainter(stackOrder * 12, stackOrder.ToString(), stackOrder == 0);
                     if (stackOrder == 0)
                     {
                         paintKit.meatyParts.Add(item3);
                     }
                     else
                     {
                         paintKit.annotations.Add(item3);
                     }
                 }
             }
         }
         this.tilesRequired++;
         if (!flag)
         {
             this.tilesAvailable++;
         }
         if ((flag && stackOrder == 0) || MapDrawingOption.IsEnabled(this.ShowTileBoundaries))
         {
             paintKit.annotations.Add(new ViewerControl.TileBoundaryPainter());
         }
         if (MapDrawingOption.IsEnabled(this.ShowTileNames))
         {
             paintKit.annotations.Add(new ViewerControl.TileNamePainter(current2.tileAddress.ToString()));
         }
         asyncRef2.Dispose();
         list.Add(paintKit);
     }
     return list;
 }