protected override int ExecuteCore(IRow row, int tableIndex) { if (tableIndex > 0) { return(NoError); } if (_filter == null) { InitFilter(); } ISpatialFilter filter = Assert.NotNull(_filter, "_filter"); var processed0 = new SegmentNeighbors(new SegmentPartComparer()); IGeometry geom0 = ((IFeature)row).Shape; IEnvelope box0 = geom0.Envelope; box0.Expand(SearchDistance, SearchDistance, false); filter.Geometry = box0; var errorCount = 0; double maxNear = SearchDistance; const int neighborTableIndex = 1; IFeatureRowsDistance rowsDistance = NearDistanceProvider.GetRowsDistance(row, tableIndex); foreach (IRow neighborRow in Search((ITable)_reference, filter, _helper, geom0)) { var rowNeighbor = (IFeature)neighborRow; if (IgnoreNeighbor(row, neighborRow)) { continue; } SegmentNeighbors processed1; var neighborKey = new RowKey(rowNeighbor, neighborTableIndex); if (!ProcessedList.TryGetValue(neighborKey, out processed1)) { processed1 = new SegmentNeighbors(new SegmentPartComparer()); ProcessedList.Add(neighborKey, processed1); } NeighborhoodFinder finder = GetNeighborhoodFinder(rowsDistance, (IFeature)row, tableIndex, rowNeighbor, neighborTableIndex); errorCount += FindNeighborhood(finder, tableIndex, processed0, neighborTableIndex, processed1, maxNear); } return(errorCount); }
private void RemoveVersion(Item item) { var itemSig = $"{item.Database}:{item.ID}/{item.Language}#{item.Version}"; if (ProcessedList.Contains(itemSig)) { return; } ProcessedList.Add(itemSig); if (!ShouldProcess(item.GetProviderPath() + ", Lang:" + item.Language.Name + ", Ver:" + item.Version.Number, confirmMessage)) { return; } var hasArchive = IsParameterSpecified(nameof(Archive)); var hasPermanently = IsParameterSpecified(nameof(Permanently)); if (hasArchive && hasPermanently) { WriteError(typeof(ParameterBindingException), "Parameter set cannot be resolved using the specified named parameters. Detected Archive and Permanently parameters provided.", ErrorIds.AmbiguousParameterSet, ErrorCategory.InvalidOperation, null); return; } if (IsParameterSpecified("Archive")) { var archive = ArchiveManager.GetArchive("archive", item.Database); if (archive == null) { return; } WriteVerbose($"Removing item {itemSig} and moving to the archive {archive.Name} in database {item.Database}"); archive.ArchiveVersion(item); } else if (IsParameterSpecified("Permanently")) { WriteVerbose($"Removing item {itemSig} permanently."); item.Versions.RemoveVersion(); } else { var archive = ArchiveManager.GetArchive("recyclebin", item.Database); if (archive == null) { return; } WriteVerbose($"Removing item {itemSig} and moving to the archive {archive.Name} in database {item.Database}"); archive.ArchiveVersion(item); } }
private void RemoveVersion(Item item) { var itemSig = $"{item.Database}:{item.ID}/{item.Language}#{item.Version}"; if (!ProcessedList.Contains(itemSig)) { ProcessedList.Add(itemSig); if ( ShouldProcess( item.GetProviderPath() + ", Lang:" + item.Language.Name + ", Ver:" + item.Version.Number, confirmMessage)) { item.Versions.RemoveVersion(); } } }
protected override int ExecuteCore(IRow row, int tableIndex) { if (tableIndex != 0) { return(NoError); } if (_spatialFilters == null) { InitFilter(); } IList <ISpatialFilter> filters = Assert.NotNull(_spatialFilters); // iterating over all needed tables int neighborTableIndex = -1; IGeometry geom0 = ((IFeature)row).Shape; geom0.QueryEnvelope(_queryBox); SegmentNeighbors processed0; var rowKey = new RowKey(row, tableIndex); if (!ProcessedList.TryGetValue(rowKey, out processed0)) { // add to process List processed0 = new SegmentNeighbors(new SegmentPartComparer()); ProcessedList.Add(rowKey, processed0); } _queryBox.Expand(SearchDistance, SearchDistance, false); double maxNear = SearchDistance; IFeatureRowsDistance rowsDistance = NearDistanceProvider.GetRowsDistance(row, tableIndex); foreach (IFeatureClass neighborFeatureClass in _referenceList) { neighborTableIndex++; ISpatialFilter spatialFilter = filters[neighborTableIndex]; spatialFilter.Geometry = _queryBox; var neighborTable = (ITable)neighborFeatureClass; foreach (IRow neighborRow in Search(neighborTable, spatialFilter, _helperList[neighborTableIndex], geom0)) { if (IgnoreNeighbor(row, neighborRow, neighborTableIndex)) { continue; } var neighborFeature = (IFeature)neighborRow; var processed1 = new SegmentNeighbors(new SegmentPartComparer()); var finder = new FullNeighborhoodFinder( rowsDistance, (IFeature)row, tableIndex, neighborFeature, neighborTableIndex); FindNeighborhood(finder, tableIndex, processed0, neighborTableIndex, processed1, maxNear); } } // Remark: here only the neighborhood properties are found // if these properties are correct is checked in OnProgressedChanged return(NoError); }
protected override int ExecuteCore(IRow row, int tableIndex) { if (tableIndex > 0) { return(NoError); } var feature = row as IFeature; if (feature == null) { return(NoError); } if (_filter == null) { InitFilter(); Assert.NotNull(_filter, "_filter"); } var processed0 = new SegmentNeighbors(new SegmentPartComparer()); IGeometry geom0 = feature.Shape; IEnvelope box0 = geom0.Envelope; const bool asRatio = false; box0.Expand(SearchDistance, SearchDistance, asRatio); ISpatialFilter filter = Assert.NotNull(_filter); filter.Geometry = box0; var errorCount = 0; double maxNear = SearchDistance; const int referenceTableIndex = 0; IFeatureRowsDistance rowsDistance = NearDistanceProvider.GetRowsDistance(feature, tableIndex); foreach (IRow neighborRow in Search((ITable)_reference, filter, _helper, geom0)) { var neighborFeature = (IFeature)neighborRow; if (neighborFeature == feature) { continue; } // TODO apply comparison condition to filter out irrelevant pairs if (IgnoreNeighbor(row, neighborRow)) { continue; } SegmentNeighbors processed1; var neighborKey = new RowKey(neighborFeature, referenceTableIndex); if (!ProcessedList.TryGetValue(neighborKey, out processed1)) { processed1 = new SegmentNeighbors(new SegmentPartComparer()); ProcessedList.Add(neighborKey, processed1); } NeighborhoodFinder finder = new NotNearNeighborhoodFinder( rowsDistance, feature, tableIndex, neighborFeature, referenceTableIndex); errorCount += FindNeighborhood(finder, tableIndex, processed0, referenceTableIndex, processed1, maxNear); } return(errorCount); }