コード例 #1
0
        private int ReportPointErrors(
            [NotNull] IDictionary <int, List <int> > pointIndexesById,
            int maxPointsId,
            [NotNull] Rings rings,
            [NotNull] IRow row)
        {
            object missing = Type.Missing;

            IPointCollection points = new MultipointClass();

            GeometryUtils.EnsureSpatialReference((IGeometry)points,
                                                 rings.SpatialReference);

            foreach (KeyValuePair <int, List <int> > pair in pointIndexesById)
            {
                int id = pair.Key;
                if (id == maxPointsId)
                {
                    continue;
                }

                List <int> pointIndexes = pair.Value;

                foreach (int pointIndex in pointIndexes)
                {
                    IPoint point = rings.get_Point(pointIndex);
                    points.AddPoint(point, ref missing, ref missing);
                }
            }

            string description;

            if (rings.RingsCount > 1)
            {
                description = string.Format(
                    "The point ids of these points differ from the most frequent point id {0} " +
                    "({1} occurrences) in the rings (outer ring = {2}. patch in multipatch)",
                    maxPointsId, pointIndexesById[maxPointsId].Count,
                    rings.FirstPatchIndex + 1);
            }
            else
            {
                description = string.Format(
                    "The point ids of these points differ from the most frequent point id {0} " +
                    "({1} occurrences) in the ring ({2}. patch in Multipatch)",
                    maxPointsId, pointIndexesById[maxPointsId].Count,
                    rings.FirstPatchIndex + 1);
            }

            return(ReportError(description, (IGeometry)points, Codes[Code.DifferentIdInRing],
                               TestUtils.GetShapeFieldName(row), row));
        }