Beispiel #1
0
        void updateTable(trackDataListLog logX, trackDataListLog logY)
        {
            dgvDataTable.Columns.Clear();
            foreach (string headText in new List <string>
            {
                "深度", logX.itemHeadInforDraw.sLogName, "深度", logY.itemHeadInforDraw.sLogName, "plotX", "plotY"
            })
            {
                DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();
                col.HeaderText = headText;
                dgvDataTable.Columns.Add(col);
            }

            int iLineMax = logX.fListMD.Count;

            if (logY.fListMD.Count > logX.fListMD.Count)
            {
                iLineMax = logY.fListMD.Count;
            }

            for (int i = 0; i < iLineMax; i++)
            {
                this.dgvDataTable.Rows.Add();
                if (i < logX.fListMD.Count)
                {
                    dgvDataTable.Rows[i].Cells[0].Value = logX.fListMD[i].ToString();
                    dgvDataTable.Rows[i].Cells[1].Value = logX.fListValue[i].ToString();
                }
                if (i < logY.fListMD.Count)
                {
                    dgvDataTable.Rows[i].Cells[2].Value = logY.fListMD[i].ToString();
                    dgvDataTable.Rows[i].Cells[3].Value = logY.fListValue[i].ToString();
                }
            }
        }
Beispiel #2
0
        void initializaForm()
        {
            trackDataListLog dlTrackDataListLog = cSVGSectionTrackLog.getLogSeriersFromLogFile(sJH, sLogName);

            if (trackTypeStr == TypeTrack.曲线道.ToString())
            {
                dgvDataTable.Columns.Clear();
                dgvDataTable.Columns.Add("topDepth", "深度");
                dgvDataTable.Columns.Add("value", "数值");
                if (dlTrackDataListLog.fListMD.Count > 1)
                {
                    dgvDataTable.Rows.Add(dlTrackDataListLog.fListMD.Count);
                }
                else
                {
                    dgvDataTable.Rows.Add();
                }
            }
            int iCount = dgvDataTable.ColumnCount;

            for (int i = 0; i < dlTrackDataListLog.fListMD.Count; i++)
            {
                dgvDataTable.Rows[i].Cells[0].Value = dlTrackDataListLog.fListMD[i].ToString("0.00");
                dgvDataTable.Rows[i].Cells[1].Value = dlTrackDataListLog.fListValue[i].ToString("0.00");
            }
        }
Beispiel #3
0
        private void btnSelectLog_Click(object sender, EventArgs e)
        {
            fTop = float.Parse(this.nTBXtop.Text);
            fBot = float.Parse(this.nTBXbot.Text);
            if (this.cbbLog.SelectedIndex >= 0)
            {
                string sLogX = cbbLog.SelectedItem.ToString();
                if (sLogX != null)
                {
                    this.curLog = cIOinputLog.getLogSeriersFromSectionWellFromLogFile(sJH, sLogX, fTop, fBot);
                }
            }

            dgvDataTable.Columns.Clear();
            foreach (string headText in new List <string> {
                "深度", curLog.itemHeadInforDraw.sLogName, "深度", "新曲线"
            })
            {
                DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn();
                col.HeaderText = headText;
                dgvDataTable.Columns.Add(col);
            }

            int iLineMax = curLog.fListMD.Count;

            for (int i = 0; i < iLineMax; i++)
            {
                this.dgvDataTable.Rows.Add();
                if (i < curLog.fListMD.Count)
                {
                    dgvDataTable.Rows[i].Cells[0].Value = curLog.fListMD[i].ToString();
                    dgvDataTable.Rows[i].Cells[1].Value = curLog.fListValue[i].ToString();
                }
            }
        }
Beispiel #4
0
        double getIntervalLogValue(trackDataListLog logDataList, ItemTrackDrawDataIntervalProperty dataItem)
        {
            List <double> ltCurDouble = new List <double>();

            for (int i = 0; i < logDataList.fListMD.Count; i++)
            {
                if (logDataList.fListMD[i] >= dataItem.top && logDataList.fListMD[i] <= dataItem.bot)
                {
                    ltCurDouble.Add(logDataList.fListValue[i]);
                }
            }
            return(ltCurDouble.Average());
        }
        public static trackDataListLog getLogSeriersFromSectionWell(string sJHSelected, string sLogname, int dfDS1Show, int dfDS2Show)
        {
            trackDataListLog sttTrackLogDataList = new trackDataListLog();

            string filePathLogTXT = Path.Combine(cProjectManager.dirPathLog, sJHSelected + "_$#log");

            if (File.Exists(filePathLogTXT))
            {
                using (StreamReader sr = new StreamReader(filePathLogTXT, Encoding.UTF8))
                {
                    String   line;
                    string[] split;
                    int      iLineIndex = 0;
                    int      iIndex     = 0;
                    while ((line = sr.ReadLine()) != null) //delete the line whose legth is 0
                    {
                        iLineIndex++;
                        split = line.Trim().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                        if (iLineIndex == 1)
                        {
                            iIndex = split.ToList().IndexOf(sLogname);
                        }
                        else if (iLineIndex % 2 == 0)  //抽稀一半点数。
                        {
                            float fDepth = float.Parse(split[0]);
                            if (fDepth >= dfDS1Show && fDepth <= dfDS2Show)
                            {
                                sttTrackLogDataList.fListMD.Add(fDepth);
                                if (iIndex >= 0)
                                {
                                    sttTrackLogDataList.fListValue.Add(float.Parse(split[iIndex]));
                                }
                                else
                                {
                                    sttTrackLogDataList.fListValue.Add(-999);
                                }
                            }
                        }
                    }
                }
            }
            return(sttTrackLogDataList);
        }
