//参数:IFeature类型的List ,IPoint类型的mapPoint private void splitFeature(ListfeatureList, IPoint mapPoint) { if (featureList == null) { return; } if (mapPoint.X == 0 && mapPoint.Y == 0 && mapPoint.IsEmpty) { return; } IFeature nowFeature = (IFeature)null; IFeatureEdit featureEdit = (IFeatureEdit)null; for (int i = 0; i < featureList.Count; i++) { try { nowFeature = featureList[i]; featureEdit = nowFeature as IFeatureEdit; this.featureSplitSet = featureEdit.Split((IGeometry)mapPoint); int flag= -1; for (int index = 0; index < this.pmc.Map.LayerCount; ++ index) { if (this.pmc.Map.get_Layer( index).Name == "点") { flag = index; break; } } if flag> -1) { IFeatureLayer featureLayer = this.pmc.Map.get_Layer(flag) as IFeatureLayer; IFeature feature1 = this.featureSplitSet.Next() as IFeature; IFeature feature2 = this.featureSplitSet.Next() as IFeature; IPolyline shape1 = feature1.Shape as IPolyline; IPolyline shape2 = nowFeature.Shape as IPolyline; if (shape1.FromPoint.X == shape2.FromPoint.X && shape1.FromPoint.Y == shape2.FromPoint.Y) { IFeature feature3 = featureLayer.FeatureClass.CreateFeature(); IPoint point = (IPoint)new PointClass(); if (i == 1) { point.X = mapPoint.X; point.Y = mapPoint.Y; feature3.Shape = (IGeometry)point; } feature3.Store(); ((IFeatureClassWrite)featureLayer.FeatureClass).WriteFeature(feature3); } else if (shape1.ToPoint.X == shape2.ToPoint.X && shape1.ToPoint.Y == shape2.ToPoint.Y) { IFeature feature3 = featureLayer.FeatureClass.CreateFeature(); IPoint point = (IPoint)new PointClass(); if (i == 1) { point.X = mapPoint.X; point.Y = mapPoint.Y; feature3.Shape = (IGeometry)point; } feature3.Store(); ((IFeatureClassWrite)featureLayer.FeatureClass).WriteFeature(feature3); } feature1.Store(); feature2.Store(); } } catch { return; } } }



