/// <summary> /// Occurs when this tool is clicked /// </summary> public override void OnClick() { drawSpecialCom = new GIS.Common.DrawSpecialCommon(); nearestGeometry = new PolylineClass(); hightPoint = new PointClass(); hightPoint.PutCoords(0, 0); string layerName = GIS.LayerNames.DEFALUT_DONGSHI; m_pDongshiFeatureLayer = drawSpecialCom.GetFeatureLayerByName(layerName); if (m_pDongshiFeatureLayer == null) { MessageBox.Show(@"当前地图上没有找到硐室图层", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
/// <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> /// 生成等值线 /// </summary> /// <params name="targetworkspace"></params> /// <params name="nameOftargetFeatureClass"></params> /// <params name="sLayerAliasName"></params> private bool CreateContours(IWorkspace targetworkspace, string nameOftargetFeatureClass, string sLayerAliasName, string extent, ref string failInfo) { double douElevation; //设置一个最小值 progressBarControl1.Properties.Minimum = 0; //设置一个最大值 progressBarControl1.Properties.Maximum = 6; //设置步长,即每次增加的数 progressBarControl1.Properties.Step = 1; //设置进度条的样式 progressBarControl1.Properties.ProgressViewStyle = ProgressViewStyle.Solid; progressBarControl1.Position = 0; try { Geoprocessor GP = new Geoprocessor(); if (withIn(m_strDataFilePath) == false) return false; if (TB_Interval.Text == "") { MessageBox.Show("请输入正确的等高距!", "提示!"); return false; } if (double.TryParse(TB_Interval.Text.Trim(), out douElevation)) { } else { TB_Interval.Text = null; MessageBox.Show("请输入正确的等高距!", "提示!"); return false; } string featurOut = m_MakeContoursFolder + "\\Cont.shp"; int k = 0; while (File.Exists(featurOut)) { k++; featurOut = m_MakeContoursFolder + "\\Cont" + k.ToString() + ".shp"; } int countCont = Directory.GetFiles(m_MakeContoursFolder, "Cont*").Length; if (countCont > 0) { featurOut = m_MakeContoursFolder + "\\Cont" + countCont.ToString() + ".shp"; } if (DrawContours.ConvertASCIIDescretePoint2FeatureClass(GP, m_strDataFilePath, featurOut) == false) return false; //执行步长 this.progressBarControl1.PerformStep(); string ContourRaster = m_MakeContoursFolder + "\\Spline"; //string ContourRaster = m_MakeContoursFolder + "\\" + nameOftargetFeatureClass + "_Render"; if (extent != "")//右上左下 xmax ymax xmin ymin GP.SetEnvironmentValue("Extent", extent); bool suc = false; string sRasterLayerAliasName = sLayerAliasName + "渲染图"; ILayer rsLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, sRasterLayerAliasName); if (rsLayer != null) { DataEditCommon.g_pMap.DeleteLayer(rsLayer); } if (Directory.Exists(ContourRaster)) { try { Directory.Delete(ContourRaster, true); } catch { k = 1; while (Directory.Exists(ContourRaster)) { ContourRaster = m_MakeContoursFolder + "\\Spline" + k.ToString(); k++; } } } switch (CB_InterpolationMethod.Text) { case "样条函数插值法": suc = DrawContours.Interpolate2RasterSpline(GP, featurOut, ContourRaster, CB_SplineType.Text); break; case "自然邻域插值法": suc = DrawContours.Interpolate2RasterNN(GP, featurOut, ContourRaster); break; case "克里格插值法": suc = DrawContours.Interpolate2RasterKriging(GP, featurOut, ContourRaster, CB_semiVariogramProp.Text, CB_searchRadiusProp.Text); break; case "反距离权重插值法": suc = DrawContours.Interpolate2RasterIDW(GP, featurOut, ContourRaster); break; case "趋势面插值法": suc = DrawContours.TrendToRaster(GP, featurOut, ContourRaster); break; } if (suc == false) return false; this.progressBarControl1.PerformStep(); GP = new Geoprocessor(); string R2Contour = m_MakeContoursFolder + "\\Contour.shp"; k = 1; while (File.Exists(R2Contour)) { R2Contour = m_MakeContoursFolder + "\\Contour" + k.ToString() + ".shp"; k++; } int countContour = Directory.GetFiles(m_MakeContoursFolder, "Contour*").Length; if (countContour > 0) { R2Contour = m_MakeContoursFolder + "\\Contour" + countContour.ToString() + ".shp"; } if (DrawContours.SplineRasterToContour(GP, ContourRaster, R2Contour, douElevation) == false) return false; this.progressBarControl1.PerformStep(); string EvEContour = m_MakeContoursFolder + "\\EvEContour.shp"; k = 1; while (File.Exists(EvEContour)) { EvEContour = m_MakeContoursFolder + "\\EvEContour" + k.ToString() + ".shp"; k++; } int countEvEContour = Directory.GetFiles(m_MakeContoursFolder, "EvEContour*").Length; if (countEvEContour > 0) { EvEContour = m_MakeContoursFolder + "\\EvEContour" + countEvEContour.ToString() + ".shp"; } if (DrawContours.FeaturesTo3D(GP, R2Contour, EvEContour) == false) return false; this.progressBarControl1.PerformStep(); //获得等值线Shp文件所在的工作空间 IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory(); IWorkspace sourceworkspace = workspaceFactory.OpenFromFile(m_MakeContoursFolder, 0); //裁切 IPolygon bianjie = GetPolygon(); //导入等值线Shp文件到数据库中 DrawSpecialCommon drawspecial = new DrawSpecialCommon(); string nameOfsourceFeatureClass = EvEContour.Substring(EvEContour.LastIndexOf("\\") + 1); nameOfsourceFeatureClass = nameOfsourceFeatureClass.Substring(0, nameOfsourceFeatureClass.LastIndexOf(".")); bool Import = false; List<ziduan> list = new List<ziduan> { new ziduan("BID", ""), new ziduan("mingcheng", sLayerAliasName), new ziduan("mcid", "0"), new ziduan("date", DateTime.Now.ToString()), new ziduan("type", CB_InterpolationMethod.Text) }; list.Add(new ziduan("BID", "")); list.Add(new ziduan("mingcheng", sLayerAliasName)); list.Add(new ziduan("mcid", "0")); list.Add(new ziduan("date", DateTime.Now.ToString())); list.Add(new ziduan("type", CB_InterpolationMethod.Text)); IFeatureLayer pFeatureLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, EditLayerName) as IFeatureLayer; string WhereClause = "mcid='" + "0" + "'"; DataEditCommon.DeleteFeatureByWhereClause(pFeatureLayer, WhereClause); if (radioBtnKJ.Checked && bianjie != null) Import = IntersectAll(DataEditCommon.GetFeatureClassByName(sourceworkspace, nameOfsourceFeatureClass), bianjie, list); else Import = drawspecial.ShapeImportGDB(sourceworkspace, targetworkspace, nameOfsourceFeatureClass, nameOftargetFeatureClass, list); this.progressBarControl1.PerformStep(); if (Import == false) { MessageBox.Show(sLayerAliasName + "导入数据库失败!"); DataEditCommon.g_axTocControl.Update(); DataEditCommon.g_pAxMapControl.Refresh(); failInfo = sLayerAliasName; return false; } //添加相应的渲染图 IRasterLayer newRasterLayer = new RasterLayerClass(); newRasterLayer.CreateFromFilePath(ContourRaster); newRasterLayer = IntersectRaster(newRasterLayer, bianjie); //newRasterLayer.CreateFromDataset(newRasterDs); newRasterLayer.Name = sRasterLayerAliasName; UsingRasterStretchColorRampRender(newRasterLayer); //groupLayer.Add(newRasterLayer as ILayer); int indexPosition = DataEditCommon.g_pAxMapControl.LayerCount;//GroupLayer序号 //判断MapControl中是否存在该图层 ILayer mLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, sRasterLayerAliasName); if (mLayer != null) { DataEditCommon.g_pMyMapCtrl.Map.DeleteLayer(mLayer); indexPosition--; } DataEditCommon.g_pAxMapControl.AddLayer(newRasterLayer as ILayer, indexPosition);//添加到最下面 DataEditCommon.g_pAxMapControl.ActiveView.Extent = newRasterLayer.AreaOfInterest; DataEditCommon.g_axTocControl.Update(); DataEditCommon.g_pAxMapControl.Refresh(); this.progressBarControl1.PerformStep(); return true; } catch (Exception ex) { MessageBox.Show(ex.Message); return false; } }
private void BT_Ok_Click(object sender, EventArgs e) { try { if (!Directory.Exists(m_MakeContoursFolder)) { Directory.CreateDirectory(m_MakeContoursFolder); } panel1.Enabled = false; panel2.Enabled = false; panel4.Enabled = false; lbshengc.Visible = true; Application.DoEvents(); ArrayList TheValueList = new ArrayList(); if (radioBtndata.Checked) { if (m_layerAliasName.Equals("瓦斯压力等值线")) { var gasPressures = GasPressure.FindAll(); foreach (var i in gasPressures) { XYValueStruct temp; temp.X = i.coordinate_x; temp.Y = i.coordinate_y; temp.TheValue = i.gas_pressure_value; TheValueList.Add(temp); } } if (m_layerAliasName.Equals("瓦斯含量等值线")) { var gasContent = GasContent.FindAll(); foreach (var i in gasContent) { XYValueStruct temp; temp.X = i.coordinate_x; temp.Y = i.coordinate_y; temp.TheValue = i.gas_content_value; TheValueList.Add(temp); } } if (m_layerAliasName.Equals("瓦斯涌出量等值线")) { var gasGushQuantity = GasGushQuantity.FindAll(); foreach (var i in gasGushQuantity) { XYValueStruct temp; temp.X = i.coordinate_x; temp.Y = i.coordinate_y; temp.TheValue = i.absolute_gas_gush_quantity; TheValueList.Add(temp); } } if (TheValueList.Count < 3) { MessageBox.Show("离散点数据为空或小于三个,无法生成等值线!"); return; } string[] strlsd = new string[TheValueList.Count]; for (int i = 0; i < TheValueList.Count; i++) { XYValueStruct tempxy = (XYValueStruct)TheValueList[i]; string temstr = tempxy.X + "," + tempxy.Y + "," + tempxy.TheValue; strlsd[i] = temstr; } m_strDataFilePath = Application.StartupPath + "\\tempdata.txt"; File.WriteAllLines(m_strDataFilePath, strlsd); } else { m_strDataFilePath = TB_DocumentPath.Text.Trim(); if (m_strDataFilePath.Equals("")) { MessageBox.Show("请选择一个离散点文件!"); return; } } bool bIsSuccess = false; string failInfo = ""; DrawSpecialCommon drawspecial = new DrawSpecialCommon(); string sLayerAliasName = m_layerAliasName;//MapControl中图层名称 string nameOftargetFeatureClass = SDELayerName;//m_layerName + "_NO" + sCoalseamNO;//数据库中图层名称 string extent = ""; if (radioBtnKJ.Checked) { ILayer pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, LayerNames.LAYER_ALIAS_MINE_BOUNDARY); IFeatureLayer pFeatureLayer = (IFeatureLayer)pLayer; IEnvelope pEnvelope = pFeatureLayer.AreaOfInterest; //右上左下 xmax ymax xmin ymin extent = pEnvelope.XMax.ToString() + " " + pEnvelope.YMax.ToString() + " " + pEnvelope.XMin.ToString() + " " + pEnvelope.YMin.ToString(); } IWorkspace targetworkspace = DataEditCommon.g_pCurrentWorkSpace; //最后重新生成图层并添加到数据库及MapControl中 bIsSuccess = CreateContours(targetworkspace, nameOftargetFeatureClass, sLayerAliasName, extent, ref failInfo); if (bIsSuccess) { string layername = ""; if (m_layerAliasName.Equals("瓦斯压力等值线")) { layername = LayerNames.LAYER_ALIAS_MR_YLDZX; } if (m_layerAliasName.Equals("瓦斯含量等值线")) { layername = LayerNames.LAYER_ALIAS_MR_HLDZX; } if (m_layerAliasName.Equals("瓦斯涌出量等值线")) { layername = LayerNames.LAYER_ALIAS_MR_YCLDZX; } if (m_layerAliasName.Equals("地面标高等值线")) { layername = LayerNames.GROUND_LEVLE_CONTOUR; } if (m_layerAliasName.Equals("煤层底板等值线")) { layername = LayerNames.FLOOR_ELEVATION_CONTOUR; } if (m_layerAliasName.Equals("埋深等值线")) { layername = LayerNames.EMBEDDED_DEPTH_CONTOUR; } DataEditCommon.SetLayerVisibleByName(DataEditCommon.g_pMap, layername, true); MessageBox.Show("等值线和渲染图生成完成。"); this.Close(); } else { MessageBox.Show(failInfo + "生成过程有误,请检查。"); } //this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { panel1.Enabled = true; panel2.Enabled = true; panel4.Enabled = true; lbshengc.Visible = false; Application.DoEvents(); progressBarControl1.Position = 0; } }
/// <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; }
/// <summary> /// 根据勘探线层绑定ID删除勘探线层图元 /// </summary> /// <params name="sfpFaultageBidArray">要删除勘探线层的绑定ID</params> 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); } }
/// <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> /// Occurs when this tool is clicked /// </summary> public override void OnClick() { drawSpecialCom = new GIS.Common.DrawSpecialCommon(); nearestGeometry = new PolylineClass(); hightPoint = new PointClass(); hightPoint.PutCoords(0, 0); string layerName = GIS.LayerNames.DEFALUT_DONGSHI; m_pDongshiFeatureLayer = drawSpecialCom.GetFeatureLayerByName(layerName); if (m_pDongshiFeatureLayer == null) { MessageBox.Show(@"��ǰ��ͼ��û���ҵ�����ͼ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } }
/// <summary> /// 修改井筒 /// </summary> /// <params name="pitshaftEntity"></params> private void ModifyJingTong(Pitshaft pitshaftEntity) { //1.获得当前编辑图层 var drawspecial = new DrawSpecialCommon(); var sLayerAliasName = LayerNames.DEFALUT_JINGTONG; //“井筒”图层 var featureLayer = drawspecial.GetFeatureLayerByName(sLayerAliasName); if (featureLayer == null) { MessageBox.Show("未找到" + sLayerAliasName + "图层,无法修改井筒图元。"); return; } //2.删除原来图元,重新绘制新图元 var bIsDeleteOldFeature = DataEditCommon.DeleteFeatureByWhereClause(featureLayer, "BID='" + pitshaftEntity.bid + "'"); //if (bIsDeleteOldFeature) { //绘制井筒 DrawJingTong(pitshaftEntity); } }
/// <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); }
/// <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> /// 根据所选钻孔点绘制勘探线 /// </summary> /// <params name="prospectingLineEntity"></params> /// <params name="lstProspectingBoreholePts"></params> private void DrawProspectingLine(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.绘制图元 if (lstProspectingBoreholePts.Count == 0) return; var prospectingLineID = prospectingLineEntity.binding_id; //绘制推断断层 PointsFit2Polyline.CreateLine(featureLayer, lstProspectingBoreholePts, prospectingLineID); }
/// <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); } }
/// <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="lstCollapsePillarsEntKeyPts"></params> /// <params name="sCollapseId"></params> private void ModifyXlz(List<CollapsePillarPoint> 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); } }