private IEnumerable <AreaSpecification> GetIntersectedAreaSpecifications(
            [NotNull] IGeometry errorGeometry,
            [NotNull] QualityCondition qualityCondition,
            [NotNull] ICollection <InvolvedRow> involvedRows)
        {
            if (_areaSpecifications.Count == 0)
            {
                yield break;
            }

            var            returnedCount        = 0;
            int            totalCount           = _areaSpecifications.Count;
            IList <string> involvedDatasetNames = null;

            for (int index = totalCount - 1; index >= 0; index--)
            {
                AreaSpecification areaSpecification = _areaSpecifications[index];

                if (involvedDatasetNames == null)
                {
                    involvedDatasetNames =
                        involvedRows.Count != 0
                                                        ? involvedRows.Select(row => row.TableName).ToList()
                                                        : qualityCondition.GetDatasetParameterValues().Select(
                            dataset => dataset.Name).ToList();
                }

                if (!areaSpecification.IsAnyDatasetEditable(involvedDatasetNames))
                {
                    // none of the involved datasets is editable in the area specification
                    continue;
                }

                if (areaSpecification.Intersects(errorGeometry))
                {
                    returnedCount++;

                    // the area spec is relevant for the geometry
                    yield return(areaSpecification);
                }
            }

            if (returnedCount == 0)
            {
                // no area specification found so far

                AreaSpecification defaultAreaSpecification = GetDefaultAreaSpecification(null);
                if (defaultAreaSpecification != null)
                {
                    yield return(defaultAreaSpecification);
                }
            }
        }
            public bool Intersects([NotNull] AreaSpecification areaSpecification)
            {
                // area spec has no polygon: false
                // shape is empty: false

                if (Shape == null)
                {
                    return(false);
                }

                if (!_ignoreCurrentTileRelation)
                {
                    switch (areaSpecification.CurrentTileRelation)
                    {
                    case TileRelation.Within:
                        if (FeatureIsWithinCurrentTile)
                        {
                            // feature is within tile, and tile is within area spec
                            // -> feature is within area spec
                            return(true);
                        }

                        break;

                    case TileRelation.Disjoint:
                        if (FeatureIsWithinCurrentTile)
                        {
                            // feature is within tile, and area spec is disjoint from tile
                            // -> feature is disjoint from area spec
                            return(false);
                        }

                        break;

                    case TileRelation.Unknown:
                    case TileRelation.PartialWithin:
                        // in all other cases, the relationship between feature and
                        // area specification will have to be calculated
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                }

                // no shortcuts, the feature must be compared to the area specification polygon
                return(areaSpecification.Intersects(Shape));
            }