private int ReportError([NotNull] IRow row,
                                [NotNull] IGeometry errorGeometry,
                                double angleRad,
                                double zDifference)
        {
            int pointCount = ((IPointCollection)errorGeometry).PointCount;

            double angleDeg     = MathUtils.ToDegrees(angleRad);
            double toleranceDeg = MathUtils.ToDegrees(_toleranceRad);
            string format       = FormatUtils.CompareFormat(angleDeg, ">", toleranceDeg, "N1");

            string    description;
            IssueCode issueCode;

            if (pointCount <= 2)
            {
                description =
                    string.Format(
                        "The segment is almost, but not sufficently horizontal " +
                        "(difference angle to horizontal: {0} > {1}, z-Difference = {2:N2})",
                        FormatAngle(angleRad, format),
                        FormatAngle(_toleranceRad, format),
                        zDifference);
                issueCode = Codes[Code.NotSufficientlyHorizontal_Segment];
            }
            else
            {
                description =
                    string.Format(
                        "{0} consecutive segments are almost, but not sufficently horizontal " +
                        "(max. difference angle to horizontal: {1} > {2}, max. z-Difference = {3:N2})",
                        pointCount - 1,
                        FormatAngle(angleRad, format), FormatAngle(_toleranceRad, format),
                        zDifference);
                issueCode = Codes[Code.NotSufficientlyHorizontal_ConsecutiveSegments];
            }

            return(ReportError(description, errorGeometry,
                               issueCode, TestUtils.GetShapeFieldName(row),
                               row));
        }
Example #2
0
        protected string FormatLengthComparison(double value0, string compare,
                                                double value1,
                                                ISpatialReference sr,
                                                string expressionFormat)
        {
            esriUnits lengthUnit     = _lengthUnit;
            double    referenceScale = ReferenceScale;
            string    numberFormat   = NumberFormat;
            double    f = FormatUtils.GetLengthUnitFactor(sr, lengthUnit, referenceScale);

            double v0 = f * value0;
            double v1 = f * value1;

            string compareFormat = FormatUtils.CompareFormat(v0, compare, v1, numberFormat);
            string result        = string.Format(expressionFormat,
                                                 FormatLength(v0, compareFormat),
                                                 compare,
                                                 FormatLength(v1, compareFormat));

            return(result);
        }