Clear Overlay in mapView

1595
1
02-10-2017 04:04 PM
Highlighted
Regular Contributor

I have a tool that gets map coordinates from a mouse click and then does some work. In code add a marker symbol at the location the person clicked. The user may click multiple times prior to exiting the tool. On exiting I would like the overlay to be cleared.

To add the points I'm doing this:

var disposable = await QueuedTask.Run(() =>

{

return mapView.AddOverlay(myPoint,

SymbolFactory.ConstructPointSymbol(ColorFactory.CreateRGBColor(255,255,0), 10.0, SimpleMarkerStyle.Cross).MakeSymbolReference());

});

Do I need to keep track of all the disposable vars (perhapse in an array) to do:

disposable.Dispose();

for each maker?

What I would like is a mapView.ClearOverlayAsync() command similar to  the existing

mapView.ClearSketchAsync();.

Ideas?

Rich

Tags (2)
Reply
0 Kudos
1 Reply
Highlighted
Esri Contributor

Hi Rich, instead use the maptool AddOverlay (and AddOverlayAsync) methods. Any graphics added to the overlay will be disposed when the tool is deactivated.

http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic9990.html

Reply
0 Kudos