public override void AssertValid() { base.AssertValid(); StringUtil.AssertNotEmpty(m_sFontFamily); Debug.Assert(m_fFontSizePt > 0f); Debug.Assert(m_iMinimumTextHeight >= 0); }
/// <summary> /// Initializes a new instance of the FontForRectangle class. /// </summary> /// /// <param name="sFamily"> /// Font family. /// </param> /// /// <param name="fEmSize"> /// Font size. /// </param> /// /// <param name="oGraphics"> /// Object that will use the font. /// </param> protected internal FontForRectangle(string sFamily, float fEmSize, Graphics oGraphics) { StringUtil.AssertNotEmpty(sFamily); Debug.Assert(fEmSize > 0f); Debug.Assert(oGraphics != null); m_oFont = new Font(sFamily, fEmSize); m_bDisposed = false; AssertValid(); }
/// <summary> /// Initializes a new instance of the MaximizingFontMapper class. /// </summary> /// /// <param name="sFamily"> /// Font family. /// </param> /// /// <param name="fMinSizePt"> /// Minimum font size, in points. /// </param> /// /// <param name="fMaxSizePt"> /// Maximum font size, in points. /// </param> /// /// <param name="fIncrementPt"> /// Increment between fonts. /// </param> /// /// <param name="oGraphics"> /// Object the caller will use to draw the node's text. /// </param> protected internal MaximizingFontMapper(string sFamily, float fMinSizePt, float fMaxSizePt, float fIncrementPt, Graphics oGraphics) { StringUtil.AssertNotEmpty(sFamily); Debug.Assert(oGraphics != null); ValidateSizeRange(fMinSizePt, fMaxSizePt, fIncrementPt, "MaximizingFontMapper.Initialize()"); m_oFontForRectangles = new ArrayList(); for (float num = fMinSizePt; num <= fMaxSizePt; num += fIncrementPt) { FontForRectangle value = new FontForRectangle(sFamily, num, oGraphics); m_oFontForRectangles.Insert(0, value); } m_bDisposed = false; AssertValid(); }
public override void AssertValid() { base.AssertValid(); StringUtil.AssertNotEmpty(this.m_sFontFamily); Debug.Assert(this.m_fFontMinSizePt > 0f); Debug.Assert(this.m_fFontMaxSizePt > 0f); Debug.Assert(this.m_fFontMaxSizePt >= this.m_fFontMinSizePt); Debug.Assert(this.m_fFontIncrementPt > 0f); Debug.Assert(this.m_oFontSolidColor.A == 255); Debug.Assert(this.m_iFontMinAlpha >= 0 && this.m_iFontMinAlpha <= 255); Debug.Assert(this.m_iFontMaxAlpha >= 0 && this.m_iFontMaxAlpha <= 255); Debug.Assert(this.m_iFontMaxAlpha >= this.m_iFontMinAlpha); Debug.Assert(this.m_iFontAlphaIncrementPerLevel > 0); }
public static int GetTextHeight(Graphics oGraphics, string sFontFamily, float fFontSizePt, int iMinimumTextHeight) { Debug.Assert(oGraphics != null); StringUtil.AssertNotEmpty(sFontFamily); Debug.Assert(fFontSizePt > 0f); Debug.Assert(iMinimumTextHeight >= 0); FontForRectangle fontForRectangle = null; try { fontForRectangle = new FontForRectangle(sFontFamily, fFontSizePt, oGraphics); return(GetTextHeight(oGraphics, fontForRectangle.Font, iMinimumTextHeight)); } finally { fontForRectangle?.Dispose(); } }
/// <summary> /// Initializes a new instance of the PerLevelFontMapper class. /// </summary> /// /// <param name="sFamily"> /// Font family. /// </param> /// /// <param name="oTreemapRectangle"> /// Treemap's outer rectangle. /// </param> /// /// <param name="fTreemapRectangleDivisor"> /// The font size for level 0 is the treemap rectangle height divided by /// fTreemapRectangleDivisor. /// </param> /// /// <param name="fPerLevelDivisor"> /// The font size for level N is the font size for level N-1 divided by /// fPerLevelDivisor. /// </param> /// /// <param name="fMinimumFontSize"> /// Minimum font size. /// </param> /// /// <param name="oGraphics"> /// Object the caller will use to draw the node's text. /// </param> protected internal PerLevelFontMapper(string sFamily, Rectangle oTreemapRectangle, float fTreemapRectangleDivisor, float fPerLevelDivisor, float fMinimumFontSize, Graphics oGraphics) { StringUtil.AssertNotEmpty(sFamily); Debug.Assert(fTreemapRectangleDivisor > 0f); Debug.Assert(fPerLevelDivisor > 0f); Debug.Assert(fMinimumFontSize > 0f); Debug.Assert(oGraphics != null); float num = (float)oTreemapRectangle.Height / fTreemapRectangleDivisor; m_oFontForRectangles = new ArrayList(); while (num > fMinimumFontSize) { FontForRectangle value = new FontForRectangle(sFamily, num, oGraphics); m_oFontForRectangles.Add(value); num /= fPerLevelDivisor; } m_bDisposed = false; AssertValid(); }
public void AssertValid() { Debug.Assert(this.m_oNodes != null); this.m_oNodes.AssertValid(); Debug.Assert(this.m_iPaddingPx >= 1); Debug.Assert(this.m_iPaddingPx <= 100); Debug.Assert(this.m_iPaddingDecrementPerLevelPx >= 0); Debug.Assert(this.m_iPaddingDecrementPerLevelPx <= 99); Debug.Assert(this.m_iPenWidthPx >= 1); Debug.Assert(this.m_iPenWidthPx <= 100); Debug.Assert(this.m_iPenWidthDecrementPerLevelPx >= 0); Debug.Assert(this.m_iPenWidthDecrementPerLevelPx <= 99); Debug.Assert(Enum.IsDefined(typeof(NodeColorAlgorithm), this.m_eNodeColorAlgorithm)); Debug.Assert(this.m_fMinColorMetric < 0f); Debug.Assert(this.m_fMaxColorMetric > 0f); Debug.Assert(this.m_iDiscretePositiveColors >= 2); Debug.Assert(this.m_iDiscretePositiveColors <= 50); Debug.Assert(this.m_iDiscreteNegativeColors >= 2); Debug.Assert(this.m_iDiscreteNegativeColors <= 50); StringUtil.AssertNotEmpty(this.m_sFontFamily); Debug.Assert(this.m_fFontMinSizePt > 0f); Debug.Assert(this.m_fFontMaxSizePt > 0f); Debug.Assert(this.m_fFontMaxSizePt >= this.m_fFontMinSizePt); Debug.Assert(this.m_fFontIncrementPt > 0f); Debug.Assert(this.m_oFontSolidColor.A == 255); Debug.Assert(this.m_iFontMinAlpha >= 0 && this.m_iFontMinAlpha <= 255); Debug.Assert(this.m_iFontMaxAlpha >= 0 && this.m_iFontMaxAlpha <= 255); Debug.Assert(this.m_iFontMaxAlpha >= this.m_iFontMinAlpha); Debug.Assert(this.m_iFontAlphaIncrementPerLevel > 0); Debug.Assert(Enum.IsDefined(typeof(NodeLevelsWithText), this.m_iNodeLevelsWithText)); Debug.Assert(this.m_iMinNodeLevelWithText >= 0); Debug.Assert(this.m_iMaxNodeLevelWithText >= 0); Debug.Assert(this.m_iMaxNodeLevelWithText >= this.m_iMinNodeLevelWithText); Debug.Assert(Enum.IsDefined(typeof(TextLocation), this.m_eTextLocation)); Debug.Assert(Enum.IsDefined(typeof(EmptySpaceLocation), this.m_eEmptySpaceLocation)); if (this.m_oSelectedNode != null) { this.m_oSelectedNode.AssertValid(); } Debug.Assert(Enum.IsDefined(typeof(LayoutAlgorithm), this.m_eLayoutAlgorithm)); }