Source: https://msdn.microsoft.com/zh-cn/library/bb412514.aspx
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">varMap =NULL; varLayer01 =NULL; varLayer02 =NULL; varSHAPE01 =NULL; varSHAPE02 =NULL; varID01 =NULL; varID02 =NULL; varLayer =NULL; functionGetmap () {map=NewVEMap (' MyMap '); Map. Loadmap (); Map. Attachevent ("OnClick", Shapelayeralert); } functionaddshapelayers () {varPOINTS01 =NewArray (NewVELatLong (45.01188,-111.06687), NewVELatLong (45.01534,-104.06324), NewVELatLong (41.01929,-104.06), NewVELatLong (41.003,-111.05878), NewVELatLong (45.01188,-111.06687) ); varPOINTS02 =NewArray (NewVELatLong (43.01188,-109.06687), NewVELatLong (43.01534,-101.06324), NewVELatLong (39.01929,-101.06), NewVELatLong (39.003,-109.05878), NewVELatLong (43.01188,-109.06687) ); Layer01=NewVeshapelayer (); Layer01. Settitle ("Layer01 title"); Map. Addshapelayer (LAYER01); Layer02=NewVeshapelayer (); Layer02. Settitle ("Layer02 title"); Map. Addshapelayer (LAYER02); SHAPE01=NewVeshape (Veshapetype.polygon, points01); Shape01. Setlinewidth (3); Shape01. Setlinecolor (NewVecolor (0,150,100,1.0)); Shape01. Setfillcolor (NewVecolor (0,150,100,0.5)); Layer01. AddShape (SHAPE01); SHAPE02=NewVeshape (Veshapetype.polygon, POINTS02); Shape02. Setlinewidth (3); Shape02. Setlinecolor (NewVecolor (0,100,150,1.0)); Shape02. Setfillcolor (NewVecolor (0,100,150,0.5)); Layer02. AddShape (SHAPE02); Map. SetMapView (POINTS01); ID01=shape01. GetID (); ID02=Shape02. GetID (); varLinks = "Delete: <a href= ' # ' onclick= ' Deleteoneshape (id01) ' >" + id01 + "</a><br/>"; Links+ = "Delete: <a href= ' # ' onclick= ' Deleteoneshape (id02) ' >" + id02 + "</a>"; Shapelinks.innerhtml=links; Shapelayerinfo (); } functionDeleteshapelayer (layer) {map. Deleteshapelayer (layer); Shapelayerinfo (); } functiondeletealllayers () {map. Deleteallshapelayers (); Shapelayerinfo (); } functionDeleteallshapes () {map. Deleteallshapes (); } functionDeleteoneshape (ID) {Shape=map. Getshapebyid (ID); Map. Deleteshape (Shape); Alert ("Shape ID:" + ID + "has been deleted."); } functionShapelayerinfo () {varLayers = "Number of shape layers:" + map. Getshapelayercount () + "(including the base layer)"; Layerinfo.innerhtml=layers; } functionShapelayeralert (e) {if(E.elementid! =NULL) {Shape=map. Getshapebyid (E.elementid); Layer=shape. Getshapelayer (); Alert ("Shape ID" + shape. GetID () + "\nbelongs to shape layer" + layer. GetTitle () + "'."); } } </script> onclick= "addshapelayers ();" /> <input id= "Deletelayer01" type= "button" value= "click to Delete Layer01" name= "Deletelayer01"onclick= "Deleteshapelayer (LAYER01);" /> <input id= "deletelayer02" type= "button" value= "click to Delete layer02" name= "Deletelayer02"onclick= "Deleteshapelayer (LAYER02);" /> <input id= "deletealllayers" type= "button" value= "click to Delete all Layers" Name= "Deletealllayers"onclick= "deletealllayers ();" /> <input id= "deleteallshapes" type= "button" value= "click to Delete all Shapes" Name= "Deleteallshapes"onclick= "Deleteallshapes ();" /><br/> </body>
To learn more about the VEMap class, see: Https://msdn.microsoft.com/zh-cn/library/bb429586.aspx
Vemap.deleteallshapelayers Method