示例#1
0
        private void DeleteLayer(Layer layer)
        {
            //if (!CkRight(layer))
            //{
            //    MessageBox.Show("基础图层不能改名或删除。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            //    return;
            //}
            //if (true)
            //{
            //    LineInfo _line = new LineInfo();
            //    _line.LayerID = layer.ID;
            //    Services.BaseService.Update("DeleteLineInfoByLayerID", _line);
            //    glebeProperty gle = new glebeProperty();
            //    gle.LayerID = layer.ID;
            //    Services.BaseService.Update("DeleteglebePropertyByLayerID", gle);
            //    substation _sub = new substation();
            //    _sub.LayerID = layer.ID;
            //    Services.BaseService.Update("DeletesubstationByLayerID", _sub);
            //}
            XmlNodeList list = tlVectorControl1.SVGDocument.SelectNodes("//*[@layer='" + layer.ID + "']");
            foreach (XmlNode elNode in list) {
                tlVectorControl1.SVGDocument.RootElement.RemoveChild(elNode);
            }

            //Services.BaseService.Update("UpdateGraPowerRelationByLayerID", layer.ID);
            //在文档中移除
            layer.Remove();
            //在列表中移除
        }
示例#2
0
        public void DeleteLayer(Layer layer)
        {
            if (!CkRight(layer)) {
                MessageBox.Show("����ͼ�㲻�ܸ�����ɾ����", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            //if (true) {
            //    LineInfo _line = new LineInfo();
            //    _line.LayerID = layer.ID;
            //    Services.BaseService.Update("DeleteLineInfoByLayerID", _line);
            //    glebeProperty gle = new glebeProperty();
            //    gle.LayerID = layer.ID;
            //    Services.BaseService.Update("DeleteglebePropertyByLayerID", gle);
            //    substation _sub = new substation();
            //    _sub.LayerID = layer.ID;
            //    Services.BaseService.Update("DeletesubstationByLayerID", _sub);
            //}
            XmlNodeList list = this.SymbolDoc.SelectNodes("//*[@layer='" + layer.ID + "']");
            foreach (XmlNode elNode in list) {
                this.SymbolDoc.RootElement.RemoveChild(elNode);
            }

            //Services.BaseService.Update("UpdateGraPowerRelationByLayerID", layer.ID);
            //���ĵ����Ƴ�
            SVG_LAYER lar = new SVG_LAYER();
            lar.SUID = layer.ID;
            Services.BaseService.Update("DeleteSVG_LAYER", lar);
            layer.Remove();
            //���б����Ƴ�
            TreeListNode node = treeList1.FindNodeByKeyID(layer.ID);
            if (node != null) {
                if (node.ParentNode == null)
                    treeList1.Nodes.Remove(node);
                else
                    node.ParentNode.Nodes.Remove(node);
            }
            layer = null;
            LayerName = "";
        }