for each (var curGra:Graphic in graphicslayer.graphicProvider) { clearBtnVisible=true; var temGra:Graphic=null; switch (curGra.geometry.type) { case Geometry.EXTENT: { var tgeom:Geometry=curGra.geometry; var points:Array=new Array(); var temppoint:MapPoint=new MapPoint(tgeom.extent.xmin, tgeom.extent.ymin); points.push(temppoint); temppoint=new MapPoint(tgeom.extent.xmin, tgeom.extent.ymax); points.push(temppoint); temppoint=new MapPoint(tgeom.extent.xmax, tgeom.extent.ymax); points.push(temppoint); temppoint=new MapPoint(tgeom.extent.xmax, tgeom.extent.ymin); points.push(temppoint); temppoint=new MapPoint(tgeom.extent.xmin, tgeom.extent.ymin); points.push(temppoint); var polygeo_ext:Polygon=new Polygon(); polygeo_ext.addRing(points); temGra=new Graphic(polygeo_ext, curGra.symbol); break; } case Geometry.POLYGON: { var polygeo_poly:Polygon=new Polygon(); var polygeo:Polygon=curGra.geometry as Polygon; for each (var ring:Array in polygeo.rings) { var temring:Array=[]; for (var i:int=0; i < ring.length; i++) { var tempt_ring:MapPoint=ring[i] as MapPoint; temring.push(new MapPoint(tempt_ring.x, tempt_ring.y)); } polygeo_poly.addRing(temring); } temGra=new Graphic(polygeo_poly, curGra.symbol); break; } case Geometry.MAPPOINT: { var mpt_tem:MapPoint=curGra.geometry as MapPoint; temGra=new Graphic(new MapPoint(mpt_tem.x, mpt_tem.y), curGra.symbol, curGra.attributes); break; } case Geometry.POLYLINE: { var polylinegeo_poly:Polyline=new Polyline(); var polylinegeo:Polyline=curGra.geometry as Polyline; for each (var path:Array in polylinegeo.paths) { var tempath:Array=[]; for (var j:int=0; j < path.length; j++) { var tempt_path:MapPoint=path[j] as MapPoint; tempath.push(new MapPoint(tempt_path.x, tempt_path.y)); } polylinegeo_poly.addPath(tempath); } temGra=new Graphic(polylinegeo_poly, curGra.symbol); break; } } temGra.autoMoveToTop=false; graLyr.add(temGra); }