ThinkGeo.com    |     Documentation    |     Premium Support

Multithread and layers not being drawn

Using the 4.0 install.


 I am moving from Single Thread mode to Multi Thread mode.  When doing this I see a very nice improvement in my draw/scroll/pan times.  I am seeing a few drawing issues that I am sure have something to do with how I set up the layers or overlays, but I can't find anything on it through a quick search.  I don't know the best way to explain, so please ask for clarification if needed.


When I display the map and scroll to areas that are in the cache (created when in single threaded mode) the map displays great.  When I scroll to new areas, the shapefiles will either not display at all or will not be rendered fully.  It acts like it can't create new cache tiles and uses other zoom level tiles if it can find those instead.


 I also attempt to use InMemoryFeatureLayer at various times through the test and I am not getting any of those shapes/features displayed on the screen.  All of these features/layers display and render successfully in SingleThreaded mode, it is just slower.


 My question is do I need to do any other setup when switching to multithreaded mode?  I have set the TileAccessMode to ReadAdd.


Jake


 


 



I found when I stop using PreviewTileCache that I don’t get the same issues I posted above.  But I also don’t get the smooth pan/zoom functionality that I want.  Any suggestions on how to use PreviewTileCache correctly?

Jake,


Just make sure are you setting different folder for the PreviewTileCache and TileCache for the same overlay?
 
Following posts are related with Multi-threaded tile cache, have a look if you are interested:
gis.thinkgeo.com/Support/DiscussionForums/tabid/143/aff/21/aft/6414/afv/topic/Default.aspx
gis.thinkgeo.com/Support/Dis...fault.aspx
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Yale, 



That discussion doesn't quite cover what I am seeing.  My issue is when I have previewTileCache set, to different directory than tilecache, I lose my inMemoryFeatureLayers and an MSSql2008FeatureLayer.  These are layers are added to Overlays that do that have any caching in place.  Do I need to add caching for all my overlays if I want to use the caching functionality?  I did not have to do that for SingleThreadedMode.



Jake



Jake, 
  
 I think you do not need to add tile caching for all your overlays, just need to add tile cache to the overlay you want to do performance enhancement, no matter in SingleThreaded mode or Multi-threaded mode. 
  
 If possible, could you send me a small sample application to recreate your problem? 
  
 Any more questions just feel free to let us know. 
  
 Thanks. 
  
 Yale 


I am not sure if I can get a simple application to create these issues.  I don’t believe I have an overly complicated project, but it contains 3 overlays with shapefilefeaturelayers, 1 overlay with a MsSql2008FeatureLayer, 2 Overlays that contain inMemoryFeatureLayers. 
  
 When I create “simple” applications with some of these overlays and caching enabled I get mixed results.  It is even difficult to explain in text what is happening.  I get different results when I use different scales, different resolutions, different cache techniques, different threadingmodes.  I would send you my code base if I thought that would help, but with custom databases and shapefiles, I don’t know if you could recreate the issue.  I am free during weekdays (8-6 US Central Timezone) for a shared meeting or anything of that nature if you think that would help.

Jake, 
  
 Probably there are some hidden bugs when using multi threaded mode for multiple overlays application. Personally I think the multi threaded mode is not as stable as single threaded mode both in Winforms and Wpf controls.  While in the new Wpf version, we use a complete new logic making the multi-threaded mode much more stable then current version.  
  
 Any all, I will log this issue into our working plan list, and hope we can get it enhanced in future, sorry for the inconvenience now. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale, this is a very discouraging response.   We have been told for the past several months that the May release was going to be much faster, and put an end to these vague multi-threading issues.   I was just about to try and convert our app to multi-threaded use.   Now we find out that nothing has changed? 
  
 It also appears that the solution to most issues recently has been to "wait for our new wpf version".  Personally, I have no interest in the wpf version.  I just want the original winforms version that I purchased to work as advertised.   Am I now using a dead product?

Ted,


I am sorry to say that even thought we already put some efforts on the multi-threading issue and we did get some improvement.  It seems still some exceptions still exist. In the past couple of months, we are busy on the customer services, new products development etc. We are sure that we will put more effects on this to mark its end in the near future. Sorry for the inconvenience for now.
 
Thanks.
 
Yale

Yale,



     Is there also an issue with Tile Cache and multi-threaded mode?  I am still attempting to use multithreaded mode and simply work around the issues I find hoping they will be fixed in a build in the near future.  WHen I am zooming in quickly with the mouse wheel, so I am trying to zoom 2-3 levels with one mouse wheel scroll, and the area I am looking at doesn't have cached tiles it appears that several tiles will be placed into the wrong directory.



