Exemplo n.º 1
0
        private int ResolveRows([NotNull] List <DirectedRow> connectedRows)
        {
            _errorCount = 0;
            // Errors are also produced in the eventhandler RingGeometryCompleted --> member variable

            int lineCount = connectedRows.Count;

            if (lineCount == 1)
            {
                const string description = "Dangling line";

                _errorCount += ReportError(description, connectedRows[0].FromPoint,
                                           Codes[Code.DanglingLine], null,
                                           connectedRows[0].Row.Row);
            }

            connectedRows.Sort(new DirectedRow.RowByLineAngleComparer());

            DirectedRow row0 = connectedRows[lineCount - 1];

            foreach (DirectedRow row1 in connectedRows)
            {
                _grower.Add(row0.Reverse(), row1);
                row0 = row1;
            }

            return(_errorCount);
        }
Exemplo n.º 2
0
        private int ResolveRows(List <DirectedRow> connectedRows)
        {
            var errorCount = 0;

            int lineCount = connectedRows.Count;

            if (lineCount == 1)
            {
                const string description = "Dangling line";
                errorCount += ReportError(description, connectedRows[0].FromPoint,
                                          Codes[Code.DanglingLine],
                                          TestUtils.GetShapeFieldName(
                                              connectedRows[0].Row.Row),
                                          connectedRows[0].Row.Row);
            }

            connectedRows.Sort(new DirectedRow.RowByLineAngleComparer());

            DirectedRow connectedRow = connectedRows[lineCount - 1];
            var         row0         = new DirectedRow(connectedRow.TopologicalLine,
                                                       !connectedRow.IsBackward);

            foreach (DirectedRow row1 in connectedRows)
            {
                _grower.Add(row0,
                            new DirectedRow(row1.TopologicalLine,
                                            row1.IsBackward));
                row0 = new DirectedRow(row1.TopologicalLine,
                                       !row1.IsBackward);
            }

            return(errorCount);
        }
Exemplo n.º 3
0
        private bool IsBackward([NotNull] DirectedRow dirRow)
        {
            RowCondition flipCondition = GetFlipCondition(dirRow.Row);

            return(flipCondition != null && flipCondition.IsFulfilled(dirRow.Row.Row)
                                       ? !dirRow.IsBackward
                                       : dirRow.IsBackward);
        }
Exemplo n.º 4
0
        private int CheckConstraint([NotNull] DirectedRow line,
                                    [CanBeNull] IRow centroid)
        {
            if (_constraintHelper == null && centroid != null)
            {
                _constraintHelper = CreateConstraintHelper(
                    line.Row.Row.Table, centroid.Table);
            }

            Assert.Null(line.LeftCentroid, "left centroid is not null");

            var errorCount = 0;

            if (line.RightCentroid != null)
            {
                var lineFeature = (IFeature)line.Row.Row;

                if (centroid != null &&
                    !_constraintHelper.MatchesConstraint(lineFeature,
                                                         centroid,
                                                         line.RightCentroid))
                {
                    errorCount +=
                        ReportError(
                            _constraintHelper.ToString(lineFeature,
                                                       centroid,
                                                       line.RightCentroid),
                            lineFeature.Shape,
                            Codes[Code.DoesNotMatchConstraint], null,
                            lineFeature, centroid, line.RightCentroid);
                }

                line.RightCentroid = null;
            }
            else
            {
                line.LeftCentroid = centroid;
            }

            return(errorCount);
        }
Exemplo n.º 5
0
        private int CheckConsistentOrientation([NotNull] LineList <DirectedRow> polygonLineList)
        {
            int         errorCount = 0;
            DirectedRow row0       = polygonLineList.DirectedRows.Last.Value;

            foreach (DirectedRow row1 in polygonLineList.DirectedRows)
            {
                if (row0.IsBackward != row1.IsBackward)
                {
                    const string description = "Inconsistent orientation";

                    errorCount += ReportError(description,
                                              row0.ToPoint,
                                              Codes[Code.InconsistentOrientation], null,
                                              row0.Row.Row, row1.Row.Row);
                }

                row0 = row1;
            }

            return(errorCount);
        }