public static IFeature Union(List <IFeature> list_0) { ITopologicalOperator4 shapeCopy = null; IGeometry geometry = null; List <IFeature> features = new List <IFeature>(); foreach (IFeature list0 in list_0) { features.Add(ZDEditTools.WriteHistory(list0)); if (shapeCopy != null) { geometry = shapeCopy.Union(list0.ShapeCopy); shapeCopy = geometry as ITopologicalOperator4; } else { shapeCopy = list0.ShapeCopy as ITopologicalOperator4; } } IFeature feature = ZDEditTools.ZDFeatureClass.CreateFeature(); feature.Shape = geometry; RowOperator.CopyFeatureAttributeToFeature(list_0[0], feature); feature.Store(); (ZDEditTools.ZDFeatureClass as IDataset).Name.Split(new char[] { '.' }); ZDHistoryTable zDHistoryTable = new ZDHistoryTable(); ZDEditTools.StartEditDateTime = DateTime.Now; int num = 0; foreach (IFeature list01 in list_0) { int num1 = num; num = num1 + 1; ZDEditTools.WriteHistoryLine(list01, feature, features[num1], 1, ZDEditTools.StartEditDateTime); list01.Delete(); } ZDEditTools.Oids.Add(feature.OID); return(feature); }
public static IFeature Union(System.Collections.Generic.List <IFeature> list_0) { ITopologicalOperator4 topologicalOperator = null; IGeometry geometry = null; System.Collections.Generic.List <IFeature> list = new System.Collections.Generic.List <IFeature>(); foreach (IFeature current in list_0) { list.Add(ZDEditTools.WriteHistory(current)); if (topologicalOperator == null) { topologicalOperator = (current.ShapeCopy as ITopologicalOperator4); } else { geometry = topologicalOperator.Union(current.ShapeCopy); topologicalOperator = (geometry as ITopologicalOperator4); } } IFeature feature = ZDEditTools.ZDFeatureClass.CreateFeature(); feature.Shape = geometry; RowOperator.CopyFeatureAttributeToFeature(list_0[0], feature); feature.Store(); (ZDEditTools.ZDFeatureClass as IDataset).Name.Split(new char[] { '.' }); new ZDHistoryTable(); ZDEditTools.StartEditDateTime = System.DateTime.Now; int num = 0; foreach (IFeature current in list_0) { ZDEditTools.WriteHistoryLine(current, feature, list[num++], 1, ZDEditTools.StartEditDateTime); current.Delete(); } ZDEditTools.Oids.Add(feature.OID); return(feature); }
public static List <IFeature> Split(IFeature ifeature_0, IPolyline ipolyline_0) { IGeometry geometry; IGeometry geometry1; IFeature feature; IFeature feature1; List <IFeature> features = new List <IFeature>(); ITopologicalOperator4 shapeCopy = ifeature_0.ShapeCopy as ITopologicalOperator4; IGeometry geometry2 = shapeCopy.Intersect(ipolyline_0, esriGeometryDimension.esriGeometry0Dimension); List <IFeature> features1 = new List <IFeature>(); ZDEditTools.StartEditDateTime = DateTime.Now; if (geometry2.IsEmpty) { shapeCopy.Cut(ipolyline_0, out geometry, out geometry1); if ((geometry == null ? false : geometry1 != null)) { feature = ZDEditTools.WriteHistory(ifeature_0); feature1 = ZDEditTools.ZDFeatureClass.CreateFeature(); features.Add(feature1); feature1.Shape = geometry; RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature1); feature1.Store(); ZDEditTools.Oids.Add(feature1.OID); ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 2, ZDEditTools.StartEditDateTime); feature1 = ZDEditTools.ZDFeatureClass.CreateFeature(); features.Add(feature1); feature1.Shape = geometry1; RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature1); feature1.Store(); ZDEditTools.Oids.Add(feature1.OID); ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 2, ZDEditTools.StartEditDateTime); ifeature_0.Delete(); } } else if ((!(geometry2 is IMultipoint) ? false : (geometry2 as IPointCollection).PointCount > 1)) { ISpatialFilter spatialFilterClass = new SpatialFilter() { Geometry = ipolyline_0, SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects }; IFeatureCursor featureCursor = (ifeature_0.Class as IFeatureClass).Search(spatialFilterClass, false); for (IFeature i = featureCursor.NextFeature(); i != null; i = featureCursor.NextFeature()) { if (i.OID != ifeature_0.OID) { features1.Add(i); } } ComReleaser.ReleaseCOMObject(featureCursor); int pointCount = (geometry2 as IPointCollection).PointCount; IPoint point = (geometry2 as IPointCollection).Point[0]; IPoint point1 = (geometry2 as IPointCollection).Point[pointCount - 1]; foreach (IFeature feature2 in features1) { ZDEditTools.HitTest(feature2, point); ZDEditTools.HitTest(feature2, point1); } IGeometryCollection geometryCollection = shapeCopy.Cut2(ipolyline_0); DateTime startEditDateTime = ZDEditTools.StartEditDateTime; feature = ZDEditTools.WriteHistory(ifeature_0); for (int j = 0; j < geometryCollection.GeometryCount; j++) { IGeometry geometry3 = geometryCollection.Geometry[j]; feature1 = ZDEditTools.ZDFeatureClass.CreateFeature(); features.Add(feature1); feature1.Shape = geometry3; RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature1); feature1.Store(); ZDEditTools.Oids.Add(feature1.OID); ZDEditTools.WriteHistoryLine(ifeature_0, feature1, feature, 2, startEditDateTime); } ifeature_0.Delete(); } return(features); }
public static System.Collections.Generic.List <IFeature> Split(IFeature ifeature_0, IPolyline ipolyline_0) { System.Collections.Generic.List <IFeature> list = new System.Collections.Generic.List <IFeature>(); ITopologicalOperator4 topologicalOperator = ifeature_0.ShapeCopy as ITopologicalOperator4; IGeometry geometry = topologicalOperator.Intersect(ipolyline_0, esriGeometryDimension.esriGeometry0Dimension); System.Collections.Generic.List <IFeature> list2 = new System.Collections.Generic.List <IFeature>(); ZDEditTools.StartEditDateTime = System.DateTime.Now; if (geometry.IsEmpty) { IGeometry geometry2; IGeometry geometry3; topologicalOperator.Cut(ipolyline_0, out geometry2, out geometry3); if (geometry2 != null && geometry3 != null) { IFeature ifeature_ = ZDEditTools.WriteHistory(ifeature_0); IFeature feature = ZDEditTools.ZDFeatureClass.CreateFeature(); list.Add(feature); feature.Shape = geometry2; RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature); feature.Store(); ZDEditTools.Oids.Add(feature.OID); ZDEditTools.WriteHistoryLine(ifeature_0, feature, ifeature_, 2, ZDEditTools.StartEditDateTime); feature = ZDEditTools.ZDFeatureClass.CreateFeature(); list.Add(feature); feature.Shape = geometry3; RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature); feature.Store(); ZDEditTools.Oids.Add(feature.OID); ZDEditTools.WriteHistoryLine(ifeature_0, feature, ifeature_, 2, ZDEditTools.StartEditDateTime); ifeature_0.Delete(); } } else if (geometry is IMultipoint && (geometry as IPointCollection).PointCount > 1) { ISpatialFilter spatialFilter = new SpatialFilter(); spatialFilter.Geometry = ipolyline_0; spatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects; IFeatureCursor featureCursor = (ifeature_0.Class as IFeatureClass).Search(spatialFilter, false); for (IFeature feature2 = featureCursor.NextFeature(); feature2 != null; feature2 = featureCursor.NextFeature()) { if (feature2.OID != ifeature_0.OID) { list2.Add(feature2); } } ComReleaser.ReleaseCOMObject(featureCursor); int pointCount = (geometry as IPointCollection).PointCount; IPoint ipoint_ = (geometry as IPointCollection).get_Point(0); IPoint ipoint_2 = (geometry as IPointCollection).get_Point(pointCount - 1); foreach (IFeature current in list2) { ZDEditTools.HitTest(current, ipoint_); ZDEditTools.HitTest(current, ipoint_2); } IGeometryCollection geometryCollection = topologicalOperator.Cut2(ipolyline_0); System.DateTime startEditDateTime = ZDEditTools.StartEditDateTime; IFeature ifeature_ = ZDEditTools.WriteHistory(ifeature_0); for (int i = 0; i < geometryCollection.GeometryCount; i++) { IGeometry shape = geometryCollection.get_Geometry(i); IFeature feature = ZDEditTools.ZDFeatureClass.CreateFeature(); list.Add(feature); feature.Shape = shape; RowOperator.CopyFeatureAttributeToFeature(ifeature_0, feature); feature.Store(); ZDEditTools.Oids.Add(feature.OID); ZDEditTools.WriteHistoryLine(ifeature_0, feature, ifeature_, 2, startEditDateTime); } ifeature_0.Delete(); } return(list); }