示例#1
0
        public SKSize Measure(Colorer colorer, float pointSize, Style style)
        {
            var sizeX = 0.0f;
            var sizeY = 0.0f;

            using (var paint = colorer.TextPaint(colorer.fixedFont, pointSize, SKColors.Black)) {
                foreach (SpeciesValue sp in sample.stateMap.species)
                {
                    var r = colorer.MeasureText(sp.Format(style) + " = " + Gui.FormatUnit(sample.stateMap.Mean(sp.symbol), " ", "M", style.numberFormat), paint);
                    sizeX  = Math.Max(sizeX, r.Width);
                    sizeY += pointSize;
                }
                sizeY += pointSize;
                foreach (var reaction in this.reactions)
                {
                    var r = colorer.MeasureText(reaction.TopFormat(style), paint);
                    sizeX  = Math.Max(sizeX, r.Width);
                    sizeY += pointSize;
                }
                sizeY += pointSize;
                foreach (var trigger in this.sample.Triggers(style))
                {
                    var r = colorer.MeasureText(trigger.Format(style), paint);
                    sizeX  = Math.Max(sizeX, r.Width);
                    sizeY += pointSize;
                }
            }
            return(new SKSize(sizeX, sizeY));
        }