Exemplo n.º 1
0
        private string GetLabel(IonType type, int ordinal, TransitionLosses losses, int charge, double mz, int rank, bool showMz)
        {
            var label = new StringBuilder(type.GetLocalizedString());

            if (!Transition.IsPrecursor(type))
            {
                label.Append(ordinal.ToString(LocalizationHelper.CurrentCulture));
            }
            if (losses != null)
            {
                label.Append(" -"); // Not L10N
                label.Append(Math.Round(losses.Mass, 1));
            }
            string chargeIndicator = (charge == 1 ? string.Empty : Transition.GetChargeIndicator(charge));

            label.Append(chargeIndicator);
            if (showMz)
            {
                label.Append(string.Format(" = {0:F01}", mz)); // Not L10N
            }
            if (rank > 0 && ShowRanks)
            {
                label.Append(TextUtil.SEPARATOR_SPACE).Append(string.Format("({0})", string.Format(Resources.AbstractSpectrumGraphItem_GetLabel_rank__0__, rank))); // Not L10N
            }
            return(label.ToString());
        }
Exemplo n.º 2
0
        public string GetFragmentIonName(CultureInfo cultureInfo, double?tolerance = null)
        {
            if (IsCustom() && !IsPrecursor())
            {
                return(CustomIon.ToString(tolerance));
            }
            string ionName = ReferenceEquals(cultureInfo, CultureInfo.InvariantCulture)
                ? IonType.ToString() : IonType.GetLocalizedString();

            if (!IsPrecursor())
            {
                ionName += Ordinal;
            }
            return(ionName);
        }
Exemplo n.º 3
0
 private string GetLabel(IonType type, int ordinal, TransitionLosses losses, int charge, double mz, int rank, bool showMz)
 {
     var label = new StringBuilder(type.GetLocalizedString());
     if (!Transition.IsPrecursor(type))
         label.Append(ordinal.ToString(LocalizationHelper.CurrentCulture));
     if (losses != null)
     {
         label.Append(" -"); // Not L10N
         label.Append(Math.Round(losses.Mass, 1));
     }
     string chargeIndicator = (charge == 1 ? string.Empty : Transition.GetChargeIndicator(charge));
     label.Append(chargeIndicator);
     if (showMz)
         label.Append(string.Format(" = {0:F01}", mz)); // Not L10N
     if (rank > 0 && ShowRanks)
         label.Append(TextUtil.SEPARATOR_SPACE).Append(string.Format("({0})",string.Format(Resources.AbstractSpectrumGraphItem_GetLabel_rank__0__, rank))); // Not L10N
     return label.ToString();
 }