ThinkGeo.com    |     Documentation    |     Premium Support

All layers not showed after update map control to beta2

Hi


After upgrading the map control, the following code dosent work, when an layer is disabled the control dosen't

redraw the active layers.... i always calls the refresh function, if you after calling the code, is forcing the control

to redraw by panning or something like that, the map is showed again.


What have you changed?????.




   if (btnShowWindFarms.Checked)

   {

    if (!m_windFarmsLoaded)

    {

     try

     {

      btnShowWindFarms.Enabled = false;

      m_vdcService.GetWindFarmItemsAsync(0, 0, 0, 0, true);

      progressControl.Visible = true;

      progressControl.Start();

     }

     catch(Exception ex)

     {

      CIM.UtilUI.Message.MsgBox.Error(this, "Failed to request wind farms", ex);

     }

    }

   }


   winMap.Overlays[GetLayerName(LayerNameEnum.WindFarms)].Lock.EnterWriteLock();

   try

   {

    InMemoryFeatureLayer pointLayer = (InMemoryFeatureLayer)winMap.FindFeatureLayer(GetLayerName(LayerNameEnum.WindFarms));

    pointLayer.IsVisible = btnShowWindFarms.Checked;

   }

   finally

   {

    winMap.Overlays[GetLayerName(LayerNameEnum.WindFarms)].Lock.ExitWriteLock();

   }


   winMap.Refresh();



Lars, 
  
   Can you tell me the version you are comming from and the version you are going to?  You can check the getversion on the map control.  Durring the various betas we changed much.  The good news is that as of Monday of next week we are moving to the final release of the desktop edition.  Betas are difficult for us and customers and I am glad we are going to producion.   
  
 Let me know the versions and I will have someone look at the code and see what they find. 
  
 David

Hi 
  
 The old version, was (fileversion) 3.0.415 
 new 3.0.453 


Lars


Thanks for your information. Could you try the following code to replace the code in following HowDoI sample:
How Do I\ Getting Started\ Hide or show a feature layer.

        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;

            //WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();
            //winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);

            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("WorldLayer", worldLayer);
            
            winformsMap1.Overlays.Add("WorldOverlay", staticOverlay);

            //winformsMap1.ThreadingMode = MapThreadingMode.Multithreaded;
            winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2);
            winformsMap1.Refresh();
        }

        private void cbkShowLayer_CheckedChanged(object sender, EventArgs e)
        {
            //Solution2.
            //winformsMap1.FindFeatureLayer("WorldLayer").IsVisible = cbkShowLayer.Checked;
            //winformsMap1.Refresh(winformsMap1.Overlays["WorldOverlay"]);

            winformsMap1.Overlays["WorldOverlay"].Lock.EnterWriteLock();
            try
            {
                ShapeFileFeatureLayer pointLayer = (ShapeFileFeatureLayer)winformsMap1.FindFeatureLayer("WorldLayer");
                pointLayer.IsVisible = cbkShowLayer.Checked;
            }
            finally
            {
                winformsMap1.Overlays["WorldOverlay"].Lock.ExitWriteLock();
            }

            winformsMap1.Refresh();
        }

 
Also, the comment part in cbkShowLayer_CheckedChanged shows you the best solution if you are using the SingleThreaded mode.
 
Any more quesitons just feel free to let me know.
 
Thanks.
 
Yale

Hi 
  
 My layer type is an InMemoryFeatureLayer, therefore the above code result in cast exception. 
 I’m using the multithreaded mode. 


If is to any help, calling refresh 2 times draws the control right.

Lars,


Just make sure you are using VS2008 or using the devexpress?
 
It seems another post talked about the first time map not showed correctly in devexpress, we are now trying to reproduce it.
gis.thinkgeo.com/Support/Dis...fault.aspx
 
Any more questions just feel free to let me know.
 
Thanks.
 
Yale

Hi 
  
 I’m using VS2008, but not devexpress. 
  
 The map control is used on an usercontrol with an toolbarstrip control! 
 On the toolbar strip there are combobox and buttons. 
  
 /Lars 


Lars, 
  
 That is interesting, could you paste out a small sample application for us to recreate your problem? That definitely would be helpful. 
  
 Thanks. 
  
 Yale 


Hi 

I'm been testing on an simple app, and can recreate the problem, i seems that when you resize the control, 

not all layers are drawed. 



I have made an simple application with an user control, if you start the application and maximize, the google layer is 

not drawed. 



I'm, not sure that this is the only thing, but it behaves almost the same. have also tried to refresh the map on resize, this 

dosent change any thing.


I have updated to the new 3.1.xxxx version


Solution is to big for forum, i send by mail to your support.



Update: 
 With the new version, the problem with no redraw of layers is gone, but as described above the layers don’t redraw correct when control is resized. this only seems to be a problem when the control shows the hole world, if zoom in an country somewhere the control works fine when resized. 
  
 Hope this helps…

Lars, 
  
 Thanks for your sample. 
  
 I am very surprised that if I only load a very simple shape file(world for example) and it works all fine no matter how you change the size of user control. 
  
 So I just want to clarify the problem more to make sure we are on the same line. I think the problem is in the GoogleLayer.  
  
 You can try to comment out the restriction layer and only leaves the GoogleLayer and a projected shape world layer, when you pan in ZoomLevel01, the shape world layer  will not overlapping with GoogleLayer for some reason. And this problem should be existing since version 3.0.415 as you mentioned.  
  
 If I made something wrong , just let me know. 
  
 Thanks. 
  
 Yale 
  


Hi 
  
 Yes we are on the same line, i use the restriction to "hide" the problem. :) 
  
 Do you have an timeline for an fix ? 
  


Lars, 
  
 Thanks for letting me know this. I have added this to our working track system(Issue 5728) and I will keep an eye on it to see we will find a solution for it as soon as possible. 
  
 Thanks. 
  
 Yale 


Hi 
  
 Whats the status for this issue, realy need to get an fix for this. 
  
 /Lars

Sorry Lars, I found that our developer is still working on this issue; I will send an email to him to see what the progress of this issue and let you know the result. 
  
 Thanks for your patience and sorry for the inconvenience. 
  
 Sun 


Lars, 
  
 We have fixed GoogleLayer overlapping issue, you can get the latest version of DesktopEdition(Development branch) and try it again. 
  
 Thanks, 
  
 James