cDataItemConnect getLayerItem(string sJH, string sLayer) { cDataItemConnect dataItemConnect = new cDataItemConnect(); string filePathOper = dirSectionData + "//" + sJH + ".xml"; XmlDocument wellTemplateXML = new XmlDocument(); wellTemplateXML.Load(filePathOper); //在文件道中循环,找到第一个地层道 XmlNodeList trackNodeList = cXmlDocSectionWell.getTrackNodes(filePathOper); foreach (XmlNode xnTrack in trackNodeList) { if (xnTrack["trackType"].InnerText == TypeTrack.分层.ToString()) { dataItemConnect.sIDTrack = xnTrack.Attributes["id"].Value; dataItemConnect.sJH = sJH; dataItemConnect.typeTrack = TypeTrack.分层.ToString(); string sPath = string.Format(".//sProperty[text()=\"{0}\"]", sLayer); XmlNode selectNode = xnTrack.SelectSingleNode(sPath); if (selectNode != null) { XmlNode dataItem = selectNode.ParentNode; dataItemConnect.sIDDataItem = dataItem.Attributes["id"].Value; dataItemConnect.sFill = sLayer; return(dataItemConnect); } } } return(dataItemConnect); }
public static List <string> makePathd(itemDrawDataFaultItem faultItem, cDataItemConnect item1, cDataItemConnect item2) { List <string> listPathd = new List <string>(); listPathd = faultSectionD(faultItem, item1, item2); return(listPathd); }
public static void swap(ref cDataItemConnect ob1, ref cDataItemConnect ob2) { cDataItemConnect t; t = ob1; ob1 = ob2; ob2 = t; }
private void btnConnectLayerByTop_Click(object sender, EventArgs e) { List <string> ltStrSelectedXCM = getSelectListLayer(); foreach (string sXCM in ltStrSelectedXCM) { for (int i = 0; i < listWellsSection.Count - 1; i++) { //搜索单井和下一口井的地层名;地层名必须唯一 cDataItemConnect selectItem1 = getLayerItem(listWellsSection[i].sJH, sXCM); cDataItemConnect selectItem2 = getLayerItem(listWellsSection[i + 1].sJH, sXCM); cXmlDocSectionGeo.addConnectDataItem(this.filePathSectionCss, 1, selectItem1, selectItem2); } } this.DialogResult = DialogResult.OK; this.Close(); }
public static string makePathd(cDataItemConnect item1, cDataItemConnect item2) { //x1 左上 x2 左下 `` // 要注意 item1 和 item2 的位置问题 item.X1 > item2.X2 时 应该交换 if (item1.x1 > item2.x1) { swap(ref item1, ref item2); } double x1 = item1.x1 + item1.width; double y1 = item1.y1; double x2 = x1; double y2 = y1 + item1.height; double x3 = item2.x1; double y3 = item2.y1; double x4 = x3; double y4 = y3 + item2.height; string d = makePathd(x1, y1, x2, y2, x3, y3, x4, y4); return(d); }
public static List <string> faultSectionD(itemDrawDataFaultItem faultItem, cDataItemConnect item1, cDataItemConnect item2) { //x1 左上 x2 左下 // 要注意 item1 和 item2 的位置问题 item.X1 > item2.X2 时 应该交换 if (item1.x1 > item2.x1) { swap(ref item1, ref item2); } List <string> listPathFaultd = new List <string>(); double x1 = item1.x1 + item1.width; double y1 = item1.y1; double x3 = item2.x1; double y3 = item2.y1; Vector2D intersection1; var actual1 = LineSegment.LineSegementsIntersect( new Vector2D(x1, y1), new Vector2D(x3, y3), new Vector2D(faultItem.x1View, faultItem.y1View), new Vector2D(faultItem.x2View, faultItem.y2View), out intersection1); // MessageBox.Show(intersection1.X + " " + intersection1.Y); double x2 = item1.x1 + item1.width; double y2 = item1.y1 + item1.height; double x4 = item2.x1; double y4 = item2.y1 + item2.height; Vector2D intersection2; var actual2 = LineSegment.LineSegementsIntersect( new Vector2D(x2, y2), new Vector2D(x4, y4), new Vector2D(faultItem.x1View, faultItem.y1View), new Vector2D(faultItem.x2View, faultItem.y2View), out intersection2); // MessageBox.Show(intersection2.X + " " + intersection2.Y); //存在交点才处理 if (actual1 == true && actual2 == true) { //正断层和逆断层的处理方式不同,你断层的处理方法不同,X上推 double dX = faultItem.displacementView / 2; // x5 y5 是 (x1,y1) (x3,y3) 交点后推的值 // x6 y6 是 (x2,y2) (x4,y4) 交点后推的值 double x5 = intersection1.X - dX; double y5 = cCalBase.linear(x5, intersection1.X, intersection2.X, intersection1.Y, intersection2.Y); double x6 = intersection2.X - dX; double y6 = cCalBase.linear(x6, intersection1.X, intersection2.X, intersection1.Y, intersection2.Y); // string d1 = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " L " + //x6.ToString() + " " + y6.ToString() + " L " + x5.ToString() + " " + y5.ToString() + " z "; string d1 = makePathd(x1, y1, x2, y2, x5, y5, x6, y6); listPathFaultd.Add(d1); double x7 = intersection1.X + dX; double y7 = cCalBase.linear(x7, intersection1.X, intersection2.X, intersection1.Y, intersection2.Y); double x8 = intersection2.X + dX; double y8 = cCalBase.linear(x8, intersection1.X, intersection2.X, intersection1.Y, intersection2.Y); // string d2 = "M " + x3.ToString() + " " + y3.ToString() + " L " + x4.ToString() + " " + y4.ToString() + " L " + //intersection2.X.ToString() + " " + intersection2.Y.ToString() + " L " + intersection1.X.ToString() + " " + intersection1.Y.ToString() + " z "; string d2 = makePathd(x7, y7, x8, y8, x3, y3, x4, y4); listPathFaultd.Add(d2); } return(listPathFaultd); }
public static List <string> makePathd(List <itemDrawDataFaultItem> listFaultItem, cDataItemConnect item1, cDataItemConnect item2) { List <string> listPathd = new List <string>(); if (item1.x1 > item2.x1) { swap(ref item1, ref item2); } foreach (itemDrawDataFaultItem item in listFaultItem) { listPathd = makePathd(item, item1, item2); if (listPathd.Count == 2) { return(listPathd); } } if (listPathd.Count == 0) { listPathd.Add(makePathd(item1, item2)); } return(listPathd); }
public static string generateFence(string dirSectionData, string pathSectionCss, string filenameSVGMap) { //定义页面大小 及 纵向平移 List <ItemWellSection> listWellsSection = cXmlDocSectionGeo.makeListWellSection(pathSectionCss); //读取page设置全局类 cXEGeopage curPage = new cXEGeopage(pathSectionCss); int iPageTopYOff = 0; cSVGDocSection svgSection = new cSVGDocSection(curPage.PageWidth, curPage.PageHeight, 0, 0, curPage.sUnit); //定义返回的xmlElement变量,作为调用各种加入的道的返回值 XmlElement returnElemment; XmlDocument XDocSection = new XmlDocument(); XDocSection.Load(pathSectionCss); #region 断层 绘制断层 并把断层数据存入List 供连层时计算使用 XmlElement gLayerFault = svgSection.gLayerElement("断层"); string faultPath = "/SectionMap/FaultInfor/FaultItem"; List <itemDrawDataFaultItem> listFaultItem = new List <itemDrawDataFaultItem>(); foreach (XmlNode xn in XDocSection.SelectNodes(faultPath)) { itemDrawDataFaultItem faultItem = new itemDrawDataFaultItem(xn); string sID = xn.Attributes["id"].Value; double x1 = transformX(curPage.fHScaleWellDistance, xn.Attributes["x1"].Value); double y1 = double.Parse(xn.Attributes["y1"].Value) * curPage.fVscale; double x2 = transformX(curPage.fHScaleWellDistance, xn.Attributes["x2"].Value); double y2 = double.Parse(xn.Attributes["y2"].Value) * curPage.fVscale; faultItem.x1View = x1; faultItem.y1View = y1; faultItem.x2View = x2; faultItem.y2View = y2; faultItem.displacementView = faultItem.displacement * curPage.fHScaleWellDistance; XmlElement faultLine = svgSection.svgDoc.CreateElement("line"); faultLine.SetAttribute("id", sID); faultLine.SetAttribute("stroke-width", "2"); faultLine.SetAttribute("onclick", "getID(evt)"); //左侧的绘制 faultLine.SetAttribute("x1", x1.ToString("0.0")); faultLine.SetAttribute("y1", y1.ToString("0.0")); faultLine.SetAttribute("x2", x2.ToString("0.0")); faultLine.SetAttribute("y2", y2.ToString("0.0")); faultLine.SetAttribute("stroke", "red"); faultLine.SetAttribute("fill", "red"); svgSection.addgElement2Layer(gLayerFault, faultLine, svgSection.offsetX_gSVG, iPageTopYOff); listFaultItem.Add(faultItem); } #endregion #region 先画连接层 判断是否切割,非切割的直接连接,切割的得重画 string pathTrack = "/SectionMap/ConnectInfor/ConnectItem"; //首先得判断是否多边形与断层线相交 XmlElement gLayerConnectJSJL = svgSection.gLayerElement("测井解释"); XmlElement gLayerConnectLayer = svgSection.gLayerElement("分层"); XmlElement gLayerConnectLitho = svgSection.gLayerElement("岩性"); XmlElement gLayerConnectBase = svgSection.gLayerElement("连接"); svgSection.addgLayer(gLayerConnectLayer, 0, 0); foreach (XmlNode xn in XDocSection.SelectNodes(pathTrack)) { if (xn.Attributes["id"] != null) { string sID = xn.Attributes["id"].Value; int iShowMode = int.Parse(xn.Attributes["iShowMode"].Value); string strTypeTrack = xn.Attributes["trackType"].Value; string sFill = xn.Attributes["sFill"].Value; #region 画连接层 模式1 if (iShowMode == 1) { XmlNode rect1 = xn.SelectSingleNode("rect1"); string sIDtrack1 = rect1.Attributes["sIDtrack"].Value; string wellID1 = rect1.Attributes["wellID"].Value; string sIDitem1 = rect1.Attributes["sIDitem"].Value; string filePathOperWell1 = dirSectionData + "//" + wellID1 + ".xml"; cDataItemConnect item1 = new cDataItemConnect(pathSectionCss, filePathOperWell1, wellID1, sIDtrack1, sIDitem1); XmlNode rect2 = xn.SelectSingleNode("rect2"); string sIDtrack2 = rect2.Attributes["sIDtrack"].Value; string wellID2 = rect2.Attributes["wellID"].Value; string sIDitem2 = rect2.Attributes["sIDitem"].Value; string filePathOperWell2 = dirSectionData + "//" + wellID2 + ".xml"; cDataItemConnect item2 = new cDataItemConnect(pathSectionCss, filePathOperWell2, wellID2, sIDtrack2, sIDitem2); if (wellID1 != "" && sIDtrack1 != "" && wellID2 != "" && sIDtrack2 != "") { List <string> ltPathd = makeConnectPath.makePathd(listFaultItem, item1, item2); foreach (string d in ltPathd) { XmlElement connectPath = svgSection.svgDoc.CreateElement("path"); connectPath.SetAttribute("id", sID); connectPath.SetAttribute("stroke-width", "1"); connectPath.SetAttribute("onclick", "getID(evt)"); connectPath.SetAttribute("stroke", "black"); connectPath.SetAttribute("d", d); string fillType = "none"; if (strTypeTrack == TypeTrack.测井解释.ToString()) { fillType = codeReplace.codeReplaceJSJL2FillUrl(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectJSJL, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else if (strTypeTrack == TypeTrack.分层.ToString()) { fillType = cSVGSectionTrackLayer.getLayerFillColor(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectLayer, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else if (strTypeTrack == TypeTrack.岩性层段.ToString()) { fillType = cSVGSectionTrackLayer.getLayerFillColor(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectLitho, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else { connectPath.SetAttribute("fill", "none"); svgSection.addgElement2Layer(gLayerConnectBase, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } } } } #endregion #region 尖灭模式 else { XmlNode rect1 = xn.SelectSingleNode("rect1"); string sIDtrack1 = rect1.Attributes["sIDtrack"].Value; string wellID1 = rect1.Attributes["wellID"].Value; string sIDitem1 = rect1.Attributes["sIDitem"].Value; if (wellID1 != "" && sIDtrack1 != "") { string filePathOperWell1 = dirSectionData + "//" + wellID1 + ".xml"; cDataItemConnect connectItem = new cDataItemConnect(pathSectionCss, filePathOperWell1, wellID1, sIDtrack1, sIDitem1); double fExtanceLength = 100; int indexWell = listWellsSection.IndexOf(listWellsSection.SingleOrDefault(p => p.sJH == wellID1)); if (indexWell < listWellsSection.Count - 1) { fExtanceLength = (listWellsSection[indexWell + 1].fXview - listWellsSection[indexWell].fXview) * 0.35; } string d = ""; if (iShowMode == (int)TypeModeGeoOperate.channelRight) //右河道 { double x1 = connectItem.x1 + connectItem.width; double y1 = connectItem.y1; double x2 = connectItem.x1 + connectItem.width; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 + fExtanceLength; double y3 = y2; double x4 = x1 + fExtanceLength; double y4 = y1; d = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.channelLeft) //左河道 { double x1 = connectItem.x1; double y1 = connectItem.y1; double x2 = connectItem.x1; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 - fExtanceLength; double y3 = y2; double x4 = x1 - fExtanceLength; double y4 = y1; d = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.barRight) //右坝 { double x1 = connectItem.x1 + connectItem.width; double y1 = connectItem.y1; double x2 = connectItem.x1 + connectItem.width; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 + fExtanceLength; double y3 = y1; double x4 = x1 + fExtanceLength; double y4 = y2; d = "M " + x2.ToString() + " " + y2.ToString() + " L " + x1.ToString() + " " + y1.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.barLeft) //左坝 { double x1 = connectItem.x1; double y1 = connectItem.y1; double x2 = connectItem.x1; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 - fExtanceLength; double y3 = y1; double x4 = x1 - fExtanceLength; double y4 = y2; d = "M " + x2.ToString() + " " + y2.ToString() + " L " + x1.ToString() + " " + y1.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.pinchOutRight) //右尖灭 { double x1 = connectItem.x1 + connectItem.width; double y1 = connectItem.y1; double x2 = connectItem.x1 + connectItem.width; double y2 = connectItem.y1 + connectItem.height; d = "M " + x1.ToString() + " " + y1.ToString() + "h " + fExtanceLength.ToString() + "l -" + (0.2 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + "l " + (0.1 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + " L " + x2.ToString() + " " + y2.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.pinchOutLeft) //左尖灭 { double x1 = connectItem.x1; double y1 = connectItem.y1; double x2 = connectItem.x1; double y2 = connectItem.y1 + connectItem.height; d = "M " + x1.ToString() + " " + y1.ToString() + "h-" + fExtanceLength.ToString() + "l " + (0.2 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + "l -" + (0.1 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + " L " + x2.ToString() + " " + y2.ToString() + " z "; } XmlElement connectPath = svgSection.svgDoc.CreateElement("path"); connectPath.SetAttribute("id", sID); connectPath.SetAttribute("stroke-width", "1"); connectPath.SetAttribute("onclick", "getID(evt)"); connectPath.SetAttribute("stroke", "black"); connectPath.SetAttribute("d", d); string fillType = "none"; if (strTypeTrack == TypeTrack.测井解释.ToString()) { fillType = codeReplace.codeReplaceJSJL2FillUrl(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectJSJL, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else if (strTypeTrack == TypeTrack.分层.ToString()) { fillType = cSVGSectionTrackLayer.getLayerFillColor(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectLayer, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } } //end if wellID 不能为空 } #endregion } } #endregion //在listWellSection中循环,一口一口井的加入剖面 for (int i = 0; i < listWellsSection.Count; i++) { string sJH = listWellsSection[i].sJH; string filePathTemplatOper = Path.Combine(dirSectionData, sJH + ".xml"); //斜井模式 cSVGSectionWell currentWell = makePathWell(svgSection, pathSectionCss, filePathTemplatOper, listWellsSection[i].fShowedDepthTop, listWellsSection[i].fShowedDepthBase, curPage.fVscale, curPage); //按显示的顶深拉高 svgSection.addgElement2BaseLayer(currentWell.gWell, curPage.fMapScale * listWellsSection[i].fXview, curPage.fMapScale * listWellsSection[i].fYview - listWellsSection[i].fShowedDepthTop * curPage.fVscale); //加个井位标识 returnElemment = cSVGSectionWell.gWellHead(svgSection.svgDoc, sJH, curPage.fMapScale * listWellsSection[i].fXview, curPage.fMapScale * listWellsSection[i].fYview, 18); svgSection.addgElement2BaseLayer(returnElemment, 0, 0); } svgSection.addgLayer(gLayerConnectBase, 0, 0); svgSection.addgLayer(gLayerConnectLitho, 0, 0); svgSection.addgLayer(gLayerConnectJSJL, 0, 0); svgSection.addgLayer(gLayerFault, 0, 0); string fileSVG = Path.Combine(cProjectManager.dirPathTemp, filenameSVGMap); svgSection.makeSVGfile(fileSVG); return(fileSVG); }
public static string generateSectionGraph(string dirSectionData, string pathSectionCss, string filenameSVGMap) { //定义页面大小 及 纵向平移 List <ItemWellSection> listWellsSection = cXmlDocSectionGeo.makeListWellSection(pathSectionCss); //读取page设置全局类 cXEGeopage curPage = new cXEGeopage(pathSectionCss); iPositionXFirstWell = curPage.iPositionXFirstWell; //设置井的绘制位置 setXPositionView(pathSectionCss, listWellsSection); saveXview2Css(pathSectionCss, listWellsSection); int iPageTopYOff = (int)(curPage.TopElevation * curPage.fVscale); cSVGDocSection svgSection = new cSVGDocSection(curPage.PageWidth, curPage.PageHeight, 0, 0, curPage.sUnit); //定义返回的xmlElement变量,作为调用各种加入的道的返回值 XmlElement returnElemment; #region 增加海拔尺 //初始化页面数据、海拔尺,绘图单位 int ElevationRulerTop = int.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXETrackRuler.xmlFullPathTopElevationDepth)); int ElevationRulerBase = int.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXETrackRuler.xmlFullPathBotElevationDepth)); int iScaleElevationRuler = int.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXETrackRuler.xmlFullPathMainScale)); //海拔尺的maintick int iFontSize = int.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXETrackRuler.xmlFullPathiFontSize)); int iVisible = int.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXETrackRuler.xmlFullPathiVisible)); //调用了简化版的海拔尺,海拔尺与井内容无关和标题一样 可由根文件控制。 //传入的深度与绘制无关,传入的海拔就是正,绘制时海拔向下为正 if (iVisible == 1) { returnElemment = cSVGSectionTrackWellRuler.gElevationRulerSimple(svgSection.svgDoc, ElevationRulerTop, ElevationRulerBase, iScaleElevationRuler, curPage.fVscale, iFontSize); //iDX取了10 //因为有页面的top深对应刻度,所以要做纵向平移。 svgSection.addgElement2BaseLayer(returnElemment, 200, iPageTopYOff); } #endregion XmlDocument XDocSection = new XmlDocument(); XDocSection.Load(pathSectionCss); #region 断层 绘制断层 并把断层数据存入List 供连层时计算使用 XmlElement gLayerFault = svgSection.gLayerElement("断层"); string faultPath = "/SectionMap/FaultInfor/FaultItem"; List <itemDrawDataFaultItem> listFaultItem = new List <itemDrawDataFaultItem>(); foreach (XmlNode xn in XDocSection.SelectNodes(faultPath)) { itemDrawDataFaultItem faultItem = new itemDrawDataFaultItem(xn); string sID = xn.Attributes["id"].Value; double x1 = transformX(curPage.fHScaleWellDistance, xn.Attributes["x1"].Value); double y1 = double.Parse(xn.Attributes["y1"].Value) * curPage.fVscale; double x2 = transformX(curPage.fHScaleWellDistance, xn.Attributes["x2"].Value); double y2 = double.Parse(xn.Attributes["y2"].Value) * curPage.fVscale; faultItem.x1View = x1; faultItem.y1View = y1; faultItem.x2View = x2; faultItem.y2View = y2; faultItem.displacementView = faultItem.displacement * curPage.fHScaleWellDistance; XmlElement faultLine = svgSection.svgDoc.CreateElement("line"); faultLine.SetAttribute("id", sID); faultLine.SetAttribute("stroke-width", "2"); faultLine.SetAttribute("onclick", "getID(evt)"); //左侧的绘制 faultLine.SetAttribute("x1", x1.ToString("0.0")); faultLine.SetAttribute("y1", y1.ToString("0.0")); faultLine.SetAttribute("x2", x2.ToString("0.0")); faultLine.SetAttribute("y2", y2.ToString("0.0")); faultLine.SetAttribute("stroke", "red"); faultLine.SetAttribute("fill", "red"); svgSection.addgElement2Layer(gLayerFault, faultLine, svgSection.offsetX_gSVG, iPageTopYOff); listFaultItem.Add(faultItem); } #endregion #region 先画连接层 判断是否切割,非切割的直接连接,切割的得重画 string pathTrack = "/SectionMap/ConnectInfor/ConnectItem"; //首先得判断是否多边形与断层线相交 XmlElement gLayerConnectJSJL = svgSection.gLayerElement("测井解释"); XmlElement gLayerConnectLayer = svgSection.gLayerElement("分层"); XmlElement gLayerConnectLitho = svgSection.gLayerElement("岩性"); XmlElement gLayerConnectBase = svgSection.gLayerElement("连接"); svgSection.addgLayer(gLayerConnectLayer, 0, 0); foreach (XmlNode xn in XDocSection.SelectNodes(pathTrack)) { if (xn.Attributes["id"] != null) { string sID = xn.Attributes["id"].Value; int iShowMode = int.Parse(xn.Attributes["iShowMode"].Value); string strTypeTrack = xn.Attributes["trackType"].Value; string sFill = xn.Attributes["sFill"].Value; #region 画连接层 模式1 if (iShowMode == 1) { XmlNode rect1 = xn.SelectSingleNode("rect1"); string sIDtrack1 = rect1.Attributes["sIDtrack"].Value; string wellID1 = rect1.Attributes["wellID"].Value; string sIDitem1 = rect1.Attributes["sIDitem"].Value; string filePathOperWell1 = dirSectionData + "//" + wellID1 + ".xml"; cDataItemConnect item1 = new cDataItemConnect(pathSectionCss, filePathOperWell1, wellID1, sIDtrack1, sIDitem1); XmlNode rect2 = xn.SelectSingleNode("rect2"); string sIDtrack2 = rect2.Attributes["sIDtrack"].Value; string wellID2 = rect2.Attributes["wellID"].Value; string sIDitem2 = rect2.Attributes["sIDitem"].Value; string filePathOperWell2 = dirSectionData + "//" + wellID2 + ".xml"; cDataItemConnect item2 = new cDataItemConnect(pathSectionCss, filePathOperWell2, wellID2, sIDtrack2, sIDitem2); if (wellID1 != "" && sIDtrack1 != "" && wellID2 != "" && sIDtrack2 != "") { List <string> ltPathd = makeConnectPath.makePathd(listFaultItem, item1, item2); foreach (string d in ltPathd) { XmlElement connectPath = svgSection.svgDoc.CreateElement("path"); connectPath.SetAttribute("id", sID); connectPath.SetAttribute("stroke-width", "1"); connectPath.SetAttribute("onclick", "getID(evt)"); connectPath.SetAttribute("stroke", "black"); connectPath.SetAttribute("d", d); string fillType = "none"; if (strTypeTrack == TypeTrack.测井解释.ToString()) { fillType = codeReplace.codeReplaceJSJL2FillUrl(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectJSJL, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else if (strTypeTrack == TypeTrack.分层.ToString()) { fillType = cSVGSectionTrackLayer.getLayerFillColor(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectLayer, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else if (strTypeTrack == TypeTrack.岩性层段.ToString()) { fillType = cSVGSectionTrackLayer.getLayerFillColor(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectLitho, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else { connectPath.SetAttribute("fill", "none"); svgSection.addgElement2Layer(gLayerConnectBase, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } } } } #endregion #region 尖灭模式 else { XmlNode rect1 = xn.SelectSingleNode("rect1"); string sIDtrack1 = rect1.Attributes["sIDtrack"].Value; string wellID1 = rect1.Attributes["wellID"].Value; string sIDitem1 = rect1.Attributes["sIDitem"].Value; if (wellID1 != "" && sIDtrack1 != "") { string filePathOperWell1 = dirSectionData + "//" + wellID1 + ".xml"; cDataItemConnect connectItem = new cDataItemConnect(pathSectionCss, filePathOperWell1, wellID1, sIDtrack1, sIDitem1); double fExtanceLength = 100; int indexWell = listWellsSection.IndexOf(listWellsSection.SingleOrDefault(p => p.sJH == wellID1)); if (indexWell < listWellsSection.Count - 1) { fExtanceLength = (listWellsSection[indexWell + 1].fXview - listWellsSection[indexWell].fXview) * 0.35; } string d = ""; if (iShowMode == (int)TypeModeGeoOperate.channelRight) //右河道 { double x1 = connectItem.x1 + connectItem.width; double y1 = connectItem.y1; double x2 = connectItem.x1 + connectItem.width; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 + fExtanceLength; double y3 = y2; double x4 = x1 + fExtanceLength; double y4 = y1; d = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.channelLeft) //左河道 { double x1 = connectItem.x1; double y1 = connectItem.y1; double x2 = connectItem.x1; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 - fExtanceLength; double y3 = y2; double x4 = x1 - fExtanceLength; double y4 = y1; d = "M " + x1.ToString() + " " + y1.ToString() + " L " + x2.ToString() + " " + y2.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.barRight) //右坝 { double x1 = connectItem.x1 + connectItem.width; double y1 = connectItem.y1; double x2 = connectItem.x1 + connectItem.width; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 + fExtanceLength; double y3 = y1; double x4 = x1 + fExtanceLength; double y4 = y2; d = "M " + x2.ToString() + " " + y2.ToString() + " L " + x1.ToString() + " " + y1.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.barLeft) //左坝 { double x1 = connectItem.x1; double y1 = connectItem.y1; double x2 = connectItem.x1; double y2 = connectItem.y1 + connectItem.height; double x3 = x1 - fExtanceLength; double y3 = y1; double x4 = x1 - fExtanceLength; double y4 = y2; d = "M " + x2.ToString() + " " + y2.ToString() + " L " + x1.ToString() + " " + y1.ToString() + " Q " + x3.ToString() + " " + y3.ToString() + " " + x4.ToString() + " " + y4.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.pinchOutRight) //右尖灭 { double x1 = connectItem.x1 + connectItem.width; double y1 = connectItem.y1; double x2 = connectItem.x1 + connectItem.width; double y2 = connectItem.y1 + connectItem.height; d = "M " + x1.ToString() + " " + y1.ToString() + "h " + fExtanceLength.ToString() + "l -" + (0.2 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + "l " + (0.1 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + " L " + x2.ToString() + " " + y2.ToString() + " z "; } if (iShowMode == (int)TypeModeGeoOperate.pinchOutLeft) //左尖灭 { double x1 = connectItem.x1; double y1 = connectItem.y1; double x2 = connectItem.x1; double y2 = connectItem.y1 + connectItem.height; d = "M " + x1.ToString() + " " + y1.ToString() + "h-" + fExtanceLength.ToString() + "l " + (0.2 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + "l -" + (0.1 * fExtanceLength).ToString() + " " + (connectItem.height / 2).ToString() + " " + " L " + x2.ToString() + " " + y2.ToString() + " z "; } XmlElement connectPath = svgSection.svgDoc.CreateElement("path"); connectPath.SetAttribute("id", sID); connectPath.SetAttribute("stroke-width", "1"); connectPath.SetAttribute("onclick", "getID(evt)"); connectPath.SetAttribute("stroke", "black"); connectPath.SetAttribute("d", d); string fillType = "none"; if (strTypeTrack == TypeTrack.测井解释.ToString()) { fillType = codeReplace.codeReplaceJSJL2FillUrl(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectJSJL, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } else if (strTypeTrack == TypeTrack.分层.ToString()) { fillType = cSVGSectionTrackLayer.getLayerFillColor(sFill); connectPath.SetAttribute("fill", fillType); svgSection.addgElement2Layer(gLayerConnectLayer, connectPath, svgSection.offsetX_gSVG, iPageTopYOff); } } //end if wellID 不能为空 } #endregion } } #endregion #region //在listWellSection中循环,一口一口井的加入剖面 for (int i = 0; i < listWellsSection.Count; i++) { string sJH = listWellsSection[i].sJH; string filePathTemplatOper = Path.Combine(dirSectionData, sJH + ".xml"); //斜井模式 cSVGSectionWell currentWell = makePathWell(svgSection, pathSectionCss, filePathTemplatOper, listWellsSection[i].fShowedDepthTop, listWellsSection[i].fShowedDepthBase, curPage.fVscale, curPage); //建立新层 XmlElement gWellLayer = svgSection.gLayerElement(sJH); svgSection.addgLayer(gWellLayer, 0, 0); svgSection.addgElement2Layer(gWellLayer, currentWell.gWell, listWellsSection[i].fXview, iPageTopYOff + listWellsSection[i].fYview * curPage.fVscale); //增加井距线 if (i < listWellsSection.Count - 1) { double distance = c2DGeometryAlgorithm.calDistance2D(listWellsSection[i].dbX, listWellsSection[i].dbY, listWellsSection[i + 1].dbX, listWellsSection[i + 1].dbY); returnElemment = cSVGSectionTrackConnect.gLineWellDistance(svgSection.svgDoc, listWellsSection[i].fXview, 10, listWellsSection[i + 1].fXview - listWellsSection[i].fXview, distance); svgSection.addgElement2BaseLayer(returnElemment, svgSection.offsetX_gSVG, svgSection.offsetY_gSVG); } } #endregion svgSection.addgLayer(gLayerConnectBase, 0, 0); svgSection.addgLayer(gLayerConnectLitho, 0, 0); svgSection.addgLayer(gLayerConnectJSJL, 0, 0); svgSection.addgLayer(gLayerFault, 0, 0); string fileSVG = Path.Combine(cProjectManager.dirPathTemp, filenameSVGMap); svgSection.makeSVGfile(fileSVG); return(fileSVG); }