private void DeleteAccDevElement(NodeDevType devType) { if (MsgBox.ShowYesNo("是否删除:" + currentElement.GetAttribute(NodeNameTag)) == DialogResult.No) { return; } ConnectLine cl = GetConnectLine(currentElement, false); if (cl != null) { xltDocument.CurrentElement = cl; xltVectorCtrl.Delete(); } xltDocument.CurrentElement = currentElement; xltVectorCtrl.Delete(); }
/// <summary> /// /// </summary> /// <param name="devType"></param> private void DeleteNodeDevElement(NodeDevType devType) { if (devType == NodeDevType.SB_BDZ && GetNextNode(currentElement) != null) { MsgBox.Show("删除变电站前请先删除与变电站相连的节点!"); return; } List<ConnectLine> listConnectLine = GetNoneTrunkConnectLines(currentElement); if (listConnectLine.Count > 0) { MsgBox.Show("删除此节点前请先删除与此节点相连的设备或分支线路!"); return; } if (MsgBox.ShowYesNo("是否删除:" + currentElement.GetAttribute(NodeNameTag)) == DialogResult.No) { return; } if (devType != NodeDevType.SB_BDZ) { ConnectLine beforeLine = GetConnectLine(currentElement, false); ConnectLine afterLine = GetConnectLine(currentElement, true); if (beforeLine != null) { SvgElement preElement = beforeLine.StartGraph as SvgElement; if (afterLine != null) { SvgElement nextElement = afterLine.EndGraph as SvgElement; if (nextElement != null) { if (preElement != null) { nextElement.SetAttribute(PreNodeGuidTag, preElement.GetAttribute(NodeGuidTag)); beforeLine.SetAttribute("devguid2", nextElement.GetAttribute(NodeGuidTag)); beforeLine.EndGraph = nextElement as IGraph; } else { nextElement.SetAttribute(PreNodeGuidTag, ""); } } xltDocument.CurrentElement = afterLine; xltVectorCtrl.Delete(); } else { xltDocument.CurrentElement = beforeLine; xltVectorCtrl.Delete(); } } } xltDocument.CurrentElement = currentElement; xltVectorCtrl.Delete(); }
/// <summary> /// 根据设备类型创建新设备 /// </summary> /// <param name="devType">设备类型</param> /// <returns>创建的新设备</returns> private SvgElement CreateNewElementByType(NodeDevType devType, PointF pt) { SvgElement devElement = xltVectorCtrl.CreateBySymbolID(devType.ToString(), pt); return devElement; }