Beispiel #6
0
 void setUpDataList()
 {
     fTop = float.Parse(this.nTBXtop.Text);
     fBot = float.Parse(this.nTBXbot.Text);
     if (cbbXLog.SelectedIndex >= 0)
     {
         string sLogX = cbbXLog.SelectedItem.ToString();
         if (sLogX != null)
         {
             logX = cIOinputLog.getLogSeriersFromSectionWellFromLogFile(sJH, sLogX, fTop, fBot);
         }
     }
     if (cbbYLog.SelectedIndex >= 0)
     {
         string sLogY = cbbYLog.SelectedItem.ToString();
         if (sLogY != null)
         {
             logY = cIOinputLog.getLogSeriersFromSectionWellFromLogFile(sJH, sLogY, fTop, fBot);
         }
     }
 }
Beispiel #7
0
        //按深度段从sectionWell 里得到值
        public static trackDataListLog getLogSeriersFromSectionWellFromLogFile(string sJH, string sLogName, double dfTop, double dfBot)
        {
            trackDataListLog sttTrackLogDataList = new trackDataListLog();

            sttTrackLogDataList.itemHeadInforDraw.sLogName = sLogName;
            string _filepath = Path.Combine(cProjectManager.dirPathWellDir, sJH, sLogName + cProjectManager.fileExtensionWellLog);

            if (!File.Exists(_filepath))
            {
                return(sttTrackLogDataList);
            }
            else
            {
                using (StreamReader sr = new StreamReader(_filepath, Encoding.UTF8))
                {
                    string _line;
                    int    lineIndex       = 0;
                    int    _iDataStartLine = 4;             //
                    while ((_line = sr.ReadLine()) != null) //抽稀
                    {
                        lineIndex++;
                        if (lineIndex > _iDataStartLine)  //抽稀了一半数据
                        {
                            string[] split = _line.Trim().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                            float    top;
                            double   value;
                            if (float.TryParse(split[0], out top) && double.TryParse(split[1], out value))
                            {
                                if (dfTop <= top && top <= dfBot)
                                {
                                    sttTrackLogDataList.fListMD.Add(top);
                                    sttTrackLogDataList.fListValue.Add(value);
                                }
                            }
                        }
                    }//end while
                }
            }
            return(sttTrackLogDataList);
        }
Beispiel #8
0
 void initialForm(double fDepth)
 {
     for (int kk = 0; kk < makeSectionWell.ltTrackLog.Count; kk++)
     {
         trackDataListLog itemLog     = makeSectionWell.ltTrackLog[kk];
         Label            newLogInfor = new Label();
         newLogInfor.Text = itemLog.itemHeadInforDraw.sLogName;
         double fValue = -999;
         for (int i = 0; i < itemLog.fListMD.Count - 1; i++)
         {
             if (itemLog.fListMD[i] <= fDepth && itemLog.fListMD[i + 1] >= fDepth)
             {
                 fValue = (float)itemLog.fListValue[i];
                 break;
             }
         }
         newLogInfor.Text    += " = " + fValue.ToString("0.00");
         newLogInfor.Location = new Point(10, 20 * kk);
         newLogInfor.AutoSize = true;
         this.Controls.Add(newLogInfor);
     }
     this.Height = 50 + makeSectionWell.ltTrackLog.Count * 20;
 }
