Пример #1
0
        public static XmlElement gWellPieGraphFromXML(XmlDocument svgDoc, XmlNode xnLayer, string sID, List <ItemWellMapPosition> ltWellPos, cXELayerPage curPage)
        {
            float         fR            = float.Parse(xnLayer.SelectSingleNode("r").InnerText);
            List <string> listscolor    = xnLayer.SelectSingleNode("sColor").InnerText.Split().ToList();
            float         fscaleR       = float.Parse(xnLayer.SelectSingleNode("fScaleR").InnerText);
            XmlElement    gEleWellGraph = svgDoc.CreateElement("g");

            gEleWellGraph.SetAttribute("id", sID);

            XmlNodeList xnList = xnLayer.SelectNodes("data/item");

            foreach (XmlNode item in xnList)
            {
                List <string>       listSplitItem      = item.InnerText.Split().ToList();
                string              jh                 = listSplitItem[0];
                ItemWellMapPosition itemStaticWellPosi = ltWellPos.Find(p => p.sJH == jh);
                List <float>        fListdata          = new List <float>();
                for (int i = 1; i < listSplitItem.Count; i++)
                {
                    fListdata.Add(float.Parse(listSplitItem[i]));
                }
                if (itemStaticWellPosi != null)
                {
                    Point PViewWell = cCordinationTransform.transRealPointF2ViewPoint(itemStaticWellPosi.dbX, itemStaticWellPosi.dbY, curPage.xRef, curPage.yRef, curPage.dfscale);
                    gEleWellGraph.AppendChild(cBaseMapSVG.gWellPie(svgDoc, PViewWell, fListdata, listscolor, fscaleR));
                }
            }
            return(gEleWellGraph);
        }
Пример #2
0
        public static XmlElement gWellsPosition(XmlDocument svgDoc, List <ItemWellMapPosition> listMapLayerWell, string sID, cXEWellCss wellCss, cXELayerPage curPage)
        {
            XmlElement gWellPositon = svgDoc.CreateElement("g");

            gWellPositon.SetAttribute("id", sID);
            foreach (ItemWellMapPosition item in listMapLayerWell)
            {
                //如果缺失本层的分层数据, 采用井头的数据作为井位,此处可以选用上一层的数据,这块可以在初始化绘图List数据时采用
                //配置文件内 显示所有井位1 显示当然层井 iShowAll = 0;
                if (curPage.iShowAllJH == 1 && item.dbX == 0)
                {
                    ItemWell curWell = cProjectData.ltProjectWell.SingleOrDefault(p => p.sJH == item.sJH);
                    if (curWell != null)
                    {
                        item.dbX = curWell.dbX;
                        item.dbY = curWell.dbY;
                    }
                }
                Point pointConvert2View = cCordinationTransform.transRealPointF2ViewPoint(item.dbX, item.dbY, curPage.xRef, curPage.yRef, curPage.dfscale);
                gWellPositon.AppendChild(gWell(svgDoc, item.sJH, pointConvert2View.X, pointConvert2View.Y, item.iWellType,
                                               wellCss.iFontSizeJH, wellCss.iRadis, wellCss.iCirlceWidth, wellCss.DX_JHText, wellCss.DY_JHText));
            }
            return(gWellPositon);
        }
