|
|
|
|
|
using DevExpress.CodeParser;
|
|
|
|
|
|
using DevExpress.Spreadsheet.Charts;
|
|
|
|
|
|
using DevExpress.XtraGrid.Columns;
|
|
|
|
|
|
using DevExpress.XtraGrid.Views.WinExplorer;
|
|
|
|
|
|
using DevExpress.XtraReports.Wizards;
|
|
|
|
|
|
using GeoSigmaDrawLib;
|
|
|
|
|
|
using InterfaceWorkAreaData;
|
|
|
|
|
|
using Raffinert.FuzzySharp.Utils;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Security.RightsManagement;
|
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
|
|
namespace GeoSigma.UCDraw.WellAndSection
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class FrmNewWellSection : CResizeForm
|
|
|
|
|
|
{
|
|
|
|
|
|
public List<string> preSetWells = new List<string>();
|
|
|
|
|
|
public class selectWellInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
public string name { get; set; }
|
|
|
|
|
|
public int posid { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
BindingList<selectWellInfo> selectWells = new BindingList<selectWellInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<int, string> wellTrackTypeNames;//井道类型字典
|
|
|
|
|
|
|
|
|
|
|
|
public class trackTypeAndRefCol
|
|
|
|
|
|
{ //保存道的类及其关联的地层数据级别
|
|
|
|
|
|
public int typeId { get; set; }
|
|
|
|
|
|
public string strRefCol { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Dictionary<string, trackTypeAndRefCol[]> wellTrackIds; //存放已经读取的井模板中的道信息
|
|
|
|
|
|
|
|
|
|
|
|
string mTemplatePath; //模板路径
|
|
|
|
|
|
class CTempfileInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
public string fileName { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
List<CTempfileInfo> mTempFileList = new List<CTempfileInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
DataTable dataWellTable;
|
|
|
|
|
|
|
|
|
|
|
|
public List<cWellBaseInfo> retWellInfos = new List<cWellBaseInfo>();// 选中的井
|
|
|
|
|
|
public string mTemplatefileNamePath; //选中的模板文件
|
|
|
|
|
|
public List<string> retLayers = new List<string>();
|
|
|
|
|
|
public string m_fileName;
|
|
|
|
|
|
public List<string> sectionNodeNames = new List<string>();
|
|
|
|
|
|
public List<cWellStratification> m_SelectedLayers;
|
|
|
|
|
|
public List<string> m_SelectLayersName = new List<string>();
|
|
|
|
|
|
|
|
|
|
|
|
BindingList<CWellLayerInfo> mWellTopLayersInfo = new BindingList<CWellLayerInfo>();
|
|
|
|
|
|
BindingList<CWellLayerInfo> mWellBottomLayersInfo = new BindingList<CWellLayerInfo>();
|
|
|
|
|
|
|
|
|
|
|
|
public double m_topExtent = 0;
|
|
|
|
|
|
public double m_bottomExtent = 0;
|
|
|
|
|
|
class CLayersInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
public string text { get; set; }
|
|
|
|
|
|
public int levelId { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
List<CLayersInfo> mLayersInfo = new List<CLayersInfo>();
|
|
|
|
|
|
List<cWellStratification> mWellStrats = new List<cWellStratification>();
|
|
|
|
|
|
class CWellLayerInfo
|
|
|
|
|
|
{
|
|
|
|
|
|
public string cw { get; set; }
|
|
|
|
|
|
public int order { get; set; }
|
|
|
|
|
|
public int id { get; set; }
|
|
|
|
|
|
}
|
|
|
|
|
|
BindingList<CWellLayerInfo> mWellLayersInfo = new BindingList<CWellLayerInfo>();
|
|
|
|
|
|
public FrmNewWellSection()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
_designSize = new Size(this.Size.Width, this.Size.Height);
|
|
|
|
|
|
StoreOriginalStates(this.Controls);
|
|
|
|
|
|
|
|
|
|
|
|
// this.cardView1.OptionsView.ShowCardCaption = false; //隐藏
|
|
|
|
|
|
// this.cardView1.OptionsView.ShowQuickCustomizeButton = false; //隐藏
|
|
|
|
|
|
|
|
|
|
|
|
wellListBox.SelectionMode = SelectionMode.MultiExtended;
|
|
|
|
|
|
this.wellListBox.DataSource = selectWells;
|
|
|
|
|
|
this.wellListBox.DisplayMember = "name";
|
|
|
|
|
|
this.wellListBox.ValueMember = "posid";
|
|
|
|
|
|
|
|
|
|
|
|
this.textBoxTopExtent.Text = "0";
|
|
|
|
|
|
this.textBoxbottomExtent.Text = "0";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (wellTempComboBox.SelectedItem is CTempfileInfo selectTemp)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (selectTemp.fileName != "")
|
|
|
|
|
|
mTemplatefileNamePath = mTemplatePath + selectTemp.fileName;
|
|
|
|
|
|
else
|
|
|
|
|
|
mTemplatefileNamePath = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
retWellInfos.Clear();
|
|
|
|
|
|
for (int i = 0; i < selectWells.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
DataRow[] trs = dataWellTable.Select($"井名 = '{selectWells[i].name}'");
|
|
|
|
|
|
for (int j = 0; j < trs.Length; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
cWellBaseInfo wellInfo = new cWellBaseInfo();
|
|
|
|
|
|
DataRow trow = trs[j];
|
|
|
|
|
|
|
|
|
|
|
|
wellInfo.WellName = trow["井名"].ToString();
|
|
|
|
|
|
wellInfo.x = Convert.ToDouble(trow["X"]);
|
|
|
|
|
|
wellInfo.y = Convert.ToDouble(trow["Y"]);
|
|
|
|
|
|
wellInfo.BushingLevel = Convert.ToDouble(trow["BXHB"]);
|
|
|
|
|
|
|
|
|
|
|
|
retWellInfos.Add(wellInfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < this.LayercheckedListBox.Items.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
CheckState state = this.LayercheckedListBox.GetItemCheckState(i);
|
|
|
|
|
|
if (state == CheckState.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
string strlayer = this.LayercheckedListBox.Items[i].ToString();
|
|
|
|
|
|
if (retLayers.Contains(strlayer) == false)
|
|
|
|
|
|
{
|
|
|
|
|
|
retLayers.Add(strlayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (retWellInfos.Count < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show("请选择井");
|
|
|
|
|
|
this.DialogResult = DialogResult.None;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_fileName = textBoxFileName.Text;
|
|
|
|
|
|
if (sectionNodeNames.Contains(m_fileName + ".pcg", StringComparer.OrdinalIgnoreCase))
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show("存在同名文件,请修改名称");
|
|
|
|
|
|
this.DialogResult = DialogResult.None;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.DialogResult = DialogResult.OK;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(retWellInfos.Count <1)
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show("请选择井");
|
|
|
|
|
|
this.DialogResult = DialogResult.None;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ((comboBoxTopLayer.SelectedItem is CWellLayerInfo topLayer) && (comboBoxBottomLayer.SelectedItem is CWellLayerInfo bottomLayer))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (topLayer.order > bottomLayer.order)
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show("结束层位序号应大于结束层位");
|
|
|
|
|
|
this.DialogResult = DialogResult.None;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<CWellLayerInfo> selectlayers = new List<CWellLayerInfo>();
|
|
|
|
|
|
selectlayers = mWellTopLayersInfo.Where(item => (item.order >= topLayer.order && item.order <= bottomLayer.order)).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
int botLevelId = mLayersInfo[mLayersInfo.Count - 1].levelId;
|
|
|
|
|
|
int levelId = -1;
|
|
|
|
|
|
if (comboBoxLayers.SelectedItem is CLayersInfo layer)
|
|
|
|
|
|
{
|
|
|
|
|
|
levelId = layer.levelId;
|
|
|
|
|
|
}
|
|
|
|
|
|
m_SelectedLayers = new List<cWellStratification>(); //实际的井段都是最底的地层,因此搜集最底层的井段
|
|
|
|
|
|
if (levelId < botLevelId)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < selectlayers.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<cWellStratification> tchildsNodes = GetAllChildren(mWellStrats, selectlayers[i].id);
|
|
|
|
|
|
m_SelectedLayers.AddRange(tchildsNodes);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < selectlayers.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_SelectedLayers.AddRange(mWellStrats.Where(item => item.code == selectlayers[i].cw).ToList());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_SelectLayersName.Clear();
|
|
|
|
|
|
for (int i = 0; i < m_SelectedLayers.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_SelectLayersName.Add(m_SelectedLayers[i].code);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(Double.TryParse(textBoxTopExtent.Text,out double topExtent))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (topExtent > 0)
|
|
|
|
|
|
m_topExtent = topExtent;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (Double.TryParse(textBoxbottomExtent.Text, out double botExtent))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (topExtent > 0)
|
|
|
|
|
|
m_bottomExtent = botExtent;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 递归获取所有子节点(包括子孙节点)
|
|
|
|
|
|
List<cWellStratification> GetAllChildren(List<cWellStratification> allNodes, int parentId)
|
|
|
|
|
|
{
|
|
|
|
|
|
var children = new List<cWellStratification>();
|
|
|
|
|
|
|
|
|
|
|
|
// 查找直接子节点
|
|
|
|
|
|
var directChildren = allNodes.Where(n => n.parentId == parentId).ToList();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var child in directChildren)
|
|
|
|
|
|
{
|
|
|
|
|
|
children.Add(child);
|
|
|
|
|
|
// 递归获取子节点的子节点
|
|
|
|
|
|
children.AddRange(GetAllChildren(allNodes, child.id));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return children;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void FrmNewWellSection_Shown(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
string[] typeNames = new string[0];
|
|
|
|
|
|
int[] typeIds = new int[0];
|
|
|
|
|
|
GeoSigmaWellSectionXY.GetWellTrackTypeInfo(ref typeIds, ref typeNames);
|
|
|
|
|
|
wellTrackTypeNames = new Dictionary<int, string>();
|
|
|
|
|
|
for (int i = 0; i < typeIds.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
wellTrackTypeNames.Add(typeIds[i], typeNames[i]);
|
|
|
|
|
|
}
|
|
|
|
|
|
wellTrackIds = new Dictionary<string, trackTypeAndRefCol[]>();
|
|
|
|
|
|
|
|
|
|
|
|
dataWellTable = new DataTable();
|
|
|
|
|
|
dataWellTable.Columns.Add("井名", typeof(string));
|
|
|
|
|
|
dataWellTable.Columns.Add("选择", typeof(bool));
|
|
|
|
|
|
dataWellTable.Columns.Add("X", typeof(double));
|
|
|
|
|
|
dataWellTable.Columns.Add("Y", typeof(double));
|
|
|
|
|
|
dataWellTable.Columns.Add("BXHB", typeof(double));
|
|
|
|
|
|
|
|
|
|
|
|
List<cWellBaseInfo> wellInfos = workAreaDb.Instance.workData.getWellsInfo();
|
|
|
|
|
|
if (wellInfos.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < wellInfos.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataRow trow = dataWellTable.NewRow();
|
|
|
|
|
|
trow["井名"] = wellInfos[i].WellName;
|
|
|
|
|
|
trow["X"] = wellInfos[i].x;
|
|
|
|
|
|
trow["Y"] = wellInfos[i].y;
|
|
|
|
|
|
trow["BXHB"] = wellInfos[i].BushingLevel ?? 0;
|
|
|
|
|
|
trow["选择"] = false;
|
|
|
|
|
|
dataWellTable.Rows.Add(trow);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// this.cardView1.MaximumCardColumns = 6;
|
|
|
|
|
|
// this.cardView1.MaximumCardRows = wellInfos.Count / 6 + 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.gridControl1.BindingContext = new BindingContext();
|
|
|
|
|
|
this.gridControl1.DataSource = dataWellTable;
|
|
|
|
|
|
|
|
|
|
|
|
this.winExplorerView1.Columns.Clear();
|
|
|
|
|
|
this.winExplorerView1.Columns.Add(new GridColumn() { FieldName = "井名" });
|
|
|
|
|
|
this.winExplorerView1.Columns.Add(new GridColumn() { FieldName = "选择" });
|
|
|
|
|
|
//this.winExplorerView1.Columns.Add(new GridColumn() { FieldName = "X" });
|
|
|
|
|
|
//this.winExplorerView1.Columns.Add(new GridColumn() { FieldName = "Y" });
|
|
|
|
|
|
//this.winExplorerView1.Columns.Add(new GridColumn() { FieldName = "BXHB" });
|
|
|
|
|
|
|
|
|
|
|
|
this.winExplorerView1.ColumnSet.TextColumn = this.winExplorerView1.Columns["井名"];
|
|
|
|
|
|
this.winExplorerView1.ColumnSet.CheckBoxColumn = this.winExplorerView1.Columns["选择"];
|
|
|
|
|
|
//this.winExplorerView1.ColumnSet.TextColumn = this.winExplorerView1.Columns["X"];
|
|
|
|
|
|
//this.winExplorerView1.ColumnSet.TextColumn = this.winExplorerView1.Columns["Y"];
|
|
|
|
|
|
//this.winExplorerView1.ColumnSet.TextColumn = this.winExplorerView1.Columns["BXHB"];
|
|
|
|
|
|
|
|
|
|
|
|
this.winExplorerView1.OptionsView.Style = WinExplorerViewStyle.List;
|
|
|
|
|
|
this.winExplorerView1.OptionsViewStyles.List.ItemWidth = 130;
|
|
|
|
|
|
this.winExplorerView1.OptionsViewStyles.List.ContentMargins = new System.Windows.Forms.Padding(5, 5, 5, 5);
|
|
|
|
|
|
//this.winExplorerView1.OptionsViewStyles.Small.ItemWidth = 100;
|
|
|
|
|
|
this.winExplorerView1.OptionsView.ShowCheckBoxes = true;
|
|
|
|
|
|
this.winExplorerView1.OptionsSelection.ItemSelectionMode = DevExpress.XtraGrid.Views.WinExplorer.IconItemSelectionMode.Click;
|
|
|
|
|
|
this.winExplorerView1.OptionsSelection.MultiSelect = false;
|
|
|
|
|
|
//this.winExplorerView1.CellValueChanging += cardView1_CellValueChanging;
|
|
|
|
|
|
this.winExplorerView1.ItemClick += new DevExpress.XtraGrid.Views.WinExplorer.WinExplorerViewItemClickEventHandler(this.winExplorerView1_ItemClick);
|
|
|
|
|
|
this.winExplorerView1.ItemDoubleClick += new DevExpress.XtraGrid.Views.WinExplorer.WinExplorerViewItemDoubleClickEventHandler(this.winExplorerView1_ItemDoubleClick);
|
|
|
|
|
|
//this.cardView1.Columns["X"].Visible = false;
|
|
|
|
|
|
// this.cardView1.Columns["Y"].Visible = false;
|
|
|
|
|
|
// this.cardView1.Columns["BXHB"].Visible = false;
|
|
|
|
|
|
|
|
|
|
|
|
// this.cardView1.ActiveFilterString = "Contains([井名],'DD')";
|
|
|
|
|
|
this.gridControl1.ForceInitialize();
|
|
|
|
|
|
|
|
|
|
|
|
CTempfileInfo tfile = new CTempfileInfo();
|
|
|
|
|
|
tfile.fileName = "";
|
|
|
|
|
|
// mTempFileList.Add(tfile); //增加一个空的名称
|
|
|
|
|
|
mTemplatePath = AppDomain.CurrentDomain.BaseDirectory + "Templates\\WellsSection\\";
|
|
|
|
|
|
if (Directory.Exists(mTemplatePath))
|
|
|
|
|
|
{
|
|
|
|
|
|
try
|
|
|
|
|
|
{
|
|
|
|
|
|
var fileNames = Directory.GetFiles(mTemplatePath)
|
|
|
|
|
|
.Select(Path.GetFileName)
|
|
|
|
|
|
.OrderBy(name => name)
|
|
|
|
|
|
.ToArray();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var fileName in fileNames)
|
|
|
|
|
|
{
|
|
|
|
|
|
string tname = fileName.ToLower();
|
|
|
|
|
|
String tstr1 = tname.Length > 4 ? tname.Substring(tname.Length - 4) : "";
|
|
|
|
|
|
if (tstr1 == ".pcg")
|
|
|
|
|
|
{
|
|
|
|
|
|
CTempfileInfo tfile1 = new CTempfileInfo();
|
|
|
|
|
|
tfile1.fileName = fileName;
|
|
|
|
|
|
mTempFileList.Add(tfile1);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.wellTempComboBox.DataSource = mTempFileList;
|
|
|
|
|
|
this.wellTempComboBox.DisplayMember = "fileName";
|
|
|
|
|
|
|
|
|
|
|
|
if (mTempFileList.Count > 0)
|
|
|
|
|
|
this.wellTempComboBox.SelectedIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
mWellStrats = workAreaDb.Instance.workData.getWellStratification();
|
|
|
|
|
|
List<cWellStratification> distinctByLevel = mWellStrats
|
|
|
|
|
|
.GroupBy(item => item.level)
|
|
|
|
|
|
.Select(g => g.First()) // 或 g.Last()、g.OrderBy(...).First() 等
|
|
|
|
|
|
.ToList();
|
|
|
|
|
|
for (int i = 0; i < distinctByLevel.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
CLayersInfo tinfo = new CLayersInfo();
|
|
|
|
|
|
string str = (i + 1).ToString() + "级";
|
|
|
|
|
|
tinfo.levelId = distinctByLevel[i].level;
|
|
|
|
|
|
tinfo.text = str;
|
|
|
|
|
|
mLayersInfo.Add(tinfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.comboBoxTopLayer.DataSource = mWellTopLayersInfo;
|
|
|
|
|
|
this.comboBoxTopLayer.DisplayMember = "cw";
|
|
|
|
|
|
|
|
|
|
|
|
this.comboBoxBottomLayer.DataSource = mWellBottomLayersInfo;
|
|
|
|
|
|
this.comboBoxBottomLayer.DisplayMember = "cw";
|
|
|
|
|
|
|
|
|
|
|
|
this.comboBoxLayers.DataSource = mLayersInfo;
|
|
|
|
|
|
this.comboBoxLayers.DisplayMember = "text";
|
|
|
|
|
|
this.comboBoxLayers.ValueMember = "levelId";
|
|
|
|
|
|
|
|
|
|
|
|
if(preSetWells.Count >0)
|
|
|
|
|
|
{
|
|
|
|
|
|
for(int i = 0; i< preSetWells.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
for(int j = 0; j < dataWellTable.Rows.Count; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataRow dr = dataWellTable.Rows[j];
|
|
|
|
|
|
string str = dr[0].ToString();
|
|
|
|
|
|
if (preSetWells[i] == str)
|
|
|
|
|
|
{
|
|
|
|
|
|
dr[1] = true;
|
|
|
|
|
|
|
|
|
|
|
|
selectWellInfo twinfo = new selectWellInfo();
|
|
|
|
|
|
twinfo.name = preSetWells[i];
|
|
|
|
|
|
twinfo.posid = j;
|
|
|
|
|
|
|
|
|
|
|
|
this.selectWells.Add(twinfo);
|
|
|
|
|
|
|
|
|
|
|
|
//winExplorerView1.RefreshRow(j);
|
|
|
|
|
|
winExplorerView1.SetRowCellValue(j, "选择", true);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.wellListBox.Refresh();
|
|
|
|
|
|
|
|
|
|
|
|
textBoxFileName.Text = getFileNameFromWellList();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string getFileNameFromWellList()
|
|
|
|
|
|
{
|
|
|
|
|
|
string strName = "";
|
|
|
|
|
|
for (int i = 0; i < selectWells.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (i < 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
strName = strName + '+' + selectWells[i].name;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
strName = strName.TrimStart('+');
|
|
|
|
|
|
if (selectWells.Count > 3)
|
|
|
|
|
|
{
|
|
|
|
|
|
strName = strName + '+' + selectWells[selectWells.Count - 1].name;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
textBoxFileName.Text = strName;
|
|
|
|
|
|
return strName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool isLayerType(int type)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (type == (int)GeoSigmaWellSectionXY.eWellExtType.Track_Result ||
|
|
|
|
|
|
type == (int)GeoSigmaWellSectionXY.eWellExtType.Track_Stratum ||
|
|
|
|
|
|
type == (int)GeoSigmaWellSectionXY.eWellExtType.Track_SandLayer ||
|
|
|
|
|
|
type == (int)GeoSigmaWellSectionXY.eWellExtType.Track_OilLayerGroup)
|
|
|
|
|
|
return true;
|
|
|
|
|
|
else
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void wellTempComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (wellTempComboBox.SelectedItem is CTempfileInfo selectTemp)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (selectTemp.fileName != "")
|
|
|
|
|
|
mTemplatefileNamePath = mTemplatePath + selectTemp.fileName;
|
|
|
|
|
|
else
|
|
|
|
|
|
mTemplatefileNamePath = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
this.LayercheckedListBox.Items.Clear();
|
|
|
|
|
|
|
|
|
|
|
|
if (mTemplatefileNamePath != "")
|
|
|
|
|
|
{
|
|
|
|
|
|
if (wellTrackIds.TryGetValue(mTemplatefileNamePath, out trackTypeAndRefCol[] ttypes))
|
|
|
|
|
|
{//如果本模板数据已经读取了,就使用保存过的
|
|
|
|
|
|
for (int i = 0; i < ttypes.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isLayerType(ttypes[i].typeId) == false)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
if (wellTrackTypeNames.TryGetValue(ttypes[i].typeId, out string type))
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = this.LayercheckedListBox.Items.Add(type);
|
|
|
|
|
|
this.LayercheckedListBox.SetItemChecked(id, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GeoSigmaWellSectionXY.WellTempateGetTracksType(mTemplatefileNamePath, out int[] types1, out string[] refCols))
|
|
|
|
|
|
{
|
|
|
|
|
|
trackTypeAndRefCol[] tracks = new trackTypeAndRefCol[types1.Length];
|
|
|
|
|
|
for (int i = 0; i < types1.Length; i++)//将读取的道id及数据层级保存下来
|
|
|
|
|
|
{
|
|
|
|
|
|
tracks[i] = new trackTypeAndRefCol();
|
|
|
|
|
|
tracks[i].typeId = types1[i];
|
|
|
|
|
|
tracks[i].strRefCol = refCols[i];
|
|
|
|
|
|
}
|
|
|
|
|
|
wellTrackIds.Add(mTemplatefileNamePath, tracks);
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < types1.Length; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isLayerType(types1[i]) == false)
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
|
|
if (wellTrackTypeNames.TryGetValue(types1[i], out string type))
|
|
|
|
|
|
{
|
|
|
|
|
|
int id = this.LayercheckedListBox.Items.Add(type);
|
|
|
|
|
|
this.LayercheckedListBox.SetItemChecked(id, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnDelSelectWells_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < selectWells.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataRow[] trs = dataWellTable.Select($"井名 = '{selectWells[i].name}'");
|
|
|
|
|
|
for (int j = 0; j < trs.Length; j++)
|
|
|
|
|
|
{
|
|
|
|
|
|
trs[j]["选择"] = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
// DataRow trow = dataWellTable.Rows[selectWells[i].posid];
|
|
|
|
|
|
// trow["选择"] = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
selectWells.Clear();
|
|
|
|
|
|
this.gridControl1.RefreshDataSource();
|
|
|
|
|
|
|
|
|
|
|
|
textBoxFileName.Text = "";
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void textBoxFilter_TextChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
string text = this.textBoxFilter.Text;
|
|
|
|
|
|
|
|
|
|
|
|
if (text == "")
|
|
|
|
|
|
this.winExplorerView1.ActiveFilterString = "";
|
|
|
|
|
|
else;
|
|
|
|
|
|
this.winExplorerView1.ActiveFilterString = $"Contains([井名], '{text}')";
|
|
|
|
|
|
|
|
|
|
|
|
// this.cardView1.RefreshData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void ScaleControls(Control.ControlCollection controls, float scaleX, float scaleY)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (Control ctrl in controls)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (_originalStates.TryGetValue(ctrl, out var state))
|
|
|
|
|
|
{
|
|
|
|
|
|
// 缩放位置和大小
|
|
|
|
|
|
ctrl.Left = (int)(state.location.X * scaleX);
|
|
|
|
|
|
ctrl.Top = (int)(state.location.Y * scaleY);
|
|
|
|
|
|
ctrl.Width = (int)(state.size.Width * scaleX);
|
|
|
|
|
|
ctrl.Height = (int)(state.size.Height * scaleY);
|
|
|
|
|
|
|
|
|
|
|
|
// 可选:缩放字体(注意:字体缩放可能影响清晰度)
|
|
|
|
|
|
// if (ctrl.Font != null)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ctrl.Font = new Font(ctrl.Font.FontFamily, state.fontSize * scale, ctrl.Font.Style);
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 递归子控件
|
|
|
|
|
|
if (ctrl.Controls.Count > 0)
|
|
|
|
|
|
ScaleControls(ctrl.Controls, scaleX, scaleY);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private void FrmNewWellSection_Resize(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
FrmResize(sender, e);
|
|
|
|
|
|
// if (_isScaling || DesignMode || WindowState == FormWindowState.Minimized)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// base.OnResize(e);
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// _isScaling = true;
|
|
|
|
|
|
|
|
|
|
|
|
// try
|
|
|
|
|
|
// {
|
|
|
|
|
|
// // 计算缩放比例(X 和 Y 方向分别计算,也可取平均或最小值)
|
|
|
|
|
|
// float scaleX = (float)ClientSize.Width / _designSize.Width;
|
|
|
|
|
|
// float scaleY = (float)ClientSize.Height / _designSize.Height;
|
|
|
|
|
|
|
|
|
|
|
|
// // 可选策略:
|
|
|
|
|
|
// // 1. 等比例(保持宽高比)→ 取 min(scaleX, scaleY)
|
|
|
|
|
|
// // 2. 非等比例拉伸 → 分别使用 scaleX, scaleY
|
|
|
|
|
|
// // 这里我们实现**真正的等比例缩放**(内容不变形),取最小比例
|
|
|
|
|
|
// float scale = Math.Min(scaleX, scaleY);
|
|
|
|
|
|
|
|
|
|
|
|
// ScaleControls(this.Controls, scaleX,scaleY);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// finally
|
|
|
|
|
|
// {
|
|
|
|
|
|
// _isScaling = false;
|
|
|
|
|
|
// // base.OnResize(e);
|
|
|
|
|
|
// }
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void winExplorerView1_ItemDoubleClick(object sender, WinExplorerViewItemDoubleClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
private void winExplorerView1_ItemClick(object sender, WinExplorerViewItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.MouseInfo.X < e.ItemInfo.CheckBoxBounds.Left || e.MouseInfo.X > (e.ItemInfo.CheckBoxBounds.Left + e.ItemInfo.CheckBoxBounds.Width)
|
|
|
|
|
|
|| e.MouseInfo.Y < e.ItemInfo.CheckBoxBounds.Top || e.MouseInfo.Y > (e.ItemInfo.CheckBoxBounds.Top + e.ItemInfo.CheckBoxBounds.Height))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DataRow trow = this.winExplorerView1.GetDataRow(e.ItemInfo.Row.RowHandle);//dataWellTable.Rows[e.RowHandle];
|
|
|
|
|
|
if (trow.ItemArray.Length > 2)
|
|
|
|
|
|
{
|
|
|
|
|
|
var val = trow.ItemArray[1];
|
|
|
|
|
|
bool b = !Convert.ToBoolean(val); //这个控件checkbox点击后,bool值才起作用
|
|
|
|
|
|
if (b)
|
|
|
|
|
|
{
|
|
|
|
|
|
selectWellInfo twinfo = new selectWellInfo();
|
|
|
|
|
|
twinfo.name = trow[0].ToString();
|
|
|
|
|
|
twinfo.posid = e.ItemInfo.Row.RowHandle;
|
|
|
|
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
|
|
for (i = 0; i < selectWells.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (selectWells[i].name == twinfo.name)
|
|
|
|
|
|
{
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (i == selectWells.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.selectWells.Add(twinfo);
|
|
|
|
|
|
this.wellListBox.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
//this.wellListBox.Items.Add(trow[0].ToString());
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
string name = trow[0].ToString();
|
|
|
|
|
|
//this.wellListBox.Items.Remove(name);
|
|
|
|
|
|
for (int i = selectWells.Count - 1; i > -1; i--)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (selectWells[i].name == name)
|
|
|
|
|
|
{
|
|
|
|
|
|
selectWells.RemoveAt(i);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.wellListBox.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
textBoxFileName.Text = getFileNameFromWellList();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void comboBoxLayers_SelectedValueChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
int levelId = -1;
|
|
|
|
|
|
if (comboBoxLayers.SelectedItem is CLayersInfo layer)
|
|
|
|
|
|
{
|
|
|
|
|
|
levelId = layer.levelId;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (levelId < 0)
|
|
|
|
|
|
return;
|
|
|
|
|
|
mWellTopLayersInfo.Clear();
|
|
|
|
|
|
mWellBottomLayersInfo.Clear();
|
|
|
|
|
|
List<cWellStratification> layersByLevel = mWellStrats.Where(item => item.level == levelId).ToList();
|
|
|
|
|
|
for (int i = 0; i < layersByLevel.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
CWellLayerInfo twellLayer = new CWellLayerInfo();
|
|
|
|
|
|
twellLayer.cw = layersByLevel[i].code;
|
|
|
|
|
|
twellLayer.order = layersByLevel[i].order;
|
|
|
|
|
|
twellLayer.id = layersByLevel[i].id;
|
|
|
|
|
|
mWellTopLayersInfo.Add(twellLayer);
|
|
|
|
|
|
|
|
|
|
|
|
CWellLayerInfo twellLayer1 = new CWellLayerInfo();
|
|
|
|
|
|
twellLayer1.cw = layersByLevel[i].code;
|
|
|
|
|
|
twellLayer1.order = layersByLevel[i].order;
|
|
|
|
|
|
twellLayer1.id = layersByLevel[i].id;
|
|
|
|
|
|
mWellBottomLayersInfo.Add(twellLayer1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (layersByLevel.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
// this.comboBoxTopLayer.DataSource = mWellTopLayersInfo;
|
|
|
|
|
|
// this.comboBoxTopLayer.DisplayMember = "cw";
|
|
|
|
|
|
comboBoxTopLayer.SelectedIndex = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// this.comboBoxBottomLayer.DataSource = mWellBottomLayersInfo;
|
|
|
|
|
|
// this.comboBoxBottomLayer.DisplayMember = "cw";
|
|
|
|
|
|
comboBoxBottomLayer.SelectedIndex = mWellBottomLayersInfo.Count - 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|