Smrf.NodeXL.Visualization.Wpf.RectangleVertexDrawingHistory.GetLabelLocation C# (CSharp) Method

GetLabelLocation() public method

public GetLabelLocation ( VertexLabelPosition labelPosition ) : Point
labelPosition VertexLabelPosition
return Point
    GetLabelLocation
    (
        VertexLabelPosition labelPosition
    )
    {
        AssertValid();

        Double dCenterX = m_oRectangle.Left + m_oRectangle.Width / 2.0;
        Double dMiddleY = m_oRectangle.Top + m_oRectangle.Height / 2.0;

        switch (labelPosition)
        {
            case VertexLabelPosition.TopLeft:

                return (m_oRectangle.TopLeft);

            case VertexLabelPosition.TopCenter:

                return ( new Point(dCenterX, m_oRectangle.Top) );

            case VertexLabelPosition.TopRight:

                return (m_oRectangle.TopRight);

            case VertexLabelPosition.MiddleLeft:

                return ( new Point(m_oRectangle.Left, dMiddleY) );

            case VertexLabelPosition.MiddleCenter:

                return ( new Point(dCenterX, dMiddleY) );

            case VertexLabelPosition.MiddleRight:

                return ( new Point(m_oRectangle.Right, dMiddleY) );

            case VertexLabelPosition.BottomLeft:

                return (m_oRectangle.BottomLeft);

            case VertexLabelPosition.BottomCenter:

                return ( new Point(dCenterX, m_oRectangle.Bottom) );

            case VertexLabelPosition.BottomRight:

                return (m_oRectangle.BottomRight);

            default:

                Debug.Assert(false);
                return ( new Point() );
        }
    }