I have tried a lot of method but just can't remove the graphics of the circle drawn. Can someone help me with this ? GraphicsLayer graphicsLayerHeat = map.Layers["Layer5_buffer"] as GraphicsLayer;
foreach (var graphic in buffersList)
{
//graphicsLayer.Graphics.Remove(graphic);
graphicsLayerHeat.Graphics.Remove(graphic);
} The above code is used for drawing a circle, I can't remove the graphics that is drawn on this layer. Help pls. I have tried this but it wont work. graphicsLayer = map.Layers["Layer5_buffer"] as GraphicsLayer;
graphicsLayer.ClearGraphics(); The code to draw the buffer is here: public void drawBuffer(double radius, int pointCount, MapPoint currentPoint, GraphicsLayer gl)
{
//bufferLayer.removeAll();
MapPoint point = currentPoint;
ESRI.ArcGIS.Client.Geometry.Polyline pl = new ESRI.ArcGIS.Client.Geometry.Polyline();
ESRI.ArcGIS.Client.Geometry.Polygon polygon = new ESRI.ArcGIS.Client.Geometry.Polygon();
ESRI.ArcGIS.Client.Geometry.PointCollection routePoint = new ESRI.ArcGIS.Client.Geometry.PointCollection();
for (int i = 1; i <= pointCount; i++)
{
double x;
double y;
x = (point.X + radius * Math.Cos(2 * Math.PI / pointCount * i));
y = (point.Y + radius * Math.Sin(2 * Math.PI / pointCount * i));
routePoint.Add(new MapPoint(x, y));
}
routePoint.Add(routePoint[0]);
polygon.Rings.Add(routePoint);
GraphicsLayer mygraphicslayer = gl;
//mygraphicslayer.ClearGraphics();
Graphic graphic = new Graphic()
{
Geometry = polygon,
Symbol = Heat
};
buffersList.Add(graphic);
mygraphicslayer.Graphics.Add(graphic);
}
... View more