Beispiel #9
0
        public static cSVGSectionWell makePathWell(cSVGDocSection svgSection, string pathSectionCss, string filePathTemplatOper, double dfDS1Show, double dfDS2Show, float fVScale, cXEGeopage curPage)
        {
            cSVGSectionWell wellGeoSingle   = new cSVGSectionWell(svgSection.svgDoc);
            List <int>      iListTrackWidth = new List <int>();
            //从配置文件读取显示深度
            string sJH = cXmlBase.getNodeInnerText(filePathTemplatOper, cXmlDocSectionWell.fullPathJH);
            //绝对值不放大fvscale,位置放大。
            ItemWell wellItem         = cProjectData.ltProjectWell.FirstOrDefault(p => p.sJH == sJH);
            int      iHeightMapTitle  = int.Parse(cXmlBase.getNodeInnerText(filePathTemplatOper, cXEWellPage.fullPathMapTitleRectHeight));
            int      iHeightTrackHead = int.Parse(cXmlBase.getNodeInnerText(filePathTemplatOper, cXEWellPage.fullPathTrackRectHeight));

            iListTrackWidth.Clear();
            XmlElement returnElemment;

            float dfDS1ShowTVD = cIOinputWellPath.getTVDByJHAndMD(wellItem, (float)dfDS1Show);

            int iYpositionTrackHead = Convert.ToInt16(dfDS1ShowTVD * fVScale) - iHeightTrackHead;

            foreach (XmlElement el_Track in cXmlDocSectionWell.getTrackNodes(filePathTemplatOper))
            {
                //初始化绘制道的基本信息
                trackDataDraw curTrackDraw = new trackDataDraw(el_Track);
                //增加道头
                returnElemment = cSVGSectionTrack.trackHead(svgSection.svgDoc, curTrackDraw.sTrackID, curTrackDraw.sTrackTitle, iYpositionTrackHead, iHeightTrackHead, curTrackDraw.iTrackWidth, curTrackDraw.iTrackHeadFontSize, curTrackDraw.sWriteMode);
                wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());

                //增加距离位置节点
                cXmlDocSectionGeo.addWellTrackXviewNode(pathSectionCss, sJH, curTrackDraw.sTrackID, iListTrackWidth.Sum());
                //先画曲线,再画道头和道框,这样好看
                #region  判断是否可见,可见才绘制
                if (curTrackDraw.iVisible > 0)
                {
                    #region 井深结构尺
                    if (el_Track["trackType"].InnerText == TypeTrack.深度尺.ToString())
                    {
                        itemDrawDataDepthRuler itemRuler = new itemDrawDataDepthRuler(el_Track);
                        //测试斜井gPathWellCone
                        returnElemment = cSVGSectionTrackWellRuler.gPathWellRuler(wellItem, svgSection, Convert.ToInt16(dfDS1Show), Convert.ToInt16(dfDS2Show), fVScale, itemRuler);
                        wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());
                    }
                    #endregion
                    #region 地层道
                    if (curTrackDraw.sTrackType == TypeTrack.分层.ToString())
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                ItemTrackDrawDataIntervalProperty item = new ItemTrackDrawDataIntervalProperty(xn);
                                if (item.top >= dfDS1Show && item.bot <= dfDS2Show)
                                {
                                    returnElemment = cSVGSectionTrackLayer.gTrackItemTVDLayer(svgSection.svgDoc, item, fVScale, curTrackDraw.iTrackFontSize, curTrackDraw.iTrackWidth);
                                    wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());
                                }
                            }
                        }
                    }
                    #endregion
                    #region 测井解释,旋回,化石道
                    if (cProjectManager.ltStrTrackTypeIntervalProperty.IndexOf(curTrackDraw.sTrackType) >= 0)
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                ItemTrackDrawDataIntervalProperty item = new ItemTrackDrawDataIntervalProperty(xn); if (item.top >= dfDS1Show && item.bot <= dfDS2Show)
                                {
                                    returnElemment = cSVGSectionTrackJSJL.gTrackItemTVDJSJL(svgSection.svgDoc, svgSection.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    if (curTrackDraw.sTrackType == TypeTrack.沉积旋回.ToString())
                                    {
                                        returnElemment = cSVGSectionTrackCycle.gTrackItemTVDGeoCycle(svgSection.svgDoc, svgSection.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    }
                                    //     if (curTrackDraw.sTrackType == TypeTrack.描述.ToString()) returnElemment = cSVGSectionTrackDes.gTrackItemFossil(svgSection.svgDoc, svgSection.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());
                                }
                            }
                        }
                    }
                    #endregion
                    #region 岩性
                    if (curTrackDraw.sTrackType == TypeTrack.岩性层段.ToString())
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                itemDrawDataIntervalValue item = new itemDrawDataIntervalValue(xn);
                                if (item.top >= dfDS1Show && item.bot <= dfDS2Show)
                                {
                                    returnElemment = cSVGSectionTrackLitho.gTrackLithoTVDItem(wellItem, svgSection.svgDoc, svgSection.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());
                                }
                            }
                        }
                    }
                    #endregion
                    #region 曲线道
                    List <itemLogHeadInforDraw> ltItemLogHeadInforDraw = new List <itemLogHeadInforDraw>(); //记录绘制道头用,节省重新读取的时间
                    if (curTrackDraw.sTrackType == TypeTrack.曲线道.ToString())
                    {
                        cSVGSectionTrackLogCurveFill.listLogViewData4fill.Clear();
                        XmlNodeList xnList  = el_Track.SelectNodes(".//Log");
                        int         iLogNum = 0;
                        bool        bGrid   = false; //记录网格是否绘制过。
                        foreach (XmlElement xnLog in xnList)
                        {
                            iLogNum++;
                            itemLogHeadInforDraw curLogHead = new itemLogHeadInforDraw(xnLog);
                            ltItemLogHeadInforDraw.Add(curLogHead);
                            if (curLogHead.iIsLog > 0)
                            {
                                if (curLogHead.fLeftValue <= 0)
                                {
                                    curLogHead.fLeftValue = 1;
                                    cXmlBase.setSelectedNodeChildNodeValue(filePathTemplatOper, "", "leftValue", "1");
                                }
                                curLogHead.iLogGridGrade = cSVGSectionTrackLog.getNumGridGroupInLog(curLogHead.fLeftValue, curLogHead.fRightValue);
                            }

                            //曲线是否可见
                            if (curLogHead.iLogCurveVisible > 0)
                            {
                                trackDataListLog dlTrackDataListLog = cSVGSectionTrackLog.getLogSeriersFromLogFile(sJH, curLogHead.sLogName, dfDS1Show, dfDS2Show);

                                //画曲线
                                returnElemment = cSVGSectionTrackLog.gTrackTVDLog(wellItem, svgSection.svgDoc, curLogHead, curTrackDraw.iTrackWidth, dlTrackDataListLog.fListMD, dlTrackDataListLog.fListValue, fVScale);
                                wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());
                            } //曲线可见
                        }     //结束曲线循环
                    }         //结束曲线if
                    #endregion 结束曲线道
                    #region 绘制测井图头,测井图信息很重要,图形加载数据要捕捉测井头的ID
                    if (curTrackDraw.sTrackType == TypeTrack.曲线道.ToString())
                    {
                        int iLogNum = 0;
                        foreach (itemLogHeadInforDraw curLogHead in ltItemLogHeadInforDraw)
                        {
                            iLogNum++;
                            if (curLogHead.iIsLog > 0)
                            {
                                if (curLogHead.fLeftValue <= 0)
                                {
                                    curLogHead.fLeftValue = 1;
                                }
                                curLogHead.iLogGridGrade = cSVGSectionTrackLog.getNumGridGroupInLog(curLogHead.fLeftValue, curLogHead.fRightValue);
                            }
                            if (curLogHead.iLogCurveVisible > 0)
                            {
                                //增加测井头
                                int iHeadLogSize = 14;
                                returnElemment = cSVGSectionTrack.addTrackItemLogHeadInfor(svgSection.svgDoc, curLogHead, iYpositionTrackHead + iHeightTrackHead, iLogNum, curTrackDraw.iTrackWidth, iHeadLogSize);
                                wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());
                            }
                        }
                    }
                    #endregion
                    //绘制道框
                    if (curPage.iShowTrackRect == 1)
                    {
                        returnElemment = cSVGSectionTrack.trackRect(svgSection.svgDoc, curTrackDraw.sTrackID, dfDS1ShowTVD, dfDS2Show, fVScale, curTrackDraw.iTrackWidth);
                        wellGeoSingle.addTrack(returnElemment, iListTrackWidth.Sum());
                    }
                    iListTrackWidth.Add(curTrackDraw.iTrackWidth);
                }
                #endregion
            } //end of for add track
            //增加图头
            returnElemment = wellGeoSingle.mapHeadTitle(sJH, iYpositionTrackHead - iHeightMapTitle, iYpositionTrackHead, iHeightMapTitle, iListTrackWidth.Sum(), iHeightMapTitle * 2 / 3);
            wellGeoSingle.addTrack(returnElemment, 0);
            return(wellGeoSingle);
        }
