public static void addConnectDataItem(string pathTemplate, int iShowMode, cDataItemConnect item1) { if (item1.sJH != "" && item1.sIDDataItem != "" && item1.sIDTrack != "") { XmlDocument wellTemplateXML = new XmlDocument(); wellTemplateXML.Load(pathTemplate); string sPath = "SectionMap/ConnectInfor"; XmlNode selectNode = wellTemplateXML.SelectSingleNode(sPath); XmlElement newNode = wellTemplateXML.CreateElement("ConnectItem"); newNode.SetAttribute("id", cIDmake.idConnectItem()); newNode.SetAttribute("iShowMode", iShowMode.ToString()); newNode.SetAttribute("trackType", item1.typeTrack); newNode.SetAttribute("sFill", item1.sFill); XmlElement itemRect1 = wellTemplateXML.CreateElement("rect1"); itemRect1.SetAttribute("wellID", item1.sJH); itemRect1.SetAttribute("sIDtrack", item1.sIDTrack); itemRect1.SetAttribute("sIDitem", item1.sIDDataItem); newNode.AppendChild(itemRect1); selectNode.AppendChild(newNode); wellTemplateXML.Save(pathTemplate); } }
public static XmlElement gConnectJSJLleftPin(XmlDocument svgDoc, String sID, cDataItemConnect connectJSJLItem) { XmlElement gConnectPath = svgDoc.CreateElement("path"); gConnectPath.SetAttribute("id", sID); gConnectPath.SetAttribute("stroke-width", "1"); gConnectPath.SetAttribute("onclick", "getID(evt)"); //左侧的绘制 gConnectPath.SetAttribute("stroke-width", "1"); double x1 = connectJSJLItem.x1; double y1 = connectJSJLItem.y1; double x2 = connectJSJLItem.x1; double y2 = connectJSJLItem.y1 + connectJSJLItem.height; double x3 = x1 - 100; double y3 = y2; double x4 = x1 - 100; double y4 = y1; string d = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; gConnectPath.SetAttribute("stroke", "black"); gConnectPath.SetAttribute("d", d); gConnectPath.SetAttribute("fill", codeReplace.codeReplaceJSJL2FillUrl(connectJSJLItem.sFill)); return(gConnectPath); }
public static XmlElement gConnectJSJL(XmlDocument svgDoc, String sID, cDataItemConnect connectJSJLItem1, cDataItemConnect connectJSJLItem2) { //左侧的绘制 XmlElement gConnectPath = svgDoc.CreateElement("path"); gConnectPath.SetAttribute("id", sID); gConnectPath.SetAttribute("stroke-width", "1"); gConnectPath.SetAttribute("onclick", "getID(evt)"); string d = ""; if (connectJSJLItem1.x1 < connectJSJLItem2.x1) { double x1 = connectJSJLItem1.x1 + connectJSJLItem1.width; double y1 = connectJSJLItem1.y1; double x2 = connectJSJLItem1.x1 + connectJSJLItem1.width; double y2 = connectJSJLItem1.y1 + connectJSJLItem1.height; double x3 = connectJSJLItem2.x1; double y3 = connectJSJLItem2.y1; double x4 = connectJSJLItem2.x1; double y4 = connectJSJLItem2.y1 + connectJSJLItem2.height; d = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " L " + x4.ToString() + " " + y4.ToString() + " L " + x3.ToString() + " " + y3.ToString() + " z "; } if (connectJSJLItem1.x1 > connectJSJLItem2.x1) { double x1 = connectJSJLItem1.x1; double y1 = connectJSJLItem1.y1; double x2 = connectJSJLItem1.x1; double y2 = connectJSJLItem1.y1 + connectJSJLItem1.height; double x3 = connectJSJLItem2.x1 + connectJSJLItem2.width; double y3 = connectJSJLItem2.y1; double x4 = connectJSJLItem2.x1 + connectJSJLItem2.width; double y4 = connectJSJLItem2.y1 + connectJSJLItem2.height; d = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " L " + x4.ToString() + " " + y4.ToString() + " L " + x3.ToString() + " " + y3.ToString() + " z "; } gConnectPath.SetAttribute("stroke", "black"); gConnectPath.SetAttribute("d", d); gConnectPath.SetAttribute("fill", codeReplace.codeReplaceJSJL2FillUrl(connectJSJLItem1.sFill)); return(gConnectPath); }