Esempio n. 1
0
        //根据fVScale抽析
        public static trackDataListLog getLogSeriersFromLogFile(string sJH, string sLogName, double dfTop, double dfBot)
        {
            trackDataListLog sttTrackLogDataList = new trackDataListLog();

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

            if (File.Exists(logFilePath))
            {
                using (StreamReader sr = new StreamReader(logFilePath, System.Text.Encoding.UTF8))
                {
                    String line;
                    int    _indexLine     = 0;
                    int    _dataStartLine = 3;
                    while ((line = sr.ReadLine()) != null)  //delete the line whose legth is 0
                    {
                        _indexLine++;
                        string[] split = line.Trim().Split(new char[] { ' ', '\t', ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
                        if (_indexLine == 1)
                        {
                            continue;                   //first comment line
                        }
                        else if (_indexLine == 2)
                        {
                            _dataStartLine = int.Parse(split[0]);                         //second line is number of column,
                        }
                        else if (_indexLine <= (2 + _dataStartLine))
                        {
                            //this ection is Column
                        }
                        else
                        {
                            float  top;
                            double value;
                            if (split.Length == 2 && 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);
                                }
                            }
                        }
                    }
                }
            }

            if (sttTrackLogDataList.fListMD.Count > 2)
            {
                if (sttTrackLogDataList.fListMD[2] < sttTrackLogDataList.fListMD[0])
                {
                    sttTrackLogDataList.fListMD.Reverse();
                    sttTrackLogDataList.fListValue.Reverse();
                }
            }

            return(sttTrackLogDataList);
        }
Esempio n. 2
0
        public static XmlElement gLayerWellLog(cSVGDocLayerMap svgLayer, ItemWellMapPosition ltWellPos, LayerDataLog layerDataLog)
        {
            string sJH         = ltWellPos.sJH;
            string sLogName    = layerDataLog.sLogName;
            int    iTrackwidth = layerDataLog.iTrackWidth;
            float  fVScale     = layerDataLog.fVScale;
            double fTop        = ltWellPos.dbTop;
            double fBot        = ltWellPos.dbBot;
            //获得测井数据
            trackDataListLog dlTrackDataListLog = cSVGSectionTrackLog.getLogSeriersFromLogFile(sJH, sLogName, fTop, fBot);
            XmlElement       gEleWellLogPattern = gWellLogPattern(svgLayer.svgDoc, layerDataLog, iTrackwidth, dlTrackDataListLog.fListValue, fVScale);

            return(gEleWellLogPattern);
        }