Beispiel #10
0
        void updateCrossPlot(trackDataListLog logX, trackDataListLog logY)
        {
            List <double> listDoubleX = new List <double>();
            List <double> listDoubleY = new List <double>();

            int iLineMax = logX.fListMD.Count;

            if (logY.fListMD.Count == logX.fListMD.Count)  //MD个数相同
            {
                listDoubleX = logX.fListValue;
                listDoubleY = logY.fListValue;
            }
            else  //MDList个数不同,找个数少的,这块误差可能选取的深度段 高低不同,如果 深度段无交叉是个要考虑的问题
            {
                if (logY.fListMD.Count < logX.fListMD.Count)
                {
                    iLineMax = logY.fListMD.Count;
                    int jStart = 0;
                    for (int i = 0; i < iLineMax; i++)
                    {
                        listDoubleY.Add(logY.fListValue[i]);
                        //为了保证序列个数相同,fValue给个初始值。不科学 需要改进
                        double fValue = logX.fListValue[i];
                        //由于深度序列是上升的,上次结束位置作为此次的开始位置。
                        for (int j = jStart; j < logX.fListMD.Count; j++)
                        {
                            //深度绝对值误差小于0.125 赋值 下次循环的起始位置改变,跳出赋值循环
                            if (Math.Abs(logX.fListMD[j] - logY.fListMD[i]) < 0.125)
                            {
                                fValue = logX.fListValue[j];
                                jStart = j;
                                break;
                            }
                        }
                        listDoubleX.Add(fValue);
                    }
                }
                if (logY.fListMD.Count > logX.fListMD.Count)
                {
                    iLineMax = logX.fListMD.Count;
                    int jStart = 0;
                    for (int i = 0; i < iLineMax; i++)
                    {
                        listDoubleX.Add(logX.fListValue[i]);
                        double fValue = logY.fListValue[i];
                        for (int j = jStart; j < logY.fListMD.Count; j++)
                        {
                            if (Math.Abs(logY.fListMD[j] - logX.fListMD[i]) < 0.125)
                            {
                                fValue = logY.fListValue[j];
                                jStart = j;
                                break;
                            }
                        }
                        listDoubleY.Add(fValue);
                    }
                }
            }

            chart1.Titles.Clear();
            string sTitle = logX.itemHeadInforDraw.sLogName + "-" + logY.itemHeadInforDraw.sLogName + "交汇图";

            chart1.Titles.Add(sTitle);

            //刻度值
            int iLeftX = (int)float.Parse(ntbxXLeft.Text);

            chart1.ChartAreas[0].AxisX.Minimum = iLeftX;
            int iRightX = (int)float.Parse(ntbxXRight.Text);

            chart1.ChartAreas[0].AxisX.Maximum = iRightX;


            int iLeftY = (int)float.Parse(ntbxYLeft.Text);

            chart1.ChartAreas[0].AxisY.Minimum = iLeftY;
            int iRightY = (int)float.Parse(ntbxYRight.Text);

            chart1.ChartAreas[0].AxisY.Maximum = iRightY;

            //网格
            chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = this.cbxGridMainX.Checked;
            chart1.ChartAreas[0].AxisX.MinorGrid.Enabled = this.cbxGridMinX.Checked;
            chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = this.cbxGridMainY.Checked;
            chart1.ChartAreas[0].AxisY.MinorGrid.Enabled = this.cbxGridMinY.Checked;

            //tickMark interval
            float fXinterval = 1;

            chart1.ChartAreas[0].AxisX.MinorTickMark.Enabled = true;
            if (this.ntbxXInterval.Text != "")
            {
                float.TryParse(this.ntbxXInterval.Text, out fXinterval);
            }
            chart1.ChartAreas[0].AxisX.MinorTickMark.Interval = fXinterval;
            float fYinterval = 1;

            chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = true;
            if (this.ntbxYInterval.Text != "")
            {
                float.TryParse(this.ntbxYInterval.Text, out fYinterval);
            }
            chart1.ChartAreas[0].AxisY.MinorTickMark.Interval = fYinterval;

            //标题
            chart1.ChartAreas[0].AxisX.Title         = logX.itemHeadInforDraw.sLogName;
            chart1.ChartAreas[0].AxisY.Title         = logY.itemHeadInforDraw.sLogName;
            chart1.ChartAreas[0].AxisX.IsLogarithmic = cbxXlog.Checked;
            chart1.ChartAreas[0].AxisY.IsLogarithmic = cbxYlog.Checked;

            //绘图数据写入表格第5列 第6列
            for (int i = 0; i < listDoubleX.Count; i++)
            {
                dgvDataTable.Rows[i].Cells[4].Value = listDoubleX[i].ToString();
                dgvDataTable.Rows[i].Cells[5].Value = listDoubleY[i].ToString();
            }
            chart1.Series["Series1"].Points.DataBindXY(listDoubleX.ToArray(), listDoubleY.ToArray());
            chart1.Show();
        }
