コード例 #1
0
 public static void Report([NotNull] IIssueReporter @this, Exception exception)
 {
     @this.Report(new Issue
     {
         Exception = exception
     });
 }
コード例 #2
0
        private static void CompareSegmentAngles(
            [NotNull] IList <double> sourceAngles,
            [NotNull] IList <double> transformedAngles,
            double maxSegmentAngleDifferenceRadians,
            double ignoredAngleValue,
            [NotNull] IFeature transformedFeature,
            [NotNull] IPointCollection transformedPoints,
            [NotNull] IIssueReporter issueReporter)
        {
            Assert.AreEqual(sourceAngles.Count, transformedAngles.Count,
                            "Differing number of segment angles. Source: {0} Transformed: {1}",
                            sourceAngles.Count, transformedAngles.Count);

            var ignoredVertices   = new List <int>();
            var isClosedEvaluator = new IsClosedEvaluator(transformedPoints);

            int lastVertexIndex = sourceAngles.Count - 1;

            for (var vertexIndex = 0; vertexIndex <= lastVertexIndex; vertexIndex++)
            {
                double sourceAngle      = sourceAngles[vertexIndex];
                double transformedAngle = transformedAngles[vertexIndex];

                if (Math.Abs(sourceAngle - ignoredAngleValue) < double.Epsilon)
                {
                    ignoredVertices.Add(vertexIndex);
                    continue;
                }

                double difference = Math.Abs(sourceAngle - transformedAngle);

                if (difference > maxSegmentAngleDifferenceRadians)
                {
                    // ignore the angle difference if this is the last vertex, and its angle is
                    // equal to the first vertex, and the points form a closed loop
                    bool ignoreDifference =
                        vertexIndex == lastVertexIndex &&
                        Math.Abs(transformedAngle - transformedAngles[0]) < double.Epsilon &&
                        isClosedEvaluator.IsClosed;

                    if (!ignoreDifference)
                    {
                        IGeometry errorGeometry = GetErrorGeometry(
                            vertexIndex, ignoredVertices, transformedPoints,
                            isClosedEvaluator, sourceAngles, ignoredAngleValue);

                        string description = string.Format(
                            "Segment angle difference exceeds limit: {0}°",
                            MathUtils.ToDegrees(difference));

                        issueReporter.Report(transformedFeature, errorGeometry, description);
                    }
                }

                if (ignoredVertices.Count > 0)
                {
                    ignoredVertices.Clear();
                }
            }
        }
コード例 #3
0
 public static void Report([NotNull] IIssueReporter @this, string message, Exception exception)
 {
     @this.Report(new Issue
     {
         Message   = message,
         Exception = exception
     });
 }
コード例 #4
0
 public static void Report([NotNull] IIssueReporter @this, Exception exception, IDictionary <string, string> tags)
 {
     @this.Report(new Issue
     {
         Exception = exception,
         Tags      = tags
     });
 }