public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                NumericLabelFormattingAuto s = null != o ? (NumericLabelFormattingAuto)o : new NumericLabelFormattingAuto();

                info.GetBaseValueEmbedded(s, typeof(NumericLabelFormattingBase), parent);
                return(s);
            }
 public void CopyFrom(NumericLabelFormattingAuto from)
 {
     base.CopyFrom(from);
     this._decimalPlaces = from._decimalPlaces;
 }
 public NumericLabelFormattingAuto(NumericLabelFormattingAuto from)
 {
     CopyFrom(from);
 }
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                NumericLabelFormattingAuto s = (NumericLabelFormattingAuto)obj;

                info.AddBaseValueEmbedded(s, typeof(NumericLabelFormattingBase));
            }
Exemplo n.º 5
0
        public override IMeasuredLabelItem[] GetMeasuredItems(Graphics g, FontX font, StringFormat strfmt, Altaxo.Data.AltaxoVariant[] items)
        {
            var litems = new MeasuredLabelItem[items.Length];

            FontX localfont1 = font;
            FontX localfont2 = font.WithSize(font.Size * 2 / 3);

            var 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(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);
        }
Exemplo n.º 6
0
		public NumericLabelFormattingAuto(NumericLabelFormattingAuto from)
			: base(from) // everything is done here, since CopyFrom is virtual
		{
		}
Exemplo n.º 7
0
 public NumericLabelFormattingAuto(NumericLabelFormattingAuto from)
     : base(from) // everything is done here, since CopyFrom is virtual
 {
 }
 public void CopyFrom(NumericLabelFormattingAuto from)
 {
   base.CopyFrom(from);
   this._decimalPlaces = from._decimalPlaces;
 }
 public NumericLabelFormattingAuto(NumericLabelFormattingAuto from)
 {
   CopyFrom(from);
 }