/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public override IMeasuredLabelItem[] GetMeasuredItems(Graphics g, FontX font, System.Drawing.StringFormat strfmt, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) { titems[i] = _prefix + titems[i] + _suffix; } } var litems = new MeasuredLabelItem[titems.Length]; FontX localfont = font; var localstrfmt = (StringFormat)strfmt.Clone(); StringAlignment horizontalAlignment = localstrfmt.Alignment; StringAlignment verticalAlignment = localstrfmt.LineAlignment; localstrfmt.Alignment = StringAlignment.Near; localstrfmt.LineAlignment = StringAlignment.Near; for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, localstrfmt, titems[i], _relativeLineSpacing, horizontalAlignment, verticalAlignment, _textBlockAlignment); } return(litems); }
/// <summary> /// Measured a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public virtual IMeasuredLabelItem[] GetMeasuredItems(Graphics g, System.Drawing.Font font, System.Drawing.StringFormat strfmt, AltaxoVariant[] items) { string[] titems = FormatItems(items); MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length]; Font localfont = (Font)font.Clone(); StringFormat localstrfmt = (StringFormat)strfmt.Clone(); for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, localstrfmt, titems[i]); } return(litems); }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public override IMeasuredLabelItem[] GetMeasuredItems(IGraphicsContext3D g, FontX3D font, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) { titems[i] = _prefix + titems[i] + _suffix; } } var litems = new MeasuredLabelItem[titems.Length]; FontX3D localfont = font; for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, titems[i], _relativeLineSpacing, Alignment.Near, Alignment.Near, _textBlockAlignment); } return(litems); }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public virtual IMeasuredLabelItem[] GetMeasuredItems(IGraphicsContext3D g, FontX3D font, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) { titems[i] = _prefix + titems[i] + _suffix; } } var litems = new MeasuredLabelItem[titems.Length]; FontX3D localfont = font; for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, titems[i]); } return(litems); }
public override IMeasuredLabelItem[] GetMeasuredItems(Graphics g, Font font, StringFormat strfmt, Altaxo.Data.AltaxoVariant[] items) { MeasuredLabelItem[] litems = new MeasuredLabelItem[items.Length]; Font localfont1 = (Font)font.Clone(); Font localfont2 = new Font(font.FontFamily, font.Size * 2 / 3, font.Style, GraphicsUnit.World); StringFormat localstrfmt = (StringFormat)strfmt.Clone(); string[] firstp = new string[items.Length]; string[] expos = new string[items.Length]; float maxexposize = 0; for (int i = 0; i < items.Length; ++i) { string firstpart, exponent; if (items[i].IsType(Altaxo.Data.AltaxoVariant.Content.VDouble)) { SplitInFirstPartAndExponent((double)items[i], out firstpart, out exponent); } else { firstpart = items[i].ToString(); exponent = string.Empty; } firstp[i] = firstpart; expos[i] = exponent; maxexposize = Math.Max(maxexposize, g.MeasureString(exponent, localfont2, new PointF(0, 0), strfmt).Width); } for (int i = 0; i < items.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont1, localfont2, localstrfmt, firstp[i], expos[i], maxexposize); } return(litems); }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public virtual IMeasuredLabelItem[] GetMeasuredItems(Graphics g, FontX font, System.Drawing.StringFormat strfmt, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) { titems[i] = _prefix + titems[i] + _suffix; } } var litems = new MeasuredLabelItem[titems.Length]; FontX localfont = font; var localstrfmt = (StringFormat)strfmt.Clone(); for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, localstrfmt, titems[i]); } return(litems); }
public override IMeasuredLabelItem[] GetMeasuredItems(IGraphicsContext3D g, FontX3D font, AltaxoVariant[] items) { var litems = new MeasuredLabelItem[items.Length]; var localfont1 = font; var localfont2 = font.WithSize(font.Size * 2 / 3); string[] firstp = new string[items.Length]; string[] middel = new string[items.Length]; string[] expos = new string[items.Length]; double[] mants = new double[items.Length]; double maxexposize = 0; int firstpartmin = int.MaxValue; int firstpartmax = int.MinValue; for (int i = 0; i < items.Length; ++i) { string firstpart, exponent; if (items[i].IsType(Altaxo.Data.AltaxoVariant.Content.VDouble)) { SplitInFirstPartAndExponent(items[i], out firstpart, out mants[i], out middel[i], out exponent); if (exponent.Length > 0) { firstpartmin = Math.Min(firstpartmin, firstpart.Length); firstpartmax = Math.Max(firstpartmax, firstpart.Length); } } else { firstpart = items[i].ToString(); middel[i] = string.Empty; exponent = string.Empty; } firstp[i] = firstpart; expos[i] = exponent; maxexposize = Math.Max(maxexposize, g.MeasureString(exponent, localfont2, PointD3D.Empty).X); } if (firstpartmax > 0 && firstpartmax > firstpartmin) // then we must use special measures to equilibrate the mantissa { firstp = NumericLabelFormattingAuto.FormatItems(mants); } for (int i = 0; i < items.Length; ++i) { string mid = string.Empty; if (!string.IsNullOrEmpty(expos[i])) { if (string.IsNullOrEmpty(firstp[i])) { mid = "10"; } else { mid = "\u00D710"; } } litems[i] = new MeasuredLabelItem(g, localfont1, localfont2, _prefix + firstp[i] + mid, expos[i], _suffix, maxexposize); } return(litems); }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public override IMeasuredLabelItem[] GetMeasuredItems(IGraphicsContext3D g, FontX3D font, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) titems[i] = _prefix + titems[i] + _suffix; } MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length]; FontX3D localfont = font; for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, titems[i], _relativeLineSpacing, Alignment.Near, Alignment.Near, _textBlockAlignment); } return litems; }
/// <summary> /// Measured a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public virtual IMeasuredLabelItem[] GetMeasuredItems(Graphics g, System.Drawing.Font font, System.Drawing.StringFormat strfmt, AltaxoVariant[] items) { string[] titems = FormatItems(items); MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length]; Font localfont = (Font)font.Clone(); StringFormat localstrfmt = (StringFormat)strfmt.Clone(); for(int i=0;i<titems.Length;++i) { litems[i] = new MeasuredLabelItem(g,localfont,localstrfmt,titems[i]); } return litems; }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public virtual IMeasuredLabelItem[] GetMeasuredItems(Graphics g, FontX font, System.Drawing.StringFormat strfmt, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) titems[i] = _prefix + titems[i] + _suffix; } MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length]; FontX localfont = font; StringFormat localstrfmt = (StringFormat)strfmt.Clone(); for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, localstrfmt, titems[i]); } return litems; }
public override IMeasuredLabelItem[] GetMeasuredItems(Graphics g, Font font, StringFormat strfmt, Altaxo.Data.AltaxoVariant[] items) { MeasuredLabelItem[] litems = new MeasuredLabelItem[items.Length]; Font localfont1 = (Font)font.Clone(); Font localfont2 = new Font(font.FontFamily, font.Size * 2 / 3, font.Style, GraphicsUnit.World); StringFormat localstrfmt = (StringFormat)strfmt.Clone(); string[] firstp = new string[items.Length]; string[] expos = new string[items.Length]; float maxexposize=0; for (int i = 0; i < items.Length; ++i) { string firstpart, exponent; if (items[i].IsType(Altaxo.Data.AltaxoVariant.Content.VDouble)) { SplitInFirstPartAndExponent((double)items[i], out firstpart, out exponent); } else { firstpart = items[i].ToString(); exponent = string.Empty; } firstp[i] = firstpart; expos[i] = exponent; maxexposize = Math.Max(maxexposize,g.MeasureString(exponent,localfont2,new PointF(0,0),strfmt).Width); } for (int i = 0; i < items.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont1, localfont2, localstrfmt, firstp[i],expos[i],maxexposize); } return litems; }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public virtual IMeasuredLabelItem[] GetMeasuredItems(IGraphicsContext3D g, FontX3D font, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) titems[i] = _prefix + titems[i] + _suffix; } MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length]; FontX3D localfont = font; for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, titems[i]); } return litems; }
public override IMeasuredLabelItem[] GetMeasuredItems(Graphics g, FontX font, StringFormat strfmt, Altaxo.Data.AltaxoVariant[] items) { MeasuredLabelItem[] litems = new MeasuredLabelItem[items.Length]; FontX localfont1 = font; FontX localfont2 = font.WithSize(font.Size * 2 / 3); StringFormat localstrfmt = (StringFormat)strfmt.Clone(); string[] firstp = new string[items.Length]; string[] middel = new string[items.Length]; string[] expos = new string[items.Length]; double[] mants = new double[items.Length]; float maxexposize = 0; int firstpartmin = int.MaxValue; int firstpartmax = int.MinValue; for (int i = 0; i < items.Length; ++i) { string firstpart, exponent; if (items[i].IsType(Altaxo.Data.AltaxoVariant.Content.VDouble)) { SplitInFirstPartAndExponent((double)items[i], out firstpart, out mants[i], out middel[i], out exponent); if (exponent.Length > 0) { firstpartmin = Math.Min(firstpartmin, firstpart.Length); firstpartmax = Math.Max(firstpartmax, firstpart.Length); } } else { firstpart = items[i].ToString(); middel[i] = string.Empty; exponent = string.Empty; } firstp[i] = firstpart; expos[i] = exponent; maxexposize = Math.Max(maxexposize, g.MeasureString(exponent, GdiFontManager.ToGdi(localfont2), new PointF(0, 0), strfmt).Width); } if (firstpartmax > 0 && firstpartmax > firstpartmin) // then we must use special measures to equilibrate the mantissa { firstp = NumericLabelFormattingAuto.FormatItems(mants); } for (int i = 0; i < items.Length; ++i) { string mid = string.Empty; if (!string.IsNullOrEmpty(expos[i])) { if (string.IsNullOrEmpty(firstp[i])) mid = "10"; else mid = "\u00D710"; } litems[i] = new MeasuredLabelItem(g, localfont1, localfont2, localstrfmt, _prefix + firstp[i] + mid, expos[i], _suffix, maxexposize); } return litems; }
/// <summary> /// Measures a couple of items and prepares them for being drawn. /// </summary> /// <param name="g">Graphics context.</param> /// <param name="font">Font used.</param> /// <param name="strfmt">String format used.</param> /// <param name="items">Array of items to be drawn.</param> /// <returns>An array of <see cref="IMeasuredLabelItem" /> that can be used to determine the size of each item and to draw it.</returns> public override IMeasuredLabelItem[] GetMeasuredItems(Graphics g, FontX font, System.Drawing.StringFormat strfmt, AltaxoVariant[] items) { string[] titems = FormatItems(items); if (!string.IsNullOrEmpty(_prefix) || !string.IsNullOrEmpty(_suffix)) { for (int i = 0; i < titems.Length; ++i) titems[i] = _prefix + titems[i] + _suffix; } MeasuredLabelItem[] litems = new MeasuredLabelItem[titems.Length]; FontX localfont = font; StringFormat localstrfmt = (StringFormat)strfmt.Clone(); StringAlignment horizontalAlignment = localstrfmt.Alignment; StringAlignment verticalAlignment = localstrfmt.LineAlignment; localstrfmt.Alignment = StringAlignment.Near; localstrfmt.LineAlignment = StringAlignment.Near; for (int i = 0; i < titems.Length; ++i) { litems[i] = new MeasuredLabelItem(g, localfont, localstrfmt, titems[i], _relativeLineSpacing, horizontalAlignment, verticalAlignment, _textBlockAlignment); } return litems; }