Esempio n. 3
0
        //按深度段从sectionWell 里得到值
        public static trackDataListLog getLogSeriersFromSectionWell(string sData, string sLogName, double dfTop, double dfBot)
        {
            trackDataListLog sttTrackLogDataList = new trackDataListLog();

            sttTrackLogDataList.itemHeadInforDraw.sLogName = sLogName;
            string[] split = sData.Trim().Split(new string[] { cProjectData.splitMark }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < split.Length; i = i + 2)
            {
                float  top;
                double value;
                if (float.TryParse(split[i], out top) && double.TryParse(split[i + 1], out value))
                {
                    if (dfTop <= top && top <= dfBot)
                    {
                        sttTrackLogDataList.fListMD.Add(top);
                        sttTrackLogDataList.fListValue.Add(value);
                    }
                }
            }
            return(sttTrackLogDataList);
        }
        public static XmlElement gLogCurveFillByLog(XmlDocument svgDoc, trackDataListLog logViewDataMain, trackDataListLog logViewDataSub, itemDrawDataTrackFill itemFill, double fVScale)
        {
            string sFill = itemFill.sFill;
            double fTop  = itemFill.fTop;
            double fBot  = itemFill.fBot;

            XmlElement gFill = svgDoc.CreateElement("g");

            gFill.SetAttribute("id", itemFill.sID);
            gFill.SetAttribute("onclick", "getID(evt)");

            Paths            subj     = new Paths(1);
            trackDataListLog ploygon1 = logViewDataMain;

            fTop *= fVScale;
            fBot *= fVScale;
            //按深度段截取,构建多边形,注意为了防止畸变,两头需要加0点控制
            List <double> listDepthView = new List <double>();
            List <double> listValueView = new List <double>();

            for (int k = 0; k < ploygon1.fListMD.Count; k++)
            {
                double fDepthView = ploygon1.fListMD[k];
                if (fTop <= fDepthView && fDepthView <= fBot)
                {
                    listDepthView.Add(fDepthView);
                    listValueView.Add(ploygon1.fListValue[k]);
                }
            }
            listDepthView.Insert(0, fTop);
            listValueView.Insert(0, 0);
            listDepthView.Add(fBot);
            listValueView.Add(0);
            subj.Add(new Path(listDepthView.Count));
            for (int k = 0; k < listDepthView.Count; k++)
            {
                subj[0].Add(new IntPoint(listValueView[k], listDepthView[k]));
            }


            Paths            clips            = new Paths(1);
            trackDataListLog ploygon2         = logViewDataSub;
            List <double>    listDepthViewSub = new List <double>();
            List <double>    listValueViewSub = new List <double>();

            for (int k = 0; k < ploygon2.fListMD.Count; k++)
            {
                double fDepthView = ploygon2.fListMD[k];
                if (fTop <= fDepthView && fDepthView <= fBot)
                {
                    listDepthViewSub.Add(fDepthView);
                    listValueViewSub.Add(ploygon2.fListValue[k]);
                }
            }
            listDepthViewSub.Insert(0, fTop);
            listValueViewSub.Insert(0, 0);
            listDepthViewSub.Add(fBot);
            listValueViewSub.Add(0);
            clips.Add(new Path(listDepthViewSub.Count));
            for (int k = 0; k < listDepthViewSub.Count; k++)
            {
                clips[0].Add(new IntPoint(listValueViewSub[k], listDepthViewSub[k]));
            }

            Paths   solution = new Paths();
            Clipper c        = new Clipper();

            c.AddPaths(subj, PolyType.ptSubject, true);
            c.AddPaths(clips, PolyType.ptClip, true);
            c.Execute(ClipType.ctDifference, solution);
            foreach (Path item in solution)
            {
                string _points = "";
                for (int kk = 0; kk < item.Count; kk++)
                {
                    _points += item[kk].X.ToString("0.00") + "," + item[kk].Y.ToString("0.00") + " ";
                }
                XmlElement gLogPolygon = svgDoc.CreateElement("polygon");
                gLogPolygon.SetAttribute("id", cIDmake.generateRandID());
                gLogPolygon.SetAttribute("fill", sFill);
                gLogPolygon.SetAttribute("fill-opacity", itemFill.fillOpacity.ToString());
                gLogPolygon.SetAttribute("points", _points);
                gFill.AppendChild(gLogPolygon);
            }

            return(gFill);
        }
