I use Desktop Edition Map-Control in our GIS-Application. As recommended I use tile caching for overlays (layers) when they contain many data. Also I use tile cache in combination with IsBase=true to display a background layer when the map is panned by the user. But I also have overlays (layers) they contain only a few features so I do not need to use tile cache.
This means the Map-Control has to draw overlays with IsBase active and inactive. This causes an flickering effect when panning the map. I have attached a sample application where you can see this effect. You can cause the flickering effect with the following steps
- zoom in
- activate checkbox
- pan the map slowly to any direction
While panning the map is appears/disappears many times. If you stop panning without releasing the mouse button the layer is not shown.
This is a very annoying effect. Do you have any solutions to solve this behaviour?
I found the problem did exist in the sample you provided, while if we changed 2 places, it is working decently.
1) This is the most important one: using single threaded mode instead of multithreaded mode. I think we have addressed this before that the winforms map control will introduce some unexpected problems in multithreaded mode, for this reason we have rewrite the wpf control successfully in the new wpf desktop edition, and we are probably going to rewrite or enhance the multithreaded part for the winforms map control, while it will be great changes and quite complicated so I think it will take time to get it done, sorry for the inconvenience for now.
2) Also, I prefer to use the FileBitmapTileCache compared to InmemoryBitmapTileCache unless you have some special requirement.
Attachment is the updated version of sample. Any more questions or concerns please do not hesitate to let me know.
thanks for info. This is no good news. I know that I can use the Map-Control in single thread mode but we ordered desktop edition to run it in multi threaded mode so it matches our architecture. In the past I found many post in this forum regarding problems with map control running in multi thread mode also in combination with drawing issues when using tile cache.
I think multi thread mode and tile cache are base factors for good drawing performance so I hope you bug fix the multithreaded part for the winforms control soon.
I have passed the requirement and this post thread to our development team, hope they can start it soon. As far as I know, we need to do some architecture changes for the desktop edition if we want to do the get it enhanced in the wpf control has done which will definitely take quite some time.
I am sorry to say that our development team is quite busy recently, so we do not have a chance to get the multithreaded part rewrote for now, I am feeling guilty if causing you any inconvenience for now.
does this mean you never want to fix the multithreaded mode?
As I mentioned above the multithreaded mode was one of the main arguments to choose ThinkGeo products. At the moment we get many tickets from our customers regarding the drawing problems caused by multithread mode. I always replied that the bug will be fixed from ThinkGeo in one of the next ThinkGeo versions. But it looks like that this takes longer as we can wait.
I want to let you know that the multithreaded issue fix and feature enhancement is indeed in our working item list, while I am not sure when it will be done. I will write a mail to our development team to remind them the post. Sorry for the causing inconvenience.
I got the reply from our development team, and he found some reason may cause your problem, please try his updated code which adding the setting of the cache for another overlay(“Overlay1”), also, if you want, you can use the FileBitmapTileCache instead of InmemoryBitmapTileCache.
Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
With Me.WinformsMap1.Overlays("Overlay2") '.TileCache = m_oInMemoryBitmapTileCache .TileCache = m_oFileBitmapTileCache .IsBase = True Me.WinformsMap1.Overlays("Overlay1").TileCache = New ThinkGeo.MapSuite.Core.InMemoryBitmapTileCache End With
Else
With Me.WinformsMap1.Overlays("Overlay2") .TileCache = Nothing .IsBase = False End With
End If
m_oInMemoryBitmapTileCache.ClearCache() m_oFileBitmapTileCache.ClearCache() End Sub
thanks for feedback. I updated my sample and recognized that the flickering effect does not appear when I pan again to an extent that is allready stored in the cache.
But I'm sorry to say that this solution did not work for us because it assumes that all overlays are cached. As I mentioned above we use the MapControl in multithread mode where the tile cache mode is buggy (empty tiles, incorrect tiles, ....)
This means that we try to avoid using the tile cache in our application. I think the right way is to fix the multithreaded mode by your development team.
Thomas
PS We use FileBitmapTileCache in our productive version. InmemoryBitmapTileCache is only used in my sample applications.