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

GetWidth() protected method

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

        // Start with the default width.

        Double dWidth = m_dWidth;

        Object oPerEdgeWidthAsObject;

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

        if ( oEdge.TryGetValue(ReservedMetadataKeys.PerEdgeWidth,
            typeof(Single), out oPerEdgeWidthAsObject) )
        {
            dWidth = (Double)(Single)oPerEdgeWidthAsObject;

            if (dWidth < MinimumWidth || dWidth > MaximumWidth)
            {
                throw new FormatException( String.Format(

                    "{0}: The edge with the ID {1} has an out-of-range {2}"
                    + " value.  Valid values are between {3} and {4}."
                    ,
                    this.ClassName,
                    oEdge.ID,
                    "ReservedMetadataKeys.PerEdgeWidth",
                    MinimumWidth,
                    MaximumWidth
                    ) );
            }
        }

        return (dWidth * m_dGraphScale);
    }