Пример #3
0
        public static string generateLayerMap(string filePathLayerOperate, string sCurrentLayer)
        {
            //注意偏移量,偏移主要是为了好看 如果不偏移的话 就会绘到角落上,这时的偏移是整个偏移 后面的不用偏移了,相对偏移0,0

            //svg文件和XML对应的问题还要思考一下
            string dirPathLayer        = Path.Combine(cProjectManager.dirPathLayerDir, sCurrentLayer);
            string filePathSVGLayerMap = Path.Combine(dirPathLayer, Path.GetFileNameWithoutExtension(filePathLayerOperate) + ".svg");

            //这块需要处理覆盖问题。
            if (File.Exists(filePathSVGLayerMap))
            {
                File.Delete(filePathSVGLayerMap);
            }

            //解析当前的XML配置文件,根据每个Layer标签的LayerType生成id为层名的图层,添加到svgLayer中去

            XmlDocument xmlLayerMap = new XmlDocument();

            xmlLayerMap.Load(filePathLayerOperate);
            //获取基本的页面信息及基础配置文件信息

            //获取井位List
            XmlNodeList xnWellDataList = xmlLayerMap.SelectNodes("/LayerMapConfig/DataDicStatic/data/item");
            List <ItemWellMapPosition> listWellLayerMap = new List <ItemWellMapPosition>();

            foreach (XmlNode xn in xnWellDataList)
            {
                ItemWellMapPosition item = ItemWellMapPosition.parseLine(xn.Attributes["LayerDataDicText"].Value);
                listWellLayerMap.Add(item);
            }

            //根据配置文件,读取页面基本配置信息
            cXELayerPage curPage = new cXELayerPage(xmlLayerMap);

            int             idx         = 200;
            int             idy         = 200;
            int             PageWidth   = curPage.iPageWidth;
            int             PageHeight  = curPage.iPageHeight;
            string          sUnit       = "mm";
            cSVGDocLayerMap svgLayerMap = new cSVGDocLayerMap(PageWidth, PageHeight, idx, idy, sUnit);
            //add title
            string sTitle = Path.GetFileNameWithoutExtension(filePathLayerOperate);

            svgLayerMap.addMapTitle(sTitle, PageWidth / 2, 20);
            XmlElement returnElemment;

            cXEWellCss wellCss = new cXEWellCss(xmlLayerMap);

            //从配置文件中 读取图层列表,根据配置绘制图层
            XmlNode xnLayerList = xmlLayerMap.SelectSingleNode("/LayerMapConfig/LayerList");

            //或许Layer标签的节点
            foreach (XmlNode xn in xnLayerList.ChildNodes)
            {
                string sIDLayer      = xn.Attributes["id"].Value;
                string sLayerType    = xn.Attributes["layerType"].Value;
                string sLayerVisible = xn["visible"].InnerText;
                //建立新层
                XmlElement gNewLayer = svgLayerMap.gLayerElement(sIDLayer);
                svgLayerMap.addgLayer(gNewLayer, idx, idy);

                #region  测井曲线图层
                if (sLayerVisible == "1" && sLayerType == TypeLayer.LayerLog.ToString())
                {
                    LayerDataLog layerDataLog = new LayerDataLog(xn);
                    foreach (ItemWellMapPosition itemWell in listWellLayerMap)
                    {
                        Point PViewWell = cCordinationTransform.transRealPointF2ViewPoint(itemWell.dbX, itemWell.dbY, curPage.xRef, curPage.yRef, curPage.dfscale);
                        returnElemment = cXMLLayerMapWellLog.gLayerWellLog(svgLayerMap, itemWell, layerDataLog);
                        //新层加内容
                        int xViewStart = PViewWell.X;
                        int yViewStart = PViewWell.Y;
                        //如果左值小于右值,就把曲线坐班绘制
                        if (layerDataLog.iLeftDraw == 1)
                        {
                            xViewStart = xViewStart - layerDataLog.iTrackWidth;
                        }
                        svgLayerMap.addgElement2Layer(gNewLayer, returnElemment, xViewStart, yViewStart);
                    }
                }
                #endregion

                #region 小层SectionLayer图层。
                if (sLayerVisible == "1" && sLayerType == TypeLayer.LayerSection.ToString())
                {
                    //建立新层
                    XmlElement gWellLayer = svgLayerMap.gLayerElement("LayerSection");
                    svgLayerMap.addgLayer(gWellLayer, 0, 0);
                    for (int i = 0; i < listWellLayerMap.Count; i++)
                    {
                        string sCurJH     = listWellLayerMap[i].sJH;
                        string sCurXCM    = listWellLayerMap[i].sXCM;
                        string dirLayerJH = Path.Combine(cProjectManager.dirPathLayerDir, sCurXCM, sCurJH);
                        string filePathSecitonTemplatOper     = Path.Combine(dirLayerJH, sCurJH + "_" + sCurXCM + ".xml");
                        string filePathSecitonLayerSectionSVG = Path.Combine(dirLayerJH, sCurJH + "_" + sCurXCM + ".svg");

                        //斜井模式
                        double fVscaleLayerSection = 50;

                        makeWellLayerSectionGraph(filePathSecitonTemplatOper, listWellLayerMap[i].dbTop, listWellLayerMap[i].dbBot, fVscaleLayerSection);
                        Point PViewWell = cCordinationTransform.transRealPointF2ViewPoint(listWellLayerMap[i].dbX, listWellLayerMap[i].dbY, curPage.xRef, curPage.yRef, curPage.dfscale);
                        //新层加内容
                        int xViewStart = PViewWell.X;
                        int yViewStart = PViewWell.Y;
                        //这块应该改成相对路径
                        string pathLayerSectionRelative = Path.Combine(sCurJH, sCurJH + "_" + sCurXCM + ".svg");
                        if (File.Exists(filePathSecitonLayerSectionSVG))
                        {
                            svgLayerMap.addgSVG2Layer(gNewLayer, filePathSecitonLayerSectionSVG, xViewStart, yViewStart);
                        }
                    }
                }
                #endregion

                #region 断层图层。
                if (sLayerVisible == "1" && sLayerType == TypeLayer.LayerFaultLine.ToString())
                {
                    XmlNode dataLine = xn.SelectSingleNode("dataList");

                    if (dataLine != null)
                    {
                        XmlNodeList dataItem = dataLine.SelectNodes("dataItem");
                        foreach (XmlNode faultItem in dataItem)
                        {
                            ItemFaultLine curItemdata   = new ItemFaultLine(faultItem);
                            List <Point>  listPointView = new List <Point>();
                            foreach (PointD pd in curItemdata.ltPoints)
                            {
                                Point PViewWell = cCordinationTransform.transRealPointF2ViewPoint(pd.X, pd.Y, curPage.xRef, curPage.yRef, curPage.dfscale);
                                listPointView.Add(PViewWell);
                            }
                            returnElemment = cXMLLayerMapStatic.gFault(svgLayerMap, curItemdata, listPointView);
                            //新层加内容
                            svgLayerMap.addgElement2Layer(gNewLayer, returnElemment);
                        }
                    }
                }
                #endregion

                #region 井位图层。
                if (sLayerVisible == "1" && sLayerType == TypeLayer.LayerWellPosition.ToString())
                {
                    XmlNode dataList = xn.SelectSingleNode("dataList");

                    if (dataList != null)
                    {
                        XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                        foreach (XmlNode xnWell in dataItem)
                        {
                            ItemLayerWellPattern itemWell = new ItemLayerWellPattern(xnWell);
                            Point PViewWell = cCordinationTransform.transRealPointF2ViewPoint(itemWell.X, itemWell.Y, curPage.xRef, curPage.yRef, curPage.dfscale);
                            returnElemment = cXMLLayerMapStatic.gWellPattern(svgLayerMap, itemWell, 10, 5, 5, 5, 5);

                            //新层加内容
                            svgLayerMap.addgElement2Layer(gNewLayer, returnElemment, PViewWell.X, PViewWell.Y);
                        }
                    }
                }
                #endregion

                #region 井位饼图图层
                if (sLayerType == TypeLayer.LayerPieGraph.ToString())
                {
                    returnElemment = cXMLLayerMapWellPieGraph.gWellPieGraphFromXML(svgLayerMap.svgDoc, xn, sIDLayer, listWellLayerMap, curPage);
                    //新层加内容
                    svgLayerMap.addgElement2Layer(gNewLayer, returnElemment);
                }
                #endregion


                //由于井位图是底图,造成被压在最下面一层。这个问题要解决一下。
                returnElemment = cSVGLayerWellPosition.gWellsPosition(xmlLayerMap, listWellLayerMap, "井位", wellCss, curPage);
                svgLayerMap.addgElement2BaseLayer(returnElemment);

                #region 比例尺
                if (curPage.iShowScaleRuler == 1)
                {
                    XmlElement gLayerScaleRuler = svgLayerMap.gLayerElement("比例尺");
                    svgLayerMap.addgLayer(gLayerScaleRuler, svgLayerMap.offsetX_gSVG, svgLayerMap.offsetY_gSVG);
                    returnElemment = svgLayerMap.gScaleRuler(0, 0, curPage.dfscale);
                    svgLayerMap.addgElement2Layer(gLayerScaleRuler, returnElemment, 100, 100);
                }
                #endregion

                #region 页面网格及标志
                if (curPage.iShowMapFrame == 1)
                {
                    returnElemment = svgLayerMap.gMapFrame(curPage);
                    svgLayerMap.addgElement2BaseLayer(returnElemment);
                }
                #endregion

                #region 指南针
                if (curPage.iShowCompass == 1)
                {
                    XmlElement gLayerCompass = svgLayerMap.gLayerElement("指南针");
                    svgLayerMap.addgLayer(gLayerCompass, svgLayerMap.offsetX_gSVG, svgLayerMap.offsetY_gSVG);
                    svgLayerMap.addgElement2Layer(gLayerCompass, svgLayerMap.gCompass(300, 100));
                }
                #endregion
            } //end of 所有图层的绘制

            svgLayerMap.makeSVGfile(filePathSVGLayerMap);
            return(filePathSVGLayerMap);
        }