Select to view content in your preferred language

Remove graphics which created by a widget when widget being closed

1539
5
Jump to solution
02-01-2018 10:55 PM
TubaKumbara
Regular Contributor

Hello. 

Added DirectLineMeasurement3D widget in to sceneview.

I have a toggle widget button. And button code below

mySceneview.ui.remove(measureWidget);

This is removing widget from sceneview but drawings stays on screen. I can't clear all graphics because of sceneview has another graphics.

How can i remove graphics which created by  a widget when widget being closed?

Thanks inadvance 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Tuba,

  Then you need to destroy the widget as well:

measureWidget.clearMeasurement();
view.ui.remove(measureWidget);
measureWidget.destroy();

For your second question look here:

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-ui-DefaultUI.html#component... 

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

View solution in original post

5 Replies
EvelynHernandez
Frequent Contributor

If u use graphicslayer. is graphicslayer.clear();

if u use map.graphics is map.graphics.clear();

if u use layers, map.removeAllLayers() for all of them or removeLayer(urLayer) to remove the desired layers that u added in the map.

I hope this helps.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tuba,

   It has not been documented but there is a clearMeasurement method.

measureWidget.clearMeasurement();
0 Kudos
TubaKumbara
Regular Contributor

Thanks for the answer.

yes widget.clearMeasurement is solved problem.

But

Mouse cursor still displaying as "plus" figure (as if widget is opened) and still continuing drawing measure graphic even after close and clear widget.

And another question, 

Can we get a list for added widgets?

Thanks inadvance

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Tuba,

  Then you need to destroy the widget as well:

measureWidget.clearMeasurement();
view.ui.remove(measureWidget);
measureWidget.destroy();

For your second question look here:

https://developers.arcgis.com/javascript/latest/api-reference/esri-views-ui-DefaultUI.html#component... 

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

TubaKumbara
Regular Contributor

Thanks Robert, your answer has been really helpful.

0 Kudos