Hello!
How do I do when the geoprocessing widget when it is closed, clear all created buffers, or how to do it whenever the geoprocessing widget is opened, it is with the default values, ie as if it had been opened by the first time?
Thank you!
Gilberto.
Solved! Go to Solution.
Hello
I was able to perform such an operation. For this, I created a function that follows below. I am Brazilian, so the comments are in Portuguese from Brazil.
Thank you!
_limpaBuffer: function()
{
//Remove os pontos do mapa, camadas de buffer, a aba do
//buffer criada no attribute table, seta o mapa para um
//extent default e executa zoom.
this.graphicClickBufferLayer.clear();
this.graphicClickPointLayer.clear();
this.graphicResultLayer.clear();
this.map.graphics.clear();
//window.location.reload(false);
//Remove as camadas gráfica de buffer (todas camadas que iniciam por Buffer_)
var camadasMapa = this.map.graphicsLayerIds.length
for (var j = camadasMapa - 1; j >= 0; j--)
{
var camada;
camada = this.map.getLayer(this.map.graphicsLayerIds
if (camada.name)
{
if (camada.name.substring(0, 7) == "Buffer_")
{
this.map.removeLayer(camada);
}
}
}
//Centraliza o mapa no extent padrão
//var spatialRef = new SpatialReference({ wkid:4674 });
//var spatialRef = new SpatialReference({ wkid:102100 });
var startExtent = new Extent();
startExtent.xmin = -57.643884794;
startExtent.ymin = -33.752081271;
startExtent.xmax = -49.691351788;
startExtent.ymax = -27.082302022;
//startExtent.spatialReference = spatialRef;
this.map.setExtent(startExtent);
//Fecha (minimiza) o attribute table
this.wManager = WidgetManager.getInstance();
if (this.wManager)
{
var widgetCfg = this._getWidgetConfig('AttributeTable');
if (widgetCfg)
{
var attWidget = this.wManager.getWidgetByLabel(widgetCfg.label);
if (attWidget)
{
attWidget._closeTable();
}
}
}
}
The drawn buffers on the map are graphicslayers. Just in the onclose() function remove them like any other layers
map.removeLayer(GraphicsLayer)
Hello
I was able to perform such an operation. For this, I created a function that follows below. I am Brazilian, so the comments are in Portuguese from Brazil.
Thank you!
_limpaBuffer: function()
{
//Remove os pontos do mapa, camadas de buffer, a aba do
//buffer criada no attribute table, seta o mapa para um
//extent default e executa zoom.
this.graphicClickBufferLayer.clear();
this.graphicClickPointLayer.clear();
this.graphicResultLayer.clear();
this.map.graphics.clear();
//window.location.reload(false);
//Remove as camadas gráfica de buffer (todas camadas que iniciam por Buffer_)
var camadasMapa = this.map.graphicsLayerIds.length
for (var j = camadasMapa - 1; j >= 0; j--)
{
var camada;
camada = this.map.getLayer(this.map.graphicsLayerIds
if (camada.name)
{
if (camada.name.substring(0, 7) == "Buffer_")
{
this.map.removeLayer(camada);
}
}
}
//Centraliza o mapa no extent padrão
//var spatialRef = new SpatialReference({ wkid:4674 });
//var spatialRef = new SpatialReference({ wkid:102100 });
var startExtent = new Extent();
startExtent.xmin = -57.643884794;
startExtent.ymin = -33.752081271;
startExtent.xmax = -49.691351788;
startExtent.ymax = -27.082302022;
//startExtent.spatialReference = spatialRef;
this.map.setExtent(startExtent);
//Fecha (minimiza) o attribute table
this.wManager = WidgetManager.getInstance();
if (this.wManager)
{
var widgetCfg = this._getWidgetConfig('AttributeTable');
if (widgetCfg)
{
var attWidget = this.wManager.getWidgetByLabel(widgetCfg.label);
if (attWidget)
{
attWidget._closeTable();
}
}
}
}