// 更新子类群。 private void _UpdateChildren() { Taxon currentTaxon = Common.CurrentTaxon; List <(Taxon, bool)> children = new List <(Taxon, bool)>(); foreach (var child in currentTaxon.GetNamedChildren(true)) { // 添加当前类群的具名子类群(若当前类群是并系群,则只添加未被排除的具名子类群) if (currentTaxon.Excludes.Count > 0) { bool childIsExcludedByCurrent = false; foreach (var exclude in currentTaxon.Excludes) { if (exclude.IsNamed) { if (child == exclude) { childIsExcludedByCurrent = true; break; } } else { foreach (var item in exclude.GetNamedChildren(true)) { if (child == item) { childIsExcludedByCurrent = true; break; } } } } if (!childIsExcludedByCurrent) { children.Add((child, false)); } } else { children.Add((child, false)); } // 若具名子类群是并系群,添加并系群排除的类群 foreach (var exclude in child.Excludes) { if (exclude.IsNamed) { children.Add((exclude, true)); } else { foreach (var item in exclude.GetNamedChildren(true)) { children.Add((item, true)); } } } } // 若当前类群是复系群,添加复系群包含的类群 foreach (var include in currentTaxon.Includes) { if (include.IsNamed) { children.Add((include, true)); } else { foreach (var item in include.GetNamedChildren(true)) { children.Add((item, true)); } } } Common.UpdateTaxonList(taxonButtonGroup_Children, children); }