Hello,
when using LayerOverlay with TileType multiple and two InMemoryFeatureLayer (1000 bitmaps of size 350x500)
LayerOverlay _layerOverlay = new LayerOverlay() { TileType = TileType.MultipleTile };
Map1.MapUnit = GeographyUnit.Meter;
Map1.Overlays.Add(_layerOverlay);
_layerOverlay.Layers.Add(inMemoryLayer1);
_layerOverlay.Layers.Add(inMemoryLayer2);
RectangleShape glBB = _layerOverlay.GetBoundingBox();
Map1.CurrentExtent = glBB;
This crash appears: "Ungültiger Parameter.". Which parameter is invalid, and why does your control crash?
bei ThinkGeo.MapSuite.WpfDesktopEdition.Tile.<>c__DisplayClass5.<DrawException>b__3()
bei System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
bei System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
bei System.Windows.Threading.DispatcherOperation.InvokeImpl()
bei System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
bei System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
bei System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
bei System.Windows.Threading.DispatcherOperation.Invoke()
bei System.Windows.Threading.Dispatcher.ProcessQueue()
bei System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
Thinkgeo WPF Control Crash with MultipleTile
Hello,
i´ve got another stacktrace with this error:
It occurs around at the same time the garbage collector run or was running (at around 1,2GB-1,3GB of memory allocation). Is this a Thinkgeo Problem or a .NET Problem?
bei System.Drawing.Bitmap…ctor(Int32 width, Int32 height, PixelFormat format)
bei System.Drawing.Bitmap…ctor(Int32 width, Int32 height)
bei ThinkGeo.MapSuite.WpfDesktopEdition.LayerOverlay.DrawTileCore(Tile tile, RectangleShape targetExtent)
bei ThinkGeo.MapSuite.WpfDesktopEdition.TileOverlay.DrawTile(Tile tile, RectangleShape targetExtent)
bei ThinkGeo.MapSuite.WpfDesktopEdition.TileOverlay.LhQ=(RectangleShape targetExtent, Int32 currentZoomLevel, Tile tile)
bei ThinkGeo.MapSuite.WpfDesktopEdition.TileOverlay.LRQ=(RectangleShape targetExtent, OverlayRefreshType refreshType, Boolean isPanning)
bei ThinkGeo.MapSuite.WpfDesktopEdition.TileOverlay.DrawCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType)
bei ThinkGeo.MapSuite.WpfDesktopEdition.LayerOverlay.DrawCore(RectangleShape targetExtent, OverlayRefreshType refreshType)
bei ThinkGeo.MapSuite.WpfDesktopEdition.Overlay.Draw(RectangleShape targetExtent, OverlayRefreshType refreshType)
bei ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.7RQ=(Overlay overlay, RectangleShape targetExtent, OverlayRefreshType overlayRefreshType, TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)
bei ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.6xQ=(IEnumerable`1 drawingOverlays, RectangleShape targetExtent, OverlayRefreshType refreshType, TimeSpan bufferTime, RequestDrawingBufferTimeType bufferTimeType)
bei ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.6xQ=(RectangleShape targetExtent, OverlayRefreshType refreshType)
bei ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.DrawCore(RectangleShape targetExtent, OverlayRefreshType overlayRefreshType)
bei ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.GRU=(InteractiveResult interactiveResult, InteractiveOverlay interactiveOverlay)
bei ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.GxU=(InteractionArguments interactionArguments)
bei ThinkGeo.MapSuite.WpfDesktopEdition.WpfMap.GhU=(Object sender, MouseWheelEventArgs e)
Hi Tobias,
I have some question about the 1000 bitmaps of size 350x500, do you means it generate 1000 tile images?
If you only use two inmemory feature layer, how you make the size increase to 1.2g to 1.3g, could you please give me more detail information so I can try to reproduce that.
Regards,
Don
Our applications allocates lot of additional memory in other places. It looks like error handling is unclear and not defined.
The error can be reproduced by continuously turning the mouse wheel forward and back, and the crash comes safely reproducably after 1.3G memory is displayed in the Taskmanager for the application.
Hi Tobias,
I did a test sample for simulate your scenario, but I hadn’t succeed reproduce your issue, please view my code as below and let me know whether I missed important thing.
private void DisplayMap_Load(object sender, EventArgs e)
{
AllocateMemory(300 * 1024);
ShapeFileFeatureSource worldFeatureSource = new ShapeFileFeatureSource(@"…\SampleData\Data\Countries02.shp");
ShapeFileFeatureSource usStatesFeatureSource = new ShapeFileFeatureSource(@"…\SampleData\Data\USStates.shp");
InMemoryFeatureLayer worldLayer = new InMemoryFeatureLayer();
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.StartCap = DrawingLineCap.Round;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.EndCap = DrawingLineCap.Round;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
InMemoryFeatureLayer usStatesLayer = new InMemoryFeatureLayer();
usStatesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.State2;
usStatesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.StartCap = DrawingLineCap.Round;
usStatesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
worldFeatureSource.Open();
foreach (Feature f in worldFeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns))
{
worldLayer.InternalFeatures.Add(f);
}
usStatesFeatureSource.Open();
foreach (Feature f in usStatesFeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns))
{
usStatesLayer.InternalFeatures.Add(f);
}
LayerOverlay overlay = new LayerOverlay();
overlay.Layers.Add(worldLayer);
overlay.Layers.Add(usStatesLayer);
winformsMap1.Overlays.Add(overlay);
winformsMap1.CurrentExtent = usStatesFeatureSource.GetBoundingBox();
winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
winformsMap1.Refresh();
}
public void AllocateMemory(int i)
{
List<byte[]> wastedMemory = new List<byte[]>();
int index = 0;
while (index++ < i)
{
byte[] buffer = new byte[4096];
wastedMemory.Add(buffer);
}
}
Regards,
Don