private void _UpdateTaxon() { if (_Taxon is not null) { Rank rank = _Taxon.Rank; if (_Taxon.IsAnonymous) { textBlock_RankName.Text = string.Empty; } else { if (rank.IsUnranked() || rank.IsClade()) { if (_Taxon.IsParaphyly) { textBlock_RankName.Text = "并系群"; } else if (_Taxon.IsPolyphyly) { textBlock_RankName.Text = "复系群"; } else { if (rank.IsUnranked()) { textBlock_RankName.Text = string.Empty; } else { textBlock_RankName.Text = rank.GetChineseName(); } } } else { textBlock_RankName.Text = rank.GetChineseName(); } } textBlock_TaxonName.Text = _Taxon.GetShortName(); bool basicPrimary = rank.IsBasicPrimaryRank(); bool bellowGenus = false; if (rank.IsPrimaryOrSecondaryRank()) { Rank inheritedPrimaryRank = _Taxon.GetInheritedPrimaryRank(); bellowGenus = inheritedPrimaryRank.IsPrimaryRank() && inheritedPrimaryRank <= Rank.Genus; } textBlock_RankName.FontStyle = textBlock_TaxonName.FontStyle = bellowGenus ? FontStyles.Italic : FontStyles.Normal; textBlock_RankName.FontWeight = textBlock_TaxonName.FontWeight = basicPrimary ? FontWeights.Bold : FontWeights.Normal; // _UpdateIsUndet(); if (_Taxon.IsNamed && _Taxon.IsExtinct) { if (exSymbol is null) { exSymbol = new ExSymbol() { Margin = new Thickness(0, 0, 3, 0) }; panel_State.Children.Add(exSymbol); } else { exSymbol.Visibility = Visibility.Visible; } } else { if (exSymbol is not null) { exSymbol.Visibility = Visibility.Collapsed; } } if (_Taxon.IsNamed && _Taxon.IsParaphyly) { if (paraphylySymbol is null) { paraphylySymbol = new ParaphylySymbol() { Margin = new Thickness(3, 0, 0, 0), VerticalAlignment = VerticalAlignment.Top }; grid_PolyOrPara.Children.Add(paraphylySymbol); } else { paraphylySymbol.Visibility = Visibility.Visible; } } else { if (paraphylySymbol is not null) { paraphylySymbol.Visibility = Visibility.Collapsed; } } if (_Taxon.IsNamed && _Taxon.IsPolyphyly) { if (polyphylySymbol is null) { polyphylySymbol = new PolyphylySymbol() { Margin = new Thickness(3, 0, 0, 0), VerticalAlignment = VerticalAlignment.Top }; grid_PolyOrPara.Children.Add(polyphylySymbol); } else { polyphylySymbol.Visibility = Visibility.Visible; } } else { if (polyphylySymbol is not null) { polyphylySymbol.Visibility = Visibility.Collapsed; } } } }
// 获取继承的基本主要分类阶元。 public static Rank GetInheritedBasicPrimaryRank(this Taxon taxon) { return(taxon.GetInheritedPrimaryRank().BasicRank()); }