/// <summary> /// 根据井筒绑定ID删除井筒图元 /// </summary> /// <params name="sPitshaftBIDArray">要删除井筒的绑定ID</params> private void DeleteJintTongByBID(string[] sPitshaftBIDArray) { if (sPitshaftBIDArray.Length == 0) { return; } //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); var sLayerAliasName = LayerNames.DEFALUT_JINGTONG; //“井筒”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show("未找到" + sLayerAliasName + "图层,无法删除井筒图元。"); return; } //2.删除井筒图元 var sPitshaftBID = ""; for (var i = 0; i < sPitshaftBIDArray.Length; i++) { sPitshaftBID = sPitshaftBIDArray[i]; DataEditCommon.DeleteFeatureByBId(featureLayer, sPitshaftBID); } }
private void btndel_Click(object sender, EventArgs e) { if (this.Tag == null || this.Text != "修改小柱状") { MessageBox.Show("请先使用修改按钮选中要删除的小柱状"); return; } string bid = this.Tag.ToString(); var AnnoLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_AnnotationXZZ) as IFeatureLayer; //注记图层 var lineLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolylineXZZ) as IFeatureLayer; //线源图层 var topLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolygonXZZ) as IFeatureLayer; //外部图形图层 if (AnnoLayer == null || lineLayer == null || topLayer == null) { return; } DataEditCommon.DeleteFeatureByBId(AnnoLayer, bid); DataEditCommon.DeleteFeatureByBId(lineLayer, bid); DataEditCommon.DeleteFeatureByBId(topLayer, bid); FrmNewXZZ frm = new FrmNewXZZ(); frm.Show(this.Owner); frm.Location = this.Location; this.Close(); DataEditCommon.g_pAxMapControl.CurrentTool = null; }
/// <summary> /// 根据坐标绘制导线点 /// </summary> /// <params name="lstWpie">导线坐标(List)</params> /// <params name="addOrChange"></params> private void DrawWirePoint(List <WirePoint> lstWpie, string addOrChange) { IPoint pt = new Point(); //找到导线点图层 var map = DataEditCommon.g_pMap; const string layerName = LayerNames.DEFALUT_WIRE_PT; //“导线点”图层 var featureLayer = LayerHelper.GetLayerByName(map, layerName); if (featureLayer == null) { MessageBox.Show(@"没有找到" + layerName + @"图层,将不能绘制导线点。", @"提示", MessageBoxButtons.OK); return; } var drawWirePt = new DrawTunnels(); //修改导线点操作,要先删除原有导线点要素 if (addOrChange == "CHANGE") { foreach (var t in lstWpie) { var wirePtInfo = t; DataEditCommon.DeleteFeatureByBId(featureLayer, wirePtInfo.bid); } } foreach (var t in lstWpie) { pt.X = t.coordinate_x; pt.Y = t.coordinate_y; pt.Z = t.coordinate_z; drawWirePt.CreatePoint(featureLayer, pt, t.bid, t); } }
/// <summary> /// 删除陷落柱图元 /// </summary> /// <params name="sCollapseId"></params> private void DeleteyXLZ(string sCollapseId) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.LAYER_ALIAS_MR_XianLuoZhu1; //“陷落柱_1”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除陷落柱图元。"); return; } //2.删除原来图元,重新绘制新图元 DataEditCommon.DeleteFeatureByBId(featureLayer, sCollapseId); }
/// <summary> /// 修改揭露断层图元 /// </summary> /// <params name="faultageEntity"></params> private void ModifyJldc(Faultage faultageEntity) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_EXPOSE_FAULTAGE; //“揭露断层”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法修改揭露断层图元。"); return; } //2.删除原来图元,重新绘制新图元 DataEditCommon.DeleteFeatureByBId(featureLayer, faultageEntity.bid); DrawJldc(faultageEntity); }
public static bool DelTddc(string bid) { try { const string sLayerAliasName = LayerNames.DEFALUT_INFERRED_FAULTAGE; ILayer pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, sLayerAliasName); IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer; if (pFeatureLayer == null) { MessageBox.Show(@"推断断层图层确实!"); return(false); } return(DataEditCommon.DeleteFeatureByBId(pFeatureLayer, bid)); } catch (Exception ex) { MessageBox.Show(ex.Message); throw; } }
/// <summary> /// 修改陷落柱图元 /// </summary> /// <param name="lstCollapsePillarsEntKeyPts"></param> /// <param name="sCollapseId"></param> private void ModifyXlz(List <CollapsePillarsPoint> lstCollapsePillarsEntKeyPts, string sCollapseId) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_COLLAPSE_PILLAR_1; //“默认_陷落柱_1”图层 IFeatureLayer featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法修改陷落柱图元。"); return; } //2.删除原来图元,重新绘制新图元 bool bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByBId(featureLayer, sCollapseId); if (bIsDeleteOldFeature) { //绘制图元 DrawXlz(lstCollapsePillarsEntKeyPts, sCollapseId); } }
/// <summary> /// 修改勘探线图元 /// </summary> /// <params name="prospectingLineEntity"></params> /// <params name="lstProspectingBoreholePts"></params> private void ModifyProspectingLine(ProspectingLine prospectingLineEntity, List <IPoint> lstProspectingBoreholePts) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); var sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“勘探线”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show("未找到" + sLayerAliasName + "图层,无法修改勘探线图元。"); return; } //2.删除原来图元,重新绘制新图元 var bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByBId(featureLayer, prospectingLineEntity.binding_id); if (bIsDeleteOldFeature) { //绘制图元 DrawProspectingLine(prospectingLineEntity, lstProspectingBoreholePts); } }
/// <summary> /// 根据钻孔绑定ID删除钻孔图元 /// </summary> /// <params name="sBoreholeBidArray">要删除钻孔的绑定ID</params> private static void DeleteZuanKongByBid(ICollection <string> sBoreholeBidArray) { if (sBoreholeBidArray.Count == 0) { return; } //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“钻孔”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除钻孔图元。"); return; } //2.删除钻孔图元 foreach (var sBoreholeBid in sBoreholeBidArray) { DataEditCommon.DeleteFeatureByBId(featureLayer, sBoreholeBid); } }
/// <summary> /// 根据揭露断层绑定ID删除揭露断层图元 /// </summary> /// <params name="sfpFaultageBidArray">要删除揭露断层的绑定ID</params> private void DeleteJLDCByBID(ICollection <string> sfpFaultageBidArray) { if (sfpFaultageBidArray.Count == 0) { return; } //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_EXPOSE_FAULTAGE; //“揭露断层”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除揭露断层图元。"); return; } //2.删除揭露断层图元 foreach (var sfpFaultageBid in sfpFaultageBidArray) { DataEditCommon.DeleteFeatureByBId(featureLayer, sfpFaultageBid); } }
/// <summary> /// 根据勘探线层绑定ID删除勘探线层图元 /// </summary> /// <param name="sfpFaultageBidArray">要删除勘探线层的绑定ID</param> private void DeleteJLDCByBID(string[] sfpFaultageBidArray) { if (sfpFaultageBidArray.Length == 0) { return; } //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_KANTANXIAN; //“默认_勘探线层”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删除揭露断层图元。"); return; } //2.删除勘探线层图元 foreach (var sfpFaultageBid in sfpFaultageBidArray) { DataEditCommon.DeleteFeatureByBId(featureLayer, sfpFaultageBid); } }
private void btnSubmit_Click(object sender, EventArgs e) { try { //去除无用空行 for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++) { if (this.dgrdvZhzzt.Rows[i].Cells[0].Value == null && this.dgrdvZhzzt.Rows[i].Cells[1].Value == null && this.dgrdvZhzzt.Rows[i].Cells[2].Value == null) { this.dgrdvZhzzt.Rows.RemoveAt(i); } } //验证 if (!check()) { this.DialogResult = DialogResult.None; return; } this.DialogResult = DialogResult.OK; string bid = IDGenerator.NewBindingID(); //实体赋值 IPoint pt = new PointClass(); pt.X = Convert.ToDouble(txtX.Text); pt.Y = Convert.ToDouble(txtY.Text); pt.Z = 0; double bili = Convert.ToDouble(txtBlc.Text); //List<double> list = new List<double>(); var datasources = new List <KeyValuePair <int, double> >(); for (int i = 0; i < dgrdvZhzzt.RowCount - 1; i++) { DataGridViewTextBoxCell cell = dgrdvZhzzt.Rows[i].Cells[0] as DataGridViewTextBoxCell; DataGridViewComboBoxCell cell1 = dgrdvZhzzt.Rows[i].Cells[1] as DataGridViewComboBoxCell; //list.Add(Convert.ToDouble(cell.Value.ToString())); int key = 0; if (cell1.Value.ToString() == "煤层") { key = 1; } datasources.Add(new KeyValuePair <int, double>(key, Convert.ToDouble(cell.Value.ToString()))); } //list.Add(Convert.ToDouble(txtDBBG.Text)); datasources.Add(new KeyValuePair <int, double>(2, Convert.ToDouble(txtDBBG.Text))); if (this.Text.Equals("修改小柱状") && this.Tag != null) { bid = this.Tag.ToString(); var AnnoLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_AnnotationXZZ) as IFeatureLayer; //注记图层 var lineLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolylineXZZ) as IFeatureLayer; //线源图层 var topLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MR_PolygonXZZ) as IFeatureLayer; //外部图形图层 if (AnnoLayer == null || lineLayer == null || topLayer == null) { System.Windows.Forms.MessageBox.Show("小柱状图层缺失!"); return; } DataEditCommon.DeleteFeatureByBId(AnnoLayer, bid); DataEditCommon.DeleteFeatureByBId(lineLayer, bid); DataEditCommon.DeleteFeatureByBId(topLayer, bid); } if (DrawXZZ.drawXZZ(datasources, pt, Convert.ToDouble(txtAngle.Text), bid, bili)) { FrmNewXZZ frm = new FrmNewXZZ(); frm.Show(this.Owner); frm.Location = this.Location; this.Close(); DataEditCommon.g_pAxMapControl.CurrentTool = null; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// 提 交 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSubmit_Click(object sender, EventArgs e) { // 验证 if (!Check()) { DialogResult = DialogResult.None; return; } var borehole = Borehole.FindOneByBoreholeNum(txtBoreholeNumber.Text) ?? new Borehole { BindingId = IDGenerator.NewBindingID() }; borehole.BoreholeNumber = txtBoreholeNumber.Text.Trim(); borehole.GroundElevation = Convert.ToDouble(txtGroundElevation.Text.Trim()); borehole.CoordinateX = Convert.ToDouble(txtCoordinateX.Text.Trim()); borehole.CoordinateY = Convert.ToDouble(txtCoordinateY.Text.Trim()); borehole.CoordinateZ = Convert.ToDouble(txtCoordinateZ.Text.Trim()); borehole.CoalSeamsTexture = string.Empty; var boreholeLithologys = new List <BoreholeLithology>(); for (var i = 0; i < gvCoalSeamsTexture.RowCount; i++) { // 最后一行为空行时,跳出循环 if (i == gvCoalSeamsTexture.RowCount - 1) { break; } // 创建钻孔岩性实体 var boreholeLithology = new BoreholeLithology { FloorElevation = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[1].Value), Thickness = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[2].Value), CoalSeamsName = gvCoalSeamsTexture.Rows[i].Cells[3].Value.ToString(), CoordinateX = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[4].Value), CoordinateY = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[5].Value), CoordinateZ = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[6].Value), Lithology = Lithology.FindOneByLithologyName(gvCoalSeamsTexture.Rows[i].Cells[0].Value.ToString()), Borehole = borehole }; boreholeLithologys.Add(boreholeLithology); } borehole.BoreholeLithologys = boreholeLithologys; borehole.Save(); // var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔", // MessageBoxButtons.YesNoCancel); // if (dlgResult == DialogResult.Yes) // { // DrawZuanKong(borehole, boreholeLithologyEntityList[0]); // } // else if (dlgResult == DialogResult.No) // { // DrawZuanKong(borehole); // } // else if (dlgResult == DialogResult.Cancel) // { // } //} //else //{ //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“默认_钻孔”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删钻孔图元。"); return; } if (borehole.BoreholeId != 0) { DataEditCommon.DeleteFeatureByBId(featureLayer, borehole.BindingId); } var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔", MessageBoxButtons.YesNoCancel); switch (dlgResult) { case DialogResult.Yes: DrawZuanKong(borehole, borehole.BoreholeLithologys.First()); break; case DialogResult.No: DrawZuanKong(borehole); break; case DialogResult.Cancel: break; } DialogResult = DialogResult.OK; }
/// <summary> /// 提 交 /// </summary> /// <params name="sender"></params> /// <params name="e"></params> private void btnSubmit_Click(object sender, EventArgs e) { var borehole = Borehole.FindAllByProperty("name", txtBoreholeNumber.Text).FirstOrDefault() ?? new Borehole { bid = IdGenerator.NewBindingId() }; borehole.name = txtBoreholeNumber.Text.Trim(); borehole.ground_elevation = Convert.ToDouble(txtGroundElevation.Text.Trim()); borehole.coordinate_x = Convert.ToDouble(txtCoordinateX.Text.Trim()); borehole.coordinate_y = Convert.ToDouble(txtCoordinateY.Text.Trim()); borehole.coordinate_z = Convert.ToDouble(txtCoordinateZ.Text.Trim()); borehole.coal_seam_texture = string.Empty; borehole.Save(); var subBorehole = new SubBorehole(); for (var i = 0; i < gvCoalSeamsTexture.RowCount; i++) { // 最后一行为空行时,跳出循环 if (i == gvCoalSeamsTexture.RowCount - 1) { break; } // 创建钻孔岩性实体 subBorehole = new SubBorehole { floor_elevation = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[1].Value), thickness = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[2].Value), coal_seam = gvCoalSeamsTexture.Rows[i].Cells[3].Value.ToString(), coordinate_x = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[4].Value), coordinate_y = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[5].Value), coordinate_z = Convert.ToDouble(gvCoalSeamsTexture.Rows[i].Cells[6].Value), lithology = gvCoalSeamsTexture.Rows[i].Cells[0].Value.ToString(), borehole = borehole }; subBorehole.Save(); } var drawspecial = new DrawSpecialCommon(); const string sLayerAliasName = LayerNames.DEFALUT_BOREHOLE; //“钻孔”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show(@"未找到" + sLayerAliasName + @"图层,无法删钻孔图元。"); return; } if (borehole.id != 0) { DataEditCommon.DeleteFeatureByBId(featureLayer, borehole.bid); } var dlgResult = MessageBox.Show(@"是:见煤钻孔,否:未见煤钻孔,取消:不绘制钻孔", @"绘制钻孔", MessageBoxButtons.YesNoCancel); borehole = Borehole.FindAllByProperty("name", borehole.name).First(); switch (dlgResult) { case DialogResult.Yes: DrawZuanKong(borehole, subBorehole); break; case DialogResult.No: DrawZuanKong(borehole); break; case DialogResult.Cancel: break; } DialogResult = DialogResult.OK; }