ThinkGeo.com    |     Documentation    |     Premium Support

Regression with 3.0.453

Hello,


The very first build with 453 shows dozen of regressions in my application ... Most of them are linked to refresh issues, I'll check them carrefuly tomorrow.


However, here is a very simple one:


I was using this code with 426 to display a scale bar; it does not longuer work unless I force a refresh (by minimizing+maximizing the application)



    private void cmShowScale_ItemClick(object sender, ItemClickEventArgs e)
    {
      theMap.AdornmentOverlay.Lock.EnterWriteLock();
      try
      {
        theMap.AdornmentOverlay.IsVisible = cmShowScale.Checked;
      }
      finally
      {
        theMap.AdornmentOverlay.Lock.ExitWriteLock();
      }
      theMap.Refresh();
    }



 


Patrick,
 
Sorry for making your upset with the new release. Can you try the following code which provides 2 solutions and both of them should work?

       private void ShowHideLayer_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
 
            ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp");
            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
 
            AdornmentLayer adormentLayer = new ScaleBarAdornmentLayer();
 
            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("WorldLayer", worldLayer);
        
            winformsMap1.Overlays.Add("WorldOverlay", staticOverlay);
            winformsMap1.AdornmentOverlay.Layers.Add(adormentLayer);
 
            winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2);
            winformsMap1.Refresh();
        }
 
        private void cbkShowLayer_CheckedChanged(object sender, EventArgs e)
        {
            // This is the first solution.
            //winformsMap1.AdornmentOverlay.IsVisible = cbkShowLayer.Checked;
            //winformsMap1.Refresh(winformsMap1.AdornmentOverlay);
 
            // The second solution should work.
            winformsMap1.AdornmentOverlay.Lock.EnterWriteLock();
            try
            {
                winformsMap1.AdornmentOverlay.IsVisible = cbkShowLayer.Checked;
            }
            finally
            {
                winformsMap1.AdornmentOverlay.Lock.ExitWriteLock();
            }
            winformsMap1.Refresh();
        }
 
        private WinformsMap winformsMap1;


 
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Yale, 
  
 Solution #1 works. 
 Solution #2 does not work. 
  
 Can I conclude that I should change every overlay.lock/unlock to map.refresh (overlay) ? 
 It’s much more simplier to code. 
  
 Patrick.

Patrick, 
  
 I am still very concerned about why the solution#2 does not work in your enviroment, it should work exactly the same with previous versions to keep its compability. 
  
 If your application is in SingleThreaded mode(default threading mode), just feel confortable to change it to solution1 ,while if you are using the Multi-threadind mode, the lock-unlock system should be kept to guarantee its theading safety. 
  
 Any more questions just feel free to let me know. 
  
 Thanks. 
  
 Yale 


Yale, 
  
 it’s working with 457 … 
  
 Patrick.

Patrick, 
  
 It’s awesome.  
  
 James