|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
|
|
namespace TestMicroStructure
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class FormMain : Form
|
|
|
|
|
|
{
|
|
|
|
|
|
public FormMain()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void rbtnInputSingle_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (rbtnInputSingle.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
lblFileInput.Text = "数据文件";
|
|
|
|
|
|
lblFileInput.Location = new Point(26, lblFileInput.Location.Y);
|
|
|
|
|
|
|
|
|
|
|
|
lblFileFault.Enabled = false;
|
|
|
|
|
|
txtFileFault.Enabled = false;
|
|
|
|
|
|
btnFileFault.Enabled = false;
|
|
|
|
|
|
|
|
|
|
|
|
lblFileGrid.Enabled = false;
|
|
|
|
|
|
txtFileGrid.Enabled = false;
|
|
|
|
|
|
btbFileGrid.Enabled = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void rbtnInputMult_CheckedChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (rbtnInputMult.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
lblFileInput.Text = "等值线文件";
|
|
|
|
|
|
lblFileInput.Location = new Point(14, lblFileInput.Location.Y);
|
|
|
|
|
|
|
|
|
|
|
|
lblFileFault.Enabled = true;
|
|
|
|
|
|
txtFileFault.Enabled = true;
|
|
|
|
|
|
btnFileFault.Enabled = true;
|
|
|
|
|
|
|
|
|
|
|
|
lblFileGrid.Enabled = true;
|
|
|
|
|
|
txtFileGrid.Enabled = true;
|
|
|
|
|
|
btbFileGrid.Enabled = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 执行计算
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">事件按钮</param>
|
|
|
|
|
|
/// <param name="e">事件参数</param>
|
|
|
|
|
|
private void btnOK_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
StructureCalculateParameter par = new StructureCalculateParameter();
|
|
|
|
|
|
par.m_dExtendDis = Convert.ToDouble(this.txtExtendDistance.Text);
|
|
|
|
|
|
par.m_dCloseDistance = Convert.ToDouble(this.txtCloseDistance.Text);
|
|
|
|
|
|
par.m_dMinimumArea = Convert.ToDouble(this.txtMiniArea.Text);
|
|
|
|
|
|
par.m_dOffsetDis = Convert.ToDouble(this.txtOffsetDistance.Text);
|
|
|
|
|
|
par.m_dMiniAngle = Convert.ToDouble(this.txtMiniAngle.Text);
|
|
|
|
|
|
par.m_dRedundant = Convert.ToDouble(this.txtRedundant.Text);
|
|
|
|
|
|
par.m_dRadius = Convert.ToDouble(this.txtStructureRadius.Text);
|
|
|
|
|
|
par.m_nLimitNum = Convert.ToInt32(this.txtMinPoints.Text);
|
|
|
|
|
|
par.m_dFaultCloseDis = Convert.ToDouble(this.txtFaultCloseDistance.Text);
|
|
|
|
|
|
|
|
|
|
|
|
par.m_bFaultFilter = this.ckbFaultFilter.Checked;
|
|
|
|
|
|
|
|
|
|
|
|
par.m_bSmooth = this.ckbSmooth.Checked;
|
|
|
|
|
|
par.m_dZoomin = Convert.ToDouble(this.txtZoomin.Text);
|
|
|
|
|
|
par.m_dUnitSacle = Convert.ToDouble(this.txtUnitScale.Text);
|
|
|
|
|
|
|
|
|
|
|
|
par.m_minDepth = -1000;
|
|
|
|
|
|
par.m_maxDepth = 1000;
|
|
|
|
|
|
|
|
|
|
|
|
par.m_ShapeTypes = StructureType.StructrueNone
|
|
|
|
|
|
| StructureType.High | StructureType.Low
|
|
|
|
|
|
| StructureType.NoseHigh | StructureType.NoseLow
|
|
|
|
|
|
| StructureType.FaultHigh | StructureType.FaultLow;
|
|
|
|
|
|
|
|
|
|
|
|
par.CurveLayer = "Contour\\Other,Contour\\Mark,等值线";
|
|
|
|
|
|
par.FaultageLayer = "0,断层";
|
|
|
|
|
|
|
|
|
|
|
|
string strCurveFile = this.txtFileInput.Text;
|
|
|
|
|
|
string strFaultFile = this.txtFileFault.Text;
|
|
|
|
|
|
string strGridFile = this.txtFileGrid.Text;
|
|
|
|
|
|
string strOutput = this.txtFileOutput.Text;
|
|
|
|
|
|
|
|
|
|
|
|
string strStatisticFile = Path.Combine(Path.GetDirectoryName(strOutput)
|
|
|
|
|
|
, Path.GetFileNameWithoutExtension(strOutput) + "_structure.csv");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 执行计算
|
|
|
|
|
|
if (rbtnInputMult.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
CreateMicroStructureOld(strCurveFile, strFaultFile, strGridFile, strOutput, ref par);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
CreateMicroStructure(strCurveFile, strOutput, strStatisticFile, ref par,"断层", "等值线");
|
|
|
|
|
|
//CreateMicroStructure(strCurveFile, strOutput, strStatisticFile, ref par, "0", "Contour\\Other,Contour\\Mark");//\\Other
|
|
|
|
|
|
}
|
|
|
|
|
|
if (File.Exists(strOutput))
|
|
|
|
|
|
{
|
|
|
|
|
|
string strData = File.ReadAllText(strOutput, Encoding.Default);
|
|
|
|
|
|
File.WriteAllText(strOutput, strData.Insert(0, @"HowToViewCurve
|
|
|
|
|
|
Property 0 13395711 65568 0 0 0.000000 0.000000 0
|
|
|
|
|
|
Solid
|
|
|
|
|
|
NoDraw
|
|
|
|
|
|
|
|
|
|
|
|
Layer M 构造\鼻状
|
|
|
|
|
|
Layer HowToViewCurve
|
|
|
|
|
|
HowToViewCurve
|
|
|
|
|
|
Property 0 6724095 65568 0 0 0.000000 0.000000 0
|
|
|
|
|
|
Solid
|
|
|
|
|
|
NoDraw
|
|
|
|
|
|
|
|
|
|
|
|
Layer M 构造\断鼻
|
|
|
|
|
|
Layer HowToViewCurve
|
|
|
|
|
|
HowToViewCurve
|
|
|
|
|
|
Property 0 16763904 65568 0 0 0.000000 0.000000 0
|
|
|
|
|
|
Solid
|
|
|
|
|
|
NoDraw
|
|
|
|
|
|
|
|
|
|
|
|
Layer M 构造\断沟
|
|
|
|
|
|
Layer HowToViewCurve
|
|
|
|
|
|
HowToViewCurve
|
|
|
|
|
|
Property 0 16776960 65568 0 0 0.000000 0.000000 0
|
|
|
|
|
|
Solid
|
|
|
|
|
|
NoDraw
|
|
|
|
|
|
|
|
|
|
|
|
Layer M 构造\沟槽
|
|
|
|
|
|
Layer HowToViewCurve
|
|
|
|
|
|
HowToViewCurve
|
|
|
|
|
|
Property 0 16751052 65568 0 0 0.000000 0.000000 0
|
|
|
|
|
|
Solid
|
|
|
|
|
|
NoDraw
|
|
|
|
|
|
|
|
|
|
|
|
Layer M 构造\低点
|
|
|
|
|
|
Layer HowToViewCurve
|
|
|
|
|
|
HowToViewCurve
|
|
|
|
|
|
Property 0 559607 65568 0 0 0.000000 0.000000 0
|
|
|
|
|
|
Solid
|
|
|
|
|
|
NoDraw
|
|
|
|
|
|
|
|
|
|
|
|
Layer M 构造\高点
|
|
|
|
|
|
Layer HowToViewCurve
|
|
|
|
|
|
HowToViewCurve
|
|
|
|
|
|
|
|
|
|
|
|
"), Encoding.Default);
|
|
|
|
|
|
}
|
|
|
|
|
|
MessageBox.Show(this, "计算完成!");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if DEBUG
|
|
|
|
|
|
//const string DLL_FILE = @"C:\GeoIntelligent\Code\dirgdf\bin\Debug\WellCalibrate.dll";
|
|
|
|
|
|
const string DLL_FILE = "MicroStructurePP.dll";
|
|
|
|
|
|
#else
|
|
|
|
|
|
const string DLL_FILE = "MicroStructurePP.dll";
|
|
|
|
|
|
#endif
|
|
|
|
|
|
[DllImport(DLL_FILE, EntryPoint = "CreateMicroStructureOld", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
|
public static extern void CreateMicroStructureOld(string curveFile, string faultFile, string gridFile, string ResultFile,ref StructureCalculateParameter par);
|
|
|
|
|
|
|
|
|
|
|
|
[DllImport(DLL_FILE, EntryPoint = "CreateMicroStructure", ExactSpelling = false, CallingConvention = CallingConvention.Cdecl)]
|
|
|
|
|
|
public static extern void CreateMicroStructure(string intputFile,
|
|
|
|
|
|
string resultFile, string statisticFile,
|
|
|
|
|
|
ref StructureCalculateParameter par, string faultLayer, string curveLayer);
|
|
|
|
|
|
|
|
|
|
|
|
private void btnFileInput_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
|
|
|
|
ofd.RestoreDirectory = true;
|
|
|
|
|
|
ofd.Filter = "*.dfd|*.dfd|*.*|*.*||";
|
|
|
|
|
|
if(ofd.ShowDialog() != DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.txtFileInput.Text = ofd.FileName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnFileFault_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
|
|
|
|
ofd.RestoreDirectory = true;
|
|
|
|
|
|
ofd.Filter = "*.dfd|*.dfd|*.*|*.*||";
|
|
|
|
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.txtFileFault.Text = ofd.FileName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btbFileGrid_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
OpenFileDialog ofd = new OpenFileDialog();
|
|
|
|
|
|
ofd.RestoreDirectory = true;
|
|
|
|
|
|
ofd.Filter = "*.dfg|*.dfg|*.*|*.*||";
|
|
|
|
|
|
if (ofd.ShowDialog() != DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.txtFileGrid.Text = ofd.FileName;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void btnFileOutput_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
SaveFileDialog sfd = new SaveFileDialog();
|
|
|
|
|
|
sfd.RestoreDirectory = true;
|
|
|
|
|
|
sfd.Filter = "*.dfd|*.dfd|*.*|*.*||";
|
|
|
|
|
|
if(sfd.ShowDialog()!= DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
this.txtFileOutput.Text = sfd.FileName;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|