protected IEnumerable <Feature> GetApplicableSelectedFeatures( [NotNull] Dictionary <MapMember, List <long> > selectionByLayer, [CanBeNull] NotificationCollection notifications = null) { int filteredCount = 0; int selectionCount = 0; foreach (var oidsByLayer in selectionByLayer) { if (!CanSelectFromLayer(oidsByLayer.Key as Layer, notifications)) { filteredCount += oidsByLayer.Value.Count; continue; } foreach (Feature feature in MapUtils.GetFeatures( oidsByLayer.Key, oidsByLayer.Value)) { yield return(feature); selectionCount++; } } if (filteredCount == 1) { notifications?.Insert( 0, new Notification("The selected feature cannot be used by the tool:")); } if (filteredCount > 1) { notifications?.Insert( 0, new Notification( $"{filteredCount} of {selectionCount + filteredCount} selected features cannot be used by the tool:")); } }