private static IGeometry GetErrorGeometry([NotNull] LineListPolygon poly) { object missing = Type.Missing; IPointCollection multiPoint = new MultipointClass(); foreach (IRow pointRow in poly.Centroids) { multiPoint.AddPoint(((IFeature)pointRow).Shape as Point, ref missing, ref missing); } return((IGeometry)multiPoint); }
private int AssignCentroids( [NotNull] PolygonNet <DirectedRow> net) { var errorCount = 0; var unprocessedCentroids = new List <IRow>(); foreach (IRow pointRow in _centroids) { int side; TopologicalLine line; LineListPolygon poly = net.AssignCentroid(pointRow, out line, out side); if (poly != null && poly.IsInnerRing) { int last = poly.Centroids.Count - 1; poly.Centroids.RemoveAt(last); poly = null; } if (line != null && side == 0) { Assert.Null(poly, "poly is not null"); const string description = "Centroid lies on border"; errorCount += ReportError(description, ((IFeature)pointRow).Shape, Codes[Code.CentroidLiesOnBorder], TestUtils.GetShapeFieldName(pointRow), pointRow); continue; } if (poly == null) { unprocessedCentroids.Add(pointRow); } } _centroids = unprocessedCentroids; return(errorCount); }
private static IRow GetUniqueCentroid([NotNull] LineListPolygon lineListPolygon) { return(lineListPolygon.Centroids.Count != 1 ? null : lineListPolygon.Centroids[0]); }