コード例 #1
0
        public IEnumerable <ExceptionObject> Search(
            [NotNull] ExceptionObject exceptionObject)
        {
            if (_boxTree == null)
            {
                _boxTree = CreateBoxTree(_exceptionObjects, _xyTolerance);

                _exceptionObjects.Clear();
            }

            if (_boxTree.Count == 0 || exceptionObject.ShapeEnvelope == null)
            {
                yield break;
            }

            IBox searchBox = GeomUtils.CreateBox(exceptionObject.ShapeEnvelope, _xyTolerance);

            foreach (BoxTree <ExceptionObject> .TileEntry tileEntry in _boxTree.Search(searchBox)
                     )
            {
                ExceptionObject candidateExceptionObject = tileEntry.Value;

                if (Matches(candidateExceptionObject, tileEntry.Box,
                            exceptionObject.ShapeEnvelope))
                {
                    yield return(candidateExceptionObject);
                }
            }
        }
コード例 #2
0
        public IEnumerable <ExceptionObject> Search([NotNull] IGeometry geometry)
        {
            if (_boxTree == null)
            {
                _boxTree = CreateBoxTree(_exceptionObjects, _xyTolerance);

                _exceptionObjects.Clear();
            }

            if (_boxTree.Count == 0 || geometry.IsEmpty)
            {
                yield break;
            }

            IBox searchBox = QaGeometryUtils.CreateBox(geometry, _xyTolerance);

            IBox issueBox        = null;
            IBox clippedIssueBox = null;

            foreach (BoxTree <ExceptionObject> .TileEntry tileEntry in _boxTree.Search(searchBox)
                     )
            {
                ExceptionObject exceptionObject = tileEntry.Value;

                if (issueBox == null)
                {
                    issueBox = GetBox(geometry);
                }

                if (Matches(exceptionObject, tileEntry.Box, issueBox))
                {
                    yield return(exceptionObject);
                }
                else
                {
                    // Check if clipped envelope matches
                    if (_areaOfInterestBox == null ||
                        _areaOfInterestBox.Contains(issueBox) ||
                        exceptionObject.AreaOfInterestShapeEnvelope == null)
                    {
                        continue;
                    }

                    if (clippedIssueBox == null)
                    {
                        clippedIssueBox = GetBox(GetClippedGeometry(geometry, _areaOfInterestBox));
                    }

                    if (Matches(exceptionObject, exceptionObject.AreaOfInterestShapeEnvelope,
                                clippedIssueBox))
                    {
                        yield return(exceptionObject);
                    }
                }
            }
        }
コード例 #3
0
        private static ExceptionsBoxTree CreateBoxTree(
            [NotNull] ICollection <ExceptionObject> exceptionObjects,
            double expansionDistance)
        {
            IBox box = GetBox(exceptionObjects, expansionDistance);

            var result = new ExceptionsBoxTree();

            if (box != null)
            {
                result.InitSize(new IGmtry[] { box });
            }

            foreach (ExceptionObject exceptionObject in exceptionObjects)
            {
                if (exceptionObject.ShapeEnvelope != null)
                {
                    result.Add(exceptionObject.ShapeEnvelope, exceptionObject);
                }
            }

            return(result);
        }