/// <summary> /// 删除元素 /// </summary> /// <param name="map"></param> /// <param name="tree"></param> /// <param name="cmd"></param> private void DeleteObject(MapImage map, MyTree tree, string[] cmd) { if (cmd.Length != 4) { return; } decimal layerid = GetId(cmd[2]); decimal objectid = GetId(cmd[3]); TreeNode layernode = FindLayer(tree.Nodes[0], layerid); TreeNode objectnode = FindObject(layernode, layerid, objectid); if (objectnode == null) { return; } //取得当前图层 VectorLayer layer = layernode.Tag as VectorLayer; //如果有当前选择区域,则从图层中删除 if (map.NeedSave && layer.NeedSave) { MapDBClass.DeleteObject(map.Map.MapId, layerid, objectid, layer.Type); } ((GeometryProvider)layer.DataSource).Geometries.Remove(objectnode.Tag as Geometry); tree.Nodes.Remove(objectnode); }