private bool IntersectAll(IFeatureClass lineLayer, IPolygon polygon2, List <ziduan> list) { try { if (radioBtnKJ.Checked && polygon2 != null) { // 根据组合成的面裁剪压力等值线 SpatialFilterClass qfilter = new SpatialFilterClass(); qfilter.Geometry = polygon2; qfilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; IFeatureCursor qfeatureCursor = lineLayer.Search(qfilter, false); if (qfeatureCursor != null) { IFeature feature = qfeatureCursor.NextFeature(); IGeometryArray geometryArray = new GeometryArrayClass(); while (feature != null) { geometryArray.Add(feature.Shape); feature = qfeatureCursor.NextFeature(); } IGeometryServer2 geometryServer2 = new GeometryServerClass(); IGeometryArray geometryArray2 = geometryServer2.Intersect(polygon2.SpatialReference, geometryArray, polygon2); //DataEditCommon.DeleteFeatureByWhereClause(lineLayer, ""); IFeatureLayer pFeatureLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, EditLayerName) as IFeatureLayer; DataEditCommon.CreateFeature(pFeatureLayer.FeatureClass, geometryArray2, list); } } return(true); } catch { return(false); } }
private void btnup_Click(object sender, EventArgs e) { //设置一个最小值 progressBarControl1.Properties.Minimum = 0; //设置步长,即每次增加的数 progressBarControl1.Properties.Step = 1; //设置进度条的样式 progressBarControl1.Properties.ProgressViewStyle = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid; progressBarControl1.Position = 0; //设置一个最小值 progressBarControl2.Properties.Minimum = 0; //设置一个最大值 progressBarControl2.Properties.Maximum = listView1.CheckedItems.Count * 2; //设置步长,即每次增加的数 progressBarControl2.Properties.Step = 1; //设置进度条的样式 progressBarControl2.Properties.ProgressViewStyle = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid; progressBarControl2.Position = 0; ////设置一个最小值 //progressBar2.Minimum = 0; ////设置一个最大值 //progressBar2.Maximum = listView1.CheckedItems.Count * 2; ////设置步长,即每次增加的数 //progressBar2.Step = 1; //progressBar2.Value = 0; IFeatureClass tFeatureClass = pFeatureLayer_QYYJY.FeatureClass; DataEditCommon.DeleteFeatureByWhereClause(tFeatureClass, ""); IGeometryArray pgeoArrayHong = new GeometryArrayClass(); IGeometryArray pgeoArrayHang = new GeometryArrayClass(); for (int i = 0; i < listView1.CheckedItems.Count; i++) { string layer = listView1.CheckedItems[i].SubItems[1].Text.ToString(); ILayer pLayer = DataEditCommon.GetLayerByName(DataEditCommon.g_pMap, layer); IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer; if (pFeatureLayer == null) { continue; } IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass; //设置一个最大值 progressBarControl1.Properties.Maximum = pFeatureClass.FeatureCount(null); IFeatureCursor pCursor = pFeatureClass.Search(null, false); IFeature pFeature = pCursor.NextFeature(); while (pFeature != null) { ITopologicalOperator pTopo = (ITopologicalOperator)pFeature.Shape; IGeometry pGeo = pTopo.Buffer(hongse); pgeoArrayHong.Add(pGeo); IGeometry pGeoH = pTopo.Buffer(huangse); if (pFeatureClass.ShapeType == esriGeometryType.esriGeometryPolygon) { pTopo = (ITopologicalOperator)pGeoH; pGeoH = pTopo.Difference(pGeo); } pgeoArrayHang.Add(pGeoH); pFeature = pCursor.NextFeature(); this.progressBarControl1.PerformStep(); Application.DoEvents(); } List <ziduan> list = new List <ziduan>(); list.Add(new ziduan("dengji", "1")); list.Add(new ziduan("layername", layer)); list.Add(new ziduan("BID", "0")); DataEditCommon.CreateFeature(tFeatureClass, pgeoArrayHong, list); this.progressBarControl2.PerformStep(); //progressBar2.Value += 1; Application.DoEvents(); List <ziduan> listH = new List <ziduan>(); listH.Add(new ziduan("dengji", "2")); listH.Add(new ziduan("layername", layer)); listH.Add(new ziduan("BID", "0")); DataEditCommon.CreateFeature(tFeatureClass, pgeoArrayHang, listH); this.progressBarControl2.PerformStep(); //progressBar2.Value += 1; Application.DoEvents(); } if (pFeatureLayer_QYYJY.Visible == false) { pFeatureLayer_QYYJY.Visible = true; } DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, null, null); MessageBox.Show("完成!"); }