Clear Overlay in mapView

2119
1
02-10-2017 04:04 PM
RichardDaniels
Occasional Contributor III

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)
0 Kudos
1 Reply
CharlesMacleod
Esri Regular 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

0 Kudos