Beispiel #11
0
        void updateCrossPlot(trackDataListLog logX, trackDataListLog logY, List <ItemTrackDrawDataIntervalProperty> ltDataItem)
        {
            chart1.Titles.Clear();
            string sTitle = logX.itemHeadInforDraw.sLogName + "-" + logY.itemHeadInforDraw.sLogName + "交汇图";

            chart1.Titles.Add(sTitle);
            chart1.Series.Clear();
            chart1.Legends.Clear();
            List <string> ltStrType = ltDataItem.Select(p => p.sProperty).Distinct().ToList();

            foreach (string sType in ltStrType)
            {
                chart1.Series.Add(sType);
                chart1.Series[sType].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Point;

                chart1.Series[sType].IsVisibleInLegend = true;
                chart1.Legends.Add(new Legend(sType));
                chart1.Series[sType].Legend   = sType;
                chart1.Legends[sType].Docking = Docking.Bottom;
                chart1.Legends[sType].IsDockedInsideChartArea = false;
                chart1.Legends[sType].IsEquallySpacedItems    = true;

                chart1.Legends[sType].LegendStyle = LegendStyle.Row;
                chart1.Legends[sType].Alignment   = System.Drawing.StringAlignment.Center;

                chart1.Series[sType].MarkerSize  = 6;
                chart1.Series[sType].MarkerStyle = System.Windows.Forms.DataVisualization.Charting.MarkerStyle.Circle;
                List <double> listDoubleX = new List <double>();
                List <double> listDoubleY = new List <double>();
                foreach (ItemTrackDrawDataIntervalProperty dataItem in ltDataItem)
                {
                    if (dataItem.sProperty == sType)
                    {
                        listDoubleX.Add(getIntervalLogValue(logX, dataItem));
                        listDoubleY.Add(getIntervalLogValue(logY, dataItem));
                    }
                    chart1.Series[sType].Points.DataBindXY(listDoubleX.ToArray(), listDoubleY.ToArray());
                }
            }

            //刻度值
            int iLeftX = (int)float.Parse(ntbxXLeft.Text);

            chart1.ChartAreas[0].AxisX.Minimum = iLeftX;
            int iRightX = (int)float.Parse(ntbxXRight.Text);

            chart1.ChartAreas[0].AxisX.Maximum = iRightX;


            int iLeftY = (int)float.Parse(ntbxYLeft.Text);

            chart1.ChartAreas[0].AxisY.Minimum = iLeftY;
            int iRightY = (int)float.Parse(ntbxYRight.Text);

            chart1.ChartAreas[0].AxisY.Maximum = iRightY;

            //网格
            chart1.ChartAreas[0].AxisX.MajorGrid.Enabled = this.cbxGridMainX.Checked;
            chart1.ChartAreas[0].AxisX.MinorGrid.Enabled = this.cbxGridMinX.Checked;
            chart1.ChartAreas[0].AxisY.MajorGrid.Enabled = this.cbxGridMainY.Checked;
            chart1.ChartAreas[0].AxisY.MinorGrid.Enabled = this.cbxGridMinY.Checked;

            //tickMark interval
            float fXinterval = 1;

            chart1.ChartAreas[0].AxisX.MinorTickMark.Enabled = true;
            if (this.ntbxXInterval.Text != "")
            {
                float.TryParse(this.ntbxXInterval.Text, out fXinterval);
            }
            chart1.ChartAreas[0].AxisX.MinorTickMark.Interval = fXinterval;
            float fYinterval = 1;

            chart1.ChartAreas[0].AxisY.MinorTickMark.Enabled = true;
            if (this.ntbxYInterval.Text != "")
            {
                float.TryParse(this.ntbxYInterval.Text, out fYinterval);
            }
            chart1.ChartAreas[0].AxisY.MinorTickMark.Interval = fYinterval;

            //标题
            chart1.ChartAreas[0].AxisX.Title         = logX.itemHeadInforDraw.sLogName;
            chart1.ChartAreas[0].AxisY.Title         = logY.itemHeadInforDraw.sLogName;
            chart1.ChartAreas[0].AxisX.IsLogarithmic = cbxXlog.Checked;
            chart1.ChartAreas[0].AxisY.IsLogarithmic = cbxYlog.Checked;


            chart1.Show();
        }
