Smrf.NodeXL.Visualization.Wpf.EdgeDrawer.GetLabelFontSize C# (CSharp) Method

GetLabelFontSize() protected method

protected GetLabelFontSize ( IEdge oEdge ) : Double
oEdge IEdge
return Double
    GetLabelFontSize
    (
        IEdge oEdge
    )
    {
        Debug.Assert(oEdge != null);
        AssertValid();

        // Start with the default font size.

        Double dLabelFontSize = m_oFormattedTextManager.FontSize;

        Object oPerEdgeLabelFontSizeAsObject;

        // Check for a per-edge label font size.  Note that the font size is
        // stored as a Single in the edge's metadata to reduce memory usage.

        if ( oEdge.TryGetValue(ReservedMetadataKeys.PerEdgeLabelFontSize,
            typeof(Single), out oPerEdgeLabelFontSizeAsObject) )
        {
            dLabelFontSize = (Double)(Single)oPerEdgeLabelFontSizeAsObject;

            if (dLabelFontSize <= 0)
            {
                throw new FormatException( String.Format(

                    "{0}: The edge with the ID {1} has an out-of-range {2}"
                    + " value.  Values must be greater than zero."
                    ,
                    this.ClassName,
                    oEdge.ID,
                    "ReservedMetadataKeys.PerEdgeLabelFontSize"
                    ) );
            }
        }

        return (dLabelFontSize);
    }