Exemplo n.º 1
0
        protected override int ExecuteCore(IRow row, int tableIndex)
        {
            if (tableIndex != 0)
            {
                return(NoError);
            }

            var feature = row as IFeature;

            if (feature == null)
            {
                return(NoError);
            }

            InitFilters();

            feature.Shape.QueryEnvelope(_envelopeTemplate);
            IGeometry searchGeometry = _envelopeTemplate;

            List <PlaneHelper> planeHelpers = null;

            var errorCount = 0;

            for (var relatedTableIndex = 1;
                 relatedTableIndex < InvolvedTables.Count;
                 relatedTableIndex++)
            {
                _filters[relatedTableIndex].Geometry = searchGeometry;
                int i = relatedTableIndex;

                foreach (IRow relatedRow in
                         Search(InvolvedTables[i], _filters[i], _filterHelpers[i]))
                {
                    var relatedFeature = (IFeature)relatedRow;
                    if (!VerifyWithinFeature && relatedFeature == row)
                    {
                        continue;
                    }

                    if (planeHelpers == null)
                    {
                        planeHelpers = GetPlaneHelpers(feature);
                    }

                    IPointsEnumerator points =
                        PointsEnumeratorFactory.Create(relatedFeature, null);

                    foreach (PlaneHelper planeHelper in planeHelpers)
                    {
                        errorCount += Check(planeHelper, points, feature, relatedFeature);
                    }
                }
            }

            return(errorCount);
        }
Exemplo n.º 2
0
        protected override int ExecuteCore(IRow row, int tableIndex)
        {
            var feature = row as IFeature;

            if (feature == null)
            {
                return(NoError);
            }

            return(_vertexCoincidenceChecker.CheckCoincidence(
                       PointsEnumeratorFactory.Create(feature, null),
                       feature));
        }
        protected override int FindErrors(IRow row1, int tableIndex1,
                                          IRow row2, int tableIndex2)
        {
            var feature1 = row1 as IFeature;
            var feature2 = row2 as IFeature;

            if (feature1 == null || feature2 == null)
            {
                return(NoError);
            }

            if (!_vertexCoincidenceChecker.VerifyWithinFeature && (feature1 == feature2))
            {
                return(NoError);
            }

            if (_allowedNonCoincidenceConditionSql != null && (feature1 != feature2))
            {
                if (_allowedNonCoincidenceCondition == null)
                {
                    const bool constraintIsDirected = false;
                    _allowedNonCoincidenceCondition = new ValidRelationConstraint(
                        _allowedNonCoincidenceConditionSql,
                        constraintIsDirected,
                        GetSqlCaseSensitivity());
                }

                string conditionMessage;
                if (_allowedNonCoincidenceCondition.IsFulfilled(row1, tableIndex1,
                                                                row2, tableIndex2,
                                                                out conditionMessage))
                {
                    // non-coincidence is allowed between these two features
                    return(NoError);
                }
            }

            if (_pointsEnumerator == null || _pointsEnumerator.Feature != feature1)
            {
                _pointsEnumerator = PointsEnumeratorFactory.Create(feature1,
                                                                   _pointSearchEnvelope);
            }

            return(_vertexCoincidenceChecker.CheckCoincidence(_pointsEnumerator, feature2));
        }