ThinkGeo.com    |     Documentation    |     Premium Support

Overlay refresh questions

I am running 3.1.299, so this may be a wasted set of questions.   But I want to describe what I'm seeing and find out if I'm doing something wrong, or the application is behaving correctly for the version it is, or will behave the same way in 4.0.


I'm using single threaded mode, but have written all of our code to use overlay locking.


My scenario is:



        
  1. Instantiate an overlay, and load it with a custom layer where I implement Draw Core.

  2.     
  3. Add the overlay to the map.

  4.     
  5. Zoom to the extent of the layer, and refresh the map.


All is well.  I have a breakpoint in the layer's draw core, and it gets hi.  Now:



        
  1. Instantiate a new overlay with no layer, and add it to the map.

  2.     
  3. Refresh the map.

  4.     
  5. Lock the overlay.

  6.     
  7. Insert a shapefile feature layer into the overlay.

  8.     
  9. Unlock the overlay.

  10.     
  11. Refresh the map, passing in the newly added overlay as the parameter on the Refresh statement.


DrawCore on the orginal layer is still being called, even though I explicitly called the Refresh with the second overlay as a parameter.   I was under the impression that if I called Refresh with a specific overlay, that only that overlay would be drawn, unless that map extent had changed, etc.


Thanks.


 


 



Ted,


Thanks for your post and questions.
 
I think we did not change this logic since 3.1.299. As you said at latst, when you refresh by passing the second overlay without changing the extent, the first overlay should not be redrawed.
 
I attached a test sample, following is part of code. You can see in the button3_click event, the CustomInmemoryLayer inMemoryLayer2 DrawCore event will not be fired.

private void button2_Click(object sender, EventArgs e)
{
   LayerOverlay staticOverlay1 = new LayerOverlay();
   winformsMap1.Overlays.Add("InMemoryOverlay1", staticOverlay1);
 
   LayerOverlay staticOverlay2 = new LayerOverlay();
   winformsMap1.Overlays.Add("InMemoryOverlay2", staticOverlay2);
 
   winformsMap1.Refresh();
}
 
private void button3_Click(object sender, EventArgs e)
{
    LayerOverlay InMemoryOverlay1 = (LayerOverlay)winformsMap1.Overlays["InMemoryOverlay1"];
    LayerOverlay InMemoryOverlay2 = (LayerOverlay)winformsMap1.Overlays["InMemoryOverlay2"];
 
    CustomInmemoryLayer inMemoryLayer2 = new CustomInmemoryLayer();
    inMemoryLayer2.InternalFeatures.Add("Polygon", new Feature(BaseShape.CreateShapeFromWellKnownData("POLYGON((10 60,40 70,30 85, 10 60))")));
    inMemoryLayer2.InternalFeatures.Add("Multipoint", new Feature(BaseShape.CreateShapeFromWellKnownData("MULTIPOINT(10 20, 30 20,40 20, 10 30, 30 30, 40 30)")));
            inMemoryLayer2.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(100, GeoColor.StandardColors.RoyalBlue);
            inMemoryLayer2.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.Color = GeoColor.StandardColors.Blue;
            inMemoryLayer2.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.OuterPen = new GeoPen(GeoColor.FromArgb(200, GeoColor.StandardColors.Red), 5);
            inMemoryLayer2.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = new GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8);
inMemoryLayer2.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
InMemoryOverlay2.Layers.Add("InMemoryFeatureLayer2", inMemoryLayer2);
 
     winformsMap1.Refresh(InMemoryOverlay1);
 }


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

2069-Post7532.zip (12.9 KB)