private void Form1_Load(object sender, EventArgs e) { try { bmp = new Bitmap("");//打开一张图将起转换为24位 m_bmp = bmp.Clone(new Rectangle(0, 0, bmp.Width, bmp.Height), PixelFormat.Format24bppRgb); pictureBox1.Image = m_bmp; pictureBox1.SizeMode = PictureBoxSizeMode.AutoSize; this.Width = pictureBox1.Width + 2 * pictureBox1.Left + (this.Size - this.ClientSize).Width; this.Height = pictureBox1.Height + 2 * pictureBox1.Top + (this.Size - this.ClientSize).Height; this.BackColor = Color.Black; //加载图像信息 初始化变量 BitmapData bmpData = m_bmp.LockBits(new Rectangle(0, 0, m_bmp.Width, m_bmp.Height), ImageLockMode.ReadOnly, m_bmp.PixelFormat); m_byArrClrInfo = new byte[bmpData.Stride * bmpData.Height]; m_byArrClrBuff = new byte[m_byArrClrInfo.Length]; m_nArrWaveCurrent = new int[m_bmp.Width, m_bmp.Height]; m_nArrWaveNext = new int[m_bmp.Width, m_bmp.Height]; m_nBmpWidth = m_bmp.Width; m_nBmpHeight = m_bmp.Height; m_nBmpWidthBySize = bmpData.Stride; Marshal.Copy(bmpData.Scan0, m_byArrClrInfo, 0, m_byArrClrInfo.Length); m_bmp.UnlockBits(bmpData); //启动水波的模拟 timerDraw.Interval = 5; //绘制水波 timerDraw.Enabled = true; //timerSetWave.Interval = 500; //随机产生波源 timerSetWave.Interval = 1500; //随机产生波源 timerSetWave.Enabled = true; } catch { Alert.AlertMsg("未找到关于图片"); } }
/// <summary> /// 下移 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void 移ToolStripMenuItem_Click(object sender, EventArgs e) { int iNowIndex = this.dgrdvZhzzt.CurrentRow.Index; if (iNowIndex == this.dgrdvZhzzt.Rows.Count - 2 || iNowIndex == this.dgrdvZhzzt.Rows.Count - 1) { Alert.AlertMsg("无法下移"); return; } object[] objArrRowData = new object[2]; int index = -1; int n = -1; objArrRowData[++n] = this.dgrdvZhzzt.Rows[iNowIndex].Cells[++index].Value; objArrRowData[++n] = this.dgrdvZhzzt.Rows[iNowIndex].Cells[++index].Value; index = -1; this.dgrdvZhzzt.Rows[iNowIndex].Cells[++index].Value = this.dgrdvZhzzt.Rows[iNowIndex + 1].Cells[index].Value; this.dgrdvZhzzt.Rows[iNowIndex].Cells[++index].Value = this.dgrdvZhzzt.Rows[iNowIndex + 1].Cells[index].Value; index = -1; n = -1; this.dgrdvZhzzt.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; this.dgrdvZhzzt.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; this.dgrdvZhzzt.CurrentCell = this.dgrdvZhzzt.Rows[iNowIndex + 1].Cells[0];//设定当前行 this.dgrdvZhzzt.Rows[iNowIndex + 1].Selected = true; }
/// <summary> /// 下移 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void 移ToolStripMenuItem_Click(object sender, EventArgs e) { if (gvCoalSeamsTexture.CurrentRow == null) { return; } var iNowIndex = gvCoalSeamsTexture.CurrentRow.Index; if (iNowIndex == gvCoalSeamsTexture.Rows.Count - 2 || iNowIndex == gvCoalSeamsTexture.Rows.Count - 1) { Alert.AlertMsg("无法下移"); return; } var objArrRowData = new object[7]; var index = -1; var n = -1; objArrRowData[++n] = gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value; objArrRowData[++n] = gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value; objArrRowData[++n] = gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value; objArrRowData[++n] = gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value; objArrRowData[++n] = gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value; objArrRowData[++n] = gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value; objArrRowData[++n] = gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value; index = -1; gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[index].Value; gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[index].Value; gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[index].Value; gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[index].Value; gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[index].Value; gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[index].Value; gvCoalSeamsTexture.Rows[iNowIndex].Cells[++index].Value = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[index].Value; index = -1; n = -1; gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[++index].Value = objArrRowData[++n]; gvCoalSeamsTexture.CurrentCell = gvCoalSeamsTexture.Rows[iNowIndex + 1].Cells[0]; //设定当前行 gvCoalSeamsTexture.Rows[iNowIndex + 1].Selected = true; }
/// <summary> /// 图显按钮事件 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnMap_Click(object sender, EventArgs e) { // 获取已选择明细行的索引 int[] iSelIdxsArr = { ((InferFaultage)gridView1.GetFocusedRow()).id }; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_INFERRED_FAULTAGE); if (pLayer == null) { MessageBox.Show(@"未发现推断断层图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; for (var i = 0; i < iSelIdxsArr.Length; i++) { var bid = ((InferFaultage)gridView1.GetFocusedRow()).bid; if (bid == "") { continue; } if (i == 0) { str = "bid='" + bid + "'"; } else { str += " or bid='" + bid + "'"; } } var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); for (var i = 0; i < list.Count; i++) { DataEditCommon.g_pMap.SelectFeature(pLayer, list[i]); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.AlertMsg("图元丢失"); } }
//帮助文件 private void mniHelpFile_ItemClick(object sender, ItemClickEventArgs e) { var strHelpFilePath = Application.StartupPath + "动态瓦斯地质图基础信息录入系统帮助文件.chm"; try { Process.Start(strHelpFilePath); } catch { Alert.AlertMsg("帮助文件未找到或已损坏"); } }
private void AddTunnelInfo() { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; //创建巷道实体 var workingFace = selectWorkingFaceControl1.SelectedWorkingFace; using (new SessionScope()) { workingFace = Workingface.Find(workingFace.id); if (workingFace.tunnels.FirstOrDefault(u => u.name == txtTunnelName.Text) != null) { Alert.AlertMsg("该工作面下已有同名巷道!"); return; } } var tunnel = new Tunnel { name = txtTunnelName.Text, support_pattern = cboSupportPattern.Text, workingface = selectWorkingFaceControl1.SelectedWorkingFace, lithology = cboLithology.SelectedValue.ToString(), type = (TunnelTypeEnum)cboTunnelType.SelectedValue, coal_or_stone = cboCoalOrStone.Text, coal_seam = ConfigHelper.current_seam.name, bid = IdGenerator.NewBindingId(), width = 5 }; //设计长度 if (txtDesignLength.Text != "") { tunnel.design_length = Convert.ToInt32(txtDesignLength.Text); } if (txtDesignArea.Text != "") { tunnel.design_area = Convert.ToInt32(txtDesignLength.Text); } //巷道信息登录 tunnel.Save(); Alert.AlertMsg("提交成功!"); }
/// <summary> /// 修改按钮响应 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void tsBtnModify_Click(object sender, EventArgs e) { if (gridView1.GetFocusedRow() == null) { Alert.AlertMsg("请选择要修改的信息"); return; } var d = new TunnelInfoEntering((Tunnel)gridView1.GetFocusedRow()); if (DialogResult.OK == d.ShowDialog()) { RefreshData(); } }
/// <summary> /// 修改(必须实装) /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnUpdate_Click(object sender, EventArgs e) { if (gridView1.GetFocusedRow() == null) { Alert.AlertMsg("请选择要修改的信息"); return; } var bigFaultageInfoEntering = new BigFaultageInfoEntering(((InferFaultage)gridView1.GetFocusedRow())); if (DialogResult.OK == bigFaultageInfoEntering.ShowDialog()) { RefreshData(); } }
/// <summary> /// 修改(必须实装) /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnUpdate_Click(object sender, EventArgs e) { if (gridView1.GetFocusedRow() == null) { Alert.AlertMsg("请选择要修改的信息"); return; } var faultageInfoEnteringForm = new FaultageInfoEntering((Faultage)gridView1.GetFocusedRow()); if (faultageInfoEnteringForm.ShowDialog() == DialogResult.OK) { RefreshData(); } }
/// <summary> /// 修改(必须实装) /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnUpdate_Click(object sender, EventArgs e) { if (gridView1.GetFocusedRow() == null) { Alert.AlertMsg("请选择要修改的信息"); return; } var m = new PitshaftInfoEntering(((Pitshaft)gridView1.GetFocusedRow()).id.ToString()); if (DialogResult.OK == m.ShowDialog()) { RefreshData(); } }
private void btnMap_Click(object sender, EventArgs e) { var faultage = (Faultage)gridView1.GetFocusedRow(); var bid = faultage.bid; var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_EXPOSE_FAULTAGE); if (pLayer == null) { MessageBox.Show(@"未发现揭露断层图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; //for (int i = 0; i < iSelIdxsArr.Length; i++) //{ if (bid != "") { if (true) { str = "bid='" + bid + "'"; } //else // str += " or bid='" + bid + "'"; } //} var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); foreach (var t in list) { DataEditCommon.g_pMap.SelectFeature(pLayer, t); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.AlertMsg("图元丢失"); } }
/// <summary> /// 修改按钮响应 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void tsBtnModify_Click(object sender, EventArgs e) { var wire = (Wire)gridView1.GetFocusedRow(); if (wire == null) { Alert.AlertMsg("请选择要修改的巷道"); return; } var wireInfoForm = new WireInfoEntering(wire); if (DialogResult.OK == wireInfoForm.ShowDialog()) { RefreshData(); } }
/// <summary> /// 工作面名称Button /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnWorkingFaceName_Click(object sender, EventArgs e) { if (this.lstMiningAreaName.SelectedItems.Count > 0) { CommonManagement commonManagement = new CommonManagement(4, _iMiningAreaId); if (DialogResult.OK == commonManagement.ShowDialog()) { // 绑定工作面信息 loadWorkingFaceName(); } } else { Alert.AlertMsg("请先选择所在采区名称!"); } }
/// <summary> /// 水平名称Button /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnHorizontalName_Click(object sender, EventArgs e) { if (this.lstMineName.SelectedItems.Count > 0) { CommonManagement commonManagement = new CommonManagement(2, _iMineId); if (DialogResult.OK == commonManagement.ShowDialog()) { // 绑定水平信息 loadHorizontalName(); } } else { Alert.AlertMsg("请先选择所在矿井名称!"); } }
/// <summary> /// 采区名称Button /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnMiningAreaName_Click(object sender, EventArgs e) { if (this.lstHorizontalName.SelectedItems.Count > 0) { CommonManagement commonManagement = new CommonManagement(3, _iHorizontalId); if (DialogResult.OK == commonManagement.ShowDialog()) { // 绑定采区信息 loadMiningAreaName(); } } else { Alert.AlertMsg("请先选择所在水平名称!"); } }
/// <summary> /// 图显按钮事件 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnMap_Click(object sender, EventArgs e) { // 获取已选择明细行的索引 var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.DEFALUT_WIRE_PT); if (pLayer == null) { MessageBox.Show(@"未发现导线点图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; var str = ""; var bid = ((Wire)gridView1.GetFocusedRow()).tunnel.bid; if (bid != "") { if (true) { str = "bid='" + bid + "'"; } //else // str += " or bid='" + bid + "'"; } var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); foreach (var t in list) { DataEditCommon.g_pMap.SelectFeature(pLayer, t); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.AlertMsg("图元丢失"); } }
private void btnMap_Click(object sender, EventArgs e) { // 获取已选择明细行的索引 var pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_TUNNEL); if (pLayer == null) { MessageBox.Show(@"未发现巷道全图层!"); return; } var pFeatureLayer = (IFeatureLayer)pLayer; //for (int i = 0; i < iSelIdxsArr.Length; i++) //{ var tunnel = (Tunnel)gridView1.GetFocusedRow(); //if (bid != "") //{ //if (true) var str = "HdId='" + tunnel.id + "'"; //else // str += " or HdId='" + bid + "'"; //} //} var list = MyMapHelp.FindFeatureListByWhereClause(pFeatureLayer, str); if (list.Count > 0) { MyMapHelp.Jump(MyMapHelp.GetGeoFromFeature(list)); DataEditCommon.g_pMap.ClearSelection(); foreach (var t in list) { DataEditCommon.g_pMap.SelectFeature(pLayer, t); } WindowState = FormWindowState.Normal; Location = DataEditCommon.g_axTocControl.Location; Width = DataEditCommon.g_axTocControl.Width; Height = DataEditCommon.g_axTocControl.Height; DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, DataEditCommon.g_pAxMapControl.Extent); } else { Alert.AlertMsg("图元丢失"); } }
/// <summary> /// 验证画面入力数据 /// </summary> /// <returns>验证结果:true 通过验证, false未通过验证</returns> private bool Check() { if (selectWorkingFaceControl1.SelectedWorkingFace == null) { Alert.AlertMsg("请选择巷道所在工作面信息"); return(false); } // 判断巷道名称是否入力 if (String.IsNullOrWhiteSpace(txtTunnelName.Text)) { txtTunnelName.BackColor = Color.Red; Alert.AlertMsg("巷道名称不能为空!"); txtTunnelName.Focus(); return(false); } txtTunnelName.BackColor = Color.White; //验证通过 return(true); }
/// <summary> /// 水平名称Button /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnHorizontalName_Click(object sender, EventArgs e) { if (lstMineName.SelectedItems.Count > 0) { var commonManagement = new CommonManagement(2, Convert.ToInt32(lstMineName.SelectedValue)); if (DialogResult.OK == commonManagement.ShowDialog()) { } if (lstMineName.SelectedItems.Count <= 0) { return; } var mine = (Mine)lstMineName.SelectedItem; DataBindUtil.LoadHorizontalName(lstHorizontalName, mine.id); } else { Alert.AlertMsg("请先选择所在矿井名称!"); } }
/// <summary> /// 工作面名称Button /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnWorkingFaceName_Click(object sender, EventArgs e) { if (lstMiningAreaName.SelectedItems.Count > 0) { var commonManagement = new CommonManagement(4, Convert.ToInt32(lstMiningAreaName.SelectedValue)); if (DialogResult.OK == commonManagement.ShowDialog()) { } if (lstMiningAreaName.SelectedItems.Count <= 0) { return; } var miningArea = (MiningArea)lstMiningAreaName.SelectedItem; DataBindUtil.LoadWorkingFaceName(lstWorkingFaceName, miningArea.id); } else { Alert.AlertMsg("请先选择所在采区名称!"); } }
/// <summary> /// 更新矿井信息 /// </summary> private void UpdateInfo <T>() where T : ActiveRecordBase { //TODO:此处需要优化强力优化!!! var dt = (DataTable)gridControl1.DataSource; var list = CollectionHelper.ConvertTo <T>(dt); try { foreach (var t in list.Where(t => t != null)) { t.Save(); } } catch (Exception) { Alert.AlertMsg("输入信息有误,请检查信息是否输入正确"); return; } Alert.AlertMsg("修改成功!"); }
/// <summary> /// 下移 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void 移ToolStripMenuItem_Click(object sender, EventArgs e) { // 当前下标 var iNowIndex = lstProspectingBoreholeSelected.SelectedIndex; if (iNowIndex == lstProspectingBoreholeSelected.Items.Count - 1) { Alert.AlertMsg("无法下移"); return; } var strTemp = lstProspectingBoreholeSelected.SelectedItem.ToString(); lstProspectingBoreholeSelected.Items[iNowIndex] = lstProspectingBoreholeSelected.Items[iNowIndex + 1]; lstProspectingBoreholeSelected.Items[iNowIndex + 1] = strTemp; lstProspectingBoreholeSelected.ClearSelected(); lstProspectingBoreholeSelected.SelectedIndex = iNowIndex + 1; // 设置该索引值对应的项为选定状态 }
private void UpdateTunnelInfo() { if (!Check()) { DialogResult = DialogResult.None; return; } DialogResult = DialogResult.OK; tunnel.workingface = selectWorkingFaceControl1.SelectedWorkingFace; //巷道名称 tunnel.name = txtTunnelName.Text; //支护方式 tunnel.support_pattern = cboSupportPattern.Text; //围岩类型 tunnel.lithology = cboLithology.SelectedValue.ToString(); tunnel.coal_seam = ConfigHelper.current_seam.name; tunnel.width = 5; //设计长度 if (txtDesignLength.Text != "") { tunnel.design_length = Convert.ToInt32(txtDesignLength.Text); } if (txtDesignArea.Text != "") { tunnel.design_area = Convert.ToInt32(txtDesignLength.Text); } //煤巷岩巷 if (cboCoalOrStone.Text != "") { tunnel.coal_or_stone = cboCoalOrStone.Text; } tunnel.Save(); Alert.AlertMsg("提交成功!"); }
private void btnReadMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; if (ofd.ShowDialog() != DialogResult.OK) { return; } _errorMsg = @"失败文件名:"; pbCount.Maximum = ofd.FileNames.Length; pbCount.Value = 0; lblTotal.Text = ofd.FileNames.Length.ToString(CultureInfo.InvariantCulture); foreach (var fileName in ofd.FileNames) { try { var strs = File.ReadAllLines(fileName, Encoding.GetEncoding("GB2312")); var type = ""; var split = strs[0].Split('|'); var bigFaultage = InferFaultage.FindAllByProperty("name", split[0]).FirstOrDefault(); var bigFaultagePoints = new List <InferFaultagePoint>(); if (bigFaultage == null) { bigFaultage = new InferFaultage { name = split[0], gap = split[1], type = split[2], angle = split[3], bid = IdGenerator.NewBindingId() }; } else { bigFaultage.name = split[0]; bigFaultage.gap = split[1]; bigFaultage.type = split[2]; bigFaultage.angle = split[3]; } for (var i = 1; i < strs.Length; i++) { if (strs[i] == "上盘") { type = "上盘"; continue; } if (strs[i] == "下盘") { type = "下盘"; continue; } if (strs[i].Equals("")) { continue; } if (type == "上盘") { bigFaultagePoints.Add(new InferFaultagePoint { bid = IdGenerator.NewBindingId(), infer_faultage = bigFaultage, coordinate_x = Convert.ToDouble(strs[i].Split(',')[0]), coordinate_y = Convert.ToDouble(strs[i].Split(',')[1]), coordinate_z = 0.0, up_or_down = "上盘" }); } if (type == "下盘") { bigFaultagePoints.Add(new InferFaultagePoint { bid = IdGenerator.NewBindingId(), infer_faultage = bigFaultage, coordinate_x = Convert.ToDouble(strs[i].Split(',')[0]), coordinate_y = Convert.ToDouble(strs[i].Split(',')[1]), coordinate_z = 0.0, up_or_down = "下盘" }); } } bigFaultage.infer_faultage_points = bigFaultagePoints; var title = bigFaultage.name + " " + bigFaultage.angle + " " + bigFaultage.gap; DrawBigFaultageInfo.DrawTddc(title, bigFaultagePoints, bigFaultage.bid); bigFaultage.Save(); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); pbCount.Value++; } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) - 1).ToString(CultureInfo.InvariantCulture); _errorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } Alert.AlertMsg("导入成功!"); }
/// <summary> /// 提交 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnSubmit_Click(object sender, EventArgs e) { var wirePoints = GetWirePointListFromDataGrid(); var wire = Wire.FindAllByProperty("tunnel.id", selectTunnelUserControl1.selected_tunnel.id).FirstOrDefault(); if (wirePoints.Count < 2) { Alert.AlertMsg("导线点数据小于2个"); return; } if (wire != null) { if (Alert.Confirm("该巷道已绑定导线点,是否覆盖?")) { //foreach (var p in wire.WirePoints) //{ // p.Delete(); //} foreach (var p in wirePoints) { p.wire = wire; p.Save(); } wire.name = txtWireName.Text; wire.level = txtWireLevel.Text; wire.measure_date = dtpMeasureDate.Value; wire.observer = cboVobserver.Text; wire.counter = cboCounter.Text; wire.count_date = dtpCountDate.Value; wire.checker = cboChecker.Text; wire.check_date = dtpCheckDate.Value; wire.Save(); DrawWirePoint(wirePoints, "CHANGE"); double hdwid; _dics = ConstructDics(selectTunnelUserControl1.selected_tunnel, out hdwid); if (selectTunnelUserControl1.selected_tunnel != null) { UpdateHdbyPnts(selectTunnelUserControl1.selected_tunnel.id, wirePoints, _dics, hdwid); } } else { return; } } else { wire = new Wire { tunnel = selectTunnelUserControl1.selected_tunnel, name = txtWireName.Text, level = txtWireLevel.Text, measure_date = dtpMeasureDate.Value, observer = cboVobserver.Text, counter = cboCounter.Text, count_date = dtpCountDate.Value, checker = cboChecker.Text, check_date = dtpCheckDate.Value }; wire.Save(); foreach (var p in wirePoints) { p.wire = wire; p.Save(); } DrawWirePoint(wirePoints, "ADD"); double hdwid; _dics = ConstructDics(selectTunnelUserControl1.selected_tunnel, out hdwid); AddHdbyPnts(wirePoints, _dics, hdwid); } DialogResult = DialogResult.OK; }
///// <params name="verticesBtmRet">Vector3_DW数据</params> /// <summary> /// 根据导线点坐标绘制巷道 /// </summary> /// <summary> /// 获得导线边线点坐标集 /// </summary> /// <returns>导线边线点坐标集List</returns> //private List<IPoint> GetTunnelPts(Vector3_DW[] verticesBtmRet) //{ // var lstBtmRet = new List<IPoint>(); // try // { // Vector3_DW vector3dw; // IPoint pt; // for (int i = 0; i < verticesBtmRet.Length; i++) // { // vector3dw = new Vector3_DW(); // vector3dw = verticesBtmRet[i]; // pt = new PointClass(); // pt.X = vector3dw.X; // pt.Y = vector3dw.Y; // pt.Z = vector3dw.Z; // if (!lstBtmRet.Contains(pt)) // { // lstBtmRet.Add(pt); // } // } // return lstBtmRet; // } // catch // { // return null; // } //} #endregion 绘制导线点和巷道图形 private void btnMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Multiselect = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*" }; _errorMsg = @"失败文件名:"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var fileCount = ofd.FileNames.Length; pbCount.Maximum = fileCount * 2; pbCount.Value = 0; foreach (var fileName in ofd.FileNames) { lblTotal.Text = fileCount.ToString(CultureInfo.InvariantCulture); string safeFileName = null; try { using (new SessionScope()) { safeFileName = fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1); var strs = safeFileName.Split('-'); var miningAreaName = strs[0]; var workingFaceName = strs[1]; var tunnelName = strs[2].Split('.')[0]; var miningArea = MiningArea.FindAllByProperty("name", miningAreaName).FirstOrDefault(); if (miningArea == null) { var newMiningArea = new MiningArea { name = miningAreaName, horizontal = Horizontal.FindFirst() }; newMiningArea.Save(); miningArea = newMiningArea; } var workingFace = Workingface.findone_by_workingface_name_and_mining_area_id(workingFaceName, miningArea.id) ?? AddWorkingFace(miningArea, workingFaceName); if (workingFace == null) { return; } Tunnel tunnel; if (workingFace.tunnels != null && workingFace.tunnels.FirstOrDefault(u => u.name == tunnelName) != null) { tunnel = workingFace.tunnels.FirstOrDefault(u => u.name == tunnelName); } else { tunnel = AddTunnel(workingFace, tunnelName); } var sr = new StreamReader(fileName, Encoding.GetEncoding("GB2312")); string fileContent; var wire = Wire.FindAllByProperty("tunnel.id", tunnel.id).FirstOrDefault(); if (wire != null) { wire.name = tunnelName.Split('.').Length > 0 ? tunnelName.Split('.')[0] + "导线点" : tunnelName + "导线点"; } else { wire = new Wire { tunnel = tunnel, check_date = DateTime.Now, measure_date = DateTime.Now, count_date = DateTime.Now, name = tunnelName.Split('.').Length > 0 ? tunnelName.Split('.')[0] + "导线点" : tunnelName + "导线点" }; } wire.Save(); var wirePoints = new List <WirePoint>(); while ((fileContent = sr.ReadLine()) != null) { if (String.IsNullOrEmpty(fileContent)) { continue; } var temp1 = fileContent.Split('|'); var pointName = temp1[0]; var pointX = temp1[1]; var pointY = temp1[2]; wirePoints.Add(new WirePoint { bid = IdGenerator.NewBindingId(), name = pointName, wire = wire, coordinate_x = Convert.ToDouble(pointX), coordinate_y = Convert.ToDouble(pointY), coordinate_z = 0, left_distance = 2.5, right_distance = 2.5, top_distance = 0, bottom_distance = 0 }); } if (wirePoints.Count < 2) { throw new Exception(); } pbCount.Value++; DrawWirePoint(wirePoints, "CHANGE"); double hdwid; _dics = ConstructDics(tunnel, out hdwid); UpdateHdbyPnts(tunnel.id, wirePoints, _dics, hdwid); pbCount.Value++; lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); } } catch (Exception ex) { pbCount.Value++; lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); _errorMsg += safeFileName + "\n"; btnDetails.Enabled = true; } } Alert.AlertMsg("导入完成"); }
private void btnDetails_Click(object sender, EventArgs e) { Alert.AlertMsg(_errorMsg); }
private void btnTXT_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*" }; if (ofd.ShowDialog() != DialogResult.OK) { return; } var fileName = ofd.SafeFileName; if (fileName != null) { var strs = fileName.Split('-'); var miningAreaName = strs[0]; var workingFaceName = strs[1]; var tunnelName = strs[2].Split('.')[0]; using (new SessionScope()) { var miningArea = MiningArea.FindAllByProperty("name", miningAreaName).FirstOrDefault(); if (miningArea == null) { var newMiningArea = new MiningArea { name = miningAreaName, horizontal = Horizontal.FindFirst() }; newMiningArea.Save(); miningArea = newMiningArea; } var workingFace = Workingface.findone_by_workingface_name_and_mining_area_id(workingFaceName, miningArea.id); if (workingFace == null) { if (Alert.Confirm("该工作面不存在,是否创建该工作面?")) { workingFace = AddWorkingFace(miningArea, workingFaceName); } } if (workingFace == null) { return; } if (workingFace.tunnels != null && workingFace.tunnels.FirstOrDefault(u => u.name == tunnelName) != null) { var tunnel = workingFace.tunnels.FirstOrDefault(u => u.name == tunnelName); selectTunnelUserControl1.LoadData(tunnel); } else { if (Alert.Confirm("该巷道不存在,是否创建该巷道?")) { if (Tunnel.exists_by_tunnel_name_and_working_face_id(tunnelName, workingFace.id)) { Alert.AlertMsg("该巷道已经存在"); return; } var tunnel = AddTunnel(workingFace, tunnelName); selectTunnelUserControl1.LoadData(tunnel); } } } txtWireName.Text = tunnelName.Split('.').Length > 0 ? tunnelName.Split('.')[0] + "导线点" : tunnelName + "导线点"; } var sr = new StreamReader(ofd.FileName, Encoding.GetEncoding("GB2312")); string duqu; while ((duqu = sr.ReadLine()) != null) { var temp1 = duqu.Split('|'); if (temp1.Length == 1) { continue; } var daoxianname = temp1[0]; var daoxianx = temp1[1]; var daoxiany = temp1[2]; dgrdvWire.Rows.Add(1); dgrdvWire[0, dgrdvWire.Rows.Count - 2].Value = daoxianname; dgrdvWire[1, dgrdvWire.Rows.Count - 2].Value = daoxianx; dgrdvWire[2, dgrdvWire.Rows.Count - 2].Value = daoxiany; dgrdvWire[3, dgrdvWire.Rows.Count - 2].Value = "0"; dgrdvWire[4, dgrdvWire.Rows.Count - 2].Value = "2.5"; dgrdvWire[5, dgrdvWire.Rows.Count - 2].Value = "2.5"; } }
private void btnMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; ErrorMsg = @"失败文件名:"; if (ofd.ShowDialog() != DialogResult.OK) { return; } var fileCount = ofd.FileNames.Length; lblTotal.Text = fileCount.ToString(); pbCount.Maximum = fileCount; pbCount.Value = 0; foreach (var fileName in ofd.FileNames) { try { var sr = new StreamReader(fileName, Encoding.GetEncoding("GB2312")); string duqu; while ((duqu = sr.ReadLine()) != null) { var str = duqu.Split('|'); var faultage = Faultage.FindAllByProperty("name", str[0]).FirstOrDefault(); if (faultage == null) { faultage = new Faultage { name = str[0], coordinate_x = Convert.ToDouble(str[1].Split(',')[0]), coordinate_y = Convert.ToDouble(str[1].Split(',')[1]), coordinate_z = 0.0, separation = str[2], gap = str[2], trend = string.IsNullOrWhiteSpace(str[4]) ? 0.0 : Convert.ToDouble(str[4]), angle = string.IsNullOrWhiteSpace(str[5]) ? 0.0 : Convert.ToDouble(str[5]), length = string.IsNullOrWhiteSpace(str[6]) ? 0.0 : Convert.ToDouble(str[6]), type = str[3], bid = IdGenerator.NewBindingId() }; DrawJldc(faultage); } else { faultage.name = str[0]; faultage.coordinate_x = Convert.ToDouble(str[1].Split(',')[0]); faultage.coordinate_y = Convert.ToDouble(str[1].Split(',')[1]); faultage.coordinate_z = 0.0; faultage.separation = str[2]; faultage.gap = str[2]; faultage.trend = string.IsNullOrWhiteSpace(str[4]) ? 0.0 : Convert.ToDouble(str[4]); faultage.angle = string.IsNullOrWhiteSpace(str[5]) ? 0.0 : Convert.ToDouble(str[5]); faultage.length = string.IsNullOrWhiteSpace(str[6]) ? 0.0 : Convert.ToDouble(str[6]); faultage.type = str[3]; ModifyJldc(faultage); } faultage.Save(); pbCount.Value++; lblSuccessed.Text = lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); } } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); ErrorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } Alert.AlertMsg("导入完成"); }
private void btnReadMultTxt_Click(object sender, EventArgs e) { var ofd = new OpenFileDialog { RestoreDirectory = true, Filter = @"文本文件(*.txt)|*.txt|所有文件(*.*)|*.*", Multiselect = true }; if (ofd.ShowDialog() != DialogResult.OK) { return; } _errorMsg = @"失败文件名:"; pbCount.Maximum = ofd.FileNames.Length; pbCount.Value = 0; lblTotal.Text = ofd.FileNames.Length.ToString(CultureInfo.InvariantCulture); foreach (var fileName in ofd.FileNames) { var encoder = TxtFileEncoding.GetEncoding(fileName, Encoding.GetEncoding("GB2312")); var sr = new StreamReader(fileName, encoder); string duqu; while ((duqu = sr.ReadLine()) != null) { try { var str = duqu.Split('|'); var borehole = Borehole.FindAllByProperty("name", str[0]).FirstOrDefault() ?? new Borehole { bid = IdGenerator.NewBindingId() }; borehole.name = str[0]; borehole.ground_elevation = Convert.ToDouble(str[3]); borehole.coordinate_x = Convert.ToDouble(str[1].Split(',')[0]); borehole.coordinate_y = Convert.ToDouble(str[1].Split(',')[1]); borehole.coordinate_z = 0; borehole.coal_seam_texture = String.Empty; // 创建钻孔岩性实体 var boreholeLithology = new SubBorehole { borehole = borehole, lithology = "煤层", floor_elevation = Convert.ToDouble(str[4]), coal_seam = ConfigHelper.current_seam.name, thickness = Convert.ToDouble(str[2]), coordinate_x = Convert.ToDouble(str[1].Split(',')[0]), coordinate_y = Convert.ToDouble(str[1].Split(',')[1]), coordinate_z = 0 }; borehole.sub_boreholes = new[] { boreholeLithology }; DrawZuanKong(borehole, boreholeLithology); borehole.Save(); } catch (Exception) { lblError.Text = (Convert.ToInt32(lblError.Text) + 1).ToString(CultureInfo.InvariantCulture); lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) - 1).ToString(CultureInfo.InvariantCulture); _errorMsg += fileName.Substring(fileName.LastIndexOf(@"\", StringComparison.Ordinal) + 1) + "\n"; btnDetails.Enabled = true; } } lblSuccessed.Text = (Convert.ToInt32(lblSuccessed.Text) + 1).ToString(CultureInfo.InvariantCulture); pbCount.Value++; } Alert.AlertMsg("导入成功!"); }