ThinkGeo.com    |     Documentation    |     Premium Support

RasterLayer not always drawn after refreash

Hi


I'm calculating an countour map in runtime, and insert this, sometimes when inserting the overlay and making refresh, the bitmap is not drawn, first when forcing the map by zoom/pan.


Some code snipes:


When new bitmap is inserted, i use the following code, to release the old one. (works fine)


            if (winMap.Overlays[1].Name == "GdiLayer")

            {

                winMap.Overlays[1].Lock.EnterWriteLock();

                try

                {

                    GdiPlusRasterLayer a = (GdiPlusRasterLayer)winMap.FindRasterLayer("GdiLayer");

                    if (a != null)

                    {

                        a.Close();

                        a.IsVisible = false;


                        File.Delete(a.PathFilename);

                    }

                }

                finally

                {

                    winMap.Overlays[1].Lock.ExitWriteLock();

                }

                winMap.Overlays.RemoveAt(1);

                winMap.Refresh();

            }


 


Code for  inserting overlay                 


bm.Save(filename, ImageFormat.Png);


                    GdiPlusRasterLayer gdiLayer = new GdiPlusRasterLayer(filename, winMap.CurrentExtent);

                    gdiLayer.UpperThreshold = double.MaxValue;

                    gdiLayer.LowerThreshold = 0;

                    gdiLayer.Transparency = 185;


                    LayerOverlay imageOverlay = new LayerOverlay();

                    imageOverlay.Layers.Add("GdiLayer", gdiLayer);

                    imageOverlay.Name = "GdiLayer";

                    winMap.Overlays.Insert(1, imageOverlay);


                    winMap.Refresh();



 




 




Lars, 
  
 Thanks for your reporting and sharing of code, I appreciate it very much! 
  
 This is a potential bug in last public version 3.0.362, and it has been fixed in current version as well as next week public version. 
  
 Sorry for the inconvenience now. 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale 


I have an demo tomorrow, is possible to get an non public release ?

Lars, 
  
 I will ask our support to send you a temporary version (3.0.411) tomorrow. 
  
 Any more questions please feel free to let me know. 
  
 Thanks. 
  
 Yale 


YES i works, and fast, the performence has got an boost 
 Thanks

Lars, 
  
   Glad this works for you.  We are busting our humps to get a faster map out there.  Glad you noticed our efforts! :-) 
  
 David