private IBox GetCurrentRowToleranceBox(int tableIndex) { if (CurrentTestRow == null) { return(null); } if (_cachedRow == null) { return(QaGeometryUtils.CreateBox(CurrentTestRow.DataReference.Extent)); } IBox currentBox = _cachedRow.Extent; double searchTolerance = GetSearchTolerance(_cachedTableIndex, tableIndex); IBox toleranceBox = currentBox.Clone(); toleranceBox.Min.X -= searchTolerance; toleranceBox.Min.Y -= searchTolerance; toleranceBox.Max.X += searchTolerance; toleranceBox.Max.Y += searchTolerance; return(toleranceBox); }
public ExceptionObjectEvaluator( [NotNull] IEnumerable <ExceptionObject> exceptionObjects, [NotNull] IDictionary <Guid, QualityCondition> conditionsByUuid, [NotNull] IExceptionEvaluationStatistics exceptionEvaluationStatistics, [NotNull] IQualityConditionObjectDatasetResolver datasetResolver, [CanBeNull] InvolvedObjectsMatchCriteria involvedObjectsMatchCriteria, [CanBeNull] IGeometry areaOfInterest) { Assert.ArgumentNotNull(exceptionObjects, nameof(exceptionObjects)); Assert.ArgumentNotNull(conditionsByUuid, nameof(conditionsByUuid)); Assert.ArgumentNotNull(exceptionEvaluationStatistics, nameof(exceptionEvaluationStatistics)); Assert.ArgumentNotNull(datasetResolver, nameof(datasetResolver)); _conditionsByUuid = conditionsByUuid; _exceptionEvaluationStatistics = exceptionEvaluationStatistics; _datasetResolver = datasetResolver; _involvedObjectsMatchCriteria = involvedObjectsMatchCriteria; _aoiBox = areaOfInterest == null || areaOfInterest.IsEmpty ? null : QaGeometryUtils.CreateBox(areaOfInterest.Envelope); foreach (ExceptionObject exceptionObject in exceptionObjects) { Add(exceptionObject); } }
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); } } } }
protected override int CompleteTileCore(TileInfo args) { if (args.State == TileState.Initial) { _tileFeatures.Clear(); _tileAreasOfInterest.Clear(); _allBox = null; _knownGaps = null; return(NoError); } try { if (_allBox == null) { Assert.NotNull(args.AllBox, "args.AllBox"); _allBox = QaGeometryUtils.CreateBox(Assert.NotNull(args.AllBox, "AllBox")); } if (_knownGaps == null) { _knownGaps = new KnownGaps(_maxArea, _tolerance, _allBox); } Assert.NotNull(args.CurrentEnvelope, "args.CurrentEnvelope"); IEnvelope tileEnvelope = GeometryFactory.Clone(Assert.NotNull(args.CurrentEnvelope, "CurrentEnvelope")); tileEnvelope.SpatialReference = _spatialReference; var errorCount = 0; foreach (IEnvelope subtile in GetSubtiles(tileEnvelope)) { errorCount += CheckSubtile(subtile, _allBox, _tileFeatures, _knownGaps); // this can be the entire (cloned) tileEnvelope: Marshal.ReleaseComObject(subtile); GC.Collect(); GC.WaitForPendingFinalizers(); } if (args.State == TileState.Final) { _knownGaps = null; } return(errorCount); } finally { _tileFeatures.Clear(); } }
private static ExceptionObject CreateExceptionObject(int id, [NotNull] IGeometry geometry) { Box box = QaGeometryUtils.CreateBox(geometry); return(new ExceptionObject(id, new Guid(), new Guid(), box, 0.001, geometry.GeometryType, ShapeMatchCriterion.EqualEnvelope, "Issue.Code", "SHAPE", new InvolvedTable[] { })); }
public RastersRowEnumerable( [NotNull] IDictionary <RasterReference, IRaster> rasters, [NotNull] ITestProgress progress) { Assert.ArgumentNotNull(rasters, nameof(rasters)); Assert.ArgumentNotNull(progress, nameof(progress)); _rastersDict = rasters; _progress = progress; IEnvelope extent = null; var minDx = double.MaxValue; foreach (var raster in rasters.Values) { var props = (IRasterProps)raster; minDx = Math.Min(props.MeanCellSize().X, minDx); if (extent == null) { extent = props.Extent.Envelope; } else { extent.Union(props.Extent.Envelope); } } if (extent != null) { _extent = QaGeometryUtils.CreateBox(extent); } // TODO: adapt cellsize according to minDx MaxRasterPointCount = _defaultMaxRasterPointCount; }
protected override Box GetExtent() { Box extent = QaGeometryUtils.CreateBox(_feature.Shape); return(extent); }
private List <BoxTree <CachedRow> .TileEntry> SearchList( [NotNull] IGeometry searchGeometry, int tableIndex) { Assert.ArgumentNotNull(searchGeometry, nameof(searchGeometry)); IBox searchGeometryBox = QaGeometryUtils.CreateBox(searchGeometry, GetXYTolerance(tableIndex)); BoxTree <CachedRow> boxTree = _rowBoxTrees[tableIndex]; if (_currentRowNeighbors == null) { _currentRowNeighbors = new BoxSelection[_cachedTableCount]; } BoxSelection currentRowBoxSelection = _currentRowNeighbors[tableIndex]; if (currentRowBoxSelection == null) { currentRowBoxSelection = CreateCurrentRowToleranceSelection(tableIndex); _currentRowNeighbors[tableIndex] = currentRowBoxSelection; } IBox searchBox = null; var isWithin = false; if (currentRowBoxSelection != null) { isWithin = currentRowBoxSelection.Box.Contains(searchGeometryBox); } if (!isWithin) { searchBox = searchGeometryBox; } else if (currentRowBoxSelection.Selection == null) { searchBox = currentRowBoxSelection.Box; } List <BoxTree <CachedRow> .TileEntry> tileEntries; if (searchBox != null) { tileEntries = new List <BoxTree <CachedRow> .TileEntry>(); foreach ( BoxTree <CachedRow> .TileEntry tileEntry in boxTree.Search(searchBox)) { tileEntries.Add(tileEntry); } if (isWithin) { currentRowBoxSelection.Selection = tileEntries; } } else { tileEntries = currentRowBoxSelection.Selection; } if (!isWithin || searchGeometryBox.Contains(currentRowBoxSelection.Box)) { return(tileEntries); } // drop non intersection lines Assert.NotNull(tileEntries, "tileEntries"); var reducedList = new List <BoxTree <CachedRow> .TileEntry>(tileEntries.Count); foreach (BoxTree <CachedRow> .TileEntry tileEntry in tileEntries) { if (tileEntry.Box.Intersects(searchGeometryBox)) { reducedList.Add(tileEntry); } } return(reducedList); }
public SimpleBaseRow([NotNull] IFeature feature) : base(feature, QaGeometryUtils.CreateBox(feature.Shape), GetOidList(feature)) { }