Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        void generateSectionGraph(string filenameSVGMap, bool bView)
        {
            //xml存数据不合适 因为会有大量的井数据,但是可以存个样式,样式搭配数据,样式里可以有道宽,这样做到数据和样式的分离,成图解析器解析样式就OK。

            //定义每口井绘制的位置坐标,剖面图y=0,井组分析x,y是井点坐标变换值
            //定义 iChoise==1 等间隔排列,iChoise==2 相邻井真实距离缩放
            int iChoise = 2;

            if (rdbPlaceByEqual.Checked == true)
            {
                iChoise = 1;
            }
            List <Point> PListWellPositon = new List <Point>();


            //根据默认值定义section的页面大小及标题,根据海拔确定纵向的平移高度
            int            iDY        = (int)listWellsSection.Select(p => p.fKB).ToList().Max() + 100;
            cSVGDocSection svgSection = new cSVGDocSection(PageWidth, PageHeight, 0, iDY, sUnit);
            string         sTitle     = string.Join("-", listWellsSection.Select(p => p.sJH).ToList()) + "开发剖面图";

            svgSection.addMapTitle(sTitle, 100, 100);

            XmlElement returnElemment;

            //画井距尺
            for (int i = 0; i < this.listWellsSection.Count - 1; i++)
            {
                if (rdbPlaceBYWellDistance.Checked == true)
                {
                    //距离是2口相邻井的距离
                    int iDistance = Convert.ToInt16(c2DGeometryAlgorithm.calDistance2D(listWellsSection[i].dbX, listWellsSection[i].dbY, listWellsSection[i + 1].dbX, listWellsSection[i + 1].dbY));
                    returnElemment = svgSection.gWellDistanceRuler(iDistance, PListWellPositon[i + 1].X - PListWellPositon[i].X);
                    svgSection.addgElement2BaseLayer(returnElemment, PListWellPositon[i].X, (int)listWellsSection[0].fYview);//拉到同一水平线
                    //画井距尺
                }
            }

            ElevationRulerBase = -PageHeight / 100 * 100;
            //海拔深度时 增加海拔尺,拉平不要海拔尺

            int iScaleElevationRuler = 50;

            returnElemment = cSVGSectionTrackWellRuler.gElevationRuler(svgSection.svgDoc, ElevationRulerTop, ElevationRulerBase, iScaleElevationRuler);
            svgSection.addgElement2BaseLayer(returnElemment, 10);

            //根据井序列循环添加井剖面
            for (int i = 0; i < listWellsSection.Count; i++)
            {
                string sJH = listWellsSection[i].sJH;

                List <ItemDicWellPath> currentWellPathList = cProjectData.ltProjectWell.Find(p => p.sJH == sJH).WellPathList;
                float fTopShowed    = listWellsSection[i].fShowedDepthTop;
                float fBaseShowed   = listWellsSection[i].fShowedDepthBase;
                float fDepthFlatted = listWellsSection[i].fYview;

                cSVGSectionWell currentWell = new cSVGSectionWell(svgSection.svgDoc, sJH);


                //增加地层道
                trackDataListLayerDepth getTrackDataListLayerDepth = cIOWellSection.getTrackDataListLayerDepth(sJH, dirSectionData, fTopShowed, fBaseShowed);
                int iTrackWidth = 15;
                cSVGSectionTrackLayer layerTrack = new cSVGSectionTrackLayer(iTrackWidth);
                layerTrack.iTextSize = 6;
                if (rdbDepthModelTVD.Checked == true && currentWellPathList.Count > 2)
                {
                    returnElemment = layerTrack.gXieTrack2VerticalLayerDepth(sJH, getTrackDataListLayerDepth, fDepthFlatted);
                }
                else
                {
                    returnElemment = layerTrack.gTrackLayerDepth(sJH, getTrackDataListLayerDepth, fDepthFlatted);
                }
                currentWell.addTrack(returnElemment, iTrackWidth);

                //增加联井的view
                //增加测井解释
                trackDataListJSJL trackDataListJSJL = cIOWellSection.getTrackDataListJSJL(sJH, dirSectionData, fTopShowed, fBaseShowed);
                iTrackWidth = 15;
                cSVGSectionTrackJSJL JSJLTrack = new cSVGSectionTrackJSJL(iTrackWidth);
                if (rdbDepthModelTVD.Checked == true && currentWellPathList.Count > 2)
                {
                    returnElemment = JSJLTrack.gXieTrack2VerticalJSJL(sJH, trackDataListJSJL, fDepthFlatted);
                }
                else
                {
                    returnElemment = JSJLTrack.gTrackJSJL(sJH, trackDataListJSJL, fDepthFlatted);
                }
                currentWell.addTrack(returnElemment, -iTrackWidth);

                //增加射孔道
                trackInputPerforationDataList getTrackDataListPerforation = cIOWellSection.getTrackDataListPerforation(sJH, dirSectionData, fTopShowed, fBaseShowed);
                iTrackWidth = 15;
                cSVGSectionTrackPeforation perforationTrack = new cSVGSectionTrackPeforation(iTrackWidth);
                if (rdbDepthModelTVD.Checked == true && currentWellPathList.Count > 2)
                {
                    returnElemment = perforationTrack.gXieTrack2VerticalPerforation(sJH, getTrackDataListPerforation, fDepthFlatted);
                }
                else
                {
                    returnElemment = perforationTrack.gTrackPerforation(sJH, getTrackDataListPerforation, fDepthFlatted);
                }
                currentWell.addTrack(returnElemment, -2 * iTrackWidth);

                //增加吸水剖面
                trackDataListProfile trackDataListProfile = cIOWellSection.getTrackDataListProfile(sJH, dirSectionData, fTopShowed, fBaseShowed);
                iTrackWidth = 15;
                cSVGSectionTrackProfile profileTrack = new cSVGSectionTrackProfile(iTrackWidth);
                returnElemment = profileTrack.gTrackProfile(sJH, trackDataListProfile, fDepthFlatted);
                if (currentWellPathList.Count > 2)
                {
                    returnElemment = profileTrack.gXieTrack2VerticalProfile(sJH, trackDataListProfile, fDepthFlatted);
                }
                else
                {
                    returnElemment = profileTrack.gTrackProfile(sJH, trackDataListProfile, fDepthFlatted);
                }
                currentWell.addTrack(returnElemment, 15);

                //增加左边曲线
                string fileLeftLogScrPath = Path.Combine(dirSectionData, sJH + "\\left");
                foreach (string fileLog in Directory.GetFileSystemEntries(fileLeftLogScrPath))
                {
                    //trackDataListLog trackDataListLeftLog = trackDataListLog.setupDataListTrackLog(fileLog, fTopShowed, fBaseShowed);
                    iTrackWidth = 15;

                    //cSVGSectionTrackLog logTrack = new cSVGSectionTrackLog(iTrackWidth);
                    //if (rdbDepthModelTVD.Checked == true && currentWellPathList.Count > 2)
                    //    returnElemment = logTrack.gXieTrack2VerticalLog(sJH, trackDataListLeftLog, fDepthFlatted);
                    //else returnElemment = logTrack.gTrackLog(sJH, trackDataListLeftLog, fDepthFlatted);
                    //currentWell.addTrack(returnElemment, -30);
                }

                //增加右边曲线
                string fileRightLogScrPath = Path.Combine(dirSectionData, sJH + "\\right");
                foreach (string fileLog in Directory.GetFileSystemEntries(fileRightLogScrPath))
                {
                    //trackDataListLog trackDataListRightLog = trackDataListLog.setupDataListTrackLog(fileLog, fTopShowed, fBaseShowed);
                    iTrackWidth = 15;
                    //cSVGSectionTrackLog logTrack = new cSVGSectionTrackLog(iTrackWidth);
                    //if (rdbDepthModelTVD.Checked == true && currentWellPathList.Count > 2)
                    //    returnElemment = logTrack.gXieTrack2VerticalLog(sJH, trackDataListRightLog, fDepthFlatted);
                    //else returnElemment = logTrack.gTrackLog(sJH,  trackDataListRightLog, fDepthFlatted);

                    //currentWell.addTrack(returnElemment, iTrackWidth);
                }
                svgSection.addgElement2BaseLayer(currentWell.gWell, PListWellPositon[i].X);
            }

            //同名小层连线的实现 在绘制小层layertrack的时候,把小层的顶底深的绘制点记录,然后此处当做polyline绘制
            bool bConnect = this.cbxConnectSameLayerName.Checked;

            string fileSVG = Path.Combine(cProjectManager.dirPathMap, filenameSVGMap);

            svgSection.makeSVGfile(fileSVG);
            if (bView == false)
            {
                FormMain.filePathWebSVG = fileSVG;
                this.Close();
            }
        }