|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
using DevExpress.XtraBars;
|
|
|
|
|
|
using DevExpress.XtraEditors;
|
|
|
|
|
|
using DevExpress.XtraEditors.Controls;
|
|
|
|
|
|
using DevExpress.XtraEditors.Repository;
|
|
|
|
|
|
using DevExpress.XtraVerticalGrid.Native;
|
|
|
|
|
|
using DevExpress.XtraVerticalGrid.Rows;
|
|
|
|
|
|
using GeoSigma;
|
|
|
|
|
|
using GeoSigmaDrawLib;
|
|
|
|
|
|
using MeshProcess;
|
|
|
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
|
|
|
|
|
|
|
|
|
|
|
namespace KepGridEditor
|
|
|
|
|
|
{
|
|
|
|
|
|
public delegate void EditorMouseMoveEventHandler(double mouseX, double mouseY);
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// The form main.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public partial class FormMain : DevExpress.XtraEditors.XtraForm
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 鼠标移动事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public EditorMouseMoveEventHandler EditorMouseMoveEvent;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 模块进程名称
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public static string ProcessName{get;set;}="智能等网交互系统";
|
|
|
|
|
|
public EventHandler PushDataClick;
|
|
|
|
|
|
private GeoSigmaXY geo;
|
|
|
|
|
|
private IntPtr pxy = IntPtr.Zero;
|
|
|
|
|
|
private FormWellAdjustSetting formWellAdjustSetting;
|
|
|
|
|
|
private FormFilterMeshSetting formFilterMeshSetting;
|
|
|
|
|
|
private CalculateZDialog calculateZDialog;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="FormMain"/> class.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public FormMain()
|
|
|
|
|
|
{
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
this.KeyPreview = true;
|
|
|
|
|
|
this.Text = ProcessName;
|
|
|
|
|
|
this.trvLayer.ExpandAll();
|
|
|
|
|
|
|
|
|
|
|
|
this.barEditItem1.EditValue = false;
|
|
|
|
|
|
this.ppgParameter.SelectedObject = meshEditor.EditorParameter;
|
|
|
|
|
|
|
|
|
|
|
|
//RepositoryItemColorEdit riColorEditor = new RepositoryItemColorEdit();
|
|
|
|
|
|
//RepositoryItemPopupContainerEdit riColorEditor = new RepositoryItemPopupContainerEdit();
|
|
|
|
|
|
//PopupContainerControl popupContainer = new PopupContainerControl();
|
|
|
|
|
|
//UCColorDialog uCColor = new UCColorDialog();
|
|
|
|
|
|
//popupContainer.Controls.Add(uCColor);
|
|
|
|
|
|
////popupContainer.Size = new System.Drawing.Size(424, 474);
|
|
|
|
|
|
//popupContainer.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
|
|
|
|
|
|
//popupContainer.AutoSizeMode = AutoSizeMode.GrowAndShrink;
|
|
|
|
|
|
//popupContainer.AutoSize = true;
|
|
|
|
|
|
//riColorEditor.PopupControl = popupContainer;
|
|
|
|
|
|
//this.ppgParameter.DefaultEditors.Add(typeof(Color), riColorEditor);
|
|
|
|
|
|
// Create a repository item which represents an in-place CheckEdit control.
|
|
|
|
|
|
RepositoryItemCheckEdit riCheckEdit = new RepositoryItemCheckEdit();
|
|
|
|
|
|
// Represent check boxes as radio buttons.
|
|
|
|
|
|
riCheckEdit.CheckStyle = DevExpress.XtraEditors.Controls.CheckStyles.Standard;
|
|
|
|
|
|
// Associate the Boolean data type with the created repository item.
|
|
|
|
|
|
this.ppgParameter.DefaultEditors.Add(typeof(Boolean), riCheckEdit);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Initializes a new instance of the <see cref="FormMain"/> class.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="pXy">The p xy.</param>
|
|
|
|
|
|
public FormMain(GeoSigmaXY geo, string contourLayer, string faultLayer, string pointLayer, string otherLineLayer)
|
|
|
|
|
|
:this()
|
|
|
|
|
|
{
|
|
|
|
|
|
this.geo = geo;
|
|
|
|
|
|
this.pxy = this.geo.GetDrawerXy();
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(contourLayer))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.ContourLayerName = string.Copy(contourLayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.ContourLayerName = string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(faultLayer))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.FaultLayerName = string.Copy(faultLayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.FaultLayerName = string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!string.IsNullOrEmpty(pointLayer))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.PointLayerName = string.Copy(pointLayer);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.PointLayerName = string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
if(!string.IsNullOrEmpty(otherLineLayer))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.OtherLineLayerName = otherLineLayer;
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.meshEditor.OtherLineLayerName = string.Empty;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开文件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
private void bbtnOpenFile_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.OpenFile();
|
|
|
|
|
|
this.ppgParameter.SelectedObject = null;
|
|
|
|
|
|
this.ppgParameter.SelectedObject = meshEditor.EditorParameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Form1_S the load.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(pxy != IntPtr.Zero)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.InitEditor();
|
|
|
|
|
|
meshEditor.OpenDraw(pxy);
|
|
|
|
|
|
// 打开时启用 “断层填充” 和 “断层边缘优化”,使得打开等网系统即呈现最佳显示效果
|
|
|
|
|
|
meshEditor.EnableFillFault(true);
|
|
|
|
|
|
meshEditor.OffsetFault();
|
|
|
|
|
|
|
|
|
|
|
|
this.ppgParameter.SelectedObject = null;
|
|
|
|
|
|
this.ppgParameter.SelectedObject = meshEditor.EditorParameter;
|
|
|
|
|
|
}
|
|
|
|
|
|
meshEditor.SetMouseMoveEvent(EditorMouseMoveEvent);
|
|
|
|
|
|
Application.Idle += Application_Idle;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 只允许输入正整数或小数(可根据需要调整正则)
|
|
|
|
|
|
this.repositoryItemTextEdit2.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;
|
|
|
|
|
|
this.repositoryItemTextEdit2.Mask.EditMask = @"\d+([.]\d+)?";
|
|
|
|
|
|
this.repositoryItemTextEdit2.Mask.ShowPlaceHolders = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Application_S the idle.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void Application_Idle(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (meshEditor != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.bbtnUndo.Enabled = meshEditor.CanUndo();
|
|
|
|
|
|
this.bbtnRedo.Enabled = meshEditor.CanRedo();
|
|
|
|
|
|
this.btxtOptimize.Enabled = bbtnOptimizeMesh.Down;
|
|
|
|
|
|
|
|
|
|
|
|
this.bbtnDragUpPolygon.Enabled = bbtnPolygonOperator.Down;
|
|
|
|
|
|
this.bbtnDragDownPolygon.Enabled = bbtnPolygonOperator.Down;
|
|
|
|
|
|
this.bbtnSmoothPolygon.Enabled = bbtnPolygonOperator.Down;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// btns the view all_ item click.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void btnViewAll_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.Editor?.ZoomView();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// bbtns the undo_ item click.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnUndo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.Undo();
|
|
|
|
|
|
ppgParameter.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// bbtns the redo_ item click.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnRedo_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.Redo();
|
|
|
|
|
|
ppgParameter.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// bbtns the drag up_ item click.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnDragUp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.StartDragUp();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// bbtns the drag down_ item click.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnDragDown_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.StartDragDown();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// bbtns the draw away_ item click.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnDrawAway_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.StartDragAway();
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 平滑按钮点击事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">事件按钮</param>
|
|
|
|
|
|
/// <param name="e">事件参数</param>
|
|
|
|
|
|
private void bbtnSmooth_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.StartSmooth();
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 数据回传事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">事件按钮</param>
|
|
|
|
|
|
/// <param name="e">事件参数</param>
|
|
|
|
|
|
private void bbtnSendBackData_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
WriteBack();
|
|
|
|
|
|
PushDataClick?.Invoke(sender, e);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void WriteBack()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<long> destroyPositions = new List<long>();
|
|
|
|
|
|
List<long> insertedPositions = new List<long>();
|
|
|
|
|
|
|
|
|
|
|
|
meshEditor.PushbackData(meshEditor.ContourLayerName, destroyPositions, insertedPositions, meshEditor.LineLayerName, meshEditor.LineLayerNoName);
|
|
|
|
|
|
|
|
|
|
|
|
geo.DestroyAndInsertElement(destroyPositions.ToArray(), insertedPositions.ToArray());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 关闭按钮单击事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
private void bbtnClose_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 参数修改事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="s">属性控件</param>
|
|
|
|
|
|
/// <param name="e">事件参数</param>
|
|
|
|
|
|
private void ppgParameter_CellValueChanged(object sender, DevExpress.XtraVerticalGrid.Events.CellValueChangedEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
GridEditorParameter editorParameter = this.ppgParameter.SelectedObject as GridEditorParameter;
|
|
|
|
|
|
if (editorParameter == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Row.Properties.Caption == "井点小数位")
|
|
|
|
|
|
{
|
|
|
|
|
|
int num = editorParameter.DecimalNumber;
|
|
|
|
|
|
if(num > 0 && num < 10)
|
|
|
|
|
|
{
|
|
|
|
|
|
int oldNum = meshEditor.GetDecimalNumber();
|
|
|
|
|
|
if (num != oldNum)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.SetDecimalNumber(num);
|
|
|
|
|
|
ppgParameter.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Row.Properties.Caption == "井点颜色")
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.SetWellColor(editorParameter.WellPointColor);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (e.Row.Properties.Caption == "文字尺寸")
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.SetWellTxtSize((float)editorParameter.FontSize);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(e.Row.Properties.Caption.Equals( "查看z值", StringComparison.CurrentCultureIgnoreCase))
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.EnablePickMeshZ(editorParameter.EnablePickMeshZ);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (e.Row.Properties.Caption == "断层充填")
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.EnableFillFault(editorParameter.EnableFillFault);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (e.Row.Properties.Caption != "井约束半径"
|
|
|
|
|
|
&& e.Row.Properties.Caption != "影响半径"
|
|
|
|
|
|
&& e.Row.Properties.Caption != "力度"
|
|
|
|
|
|
&& e.Row.Properties.Caption != "运算方式")
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.SetProperty(
|
|
|
|
|
|
editorParameter.ContourSpace, editorParameter.MarkStep
|
|
|
|
|
|
, editorParameter.ContourMinValue, editorParameter.ContourMaxValue
|
|
|
|
|
|
, editorParameter.ZMin, editorParameter.ZMax);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 图层选中变化事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">图层树</param>
|
|
|
|
|
|
/// <param name="e">事件参数</param>
|
|
|
|
|
|
private void trvLayer_AfterCheckNode(object sender, DevExpress.XtraTreeList.NodeEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
string strText = e.Node.GetDisplayText(0);
|
|
|
|
|
|
bool bShow = e.Node.Checked;
|
|
|
|
|
|
switch (strText)
|
|
|
|
|
|
{
|
|
|
|
|
|
case "网格":
|
|
|
|
|
|
meshEditor.ShowMesh(bShow);
|
|
|
|
|
|
//Trace.WriteLine(bShow.ToString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "等值线":
|
|
|
|
|
|
meshEditor.ShowIsopleth(bShow);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "断层":
|
|
|
|
|
|
meshEditor.ShowFault(bShow);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "控制点":
|
|
|
|
|
|
meshEditor.ShowControlPoint(bShow);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "边界":
|
|
|
|
|
|
meshEditor.ShowBound(bShow);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "附加线":
|
|
|
|
|
|
meshEditor.ShowOtherLines(bShow);
|
|
|
|
|
|
break;
|
|
|
|
|
|
case "网格点":
|
|
|
|
|
|
meshEditor.ShowMeshVertex(bShow);
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// ppgs the parameter_ custom property descriptors.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void ppgParameter_CustomPropertyDescriptors(object sender, DevExpress.XtraVerticalGrid.Events.CustomPropertyDescriptorsEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.Context.PropertyDescriptor == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Properties = e.Properties.Sort(new string[] {
|
|
|
|
|
|
"OperatorRadius"
|
|
|
|
|
|
,"Strength"
|
|
|
|
|
|
,"ComputeType"
|
|
|
|
|
|
,"ContourSpace"
|
|
|
|
|
|
, "MarkStep"
|
|
|
|
|
|
, "ContourMinValue"
|
|
|
|
|
|
, "ContourMaxValue"
|
|
|
|
|
|
,"ZMin"
|
|
|
|
|
|
,"ZMax"});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 窗体关闭事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">窗体</param>
|
|
|
|
|
|
/// <param name="e">事件参数</param>
|
|
|
|
|
|
private void FormMain_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(meshEditor.IsSaved == false
|
|
|
|
|
|
&& meshEditor?.CanUndo() == true)
|
|
|
|
|
|
{
|
|
|
|
|
|
DialogResult result = MessageBox.Show(this, "文件已经修改,是否保存?"
|
|
|
|
|
|
, "退出", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
|
|
|
|
|
if(result == DialogResult.Yes)
|
|
|
|
|
|
{
|
|
|
|
|
|
WriteBack();
|
|
|
|
|
|
PushDataClick?.Invoke(sender, e);
|
|
|
|
|
|
}
|
|
|
|
|
|
else if(result == DialogResult.Cancel)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.Cancel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void meshEditor_Load(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void bbtnOffsetFault_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor?.OffsetFault();
|
|
|
|
|
|
}
|
|
|
|
|
|
#region 二期功能
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 井点匹配点击事件.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnPointAdapt_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (formWellAdjustSetting == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
formWellAdjustSetting = new FormWellAdjustSetting(100, 10, 0);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(formWellAdjustSetting.ShowDialog() == DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
string selected = formWellAdjustSetting.SelectedMode;
|
|
|
|
|
|
string method = "井点校正";
|
|
|
|
|
|
int methodType = 1;
|
|
|
|
|
|
switch (selected)
|
|
|
|
|
|
{
|
|
|
|
|
|
case "默认":
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.WellAdaptiveAdjust(
|
|
|
|
|
|
(float)formWellAdjustSetting.WellRadius
|
|
|
|
|
|
, (float)formWellAdjustSetting.ValueRange
|
|
|
|
|
|
, (float)formWellAdjustSetting.DecreasingFactor);
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
//case "克里金": method = "克里金井点校正"; methodType = 1; break;
|
|
|
|
|
|
case "RFB": method = "RFB井点校正"; methodType = 2; break;
|
|
|
|
|
|
case "IDW": method = "IDW井点校正"; methodType = 3; break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
double valueRange = formWellAdjustSetting.ValueRange;
|
|
|
|
|
|
double lastValidFactor = formWellAdjustSetting.DilutionFactor;
|
|
|
|
|
|
bool state = meshEditor.RectificationMeshWellCompute(valueRange, methodType, lastValidFactor);
|
|
|
|
|
|
if (!state)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using (var dlg = new FrmRectificationProgress(() => meshEditor.GetWellRectificationProgress(),
|
|
|
|
|
|
() => meshEditor.MeshWellThreadStop(),
|
|
|
|
|
|
method))
|
|
|
|
|
|
{
|
|
|
|
|
|
var result = dlg.ShowDialog(this);
|
|
|
|
|
|
if (result != DialogResult.Cancel)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.OSGUpdateObjectView();
|
|
|
|
|
|
ppgParameter.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 过滤等值线点击事件.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnFilterMesh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (formFilterMeshSetting == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
formFilterMeshSetting = new FormFilterMeshSetting(30);
|
|
|
|
|
|
}
|
|
|
|
|
|
if(formFilterMeshSetting.ShowDialog() == DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor.FilterMesh((float)formFilterMeshSetting.FilterValue);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private float optimizeMeshRadius = 50;
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// bbtns the optimize mesh_ item click.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnOptimizeMesh_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
optimizeMeshRadius = Convert.ToSingle(btxtOptimize.EditValue);
|
|
|
|
|
|
meshEditor.StartOptimizeMesh(optimizeMeshRadius);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// btxts the optimize_ edit value changed.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void btxtOptimize_EditValueChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
optimizeMeshRadius = Convert.ToSingle(btxtOptimize.EditValue);
|
|
|
|
|
|
meshEditor.OptimizeMeshRadius = optimizeMeshRadius;
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 区域控制.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender">The sender.</param>
|
|
|
|
|
|
/// <param name="e">The e.</param>
|
|
|
|
|
|
private void bbtnPolygonOperator_DownChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
meshEditor?.EnableDrawPolygon(bbtnPolygonOperator.Down);
|
|
|
|
|
|
}
|
|
|
|
|
|
private void bbtnDragUpPolygon_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isChecked = Convert.ToBoolean(barEditItem1.EditValue);
|
|
|
|
|
|
meshEditor?.StretchUpPolygon(isChecked);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void bbtnDragDownPolygon_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isChecked = Convert.ToBoolean(barEditItem1.EditValue);
|
|
|
|
|
|
meshEditor?.PushDownPolygon(isChecked);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void bbtnSmoothPolygon_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isChecked = Convert.ToBoolean(barEditItem1.EditValue);
|
|
|
|
|
|
meshEditor?.SmoothPolygon(isChecked);
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
private int influenceRadius = 30; //初始影响半径
|
|
|
|
|
|
private int strengthPercentage = 10; //初始力度百分比
|
|
|
|
|
|
private bool isAltPressed = false; //是否按下 ALT 键
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置控件节点value
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="targetName">控件名</param>
|
|
|
|
|
|
/// <param name="value">值</param>
|
|
|
|
|
|
private void SetEditorValue(string targetName, int value)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (BaseRow row in ppgParameter.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (row is CategoryRow categoryRow)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (BaseRow childRow in categoryRow.ChildRows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(childRow.Properties.Caption == targetName)
|
|
|
|
|
|
{
|
|
|
|
|
|
childRow.Properties.Value = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 设置控件节点value
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="targetName">控件名</param>
|
|
|
|
|
|
/// <param name="value">值</param>
|
|
|
|
|
|
private void SetEditorValue(string targetName, double value)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (BaseRow row in ppgParameter.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (row is CategoryRow categoryRow)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (BaseRow childRow in categoryRow.ChildRows)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (childRow.Properties.Caption == targetName)
|
|
|
|
|
|
{
|
|
|
|
|
|
childRow.Properties.Value = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnRadiusUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
influenceRadius += 5;
|
|
|
|
|
|
if (influenceRadius > 300)
|
|
|
|
|
|
{
|
|
|
|
|
|
influenceRadius = 300;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SetEditorValue("影响半径", influenceRadius);
|
|
|
|
|
|
meshEditor?.SetDrawCircle();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnRadiusDown()
|
|
|
|
|
|
{
|
|
|
|
|
|
influenceRadius -= 5;
|
|
|
|
|
|
if (influenceRadius < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
influenceRadius = 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
SetEditorValue("影响半径", influenceRadius);
|
|
|
|
|
|
meshEditor?.SetDrawCircle();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnPressureUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
strengthPercentage += 5;
|
|
|
|
|
|
if (strengthPercentage > 100)
|
|
|
|
|
|
{
|
|
|
|
|
|
strengthPercentage = 100;
|
|
|
|
|
|
}
|
|
|
|
|
|
SetEditorValue("力度", strengthPercentage);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void OnPressureDown()
|
|
|
|
|
|
{
|
|
|
|
|
|
strengthPercentage -= 5;
|
|
|
|
|
|
if (strengthPercentage < 1)
|
|
|
|
|
|
{
|
|
|
|
|
|
strengthPercentage = 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
SetEditorValue("力度", strengthPercentage);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void UpdateStatus(bool state)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (state)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.bbtnDragDown.Down = true;
|
|
|
|
|
|
isAltPressed = true;
|
|
|
|
|
|
meshEditor?.StartDragDown();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.bbtnDragUp.Down = true;
|
|
|
|
|
|
isAltPressed = false;
|
|
|
|
|
|
meshEditor?.StartDragUp();
|
|
|
|
|
|
}
|
|
|
|
|
|
meshEditor?.SetDrawCircle();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnKeyDown(KeyEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnKeyDown(e);
|
|
|
|
|
|
|
|
|
|
|
|
// 按下“]”键放大影响半径
|
|
|
|
|
|
if (e.KeyCode == Keys.OemCloseBrackets)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnRadiusUp();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 按下“[”键缩小影响半径
|
|
|
|
|
|
if (e.KeyCode == Keys.OemOpenBrackets)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnRadiusDown();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e.Shift)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 按下“>”增加力度百分比
|
|
|
|
|
|
if (e.KeyCode == Keys.OemPeriod)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnPressureUp();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 按下“<”减少力度百分比
|
|
|
|
|
|
if (e.KeyCode == Keys.Oemcomma)
|
|
|
|
|
|
{
|
|
|
|
|
|
OnPressureDown();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (e.KeyCode == Keys.Menu)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(!isAltPressed)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateStatus(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnKeyUp(KeyEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
base.OnKeyUp(e);
|
|
|
|
|
|
|
|
|
|
|
|
if (e.KeyCode == Keys.Menu)
|
|
|
|
|
|
{
|
|
|
|
|
|
if(isAltPressed)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateStatus(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void bbtnCalculateZ_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (calculateZDialog == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
calculateZDialog = new CalculateZDialog()
|
|
|
|
|
|
{
|
|
|
|
|
|
StartPosition = FormStartPosition.CenterScreen,
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
if (calculateZDialog.ShowDialog(this) == DialogResult.OK)
|
|
|
|
|
|
{
|
|
|
|
|
|
//运算 传入z值表达式
|
|
|
|
|
|
string zExpression = calculateZDialog.GetZExpression().ToLower();
|
|
|
|
|
|
|
|
|
|
|
|
bool state = meshEditor.CompileExpressionZ(zExpression);
|
|
|
|
|
|
if (!state)
|
|
|
|
|
|
{
|
|
|
|
|
|
MessageBox.Show(this, "公式输入不正确,请检查语法、变量名和括号匹配。", "公式错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
state = meshEditor.CalculateZByExpression(zExpression);
|
|
|
|
|
|
|
|
|
|
|
|
if(state)
|
|
|
|
|
|
{
|
|
|
|
|
|
ppgParameter.Refresh();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void barEditItem1_ItemClick(object sender, ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void bbtnFaultControl_CheckedChanged(object sender, ItemClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
var item = sender as BarCheckItem;
|
|
|
|
|
|
if (item.Checked)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 处理按下(选中)状态
|
|
|
|
|
|
meshEditor?.SetFaultControlState(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// 处理释放(未选中)状态
|
|
|
|
|
|
meshEditor?.SetFaultControlState(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//private void RepositoryItemComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
//{
|
|
|
|
|
|
// // 获取当前选中的项
|
|
|
|
|
|
// var selectedItem = this.numbarEditItem.EditValue?.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
// int num = int.Parse(selectedItem);
|
|
|
|
|
|
// meshEditor.Editor?.SetDecimalNumber(num);
|
|
|
|
|
|
|
|
|
|
|
|
// ppgParameter.Refresh();
|
|
|
|
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|