ThinkGeo.com    |     Documentation    |     Premium Support

Zoom Bar overlay with transparency

Hi, I want to add a zoom bar with transparency like image I attached that  Google has.


 



 


Try as I may I cant seem to do it. Any panel that is placed on top of the WinForms control looses its transparency. I can do this with the WPF version of MapSuite but I then loose the speed. The redraw just isnt fast enough. Remember I am using a large static image for the background. So unless you guys have any ideas I think I am stuck and will only be able to put a boring square box on top of the MapSuite win fomrs control.


Thanks for any ideas.


Bob



PS is there going to be an update to the WPF version to make it repaint faster?  
 That would be a lot of help in designing a slick user interface

Bob, 
  
 Thanks for your post. About the winforms Transparent panel placed on top of it, it seems there is some way to go around this, see following links, hope it helps, while I did not try it yet. 
 west-wind.com/WebLog/posts/247977.aspx 
 switchonthecode.com/tutorials/winforms-painting-on-top-of-child-controls 
 stackoverflow.com/questions/282838/drawing-on-top-of-controls-inside-a-panel-c-winforms 
  
 About the performance , I have enhanced the WPF & Winforms version a few days ago, now the panning performance have been enhanced quite a bit, just get the latest version and then try it. 
  
 Thanks. 
  
 Yale 


Thanks a bunch Yale…  
 I will get the latest ASAP ! 
  


Bob, 
  
   We have been up to quite a bit over here.  First we have been working to improving the panning performance of the Winforms and WPF editions and have made allot of progress.  I think we have the Winforms about 80% faster on panning and WPF about 60% or more.  You see the performance gains the most at high resolutions.  The other thing in the works is a WPF edition written from the ground up to support native WPF much better.  In the past the WPF was kind of a copy of the Winforms, this new one leverages WPF much more and is more inline with our Silverlight offering with very responsive panning and zooming along with cool and smooth transitions effects.  If you check out our Silverlight edition it will be like that but even better.  We are also looking to support overlays for bitmap rendering like we do now and also WPF objects so you can get things like blinking points or other WPF effects.  We are making good progress and should release a beta pretty soon.  I will see if I can at least get a video out to show you all.  Good stuff! 
  
 David

Thanks David could not come at a better time.  
  


Thank you Bob for giving us the idea of a Transparent Zoom Bar for a Code Community project. We added this idea to our list and there should be that project posted soon in the Code Community.

Yale and everyone else. Tested the latest build The desktop edition just gets better and better. The WPF seems much better as well but I have run into a snag somewhere. The WPF version was panning and moving very well then started to slow down more and more to the point of becoming unresponsive. All I did was zoom up and down and pan around on each zoom level for a while. Seems like a memory leak or it could be some sort of image tile rebuild error…   
 But not to be a downer this is a MAJOR improvement. Hats off… 
 I have more testing to do but you guys have really improved things for me with these modifications.  
  


Bob, 
  
 Thanks for your words and encouragement. 
  
 Just make sure what you means that after some operations(paning or zooming) on the WPF control, there seems some memory leak on it right, can this be recreated on our HowDoI sample? Besides, could you have a try that this same thing would happen on the Winforms map or not? 
  
 Thanks for your information. 
  
 Yale

can this be recreated on our HowDoI sample?  
 I dont think you have anything that compares. I am using a large sattelite image map as my (jp2) file as my backdrop. Large as in 39000x18000 pixels. I pre-generate tiles at multiple zoom levels to improve performance. I then create geometry on and overlay and update it in realtime.  
 So I dont think you have anything that comes close in comparison.  
  
 >>Besides, could you have a try that this same thing would happen on the Winforms map or not?  
 I have not noticed it yet. It is not easy to reproduce. I was able to recreate the issue twice then went back in did just as much zooming and  
 paning and everything was fine. ??? It could have something tied to the speed that I zoom up down and pan not sure. But I am sure it will be resovled. In fact I am porting all my winform code over to WPF and try and keep the two codebases going. If there is anything you need let me know set up a case or whatever and I will try to provide. The shell application I used to create the issue was pretty small.  
  
  


      Here is why I like WPF. When it comes to interface creation you can do some cool stuff. here is a Zoombar



Yale,


I did have one real issue. The WPF control would not load. I do have the older version and the new version on this PC but for some reason the new version would not load. It wasnt until I copied the older DLL's over to the directory I was referenceing that I could load my application again. Not really sure why that would happen. Registry and versioning maybe? Anyway until that point this thing was humming. I am going to try and delete the control replace the DLL's and put the control back on the WPF window and see if that fixes it.  I can keep going. 


 



 


Bob,
 
Your Zoombar looks very cool.
 
I jump in and see if there is something I can help, and I think maybe Yale or someone else will give you more information about your questions.
 
About the issue that WPF control would not load, could you provide the source code of loading layers and settings of WpfMap, just like the code below from HowDoI sample.
 
        private void DisplayASimpleMap_Loaded(object sender, RoutedEventArgs e)
        {
            wpfMap1.MapUnit = GeographyUnit.DecimalDegree;
            wpfMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

            WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();
            wpfMap1.Overlays.Add(worldMapKitDesktopOverlay);

            wpfMap1.CurrentExtent = new RectangleShape(-133.2515625, 89.2484375, 126.9046875, -88.290625);
            wpfMap1.Refresh();
        }

 
Thanks
 
James

private void DisplayASimpleMap_Loaded(object sender, RoutedEventArgs e) 
         { 
             wpfMap1.MapUnit = GeographyUnit.Meters; 
             wpfMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); 
  
             Jpeg2000RasterLayer jpeg2000RasterLayer = new Jpeg2000RasterLayer(jpegFileName); 
             jpeg2000RasterLayer.UpperThreshold = 10000000;             
             jpeg2000RasterLayer.LowerThreshold = 0; 
  
             LayerOverlay imageOverlay = new LayerOverlay(); 
             FileBitmapTileCache fileBitmapTileCache = new FileBitmapTileCache(cacheDirectory, string.Empty); 
             fileBitmapTileCache.TileMatrix.TileWidth = 512; 
             fileBitmapTileCache.TileMatrix.TileHeight = 512; 
             fileBitmapTileCache.TileAccessMode = TileAccessMode.ReadAdd; 
             imageOverlay.TileCache = fileBitmapTileCache; 
              
             imageOverlay.Layers.Add("JpegImageLayer", jpeg2000RasterLayer); 
                         
             wpfMap1.Overlays.Add(imageOverlay); 
  
             jpeg2000RasterLayer.Open(); 
             wpfMap1.CurrentExtent = jpeg2000RasterLayer.GetBoundingBox(); 
             wpfMap1.CurrentScale = zoomLevels[2].Scale; // 0 is too small 
  
             wpfMap1.Refresh(); 
         }

Bob, 
  
 Thanks for your sharing and sorry for my delay on replying your post. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale

This would be a great feature! I see the topic in the Code Gallery (code.thinkgeo.com/issues/show/137), any idea when?

Bob, 
  
 I have tested your code and found the problem is caused by TileWidth and TileHeight, the default value is 256, but you set 512, if you comment out those two lines, it works fine. 
             //fileBitmapTileCache.TileMatrix.TileWidth = 512; 
             //fileBitmapTileCache.TileMatrix.TileHeight = 512; 
  
 It’s a bug, I have added it to our Issue Track system, we will work on it soon, if we fix it I will let you know. 
  
 Thanks 
 James

James & Bob, 
  
 I tested the code pasted above against last public release 3.1.299 in WinXp 32 bit OS, it works fine. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale