/// <summary> /// 注意xtmFile /// </summary> /// <param name="xtlFileName">模板文件名,带扩展名</param> /// <param name="goalFilePath">目标文件路径,全路径</param> /// <param name="sJH"></param> public static void copyTemplate(string xtlFileName, string goalFilePath, string sJH) { //加载模板 string xtmPath = Path.Combine(cProjectManager.dirPathTemplate, xtlFileName); File.Copy(xtmPath, goalFilePath, true); cXmlBase.setNodeInnerText(goalFilePath, cXmlDocSectionWell.fullPathJH, sJH); cXmlBase.setNodeInnerText(goalFilePath, cXEWellPage.fullPathMapTitle, sJH); //加载曲线数据 ItemWell curWell = cProjectData.ltProjectWell.FirstOrDefault(p => p.sJH == sJH); foreach (XmlElement el_Track in cXmlDocSectionWell.getTrackNodes(goalFilePath)) { trackDataDraw curTrackDraw = new trackDataDraw(el_Track); //继续读取曲线,加载数据 if (curTrackDraw.sTrackType == TypeTrack.分层.ToString()) { List <itemDrawDataIntervalValue> listDataItem = new List <itemDrawDataIntervalValue>(); //判断库中是否有相关数据,如果有数据的话,构建 listDataItem,然后导入 cIOinputLayerDepth cSelectLayerDepth = new cIOinputLayerDepth(); List <string> listStrLine = cSelectLayerDepth.selectSectionDrawData2List(sJH); foreach (string sLine in listStrLine) { string[] splitLine = sLine.Split(); if (splitLine.Length >= 3) { itemDrawDataIntervalValue itemPro = new itemDrawDataIntervalValue(); itemPro.top = float.Parse(splitLine[0]); itemPro.bot = float.Parse(splitLine[1]); itemPro.sProperty = splitLine[2]; itemPro.calTVD(curWell); listDataItem.Add(itemPro); } } //end 第一种类型 cXmlDocSectionWell.addDataItemListIntervaProperty(goalFilePath, curTrackDraw.sTrackID, listDataItem); } if (curTrackDraw.sTrackType == TypeTrack.测井解释.ToString()) { List <itemDrawDataIntervalValue> listDataItem = new List <itemDrawDataIntervalValue>(); //判断库中是否有相关数据,如果有数据的话,构建 listDataItem,然后导入 cIOinputJSJL cSelectJSJL = new cIOinputJSJL(); List <string> listStrLine = cSelectJSJL.selectSectionDrawData2List(sJH); foreach (string sLine in listStrLine) { string[] splitLine = sLine.Split(); if (splitLine.Length >= 3) { itemDrawDataIntervalValue itemPro = new itemDrawDataIntervalValue(); itemPro.top = float.Parse(splitLine[0]); itemPro.bot = float.Parse(splitLine[1]); itemPro.sProperty = splitLine[2]; itemPro.calTVD(curWell); listDataItem.Add(itemPro); } } //end 第一种类型 cXmlDocSectionWell.addDataItemListIntervaProperty(goalFilePath, curTrackDraw.sTrackID, listDataItem); } } //end track loop }
public FormSettingSectionLayer(string _filePathTemple, string _sIDTrack, string _sIDdataItem) { InitializeComponent(); this.filePathTemple = _filePathTemple; this.sJH = cXmlDocSectionWell.getJH(filePathTemple); sIDTrack = _sIDTrack; item.sID = _sIDdataItem; item = cXmlDocSectionWell.getDataItemValueByID(filePathTemple, item.sID); if (item != null) { int iFindIndexLayer = cProjectData.ltStrProjectXCM.IndexOf(item.sProperty); if (iFindIndexLayer >= 0) { this.tbxLayerColor.BackColor = System.Drawing.ColorTranslator.FromHtml(listLayerColor[iFindIndexLayer]); this.tbxLayerColor.Text = listLayerColor[iFindIndexLayer]; } } cbbConformity.Items.Add(TypeConformity.顶不整合.ToString()); cbbConformity.Items.Add(TypeConformity.整合.ToString()); cbbConformity.Items.Add(TypeConformity.底不整合.ToString()); cbbConformity.Items.Add(TypeConformity.顶底不整合.ToString()); cbbConformity.SelectedIndex = (int)item.fValue; this.btnOK.DialogResult = DialogResult.OK; this.btnCancel.DialogResult = DialogResult.Cancel; this.nTBXTopDepth.Text = item.top.ToString(); this.nTBXBotDepth.Text = item.bot.ToString(); }
public FormSectionAddImageItem(string _filePathTemple, string _sIDTrack, string _sIDdataItem) { InitializeComponent(); this.filePathTemple = _filePathTemple; this.sJH = cXmlDocSectionWell.getJH(filePathTemple); sIDTrack = _sIDTrack; item.sID = _sIDdataItem; item = cXmlDocSectionWell.getDataItemValueByID(filePathTemple, item.sID); this.nTBXTopDepth.Text = item.top.ToString(); this.nTBXBotDepth.Text = item.bot.ToString(); this.nUDWidthPercent.Value = (decimal)item.fValue; this.tbxImageFilePath.Text = item.sText; this.btnOK.DialogResult = DialogResult.OK; this.btnCancel.DialogResult = DialogResult.Cancel; }
public FormSectionAddSymbol(string _filePathTemple, string _sIDTrack, string _sIDdataItem) { InitializeComponent(); this.filePathTemple = _filePathTemple; this.sJH = cXmlDocSectionWell.getJH(filePathTemple); sIDTrack = _sIDTrack; item.sID = _sIDdataItem; item = cXmlDocSectionWell.getDataItemValueByID(filePathTemple, item.sID); this.nTBXTopDepth.Text = item.top.ToString(); this.nTBXBotDepth.Text = item.bot.ToString(); initialCbb(); cbbType.SelectedItem = item.sProperty; this.tbxBackText.Text = item.sText; this.btnOK.DialogResult = DialogResult.OK; this.btnCancel.DialogResult = DialogResult.Cancel; }
public FormSectionAddItemLitho(string _filePathTemple, string _sIDTrack, string _sIDdataItem) { InitializeComponent(); this.filePathTemple = _filePathTemple; this.sJH = cXmlDocSectionWell.getJH(filePathTemple); sIDTrack = _sIDTrack; item.sID = _sIDdataItem; itemDrawDataIntervalValue curItem = cXmlDocSectionWell.getDataItemValueByID(filePathTemple, item.sID); this.nTBXTopDepth.Text = curItem.top.ToString(); this.nTBXBotDepth.Text = curItem.bot.ToString(); List <string> ltColor = cProjectManager.dicColor.Keys.ToList(); cPublicMethodForm.inialComboBox(this.cbbColor, ltColor); string sHexColor = curItem.sProperty; cbbColor.Items.Insert(0, sHexColor); cbbColor.SelectedIndex = 0; string sLithoName = curItem.sText; ItemCode inputCode = cProjectManager.ltCodeItem.FirstOrDefault(p => p.chineseName == sLithoName); List <string> ltStrRockType = cProjectManager.ltCodeItem.Select(p => p.codeType).Distinct().ToList(); cPublicMethodForm.inialComboBox(this.cbbType, ltStrRockType); if (inputCode != null) { cbbType.SelectedItem = inputCode.codeType; initialCbbRock(inputCode.codeType); cbbItemLitho.SelectedItem = inputCode.chineseName; } this.filePathTemple = _filePathTemple; nUDGrainSize.Value = (decimal)curItem.fValue; this.btnOK.DialogResult = DialogResult.OK; this.btnCancel.DialogResult = DialogResult.Cancel; }
void makeFlattedByLayer(bool bFlattedTVD) { string sTopXCM = this.cbbTopXCM.SelectedItem.ToString(); cXmlBase.setNodeInnerText(filePathSectionGeoCss, cXETrackRuler.xmlFullPathiVisible, "0"); foreach (ItemWellSection item in listWellsSection) { string sJH = item.sJH; string filePathOper = dirSectionData + "//" + sJH + ".xml"; float fTop = -999; //应该先在文件中按层名查找个性layer深度 XmlNode xnProperty = cXmlBase.selectNodeByInnerText(filePathOper, "sProperty", sTopXCM); if (xnProperty != null) { itemDrawDataIntervalValue xn = new itemDrawDataIntervalValue(xnProperty.ParentNode); fTop = xn.top; } else { cIOinputLayerDepth fileLayerDepth = new cIOinputLayerDepth(); fTop = fileLayerDepth.selectTopDepthMDByJHAndXCM(sJH, sTopXCM); } if (fTop > 0) //返回值-999 说明未找到 { if (bFlattedTVD == false) { cXmlBase.setSelectedNodeChildNodeValue(filePathSectionGeoCss, sJH, "Yview", (-fTop).ToString()); } else { float fTVD = cIOinputWellPath.getTVDByJHAndMD(sJH, fTop); //md->tvd cXmlBase.setSelectedNodeChildNodeValue(filePathSectionGeoCss, sJH, "Yview", (-fTVD).ToString()); } } } }
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); }
//由于有剖面井的存在导数据的问题 void initializaForm(string m_filePathOperSource, string m_sTrackID) { if (sJH != "") { this.Text = trackTypeStr + "数据导入: " + sJH; listDataItem = cXmlDocSectionWell.getListDataItemIntervalPropertyValue(m_filePathOperSource, m_sTrackID); if (trackTypeStr == TypeTrack.分层.ToString()) { this.dgvDataTable.Columns.Clear(); dgvDataTable.Columns.Add("topDepth", "顶度"); dgvDataTable.Columns.Add("baseDepth", "底深"); dgvDataTable.Columns.Add("layerName", "小层名"); for (int i = 0; i < listDataItem.Count; i++) { itemDrawDataIntervalValue item = listDataItem[i]; dgvDataTable.Rows.Add(); dgvDataTable.Rows[i].Cells[0].Value = item.top.ToString(); dgvDataTable.Rows[i].Cells[1].Value = item.bot.ToString(); dgvDataTable.Rows[i].Cells[2].Value = item.sProperty.ToString(); } } if (trackTypeStr == TypeTrack.测井解释.ToString() || trackTypeStr == TypeTrack.沉积旋回.ToString() || trackTypeStr == TypeTrack.含油级别.ToString()) { dgvDataTable.Columns.Clear(); dgvDataTable.Columns.Add("topDepth", "顶深"); dgvDataTable.Columns.Add("baseDepth", "底深"); dgvDataTable.Columns.Add("property", trackTypeStr); for (int i = 0; i < listDataItem.Count; i++) { itemDrawDataIntervalValue item = listDataItem[i]; dgvDataTable.Rows.Add(); dgvDataTable.Rows[i].Cells[0].Value = item.top.ToString(); dgvDataTable.Rows[i].Cells[1].Value = item.bot.ToString(); dgvDataTable.Rows[i].Cells[2].Value = item.sProperty.ToString(); } } if (trackTypeStr == TypeTrack.描述.ToString()) { dgvDataTable.Columns.Clear(); dgvDataTable.Columns.Add("topDepth", "顶深"); dgvDataTable.Columns.Add("baseDepth", "底深"); dgvDataTable.Columns.Add("property", "类别"); dgvDataTable.Columns.Add("text", trackTypeStr); for (int i = 0; i < listDataItem.Count; i++) { itemDrawDataIntervalValue item = listDataItem[i]; dgvDataTable.Rows.Add(); dgvDataTable.Rows[i].Cells[0].Value = item.top.ToString(); dgvDataTable.Rows[i].Cells[1].Value = item.bot.ToString(); dgvDataTable.Rows[i].Cells[2].Value = item.sProperty.ToString(); dgvDataTable.Rows[i].Cells[3].Value = item.sText.ToString(); } } if (trackTypeStr == TypeTrack.岩性层段.ToString()) { dgvDataTable.Columns.Clear(); dgvDataTable.Columns.Add("topDepth", "顶深"); dgvDataTable.Columns.Add("baseDepth", "底深"); dgvDataTable.Columns.Add("property", "颜色"); dgvDataTable.Columns.Add("text", "岩性"); for (int i = 0; i < listDataItem.Count; i++) { itemDrawDataIntervalValue item = listDataItem[i]; dgvDataTable.Rows.Add(); dgvDataTable.Rows[i].Cells[0].Value = item.top.ToString(); dgvDataTable.Rows[i].Cells[1].Value = item.bot.ToString(); dgvDataTable.Rows[i].Cells[2].Value = item.sProperty.ToString(); dgvDataTable.Rows[i].Cells[3].Value = item.sText.ToString(); } } if (trackTypeStr == TypeTrack.文本道.ToString()) { dgvDataTable.Columns.Clear(); dgvDataTable.Columns.Add("topDepth", "顶深"); dgvDataTable.Columns.Add("baseDepth", "底深"); dgvDataTable.Columns.Add("text", "文本"); for (int i = 0; i < listDataItem.Count; i++) { itemDrawDataIntervalValue item = listDataItem[i]; dgvDataTable.Rows.Add(); dgvDataTable.Rows[i].Cells[0].Value = item.top.ToString(); dgvDataTable.Rows[i].Cells[1].Value = item.bot.ToString(); dgvDataTable.Rows[i].Cells[2].Value = item.sText.ToString(); } } if (trackTypeStr == TypeTrack.符号.ToString()) { dgvDataTable.Columns.Clear(); dgvDataTable.Columns.Add("topDepth", "顶深"); dgvDataTable.Columns.Add("baseDepth", "底深"); dgvDataTable.Columns.Add("topDepth", "符号"); dgvDataTable.Columns.Add("baseDepth", "备注"); for (int i = 0; i < listDataItem.Count; i++) { itemDrawDataIntervalValue item = listDataItem[i]; dgvDataTable.Rows.Add(); dgvDataTable.Rows[i].Cells[0].Value = item.top.ToString(); dgvDataTable.Rows[i].Cells[1].Value = item.bot.ToString(); dgvDataTable.Rows[i].Cells[2].Value = item.sProperty.ToString(); dgvDataTable.Rows[i].Cells[3].Value = item.sText.ToString(); } } if (trackTypeStr == TypeTrack.比例条.ToString()) { dgvDataTable.Columns.Clear(); dgvDataTable.Columns.Add("topDepth", "顶深"); dgvDataTable.Columns.Add("baseDepth", "底深"); dgvDataTable.Columns.Add("value", "值(%)"); for (int i = 0; i < listDataItem.Count; i++) { itemDrawDataIntervalValue item = listDataItem[i]; dgvDataTable.Rows.Add(); dgvDataTable.Rows[i].Cells[0].Value = item.top.ToString(); dgvDataTable.Rows[i].Cells[1].Value = item.bot.ToString(); dgvDataTable.Rows[i].Cells[2].Value = item.sProperty.ToString(); } } } }
public void readDataGridView2ListData(DataGridView dgv) { listDataItem.Clear(); ItemWell curWell = cProjectData.ltProjectWell.FirstOrDefault(p => p.sJH == this.sJH); for (int i = 0; i < dgv.RowCount; i++) { bool bDataCorrect = true; //根据不同类型赋缺省值 if (trackTypeStr == TypeTrack.符号.ToString()) { if (dgv.Rows[i].Cells[2].Value == null) { dgv.Rows[i].Cells[2].Value = "半工字"; } if (dgv.Rows[i].Cells[3].Value == null) { dgv.Rows[i].Cells[3].Value = " "; } } for (int j = 0; j < dgv.ColumnCount; j++) { if (dgv.Rows[i].Cells[j].Value == null || dgv.Rows[i].Cells[j].Value.ToString() == "") { bDataCorrect = false; break; } } if (bDataCorrect == false) { //抛弃空值行 } else if (trackTypeStr == TypeTrack.分层.ToString() || trackTypeStr == TypeTrack.测井解释.ToString() || trackTypeStr == TypeTrack.含油级别.ToString() || trackTypeStr == TypeTrack.沉积旋回.ToString() || trackTypeStr == TypeTrack.比例条.ToString() ) { itemDrawDataIntervalValue itemPro = new itemDrawDataIntervalValue(); itemPro.top = float.Parse(dgv.Rows[i].Cells[0].Value.ToString()); itemPro.bot = float.Parse(dgv.Rows[i].Cells[1].Value.ToString()); itemPro.sProperty = dgv.Rows[i].Cells[2].Value.ToString(); itemPro.calTVD(curWell); listDataItem.Add(itemPro); } //end 第一种类型 else if (trackTypeStr == TypeTrack.岩性层段.ToString() || trackTypeStr == TypeTrack.描述.ToString() || trackTypeStr == TypeTrack.符号.ToString() ) { itemDrawDataIntervalValue itemPro = new itemDrawDataIntervalValue(); itemPro.top = float.Parse(dgv.Rows[i].Cells[0].Value.ToString()); itemPro.bot = float.Parse(dgv.Rows[i].Cells[1].Value.ToString()); itemPro.sProperty = dgv.Rows[i].Cells[2].Value.ToString(); itemPro.sText = dgv.Rows[i].Cells[3].Value.ToString(); itemPro.calTVD(curWell); listDataItem.Add(itemPro); } else if (trackTypeStr == TypeTrack.文本道.ToString()) { itemDrawDataIntervalValue itemPro = new itemDrawDataIntervalValue(); itemPro.top = float.Parse(dgv.Rows[i].Cells[0].Value.ToString()); itemPro.bot = float.Parse(dgv.Rows[i].Cells[1].Value.ToString()); itemPro.sProperty = "none"; itemPro.sText = dgv.Rows[i].Cells[2].Value.ToString(); itemPro.calTVD(curWell); listDataItem.Add(itemPro); } } }
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图道循环绘制