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); } } }
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); } } } }
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); }