Ejemplo n.º 1
0
        public override void Render(Graphics g, MapViewport map)
        {
            ViewPort viewport;

            if (!_maps.TryGetValue(map.ID, out viewport))
            {
                viewport = new ViewPort();

                _maps.Add(map.ID, viewport);
            }

            _viewPort = viewport;

            LastRenderedSize    = map.Size;
            LastRenderedExtents = map.Envelope;
            if (RequiresRedraw || CachedBitmap == null)
            {
                var bmp = new Bitmap(LastRenderedSize.Value.Width, LastRenderedSize.Value.Height);
                using (Graphics g2 = Graphics.FromImage(bmp))
                {
                    _innerLayer.Render(g2, map);
                    CachedBitmap = bmp;
                }
            }
            RequiresRedraw = false;
            g.DrawImageUnscaled(CachedBitmap, 0, 0);
            base.Render(g, map);
        }
Ejemplo n.º 2
0
 public override void Render(Graphics g, Map map)
 {
     LastRenderedSize    = map.Size;
     LastRenderedExtents = map.Envelope;
     if (RequiresRedraw || CachedBitmap == null)
     {
         var bmp = new Bitmap(LastRenderedSize.Value.Width, LastRenderedSize.Value.Height);
         using (Graphics g2 = Graphics.FromImage(bmp))
         {
             _innerLayer.Render(g2, map);
             CachedBitmap = bmp;
         }
     }
     RequiresRedraw = false;
     g.DrawImageUnscaled(CachedBitmap, 0, 0);
     base.Render(g, map);
 }