Beispiel #12
0
        public static void makeWellLayerSectionGraph(string filePathTemplatOper, double fTopShow, double fBotShow, double fVScale)
        {
            string        filePathWellsvg = filePathTemplatOper.Replace(".xml", ".svg");
            List <int>    iListTrackWidth = new List <int>();
            List <string> ListLegend      = new List <string>(); //图例
            XmlDocument   curDoc          = new XmlDocument();

            curDoc.Load(filePathTemplatOper);
            string sJH = cXmlBase.getNodeInnerText(curDoc, cXmlDocSectionWell.fullPathJH);

            string sMapTitle = cXmlBase.getNodeInnerText(curDoc, cXEWellPage.fullPathMapTitle);
            //图幅全部用px基本单位,fVScale已经包含了 px-> 到应用单位的转换。
            double dfDS1Show = fTopShow;
            double dfDS2Show = fBotShow;
            double iDx       = 0;

            //这种是上移式图头绘制模式 与 遮盖式图头绘制模式严格位置不同
            double iYpositionTitle = 0;

            double iDy = -dfDS1Show * fVScale;

            int    iShowMode  = int.Parse(cXmlBase.getNodeInnerText(curDoc, cXEWellPage.fullPathShowMode));
            double PageWidth  = 1000;
            double PageHeight = (dfDS2Show - dfDS1Show) * fVScale + 20;
            //以上代码执行2毫秒,不必优化了
            cSVGBaseSection cSingleWell = new cSVGBaseSection(PageWidth, PageHeight, iDx, iDy, "px"); //全部用px 单位转换用算法实现

            iListTrackWidth.Clear();
            XmlElement returnElemment;

            foreach (XmlElement el_Track in cXmlDocSectionWell.getTrackNodes(curDoc))
            {
                //初始化绘制道的基本信息
                trackDataDraw curTrackDraw = new trackDataDraw(el_Track);

                //定义一个新层 装道。 但是 也有问题,会有下面的遮盖问题。

                //先画曲线,再画道头和道框,这样好看
                if (curTrackDraw.iVisible > 0) //判断是否可见,可见才绘制
                {
                    #region 深度道
                    if (curTrackDraw.sTrackType == TypeTrack.深度尺.ToString())
                    {
                        int mainTick     = int.Parse(el_Track["mainScale"].InnerText);
                        int minTick      = int.Parse(el_Track["minScale"].InnerText);
                        int tickFontSize = int.Parse(el_Track["fontSize"].InnerText);
                        returnElemment = cSVGSectionTrackWellRuler.gMDRuler(cSingleWell.svgDoc, cSingleWell.svgDefs, cSingleWell.svgCss, Convert.ToInt16(dfDS1Show), Convert.ToInt16(dfDS2Show), mainTick, minTick, fVScale, tickFontSize);
                        cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                    }
                    # endregion
                    # region 文本道
                    if (curTrackDraw.sTrackType == TypeTrack.文本道.ToString())
                    {
                        int iAlignMode = 0;
                        if (el_Track["iAlignMode"] != null)
                        {
                            iAlignMode = int.Parse(el_Track["iAlignMode"].InnerText);
                        }
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                ItemTrackDrawDataIntervalProperty item = new ItemTrackDrawDataIntervalProperty(xn);
                                if (item.top >= dfDS1Show && item.bot <= dfDS2Show)
                                {
                                    returnElemment = cSVGSectionTrackText.gTrackItemText(cSingleWell.svgDoc, item.sID, item.top, item.bot, fVScale, item.sText, curTrackDraw.iTrackFontSize, iAlignMode, curTrackDraw.iTrackWidth, item.sProperty, curTrackDraw.sWriteMode);
                                    cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                                }
                            }
                        }
                    }
                    #endregion
                    #region 符号图道
                    if (curTrackDraw.sTrackType == TypeTrack.符号.ToString())
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                ItemTrackDrawDataIntervalProperty item = new ItemTrackDrawDataIntervalProperty(xn);
                                returnElemment = cSVGSectionTrackSymbol.gTrackIntervalSymbol(cSingleWell.svgDoc, cSingleWell.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                            }
                        }
                    }
                    #endregion
                    #region 比例条
                    if (curTrackDraw.sTrackType == TypeTrack.比例条.ToString())
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                ItemTrackDrawDataIntervalProperty item = new ItemTrackDrawDataIntervalProperty(xn);
                                returnElemment = cSVGSectionTrackSymbol.gTrackRatioRect(cSingleWell.svgDoc, item.sID, item.top, item.bot, float.Parse(item.sText), fVScale, curTrackDraw.iTrackWidth, "blue");
                                cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                            }
                        }
                    }
                    #endregion
                    #region 地层道
                    if (curTrackDraw.sTrackType == TypeTrack.分层.ToString())
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                itemDrawDataIntervalValue item = new itemDrawDataIntervalValue(xn);
                                if (item.top >= dfDS1Show && item.bot <= dfDS2Show)
                                {
                                    returnElemment = cSVGSectionTrackLayer.gTrackItemLayer(cSingleWell.svgDoc, item, fVScale, curTrackDraw.iTrackFontSize, curTrackDraw.iTrackWidth);
                                    cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                                }
                            }
                        }
                    }
                    #endregion
                    #region 图片道
                    if (curTrackDraw.sTrackType == TypeTrack.图片道.ToString())
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                itemDrawDataIntervalValue item = new itemDrawDataIntervalValue(xn);
                                returnElemment = cSVGSectionTrackImage.gTrackImage(cSingleWell.svgDoc, cSingleWell.svgDefs, sJH, item, fVScale, curTrackDraw.iTrackWidth);
                                cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                            }
                        }
                    }
                    #endregion
                    #region 岩性
                    if (curTrackDraw.sTrackType == TypeTrack.岩性层段.ToString())
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                itemDrawDataIntervalValue item = new itemDrawDataIntervalValue(xn);
                                if (item.top >= dfDS1Show && item.bot <= dfDS2Show)
                                {
                                    returnElemment = cSVGSectionTrackLitho.gTrackLitho(cSingleWell.svgDoc, cSingleWell.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                                }
                            }
                        }
                    }
                    #endregion
                    #region 测井解释,旋回,化石道
                    if (cProjectManager.ltStrTrackTypeIntervalProperty.IndexOf(curTrackDraw.sTrackType) >= 0)
                    {
                        XmlNode dataList = el_Track.SelectSingleNode("dataList");
                        if (dataList != null)
                        {
                            XmlNodeList dataItem = dataList.SelectNodes("dataItem");
                            foreach (XmlNode xn in dataItem)
                            {
                                ItemTrackDrawDataIntervalProperty item = new ItemTrackDrawDataIntervalProperty(xn); if (item.top >= dfDS1Show && item.bot <= dfDS2Show)
                                {
                                    returnElemment = cSVGSectionTrackJSJL.gTrackItemJSJL(cSingleWell.svgDoc, cSingleWell.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    if (curTrackDraw.sTrackType == TypeTrack.沉积旋回.ToString())
                                    {
                                        returnElemment = cSVGSectionTrackCycle.gTrackGeoCycle(cSingleWell.svgDoc, cSingleWell.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    }
                                    if (curTrackDraw.sTrackType == TypeTrack.描述.ToString())
                                    {
                                        returnElemment = cSVGSectionTrackDes.gTrackItemFossil(cSingleWell.svgDoc, cSingleWell.svgDefs, item, fVScale, curTrackDraw.iTrackWidth);
                                    }
                                    cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);
                                }
                            }
                        }
                    }
                    #endregion
                    #region 曲线道
                    List <itemLogHeadInforDraw> ltItemLogHeadInforDraw = new List <itemLogHeadInforDraw>(); //记录绘制道头用,节省重新读取的时间
                    if (curTrackDraw.sTrackType == TypeTrack.曲线道.ToString())
                    {
                        cSVGSectionTrackLogCurveFill.listLogViewData4fill.Clear();
                        XmlNodeList xnList  = el_Track.SelectNodes(".//Log");
                        int         iLogNum = 0;
                        bool        bGrid   = false; //记录网格是否绘制过。
                        foreach (XmlElement xnLog in xnList)
                        {
                            iLogNum++;
                            itemLogHeadInforDraw curLogHead = new itemLogHeadInforDraw(xnLog);
                            ltItemLogHeadInforDraw.Add(curLogHead);
                            if (curLogHead.iIsLog > 0)
                            {
                                if (curLogHead.fLeftValue <= 0)
                                {
                                    curLogHead.fLeftValue = 1;
                                    cXmlBase.setSelectedNodeChildNodeValue(filePathTemplatOper, "", "leftValue", "1");
                                }
                                curLogHead.iLogGridGrade = cSVGSectionTrackLog.getNumGridGroupInLog(curLogHead.fLeftValue, curLogHead.fRightValue);
                            }

                            //曲线是否可见
                            if (curLogHead.iLogCurveVisible > 0)
                            {
                                trackDataListLog dlTrackDataListLog = cSVGSectionTrackLog.getLogSeriersFromLogFile(sJH, curLogHead.sLogName, dfDS1Show, dfDS2Show);
                                //画曲线
                                returnElemment = cSVGSectionTrackLog.gTrackLog(cSingleWell.svgDoc, curLogHead, curTrackDraw.iTrackWidth, dlTrackDataListLog.fListMD, dlTrackDataListLog.fListValue, fVScale);
                                cSingleWell.addgElement2BaseLayer(returnElemment, iListTrackWidth.Sum(), 0);

                                XmlNode nodeData = xnLog.SelectSingleNode("sData");
                            } //曲线可见
                        }     //结束曲线循环
                    }         //结束曲线if
                    #endregion 结束曲线道

                    #region 绘制测井图头,测井图信息很重要,图形加载数据要捕捉测井头的ID
                    if (curTrackDraw.sTrackType == TypeTrack.曲线道.ToString())
                    {
                        int iLogNum = 0;
                        foreach (itemLogHeadInforDraw curLogHead in ltItemLogHeadInforDraw)
                        {
                            iLogNum++;
                            if (curLogHead.iIsLog > 0)
                            {
                                if (curLogHead.fLeftValue <= 0)
                                {
                                    curLogHead.fLeftValue = 1;
                                }
                                curLogHead.iLogGridGrade = cSVGSectionTrackLog.getNumGridGroupInLog(curLogHead.fLeftValue, curLogHead.fRightValue);
                            }
                        }
                    }
                    #endregion

                    //道宽List
                    iListTrackWidth.Add(curTrackDraw.iTrackWidth);
                } //if 是否可见
            }     //结束Foreach图道循环绘制