Esempio n. 5
0
        public static XmlElement gTrackLog(XmlDocument svgDoc, itemLogHeadInforDraw item, int iTrackwidth, List <double> fListDepthInput, List <double> fListValue, double fVScale)
        {
            trackDataListLog trackDataView = new trackDataListLog(); //保存每条曲线绘制的ViewPoint 为了绘制填充使用。

            trackDataView.itemHeadInforDraw = item;

            string sLogName      = item.sLogName;
            double fLeftValue    = item.fLeftValue;
            double fRightValue   = item.fRightValue;
            string m_sColorCurve = item.sLogColor;
            string sFill         = item.sFill;
            float  iLinewidth    = item.fLineWidth;
            int    iLineType     = item.iLineType;
            int    iNumSpare     = 2;

            if (item.iSparceNum > 0)
            {
                iNumSpare = item.iSparceNum;
            }
            double xViewTrack = 0f;
            //对大小支进行值域质量控制
            double qcMinValue = Math.Min(fLeftValue, fRightValue);
            double qcMaxValue = Math.Max(fLeftValue, fRightValue);

            if (qcMinValue <= 0)
            {
                qcMinValue *= 2;
            }
            else
            {
                qcMinValue *= 0.5;
            }

            if (qcMaxValue <= 0)
            {
                qcMaxValue *= 0.5;
            }
            else
            {
                qcMaxValue *= 2;
            }

            string _points = "";
            //曲线可能反转,所以一定要加值
            XmlElement gLog = svgDoc.CreateElement("g");

            if (fListDepthInput.Count > 0)
            {
                #region logCurve
                if (item.typeMode == TypeTrack.曲线.ToString())
                {
                    xViewTrack = getXview(qcMinValue, fLeftValue, fRightValue, iTrackwidth);
                    _points   += (xViewTrack).ToString("0.0") + ',' + (fListDepthInput[0] * fVScale).ToString("0.0") + " ";

                    if (item.iIsLog == 0) //非对数
                    {
                        for (int i = 0; i < fListDepthInput.Count; i = i + iNumSpare)
                        {
                            double fDepthView = fListDepthInput[i] * fVScale;
                            double fValue     = fListValue[i];
                            if (qcMinValue <= fValue && fValue <= qcMaxValue)
                            {
                                xViewTrack = getXview(fValue, fLeftValue, fRightValue, iTrackwidth);
                                _points   += (xViewTrack).ToString("0.0") + ',' + fDepthView.ToString("0.0") + " ";
                                trackDataView.fListMD.Add(fDepthView);
                                trackDataView.fListValue.Add(xViewTrack);
                            }
                        }
                    }
                    else
                    {
                        for (int i = 0; i < fListDepthInput.Count; i = i + iNumSpare)
                        {
                            double fDepthView = fListDepthInput[i] * fVScale;
                            double fValue     = fListValue[i];
                            //if (i == 0 || i == (fListDepthInput.Count - 1)) fValue = fLeftValue;
                            if (fLeftValue <= fValue && fLeftValue > 0)
                            {
                                xViewTrack = iTrackwidth * (Math.Log10(fValue / fLeftValue)) / item.iLogGridGrade;
                                if (xViewTrack < 0)
                                {
                                    xViewTrack = 0;
                                }
                                else if (xViewTrack > iTrackwidth)
                                {
                                    xViewTrack = iTrackwidth;
                                }
                                _points = _points + (xViewTrack).ToString("0.0") + ',' + fDepthView.ToString("0.0") + " ";
                                trackDataView.fListMD.Add(fDepthView);
                                trackDataView.fListValue.Add(xViewTrack);
                            }
                        }
                    }
                    xViewTrack = getXview(qcMinValue, fLeftValue, fRightValue, iTrackwidth);
                    _points   += (xViewTrack).ToString("0.0") + ',' + (fListDepthInput.Last() * fVScale).ToString("0.0") + " ";

                    trackDataView.fListMD.Insert(0, fListDepthInput[0] * fVScale);
                    trackDataView.fListValue.Insert(0, xViewTrack);
                    trackDataView.fListMD.Add(fListDepthInput.Last() * fVScale);
                    trackDataView.fListValue.Add(xViewTrack);
                    XmlElement gLogPolygon = svgDoc.CreateElement("polygon");
                    gLogPolygon.SetAttribute("id", item.sIDLog);
                    gLogPolygon.SetAttribute("onclick", "getID(evt)");
                    gLogPolygon.SetAttribute("stroke-width", iLinewidth.ToString());
                    gLogPolygon.SetAttribute("stroke", m_sColorCurve);
                    gLogPolygon.SetAttribute("stroke-dasharray", codeReplace.codeReplaceStrokeDashInt2Str(iLineType));
                    gLogPolygon.SetAttribute("fill", sFill);
                    gLogPolygon.SetAttribute("points", _points);
                    cSVGSectionTrackLogCurveFill.listLogViewData4fill.Add(trackDataView);
                    gLog.AppendChild(gLogPolygon);
                }
                #endregion
                #region scatterPoint
                if (item.typeMode == TypeTrack.散点.ToString())
                {
                    for (int i = 0; i < fListDepthInput.Count; i++)
                    {
                        double fDepth = fListDepthInput[i] * fVScale;
                        double fValue = fListValue[i];
                        if (item.iIsLog == 0)
                        {
                            if (qcMinValue <= fValue && fValue <= qcMaxValue)
                            {
                                xViewTrack = iTrackwidth * (fValue - fLeftValue) / (fRightValue - fLeftValue);
                                if (xViewTrack < 0)
                                {
                                    xViewTrack = 0;
                                }
                                else if (xViewTrack > iTrackwidth)
                                {
                                    xViewTrack = iTrackwidth;
                                }
                            }
                        }
                        else if (fLeftValue <= fValue && fLeftValue > 0)
                        {
                            xViewTrack = iTrackwidth * (Math.Log10(fValue / fLeftValue)) / item.iLogGridGrade;
                            if (xViewTrack < 0)
                            {
                                xViewTrack = 0;
                            }
                            else if (xViewTrack > iTrackwidth)
                            {
                                xViewTrack = iTrackwidth;
                            }
                        }

                        XmlElement eCircle = svgDoc.CreateElement("circle");
                        eCircle.SetAttribute("cx", xViewTrack.ToString());
                        eCircle.SetAttribute("cy", fDepth.ToString());
                        eCircle.SetAttribute("r", "3");
                        eCircle.SetAttribute("fill", m_sColorCurve);
                        gLog.AppendChild(eCircle);
                    }
                }
                #endregion
                #region 杆状
                if (item.typeMode == TypeTrack.杆状.ToString())
                {
                    for (int i = 0; i < fListDepthInput.Count; i++)
                    {
                        double fDepth = fListDepthInput[i] * fVScale;
                        double fValue = fListValue[i];
                        if (item.iIsLog == 0)
                        {
                            if (qcMinValue <= fValue && fValue <= qcMaxValue)
                            {
                                xViewTrack = iTrackwidth * (fValue - fLeftValue) / (fRightValue - fLeftValue);
                                if (xViewTrack < 0)
                                {
                                    xViewTrack = 0;
                                }
                                else if (xViewTrack > iTrackwidth)
                                {
                                    xViewTrack = iTrackwidth;
                                }
                            }
                        }
                        else if (fLeftValue <= fValue && fLeftValue > 0)
                        {
                            xViewTrack = iTrackwidth * (Math.Log10(fValue / fLeftValue)) / item.iLogGridGrade;
                            if (xViewTrack < 0)
                            {
                                xViewTrack = 0;
                            }
                            else if (xViewTrack > iTrackwidth)
                            {
                                xViewTrack = iTrackwidth;
                            }
                        }

                        string     d        = "M0 " + fDepth.ToString() + " h" + xViewTrack;
                        XmlElement gLogPath = svgDoc.CreateElement("path");
                        gLogPath.SetAttribute("stroke-widt", iLinewidth.ToString());
                        gLogPath.SetAttribute("stroke", m_sColorCurve);
                        gLogPath.SetAttribute("fill", "none");
                        gLogPath.SetAttribute("d", d);
                        gLog.AppendChild(gLogPath);
                        XmlElement eCircle = svgDoc.CreateElement("circle");
                        eCircle.SetAttribute("cx", xViewTrack.ToString());
                        eCircle.SetAttribute("cy", fDepth.ToString());
                        eCircle.SetAttribute("r", "2");
                        eCircle.SetAttribute("fill", "red");
                        gLog.AppendChild(eCircle);
                    }
                }
                #endregion
            }
            return(gLog);
        }