public override void Measure(MeasureContext mc, double x) { ExtendAboveBaseline = 0; ExtendBelowBaseline = 0; SizeX = 0; SizeZ = 0; var fontInfo = mc.FontCache.GetFontInfo(Style.FontId); if (_subscript != null) { _subscript.Measure(mc, x); double shift = (0.35 * fontInfo.cyAscent); ExtendBelowBaseline = Math.Max(ExtendBelowBaseline, _subscript.ExtendBelowBaseline + shift); ExtendAboveBaseline = Math.Max(ExtendAboveBaseline, _subscript.ExtendAboveBaseline - shift); SizeX = Math.Max(SizeX, _subscript.SizeX); SizeZ = Math.Max(SizeZ, _subscript.SizeZ); } if (_superscript != null) { _superscript.Measure(mc, x); double shift = (0.35 * fontInfo.cyAscent); ExtendBelowBaseline = Math.Max(ExtendBelowBaseline, _subscript.ExtendBelowBaseline - shift); ExtendAboveBaseline = Math.Max(ExtendAboveBaseline, _subscript.ExtendAboveBaseline + shift); SizeX = Math.Max(SizeX, _superscript.SizeX); SizeZ = Math.Max(SizeZ, _superscript.SizeZ); } }
private void MeasureForward(ref MeasureContext context) { var firstContainerDesiredSize = new RadSize(); var lastContainerDesiredSize = new RadSize(); using (var itemInfos = this.layout.GetLines(context.FirstVisibleIndex, true).GetEnumerator()) { if (itemInfos.MoveNext()) { firstContainerDesiredSize = this.GenerateContainer(itemInfos.Current); context.ForwardGeneratedLength += context.GetLength(firstContainerDesiredSize); context.MaxLength = Math.Max(context.MaxLength, context.GetOppositeLength(firstContainerDesiredSize)); // Take the length portion of the indexed element that is not currently in viewport. this.HiddenPixels = GridModel.DoubleArithmetics.Floor(context.GetLength(firstContainerDesiredSize) * (context.Index % 1)); context.ForwardGeneratedLength -= this.HiddenPixels; context.ForwardGeneratedLength = GridModel.DoubleArithmetics.Ceiling(context.ForwardGeneratedLength); lastContainerDesiredSize = firstContainerDesiredSize; this.ViewportItemCount++; } while (GridModel.DoubleArithmetics.IsLessThan(context.ForwardGeneratedLength, context.AvailableLength) && itemInfos.MoveNext()) { context.LastVisibleIndex++; lastContainerDesiredSize = this.GenerateContainer(itemInfos.Current); context.ForwardGeneratedLength += context.GetLength(lastContainerDesiredSize); context.MaxLength = Math.Max(context.MaxLength, context.GetOppositeLength(lastContainerDesiredSize)); this.ViewportItemCount++; } } }
public override void Measure(MeasureContext mc, double x) { SizeX = 0; SizeY = 0; SizeZ = 0; var mylayer = mc.LinkedObject as HostLayer; if (null == mylayer) { return; } var layer = mylayer as XYZPlotLayer; if (_layerNumber >= 0 && null != mylayer.SiblingLayers && _layerNumber < mylayer.SiblingLayers.Count) { layer = mylayer.SiblingLayers[_layerNumber] as XYZPlotLayer; } if (null == layer) { return; } if (_plotNumber < layer.PlotItems.Flattened.Length) { var fontInfo = mc.FontCache.GetFontInfo(Style.FontId); var size = FontManager3D.Instance.MeasureString("MMM", Style.FontId); SizeX = size.X; ExtendAboveBaseline = fontInfo.cyAscent; ExtendBelowBaseline = fontInfo.cyDescent; SizeZ = size.Z; } }
public override void Measure(MeasureContext mc, double x) { var fontInfo = mc.FontCache.GetFontInfo(Style.FontId); double sizeX = 0, sizeY = 0, sizeZ = 0; double y = 0; foreach (var ch in _childs) { ch.Measure(mc, x); sizeX = Math.Max(sizeX, ch.SizeX); sizeY = y + ch.SizeY; sizeZ = Math.Max(sizeZ, ch.SizeZ); y += GetLineSpacing(ch, fontInfo); } SizeX = sizeX; if (_childs.Count == 1) { ExtendAboveBaseline = _childs[0].ExtendAboveBaseline; ExtendBelowBaseline = _childs[0].ExtendBelowBaseline; } else if (_childs.Count == 2) { double heightDiff = sizeY - (_childs[0].SizeY + _childs[1].SizeY); ExtendAboveBaseline = _childs[0].SizeY + heightDiff / 2; ExtendBelowBaseline = _childs[1].SizeY + heightDiff / 2; } else { SizeY = sizeY; } SizeZ = sizeZ; }
public RepositoryWrapper( MeasureContext db, IMeasurePointRepository measurePoint, ILocationRepository location, IMeasureValueRepository measureValue, ILinkRepository link, IPriorityStateRepository priorityState, IUnitRepository unit, IActiveMeasurePointRepository activeMeasurePoint, IBatteryStateRepository batteryState, IAirUserRepository airUser, ILogger <RepositoryWrapper> logger) { _db = db; MeasurePoint = measurePoint; Location = location; MeasureValue = measureValue; Link = link; PriorityState = priorityState; Unit = unit; ActiveMeasurePoint = activeMeasurePoint; BatteryState = batteryState; AirUser = airUser; _logger = logger; }
public override void Measure(Graphics g, MeasureContext mc, double x) { var fontInfo = mc.FontCache.GetFontInfo(g, Style.FontId); double w = 0, h = 0; double y = 0; foreach (var ch in _childs) { ch.Measure(g, mc, x); w = Math.Max(w, ch.Width); h = y + ch.Height; y += GetLineSpacing(ch, fontInfo); } Width = w; if (_childs.Count == 1) { ExtendAboveBaseline = _childs[0].ExtendAboveBaseline; ExtendBelowBaseline = _childs[0].ExtendBelowBaseline; } else if (_childs.Count == 2) { double heightDiff = h - (_childs[0].Height + _childs[1].Height); ExtendAboveBaseline = _childs[0].Height + heightDiff / 2; ExtendBelowBaseline = _childs[1].Height + heightDiff / 2; } else { Height = h; } }
private protected virtual Measure MeasureLineNumberWidth() { string LongestLineText = $"{LastLineNumber} "; Size LineSize = MeasureContext.MeasureText(LongestLineText, TextStyles.LineNumber, Measure.Floating); return(LineSize.Width); }
protected RepositoryBase( MeasureContext db, ILogger <RepositoryBase <T> > logger) { Db = db; _logger = logger; }
public override void Measure(Graphics g, MeasureContext mc, double x) { var fontInfo = mc.FontCache.GetFontInfo(g, Style.FontId); Width = g.MeasureString(_text, GdiFontManager.ToGdi(Style.FontId), PointF.Empty, _stringFormat).Width; ExtendAboveBaseline = fontInfo.cyAscent; ExtendBelowBaseline = fontInfo.cyDescent; }
public override void Measure(Graphics g, MeasureContext mc, double x) { ExtendAboveBaseline = 0; ExtendBelowBaseline = 0; Width = 0; var fontInfo = mc.FontCache.GetFontInfo(g, Style.FontId); if (_subscript != null) { _subscript.Measure(g, mc, x); double shift = (0.35 * fontInfo.cyAscent); ExtendBelowBaseline = Math.Max(ExtendBelowBaseline, _subscript.ExtendBelowBaseline + shift); ExtendAboveBaseline = Math.Max(ExtendAboveBaseline, _subscript.ExtendAboveBaseline - shift); Width = Math.Max(Width, _subscript.Width); } if (_superscript != null) { _superscript.Measure(g, mc, x); double shift = (0.35 * fontInfo.cyAscent); ExtendBelowBaseline = Math.Max(ExtendBelowBaseline, _subscript.ExtendBelowBaseline - shift); ExtendAboveBaseline = Math.Max(ExtendAboveBaseline, _subscript.ExtendAboveBaseline + shift); Width = Math.Max(Width, _superscript.Width); } }
private RadSize MeasureVertically(RadSize availableSize, double offset, double bufferScale) { var context = new MeasureContext() { Offset = offset, BufferScale = bufferScale }; context.InitializeForVerticalMeasure(this.Layout, availableSize); this.AvailableLength = context.AvailableLength; var initialFirstVisibleIndex = context.FirstVisibleIndex; if (this.IsBufferNeeded) { context.FirstVisibleIndex = this.GenerateTopBufferItems(context.FirstVisibleIndex, context.AvailableLength, context.Offset, context); context.LastVisibleIndex = context.FirstVisibleIndex; } this.MeasureForward(ref context); //TODO: Investigate the case with maximizing and incorrect scroll offset. if (context.AvailableLength - context.ForwardGeneratedLength > ListViewModel.DoubleArithmetics.Ceiling(1d / IndexStorage.PrecisionMultiplier)) { if (this.viewportItemsCount < this.Layout.VisibleLineCount) { // perform the measure logic again, since this difference will most probably occur when the Index tree is cleared before the measure pass this.RecycleLocally(); context.InitializeForVerticalMeasure(this.Layout, availableSize); if (this.IsBufferNeeded) { context.FirstVisibleIndex = this.GenerateTopBufferItems(context.FirstVisibleIndex, context.AvailableLength, context.Offset, context); context.LastVisibleIndex = context.FirstVisibleIndex; } this.MeasureForward(ref context); } } this.MeasureBackwards(ref context); if (this.IsBufferNeeded) { this.GenerateBottomBufferItems(context.LastVisibleIndex, context.AvailableLength, context); } var desiredSize = new RadSize(context.MaxLength, context.GeneratedLength); desiredSize.Width = Math.Min(desiredSize.Width, ListViewModel.DoubleArithmetics.Ceiling(availableSize.Width)); desiredSize.Height = Math.Min(desiredSize.Height, context.AvailableLength); this.Layout.UpdateAverageLength(context.FirstVisibleIndex, context.LastVisibleIndex); if (Math.Floor(context.Index) > initialFirstVisibleIndex) { (this.Owner as RadListView).updateService.RegisterUpdate((int)UpdateFlags.AffectsContent); } return(desiredSize); }
public void applying_unsupported_prefixes_to_a_unit_uses_the_adjustment_factor() { var c = new MeasureContext("Empty"); var percent = c.DefineAlias("%", "Percent", new ExpFactor(0, -2), MeasureUnit.None); var milliPercent = MeasureStandardPrefix.Milli[percent]; milliPercent.ToString().Should().Be("(10^-3)%"); }
/// <summary> /// Efficiently merges books in-memory without making search requests. /// By deriving a unique list of books, we can reduce the number of database operations and, when possible, bulk create books that are not mergeable. /// </summary> DbBook[] DryMerge(DbBook[] books) { var measure = new MeasureContext(); var results = new List <DbBook>(books.Length); var primaryNames = new Dictionary <string, HashSet <DbBook> >(books.Length, StringComparer.OrdinalIgnoreCase); var englishNames = new Dictionary <string, HashSet <DbBook> >(books.Length, StringComparer.OrdinalIgnoreCase); var artistTags = new Dictionary <string, HashSet <DbBook> >(StringComparer.OrdinalIgnoreCase); var circleTags = new Dictionary <string, HashSet <DbBook> >(StringComparer.OrdinalIgnoreCase);
private void InitializeCore(BaseLayout layout, MeasureContext previousContext) { this.Index = layout.SlotFromPhysicalOffset(this.Offset + previousContext.GeneratedLength); this.FirstVisibleIndex = Math.Max(previousContext.LastVisibleIndex - 1, Math.Min(layout.VisibleLineCount, (int)this.Index)); this.LastVisibleIndex = this.FirstVisibleIndex; this.MaxLength = previousContext.MaxLength; this.ForwardGeneratedLength = previousContext.ForwardGeneratedLength; this.BackwardGeneratedLength = previousContext.BackwardGeneratedLength; }
public override void Measure(MeasureContext mc, double x) { var fontInfo = mc.FontCache.GetFontInfo(Style.FontId); var size = FontManager3D.Instance.MeasureString(_text, Style.FontId); SizeX = size.X; ExtendAboveBaseline = fontInfo.cyAscent; ExtendBelowBaseline = fontInfo.cyDescent; SizeZ = size.Z; }
public void prefix_applied_to_non_prefixable_units_use_the_adjusment_factor() { var c = new MeasureContext("NoPrefix"); var tUnit = c.DefineFundamental("T", "Thing", AutoStandardPrefix.Binary); var kiloT = MeasureStandardPrefix.Kilo[tUnit]; var kibiT = MeasureStandardPrefix.Kibi[tUnit]; kiloT.Abbreviation.Should().Be("(10^3)T"); kibiT.Abbreviation.Should().Be("KiT"); }
private RadSize MeasureHorizontally(RadSize availableSize, double offset, double bufferScale) { //TODO: add buffer here var context = new MeasureContext() { Offset = offset, BufferScale = bufferScale }; context.InitializeForHorizontalMeasure(this.Layout, availableSize); this.AvailableLength = context.AvailableLength; if (this.IsBufferNeeded) { context.FirstVisibleIndex = this.GenerateTopBufferItems(context.FirstVisibleIndex, context.AvailableLength, context.Offset, context); context.LastVisibleIndex = context.FirstVisibleIndex; } this.MeasureForward(ref context); //TODO: Investigate the case with maximizing and incorrect scroll offset. if (context.AvailableLength - context.ForwardGeneratedLength > ListViewModel.DoubleArithmetics.Ceiling(1d / IndexStorage.PrecisionMultiplier)) { if (this.viewportItemsCount < this.Layout.VisibleLineCount) { // perform the measure logic again, since this difference will most probably occur when the Index tree is cleared before the measure pass this.RecycleLocally(); context.InitializeForHorizontalMeasure(this.Layout, availableSize); if (this.IsBufferNeeded) { context.FirstVisibleIndex = this.GenerateTopBufferItems(context.FirstVisibleIndex, context.AvailableLength, context.Offset, context); context.LastVisibleIndex = context.FirstVisibleIndex; } this.MeasureForward(ref context); } } this.MeasureBackwards(ref context); if (this.IsBufferNeeded) { this.GenerateBottomBufferItems(context.LastVisibleIndex, context.AvailableLength, context); } var desiredSize = this.ComputeDesiredSize(context); this.Layout.UpdateAverageLength(context.FirstVisibleIndex, context.LastVisibleIndex); return(desiredSize); }
public override void Measure(Graphics g, MeasureContext mc, double x) { ExtendBelowBaseline = 0; ExtendAboveBaseline = 0; Width = 0; foreach (var glyph in _childs) { glyph.Measure(g, mc, x + Width); ExtendAboveBaseline = Math.Max(ExtendAboveBaseline, glyph.ExtendAboveBaseline); ExtendBelowBaseline = Math.Max(ExtendBelowBaseline, glyph.ExtendBelowBaseline); Width += glyph.Width; } }
public override void Measure(Graphics g, MeasureContext mc, double x) { ExtendAboveBaseline = 0; ExtendBelowBaseline = 0; Width = 0; if (_child != null) { _child.Measure(g, mc, x); ExtendBelowBaseline = _child.ExtendBelowBaseline; ExtendAboveBaseline = _child.ExtendAboveBaseline; Width = _child.Width; } }
public void Run() { _logger.LogInformation($"This is a console application for {_config.Title}"); var serviceCollection = new ServiceCollection(); using (MeasureContext context = new MeasureContext(null)) { PhoneNumberType fax = new PhoneNumberType { Name = "Fax" }; PhoneNumberType work = new PhoneNumberType { Name = "Work" }; Client parent = new Client { CompanyName = "Home Depot", Address = new Address(), BillingAddress = new Address() }; Client store = new Client { CompanyName = "Store 127", Address = new Address(), BillingAddress = new Address(), Parent = parent }; context.Clients.Add(store); store.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.666.7777", PhoneNumberType = fax }); store.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.666.7778", PhoneNumberType = fax }); store.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.666.8777", PhoneNumberType = work }); store.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.666.8778", PhoneNumberType = work }); parent.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.667.7777", PhoneNumberType = fax }); parent.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.667.7778", PhoneNumberType = fax }); parent.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.667.8777", PhoneNumberType = work }); parent.PhoneNumbers.Add(new PhoneNumberClient { Number = "555.667.8778", PhoneNumberType = work }); context.Clients.Add(parent); int count = context.SaveChanges(); List <Client> customers = context.Clients.ToList(); } }
private void MeasureGlyphs(IGraphicsContext3D g, FontCache cache, Altaxo.Graph.IPaintContext paintContext) { var mc = new MeasureContext { FontCache = cache, LinkedObject = Altaxo.Main.AbsoluteDocumentPath.GetRootNodeImplementing <HostLayer>(this), TabStop = Glyph.MeasureString("MMMM", _font).X }; if (null != _rootNode) { _rootNode.Measure(mc, 0); } }
public override void Measure(MeasureContext mc, double x) { ExtendBelowBaseline = 0; ExtendAboveBaseline = 0; SizeX = 0; SizeZ = 0; foreach (var glyph in _childs) { glyph.Measure(mc, x + SizeX); ExtendAboveBaseline = Math.Max(ExtendAboveBaseline, glyph.ExtendAboveBaseline); ExtendBelowBaseline = Math.Max(ExtendBelowBaseline, glyph.ExtendBelowBaseline); SizeX += glyph.SizeX; SizeZ = Math.Max(SizeZ, glyph.SizeZ); } }
public override void Measure(MeasureContext mc, double x) { ExtendAboveBaseline = 0; ExtendBelowBaseline = 0; SizeX = 0; SizeZ = 0; if (_child != null) { _child.Measure(mc, x); ExtendBelowBaseline = _child.ExtendBelowBaseline; ExtendAboveBaseline = _child.ExtendAboveBaseline; SizeX = _child.SizeX; SizeZ = _child.SizeZ; } }
private void OnRendering(Object sender, EventArgs e) { _sbSelected.Clear(); _isChanged = false; var element = _viewHost.View; //MeasureContext.ViewState = _viewHost; var size = new ValueRenderSize(_viewHost.RenderMargin.Width, _viewHost.RenderMargin.Height); var measured = MeasureContext.MeasureMainView(element, size, _viewHost); var selectedVisual = SelectedVisuals?.FirstOrDefault(); if (selectedVisual == null) { return; } _sbSelected.AppendLine(element.ToString()); _sbSelected.AppendLine("Measured: " + measured); _sbSelected.AppendLine("Arranged: " + selectedVisual.Position); var nonDefaults = GetNonDefaultSetters(element).ToArray(); foreach (var kvp in nonDefaults) { _sbSelected.AppendLine(kvp.ToString()); } //_sbSelected.AppendLine(kvp.Key + ": " + kvp.Value); _rightRectangle = new Rectangle(_viewHost.AvailableSize.Width - _viewHost.RenderMargin.Right, 0, _viewHost.RenderMargin.Width, _viewHost.AvailableSize.Height); //RenderContext.ViewState = _viewHost; RenderContext.FillRectangle(_rightRectangle, SolidColorBrush.DarkGray); if (selectedVisual.Element == null) { return; } RenderContext.DrawString(_sbSelected.ToString(), _font, _rightRectangle, SolidColorBrush.White); }
internal override RadSize ComputeDesiredSize(MeasureContext context) { RadSize desiredSize; if (this.IsHorizontal) { desiredSize = new RadSize(context.GeneratedLength, context.MaxLength); desiredSize.Width = Math.Min(desiredSize.Width, context.AvailableLength); desiredSize.Height = Math.Max(desiredSize.Height, ListViewModel.DoubleArithmetics.Ceiling(this.AvailableSize.Height)); } else { desiredSize = new RadSize(Math.Max(AvailableSize.Width, context.MaxLength), Math.Min(context.AvailableLength, context.GeneratedLength)); } return(desiredSize); }
private MeasureContext MeasureHorizontalFrozenElements(RadSize availableSize, int frozenContainersCount) { var context = new MeasureContext(); context.InitializeForHorizontalMeasure(this, availableSize); if (frozenContainersCount == 0) { return(context); } var firstContainerDesiredSize = new RadSize(); var lastContainerDesiredSize = new RadSize(); using (var itemInfos = this.layout.GetLines(context.FirstVisibleIndex, true).GetEnumerator()) { if (itemInfos.MoveNext()) { firstContainerDesiredSize = this.GenerateContainer(itemInfos.Current); context.ForwardGeneratedLength = context.GetLength(firstContainerDesiredSize); context.MaxLength = Math.Max(context.MaxLength, context.GetOppositeLength(firstContainerDesiredSize)); // Take the length portion of the indexed element that is not currently in viewport. this.HiddenPixels = GridModel.DoubleArithmetics.Floor(context.ForwardGeneratedLength * (context.Index % 1)); context.ForwardGeneratedLength -= this.HiddenPixels; context.ForwardGeneratedLength = GridModel.DoubleArithmetics.Ceiling(context.ForwardGeneratedLength); lastContainerDesiredSize = firstContainerDesiredSize; this.ViewportItemCount++; } while (frozenContainersCount - 1 > context.LastVisibleIndex && GridModel.DoubleArithmetics.IsLessThan(context.ForwardGeneratedLength, context.AvailableLength) && itemInfos.MoveNext()) { context.LastVisibleIndex++; lastContainerDesiredSize = this.GenerateContainer(itemInfos.Current); context.ForwardGeneratedLength += context.GetLength(lastContainerDesiredSize); context.MaxLength = Math.Max(context.MaxLength, context.GetOppositeLength(lastContainerDesiredSize)); this.ViewportItemCount++; } } return(context); }
private RadSize MeasureHorizontally(RadSize availableSize, double offset, int frozenElementsCount) { var context = new MeasureContext() { Offset = offset }; if (frozenElementsCount > 0) { var frozenGeneratedContext = this.MeasureHorizontalFrozenElements(availableSize, frozenElementsCount); context.InitializeForHorizontalMeasure(this, availableSize, frozenGeneratedContext); } else { context.InitializeForHorizontalMeasure(this, availableSize); } this.AvailableLength = context.AvailableLength; this.MeasureForward(ref context); if (context.AvailableLength - context.ForwardGeneratedLength > GridModel.DoubleArithmetics.Ceiling(1d / IndexStorage.PrecisionMultiplier)) { if (context.FirstVisibleIndex + this.ViewportItemCount < this.layout.VisibleLineCount) { // perform the measure logic again, since this difference will most probably occur when the Index tree is cleared before the measure pass this.RecycleLocally(); context.InitializeForHorizontalMeasure(this, availableSize); this.MeasureForward(ref context); } } context.FirstVisibleIndex -= this.owner.FrozenColumnCount; this.MeasureBackwards(ref context); var desiredSize = new RadSize(context.GeneratedLength, context.MaxLength); desiredSize.Width = Math.Min(desiredSize.Width, context.AvailableLength); desiredSize.Height = Math.Min(desiredSize.Height, GridModel.DoubleArithmetics.Ceiling(availableSize.Height)); this.Layout.UpdateAverageLength(context.FirstVisibleIndex, context.LastVisibleIndex); return(desiredSize); }
private RadSize MeasureVertically(RadSize availableSize, double offset, double bufferScale) { var context = new MeasureContext() { Offset = offset, BufferScale = bufferScale }; context.InitializeForVerticalMeasure(this, availableSize); this.AvailableLength = context.AvailableLength; // Always start with frozen containers unitl we generate row with cells. this.shouldGenerateFrozenContainer = true; if (this.IsBufferNeeded) { context.FirstVisibleIndex = this.GenerateTopBufferItems(context.FirstVisibleIndex, context.AvailableLength, context.Offset, context); context.LastVisibleIndex = context.FirstVisibleIndex; } this.MeasureForward(ref context); ////TODO: We may need an additional synchronous measure pass in case less generated length (as in the Horizontal measure) this.MeasureBackwards(ref context); if (this.IsBufferNeeded) { this.GenerateBottomBufferItems(context.LastVisibleIndex, context.AvailableLength, context); } this.GenerateFrozenContainers(); var desiredSize = new RadSize(context.MaxLength, context.GeneratedLength); desiredSize.Width = Math.Min(desiredSize.Width, GridModel.DoubleArithmetics.Ceiling(availableSize.Width)); desiredSize.Height = Math.Min(desiredSize.Height, context.AvailableLength); this.Layout.UpdateAverageLength(context.FirstVisibleIndex, context.LastVisibleIndex); return(desiredSize); }
public override void Measure(Graphics g, MeasureContext mc, double x) { Height = 0; Width = 0; double tab = mc.TabStop; if (!(tab > 0)) tab = g.MeasureString("MMMM", GdiFontManager.ToGdi(Style.BaseFontId), PointF.Empty, _stringFormat).Width; if (!(tab > 0)) tab = Style.BaseFontId.Size * 4; if (tab > 0) { double t = Math.Floor(x / tab); Width = (t + 1) * tab - x; } }
public override void Measure(Graphics g, MeasureContext mc, double x) { _text = string.Empty; var suspObj = mc.LinkedObject as Altaxo.Main.IDocumentLeafNode; if (null != suspObj) { var context = Altaxo.PropertyExtensions.GetPropertyContext(suspObj); if (null != context) { if (context.TryGetValue<object>(_propertyName, out var value, out var bag, out var info)) { if (null != value) { var documentCulture = context.GetValue(Altaxo.Settings.CultureSettings.PropertyKeyDocumentCulture); _text = string.Format(documentCulture.Culture, "{0}", value); } } } } base.Measure(g, mc, x); }
public override void Measure(Graphics g, MeasureContext mc, double x) { Width = 0; Height = 0; var mylayer = mc.LinkedObject as HostLayer; if (null == mylayer) return; XYPlotLayer layer = mylayer as XYPlotLayer; if (_layerNumber >= 0 && null != mylayer.SiblingLayers && _layerNumber < mylayer.SiblingLayers.Count) layer = mylayer.SiblingLayers[_layerNumber] as XYPlotLayer; if (null == layer) return; if (_plotNumber < layer.PlotItems.Flattened.Length) { var fontInfo = mc.FontCache.GetFontInfo(g, Style.FontId); Width = g.MeasureString("MMM", GdiFontManager.ToGdi(Style.FontId), PointF.Empty, _stringFormat).Width; ExtendAboveBaseline = fontInfo.cyAscent; ExtendBelowBaseline = fontInfo.cyDescent; } }
/// <summary></summary> public virtual void Measure(MeasureContext mc, double x) { SizeX = 0; SizeY = 0; SizeZ = 0; }
public override void Measure(MeasureContext mc, double x) { _text = string.Empty; var suspObj = mc.LinkedObject as Altaxo.Main.IDocumentLeafNode; if (null != suspObj) { var context = Altaxo.PropertyExtensions.GetPropertyContext(suspObj); if (null != context) { Altaxo.Main.Properties.IPropertyBag bag; Altaxo.Main.Properties.PropertyBagInformation info; object value; if (context.TryGetValue<object>(_propertyName, out value, out bag, out info)) { if (null != value) { var documentCulture = context.GetValue(Altaxo.Settings.CultureSettings.PropertyKeyDocumentCulture); _text = string.Format(documentCulture.Culture, "{0}", value); } } } } base.Measure(mc, x); }
public override void Measure(MeasureContext mc, double x) { SizeY = 0; SizeX = 0; SizeZ = 0; double tab = mc.TabStop; if (!(tab > 0)) tab = FontManager3D.Instance.MeasureString("MMMM", Style.BaseFontId).X; if (!(tab > 0)) tab = Style.BaseFontId.Size * 4; if (tab > 0) { double t = Math.Floor(x / tab); SizeX = (t + 1) * tab - x; } }
public override void Measure(MeasureContext mc, double x) { _text = GetName(mc.LinkedObject); base.Measure(mc, x); }
public override void Measure(MeasureContext mc, double x) { SizeX = 0; SizeY = 0; SizeZ = 0; var mylayer = mc.LinkedObject as HostLayer; if (null == mylayer) return; XYZPlotLayer layer = mylayer as XYZPlotLayer; if (_layerNumber >= 0 && null != mylayer.SiblingLayers && _layerNumber < mylayer.SiblingLayers.Count) layer = mylayer.SiblingLayers[_layerNumber] as XYZPlotLayer; if (null == layer) return; if (_plotNumber < layer.PlotItems.Flattened.Length) { var fontInfo = mc.FontCache.GetFontInfo(Style.FontId); var size = FontManager3D.Instance.MeasureString("MMM", Style.FontId); SizeX = size.X; ExtendAboveBaseline = fontInfo.cyAscent; ExtendBelowBaseline = fontInfo.cyDescent; SizeZ = size.Z; } }
public override void Measure(MeasureContext mc, double x) { _text = Current.Project.DocumentIdentifier; base.Measure(mc, x); }
private void MeasureGlyphs(Graphics g, FontCache cache, IPaintContext paintContext) { MeasureContext mc = new MeasureContext(); mc.FontCache = cache; mc.LinkedObject = Altaxo.Main.AbsoluteDocumentPath.GetRootNodeImplementing<HostLayer>(this); mc.TabStop = Glyph.MeasureString(g, "MMMM", _font).X; if (null != _rootNode) _rootNode.Measure(g, mc, 0); }
/// <summary></summary> public virtual void Measure(Graphics g, MeasureContext mc, double x) { Width = 0; Height = 0; }