private ICollection <IFeature> GetConnectedBorderFeatures(
            [NotNull] IPoint point,
            [NotNull] IFeature lineFeature, int lineClassIndex,
            int borderClassIndex)
        {
            ITable borderClass = InvolvedTables[borderClassIndex];

            ISpatialFilter spatialFilter = _filters[borderClassIndex];

            spatialFilter.Geometry = point;

            var result = new List <IFeature>(5);

            BorderMatchCondition borderMatchCondition =
                GetBorderMatchCondition(lineClassIndex);

            foreach (IRow borderRow in Search(borderClass,
                                              spatialFilter,
                                              _filterHelpers[borderClassIndex]))
            {
                if (!borderMatchCondition.IsFulfilled(lineFeature, lineClassIndex,
                                                      borderRow, borderClassIndex))
                {
                    continue;
                }

                result.Add((IFeature)borderRow);
            }

            return(result);
        }
        private bool IsCoincidentWithNeighborBorder(
            [NotNull] BorderConnection borderConnection,
            [NotNull] IFeature neighborFeature, int neighborLineClassIndex,
            int neighborBorderClassIndex)
        {
            ITable neighborBorderClass = InvolvedTables[neighborBorderClassIndex];

            ISpatialFilter spatialFilter = _filters[neighborBorderClassIndex];

            spatialFilter.Geometry = borderConnection.Point;

            BorderMatchCondition neighborBorderMatchCondition =
                GetBorderMatchCondition(neighborLineClassIndex);

            foreach (IRow borderRow in Search(neighborBorderClass,
                                              spatialFilter,
                                              _filterHelpers[neighborBorderClassIndex]))
            {
                if (neighborBorderMatchCondition.IsFulfilled(neighborFeature,
                                                             neighborLineClassIndex,
                                                             borderRow,
                                                             neighborBorderClassIndex))
                {
                    return(true);
                }
            }

            return(false);
        }
        private BorderMatchCondition GetBorderMatchCondition(int pointClassIndex)
        {
            if (IsPointClass1(pointClassIndex))
            {
                return(_pointClass1BorderMatchCondition ??
                       (_pointClass1BorderMatchCondition =
                            new BorderMatchCondition(_pointClass1BorderMatchConditionSql,
                                                     GetSqlCaseSensitivity(pointClassIndex,
                                                                           _borderClass1Index))));
            }

            if (IsPointClass2(pointClassIndex))
            {
                return(_pointClass2BorderMatchCondition ??
                       (_pointClass2BorderMatchCondition =
                            new BorderMatchCondition(_pointClass2BorderMatchConditionSql,
                                                     GetSqlCaseSensitivity(pointClassIndex,
                                                                           _borderClass2Index))));
            }

            throw new ArgumentException("Not a line class index");
        }