private void btnCollectWells_Click(object sender, EventArgs e) { listWellsSection.Clear(); ltStrSelectedJH.Clear(); foreach (object selecteditem in lbxJHSeclected.Items) { string strItem = selecteditem as String; ltStrSelectedJH.Add(strItem); } //创建模板,2个模板 一个是描述整体布局的模板,每个单井又是一个模板。 //不同的模式,初始化不同的 listWellSection List <ItemWellHead> listWellHead = cIOinputWellHead.readWellHead2Struct(); cXmlDocSectionGeo.generateSectionCssXML(filePathSectionCss); //初始化 ItemWellSection for (int i = 0; i < ltStrSelectedJH.Count; i++) { ItemWellSection _wellSection = new ItemWellSection(ltStrSelectedJH[i], 0, 0); //默认把显示深度设为全井段 _wellSection.fShowedDepthTop = 0; _wellSection.fShowedDepthBase = _wellSection.fWellBase; if (_wellSection.fShowedDepthBase >= _wellSection.fWellBase) { _wellSection.fShowedDepthBase = _wellSection.fWellBase; } listWellsSection.Add(_wellSection); } cXmlDocSectionGeo.write2css(listWellsSection, filePathSectionCss); }
public static void setXPositionView(string pathSectionCss, List <ItemWellSection> listWellsSection) { //定义 iChoise==1 等间隔排列,iChoise==2 相邻井真实距离缩放 int iChoise = int.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXEGeopage.xmlFullPathPageWellArrange)); float fHScale = float.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXEGeopage.xmlFullPathPageHorizonWellDistanceScale)); //设置拉平高度 就是 给 fxview和fyview 赋值 //第一口井默认位置,乘以水平系数 为了连接层; for (int i = 0; i < listWellsSection.Count; i++) { ItemWellSection itemWell = listWellsSection[i]; //等间距排列剖面井 if (iChoise == 1) { itemWell.fXview = iPositionXFirstWell + 200 * i * fHScale; } if (iChoise == 2) { if (i == 0) { itemWell.fXview = iPositionXFirstWell; } else { //计算前后井的距离 int iDistance = Convert.ToInt16(c2DGeometryAlgorithm.calDistance2D(listWellsSection[i].dbX, listWellsSection[i].dbY, listWellsSection[i - 1].dbX, listWellsSection[i - 1].dbY)); //注意加上基准点的100 itemWell.fXview = listWellsSection[i - 1].fXview + iDistance * fHScale; } } } }
public static void setYPositionView(string pathSectionCss, List <ItemWellSection> listWellsSection) { for (int i = 0; i < listWellsSection.Count; i++) { ItemWellSection itemWell = listWellsSection[i]; itemWell.fYview = -itemWell.fKB; } }
void initialForm() { cPublicMethodForm.inialComboBox(cbbTopXCM, cProjectData.ltStrProjectXCM); cPublicMethodForm.inialComboBox(cbbBottomXCM, cProjectData.ltStrProjectXCM); foreach (XmlElement elWell in cXmlDocSectionGeo.getWellNodes(filePathSectionCss)) { ItemWellSection item = new ItemWellSection(elWell["JH"].InnerText); item.fShowedDepthTop = float.Parse(elWell["fShowTop"].InnerText); item.fShowedDepthBase = float.Parse(elWell["fShowBot"].InnerText); item.fXview = float.Parse(elWell["Xview"].InnerText); item.fYview = float.Parse(elWell["Yview"].InnerText); listWellsSection.Add(item); } }
private void btnDataPre_Click(object sender, EventArgs e) { if (cbbSelectTemplate.Items.Count == 0) { MessageBox.Show("请自定义模板。"); return; } initialSectionData(); for (int i = 0; i < ltStrSelectedJH.Count; i++) { ItemWellSection _wellSection = new ItemWellSection(ltStrSelectedJH[i], 0, 0); //默认把显示深度设为全井段,需要时再按层段或者深度截取 _wellSection.fShowedDepthTop = 0; _wellSection.fShowedDepthBase = _wellSection.fWellBase; if (_wellSection.fShowedDepthBase >= _wellSection.fWellBase) { _wellSection.fShowedDepthBase = _wellSection.fWellBase; } listWellsSection.Add(_wellSection); } //设定井的放置位置 if (rbsWellPositionRelative.Checked == true) { makeSectionFence.setXYPositionViewFenceRelative(filePathSectionCss, listWellsSection); } else { makeSectionFence.setXYPositionViewFence(filePathSectionCss, listWellsSection); } //初始化显示层段 makeSectionFence.makeNewShowDepth(filePathSectionCss, listWellsSection); cXmlDocSectionGeo.write2css(listWellsSection, filePathSectionCss); if (Directory.Exists(dirSectionData)) { Directory.Delete(dirSectionData, true); } Directory.CreateDirectory(dirSectionData); //插入数据 string fileNameSelectTemplate = this.cbbSelectTemplate.SelectedItem.ToString(); foreach (ItemWellSection item in listWellsSection) { string filePathGoal = Path.Combine(dirSectionData, item.sJH + ".xml"); cIOtemplate.copyTemplate(fileNameSelectTemplate, filePathGoal, item.sJH, item.fShowedDepthTop, item.fShowedDepthBase); //在道中循环插入道数据 } this.DialogResult = DialogResult.OK; this.Close(); }
//设置well的摆放位置 public static void setXYPositionViewFence(string pathSectionCss, List <ItemWellSection> listWellsSection) { float fHScale = float.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXEGeopage.xmlFullPathPageHorizonWellDistanceScale)); //设置拉平高度 就是 给 fxview和fyview 赋值 //第一口井默认位置,乘以水平系数 为了连接层; for (int i = 0; i < listWellsSection.Count; i++) { ItemWellSection itemWell = listWellsSection[i]; Point headView = cCordinationTransform.transRealPointF2ViewPoint( listWellsSection[i].WellPathList[0].dbX, listWellsSection[i].WellPathList[0].dbY, cProjectData.dfMapXrealRefer, cProjectData.dfMapYrealRefer, cProjectData.dfMapScale); itemWell.fXview = headView.X; itemWell.fYview = headView.Y; } }
void scaleMap(float fCoeffect) { fMapscale = float.Parse(cXmlBase.getNodeInnerText(filePathSectionCss, cXEGeopage.fullPathSacleMap)); fMapscale = fMapscale + fCoeffect; cXmlBase.setNodeInnerText(filePathSectionCss, cXEGeopage.fullPathSacleMap, fMapscale.ToString("0.0")); for (int i = 0; i < listWellsSection.Count; i++) { ItemWellSection itemWell = listWellsSection[i]; Point currentPositon = cCordinationTransform.getPointViewByJH(itemWell.sJH); itemWell.fXview = (float)fMapscale * currentPositon.X; itemWell.fYview = (float)fMapscale * currentPositon.Y; cXmlDocSectionGeo.setSelectedNodeChildNodeValue(filePathSectionCss, itemWell.sJH, "Xview", itemWell.fXview.ToString()); cXmlDocSectionGeo.setSelectedNodeChildNodeValue(filePathSectionCss, itemWell.sJH, "Yview", itemWell.fYview.ToString()); } }
private void setDepthIntervalShowedBYBaseDepth() { updateSelectedListJH(); initializeTreeViewWellCollection(); List <ItemWellHead> listWellHead = cIOinputWellHead.readWellHead2Struct(); for (int i = 0; i < ltStrSelectedJH.Count; i++) { ItemWellSection _wellSection = new ItemWellSection(ltStrSelectedJH[i], 0, 0); _wellSection.fShowedDepthTop = 0; _wellSection.fShowedDepthBase = listWellHead.Find(p => p.sJH == ltStrSelectedJH[i]).fWellBase; listWellsSection.Add(_wellSection); } cXmlDocSectionGeo.generateSectionCssXML(pathSectionCss); generateSectionDataDirectory(); }
void inintialSectionFlow() { initialSectionData(); //初始化 ItemWellSection //全井井段绘制 for (int i = 0; i < ltStrSelectedJH.Count; i++) { ItemWellSection _wellSection = new ItemWellSection(ltStrSelectedJH[i], 0, 0); //海拔转成md _wellSection.fShowedDepthTop = 0; _wellSection.fShowedDepthBase = _wellSection.fWellBase; if (_wellSection.fShowedDepthBase >= _wellSection.fWellBase) { _wellSection.fShowedDepthBase = _wellSection.fWellBase; } listWellsSection.Add(_wellSection); } makeSectionGeo.setXPositionView(filePathSectionCss, listWellsSection); cXmlDocSectionGeo.write2css(listWellsSection, filePathSectionCss); }
public static void setXYPositionViewFenceRelative(string pathSectionCss, List <ItemWellSection> listWellsSection) { float fHScale = float.Parse(cXmlBase.getNodeInnerText(pathSectionCss, cXEGeopage.xmlFullPathPageHorizonWellDistanceScale)); //设置拉平高度 就是 给 fxview和fyview 赋值 double dfMapXrealRefer = 0; double dfMapYrealRefer = 10000; if (listWellsSection.Count > 0) { int iSacleUnit = 1000; dfMapXrealRefer = Math.Floor(listWellsSection.Select(p => p.dbX).ToList().Min() / iSacleUnit - 1) * iSacleUnit; dfMapYrealRefer = (Math.Ceiling(listWellsSection.Select(p => p.dbY).ToList().Max() / iSacleUnit) + 1) * iSacleUnit; } for (int i = 0; i < listWellsSection.Count; i++) { ItemWellSection itemWell = listWellsSection[i]; Point headView = cCordinationTransform.transRealPointF2ViewPoint( listWellsSection[i].WellPathList[0].dbX, listWellsSection[i].WellPathList[0].dbY, dfMapXrealRefer, dfMapYrealRefer, cProjectData.dfMapScale); itemWell.fXview = headView.X; itemWell.fYview = headView.Y; } }
private void setDepthIntervalShowedBYElevationDepth() { updateSelectedListJH(); int iTopElevation = int.Parse(this.tbxTopElevationInput.Text); int iBottomElevation = int.Parse(this.tbxBottomElevationInput.Text); initializeTreeViewWellCollection(); for (int i = 0; i < ltStrSelectedJH.Count; i++) { ItemWellSection _wellSection = new ItemWellSection(ltStrSelectedJH[i], 0, 0); //海拔转成md _wellSection.fShowedDepthTop = _wellSection.fKB - iTopElevation; _wellSection.fShowedDepthBase = _wellSection.fKB - iBottomElevation; if (_wellSection.fShowedDepthBase >= _wellSection.fWellBase) { _wellSection.fShowedDepthBase = _wellSection.fWellBase; } listWellsSection.Add(_wellSection); } cXmlDocSectionGeo.generateSectionCssXML(pathSectionCss); generateSectionDataDirectory(); }
private void setDepthIntervalShowedBYLayer() { updateSelectedListJH(); List <string> ltStrSelectedXCM = new List <string>(); string sTopXCM = this.cbbTopXCM.SelectedItem.ToString(); int iTopIndex = cProjectData.ltStrProjectXCM.IndexOf(sTopXCM); string sBottomXCM = this.cbbBottomXCM.SelectedItem.ToString(); int iBottomIndex = cProjectData.ltStrProjectXCM.IndexOf(sBottomXCM); if (iBottomIndex - iTopIndex >= 0) { ltStrSelectedXCM = cProjectData.ltStrProjectXCM.GetRange(iTopIndex, iBottomIndex - iTopIndex + 1); initializeTreeViewWellCollection(); int _up = Convert.ToInt16(this.nUDtopDepthUp.Value); int _down = Convert.ToInt16(this.nUDbottomDepthDown.Value); for (int i = 0; i < ltStrSelectedJH.Count; i++) { ItemWellSection _wellSection = new ItemWellSection(ltStrSelectedJH[i], 0, 0); //有可能上下层有缺失。。。所以这块的技巧是找出深度序列,取最大最小值 cIOinputLayerDepth fileLayerDepth = new cIOinputLayerDepth(); List <float> fListDS1Return = fileLayerDepth.selectDepthListFromLayerDepthByJHAndXCMList(ltStrSelectedJH[i], ltStrSelectedXCM); if (fListDS1Return.Count > 0) //返回值为空 说明所选层段整个缺失! { _wellSection.fShowedDepthTop = fListDS1Return.Min() - _up; _wellSection.fShowedDepthBase = fListDS1Return.Max() + _down; } listWellsSection.Add(_wellSection); } cXmlDocSectionGeo.generateSectionCssXML(cProjectManager.xmlSectionCSS); generateSectionDataDirectory(); } else { MessageBox.Show("上层应该比下层选择高,请重新选择。"); } }
void insertWell() { FormSectAddNewWell formNew = new FormSectAddNewWell(); var result = formNew.ShowDialog(); if (result == DialogResult.OK) { string sJHInsert = formNew.ReturnJH; //values preserved after close string xtlFileName = formNew.ReturnFileNameXMT; bool bNew = true; filePathOper = dirSectionData + "//" + sJHInsert + ".xml"; if (File.Exists(filePathOper)) { DialogResult dialogResult = MessageBox.Show("是否新建并覆盖?", "文件已存在", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.No) { bNew = false; } } if (bNew == true) { ItemWellSection wellSectionInsert = new ItemWellSection(sJHInsert, 0, 0); //默认把显示深度设为全井段 wellSectionInsert.fShowedDepthTop = 0; wellSectionInsert.fShowedDepthBase = wellSectionInsert.fWellBase; Point headView = cCordinationTransform.transRealPointF2ViewPoint( wellSectionInsert.WellPathList[0].dbX, wellSectionInsert.WellPathList[0].dbY, cProjectData.dfMapXrealRefer, cProjectData.dfMapYrealRefer, cProjectData.dfMapScale); wellSectionInsert.fXview = headView.X; wellSectionInsert.fYview = headView.Y; //CSS的加入井 cXmlDocSectionGeo.insertWell(this.filePathSectionCss, this.sJH, wellSectionInsert, 0); //copy文件到目录 cIOtemplate.copyTemplate(xtlFileName, filePathOper, wellSectionInsert.sJH, wellSectionInsert.fShowedDepthTop, wellSectionInsert.fShowedDepthBase); updateTVandList(); makeSVGmap(); } } }
void updateTVandList() { tvSectionEdit.Nodes.Clear(); listWellsSection.Clear(); //解析sectioncss文件,增加节点 foreach (XmlElement elWell in cXmlDocSectionGeo.getWellNodes(filePathSectionCss)) { ItemWellSection item = new ItemWellSection(elWell["JH"].InnerText); item.fShowedDepthTop = float.Parse(elWell["fShowTop"].InnerText); item.fShowedDepthBase = float.Parse(elWell["fShowBot"].InnerText); item.fXview = float.Parse(elWell["Xview"].InnerText); item.fYview = float.Parse(elWell["Yview"].InnerText); listWellsSection.Add(item); string filePath = Path.Combine(dirSectionData, item.sJH + ".xml"); TreeNode tnWell = new TreeNode(item.sJH); tnWell.Tag = item.sJH; tnWell.Text = item.sJH; tnWell.Name = item.sJH; TreeViewSectionEditView.setupWellNode(tnWell, filePath); tvSectionEdit.Nodes.Add(tnWell); tnWell.Expand(); } }