Our product allows the user to specify a background image for use with their map. We add it to the map by instantiating a GdiPlusRasterLayer and adding it as the first (back) layer of our static layers overlay. In addition to the (optional) background image, that overlay also can contain (optionally) one or more shape file layers.
We've seen performance problems before when customers use large high resolution images. The current problem involves use of a JPG with a file size of 70.2MB and resolution of 11410 by 12972. The customer wants to use this image because it will give him a nice high fidelity image when zoomed in. However, addition of this image consumes a LOT of resources and slows our product to an almost unusable crawl. Also, when zooming in, it will eventually produce an exception in GDI+. Simply compressing the file down to ~30MB did not correct the problem.
The exception call stack is pasted below.
System.Runtime.InteropServices.ExternalException
A generic error occurred in GDI+.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawImage(Image image, PointF[] destPoints, RectangleF srcRect, GraphicsUnit srcUnit)
at ThinkGeo.MapSuite.Core.GdiPlusRasterSource.dyk=(Bitmap sourceBitmap, RectangleF sourceRectangle, Int32 tempReturnWidth, Int32 tempReturnHeight)
at ThinkGeo.MapSuite.Core.GdiPlusRasterSource.GetImageCore(RectangleShape worldExtent, Int32 canvasWidth, Int32 canvasHeight)
at ThinkGeo.MapSuite.Core.RasterSource.GetImage(RectangleShape worldExtent, Int32 canvasWidth, Int32 canvasHeight)
at ThinkGeo.MapSuite.Core.RasterLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.GdiPlusRasterLayer.DrawCore(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.Core.Layer.Draw(GeoCanvas canvas, Collection`1 labelsInAllLayers)
at ThinkGeo.MapSuite.DesktopEdition.LayerOverlay.DrawCore(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.YRQ=(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.Overlay.Draw(GeoCanvas canvas)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.LRQ=(IEnumerable`1 drawingOverlays, RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.KxQ=(RectangleShape drawingExtent, RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.UhQ=(RectangleShape extent, Overlay overlay, Int32 width, Int32 height, GeographyUnit geographyUnit)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.VRQ=(IEnumerable`1 drawingOverlays)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.TBQ=(RectangleShape extent)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.RBQ=(InteractionArguments interactionArguments)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.ORQ=(Object sender, qxQ= e)
at ThinkGeo.MapSuite.DesktopEdition.MouseEventAnalyzer.OnMouseEvent(qxQ= e)
at ThinkGeo.MapSuite.DesktopEdition.MouseEventAnalyzer.qBQ=(Double screenX, Double screenY, Double worldX, Double worldY, MapMouseButton mouseButton)
at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.QxQ=(Object sender, MouseEventArgs e)
at System.Windows.Forms.Control.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Toro.Client.ApplicationManager.Main() in d:\Toro\Archer\Solution\Client\ClientHost\ApplicationManager.cs:line 418