Steps I use to recreate:

1.  Use world mapkitdemo

2.  Use Multithreaded mode

3.  Use precache and cache

4.  Use set isbase = true

 Basically add the following lines:

            Map.ThreadingMode = MapThreadingMode.Multithreaded;

            FileBitmapTileCache bitCache = new FileBitmapTileCache(string.Format("c:\\temp2\\mapcache"), "cache1");

            FileBitmapTileCache prebitCache = new FileBitmapTileCache(string.Format("c:\\temp2\\premapcache"), "precache1");

            worldMapKitRenderLayerOverlay.TileCache = bitCache;

            worldMapKitRenderLayerOverlay.PreviewTileCache = prebitCache;

            worldMapKitRenderLayerOverlay.IsBase = true;


5.  Start the application and start zooming into a city

6.  Zoom in several steps at a time, before the rendering is complete for the levels. 

7.  Zoom out/in to several different areas, don't wait for rendering to complete, just zoom in and out quicky to different areas.

8.  THe majority of the time everything looks right.  Occassionally a tile will be in the wrong layer though.  I have attached a file showing 1 sample.  I can recreate this if you need more samples.


I am using 4.0.10.0 dlls and the World Map Kit Demo to create the images.


Thanks


Jake



2080-ZoomLevelIssue.docx (364 KB)

Jake, 
  
 Sorry for the delay and thanks for your detailed reporting. 
  
 We may put on more efforts to enhance the Multi-threaded stuff in the Winforms Map control in the coming days. I agree that some strange behaviors will be happening if we navigate the map control in a fast pat. 
  
 Thanks. 
  
 Yale 


Any updates on this?  I am still seeing incorrect tiles in the 4.0.49.0 build.

Jake, 
  
 I am sorry to say that we have not started to focus on this issue yet; it is still on our working list. Sorry for the delay. 
  
 Thanks. 
  
 Yale 


 Hi,


I'm experiencing the same behaviour in 5.5.0.50


This make the caching system simply unusable.


What is the status, it looks it has been reported since a while.


Patrick.



Hi Patrick, 
  
 We fixed an cache issue for 5.5 in latest development builds, could you download that from helpdesk.thinkgeo.com and have a look whether that solve your cache issue? 
  
 Regards, 
  
 Don

Don, 
  
 I just tried 5.5.0.83 and get exceptions while zooming out: 
  
    à System.ThrowHelper.ThrowArgumentOutOfRangeException() 
    à System.Collections.Generic.List`1.get_Item(Int32 index) 
    à System.Collections.ObjectModel.Collection`1.get_Item(Int32 index) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.2hU=() 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.HRY=(Int32 HhY=) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.GxY=(Int32 HBY=) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.FBY=(InteractionArguments FRY=) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.8RU=(Object 8hU=, ZBc= 8xU=) 
    à 7xM=.bhU=.OnMouseEvent(ZBc= e) 
    à 7xM=.bhU=.kxU=(Double lBU=, Double lRU=, Double lhU=, Double lxU=, Int32 mBU=) 
    à ThinkGeo.MapSuite.DesktopEdition.WinformsMap.ERY=(Object EhY=, MouseEventArgs ExY=) 
    à System.Windows.Forms.Control.OnMouseWheel(MouseEventArgs e) 
    à System.Windows.Forms.Control.WmMouseWheel(Message& m) 
    à System.Windows.Forms.Control.WndProc(Message& m) 
    à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) 
    à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) 
    à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) 
    à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) 
    à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) 
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) 
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) 
    à System.Windows.Forms.Application.Run(Form mainForm) 
    à Gorba.icenter.Motion.DataManager.Program.Main() dans D:\ToBackup\Gorba\france\trunk\icenter\Motion\Project\icenter.DataManager\Program.cs:ligne 28 
    à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
    à System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args) 
    à System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel) 
    à System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() 
    à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData) 
    à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext) 
    à System.Activator.CreateInstance(ActivationContext activationContext) 
    à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() 
    à System.Threading.ThreadHelper.ThreadStart_Context(Object state) 
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx) 
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
    à System.Threading.ThreadHelper.ThreadStart() 
  
 Please advise. 
 Patrick.

I mean 5.5.83.0 :)

Hello Patrick, 
  
 Thanks for your further information, how can I recreate this problem? Can I try with your sample above? It’s very old and I don’t know if you have update anything. 
  
 Sorry for the inconvenience. 
  
 Regards, 
  
 Gary