Hi,
I’m having trouble clearing the objects from an InMemoryMarkerOverlay. The code below shows a single marker on a solid background.
Excuting the Clear method, clears the background layer, but the image for the MarkerOverlay layer is still present.
How do I clear this from the map?
Thanks,
Steve
private
void
Window_Loaded(
object
sender, RoutedEventArgs e)
{
wpfMap.MapUnit = GeographyUnit.DecimalDegree;
var layerOverlay =
new
LayerOverlay();
layerOverlay.Layers.Add(
new
BackgroundLayer(
new
GeoSolidBrush(GeoColor.GeographicColors.Tundra)));
wpfMap.Overlays.Add(layerOverlay);
var pointLayer =
new
InMemoryMarkerOverlay();
var uri =
new
Uri(@
“D:\Temp\AQUA.png”
);
pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.ImageSource =
new
BitmapImage(uri);
pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Width = 20;
pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.Height = 34;
pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointMarkerStyle.YOffset = -17;
pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
wpfMap.Overlays.Add(pointLayer);
pointLayer.FeatureSource.BeginTransaction();
var pointShape =
new
PointShape(-111, -50);
var pointFeature =
new
Feature(pointShape);
pointLayer.FeatureSource.AddFeature(pointFeature);
pointLayer.FeatureSource.CommitTransaction();
wpfMap.Refresh();
}
private
void
ClearClick(
object
sender, RoutedEventArgs e)
{
wpfMap.Overlays.Clear();
wpfMap.Refresh();
}