ThinkGeo.com    |     Documentation    |     Premium Support

Problems with empty LayerOverlay (WPF)

Hey,

I have an issue with LayerOverlay in case where I initially don’t have any layers in it’s Layers collection.

Let’s assume I have the background overlay with a world shape layer on it and nothing else. After I add an overlay that has no layers, then any map interaction (e.g. zoom in/out) “flickers” the background overlay. I think it updates & draws the empty overlay. So for brief moment background is “invisible” and only background color is shown.

If I later add layers to this empty overlay, it won’t refresh/redraw the overlay if map is not panned or zoomed. I have tried to refresh the overlay and call Map.Refresh(). Both have no effect. If overlay had layers initially these refresh functions works as intented.

Why this is an issue?

It seems adding and removing layers from an existing overlay is much more performant than removing and adding the overlay again to the map control (which is what I need to do now).

Br,
Mikko

Thanks Mikko,
Could you provide us a simple sample to reproduce the issue you mentioned. Seems this is the same issue as we are working on

Basically it says removing/adding layer will not get effective until zoom in/out.

Thanks

Frank

The latter problem seems to be resolved in latests builds core beta213, wpf beta250.

Flickering background still remains if there’s empty layer on overlay but seems like it now obeys “isVisible” property, .

private void Map_OnLoaded(object sender, RoutedEventArgs e)
{
    Map.MapUnit = GeographyUnit.Meter;
    string shapeFile = @"Assets\World_Countries.shp";
    var shapeLayer = new ShapeFileFeatureLayer(shapeFile);
    shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.Green, GeoColors.Black);
    shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
    var shapeOverlay = new LayerOverlay(new Layer[] { shapeLayer });
    Map.Overlays.Add(shapeOverlay);

    var memoryOverlay = new LayerOverlay(new Layer[] { new InMemoryFeatureLayer() });
    //memoryOverlay.IsVisible = false; <- now this prevents flickering, on earlier build it did not
    Map.Overlays.Add(memoryOverlay);
}

Hi Mikko_Viitala,
This seems related with another known bug on clearing stretch image when zoom in/out, we are still working on this and will keep you updated.
Thanks,
Jack

Hi Mikko_Viitala,
We’ve implemented enhancements on overlay refresh, primarily on the timing of clearing stretch image, which was the root cause of map “flash” when zoom in/out. Would you please give a try with newest v13-beta version and let us know how it goes.
Thanks,
Jack

1 Like