@ VisibleForTesting protected static Dimension getSize ( final ScalebarAttributeValues scalebarParams , final ScaleBarRenderSettings settings , final Dimension maxLabelSize ) { final float width ; final float height ; if ( scalebarParams . getOrientation ( ) . isHorizontal ( ) ) { width = 2 * settings . getPadding ( ) + settings . getIntervalLengthInPixels ( ) * scalebarParams . intervals + settings . getLeftLabelMargin ( ) + settings . getRightLabelMargin ( ) ; height = 2 * settings . getPadding ( ) + settings . getBarSize ( ) + settings . getLabelDistance ( ) + Label . getRotatedHeight ( maxLabelSize , scalebarParams . getLabelRotation ( ) ) ; } else { width = 2 * settings . getPadding ( ) + settings . getLabelDistance ( ) + settings . getBarSize ( ) + Label . getRotatedWidth ( maxLabelSize , scalebarParams . getLabelRotation ( ) ) ; height = 2 * settings . getPadding ( ) + settings . getTopLabelMargin ( ) + settings . getIntervalLengthInPixels ( ) * scalebarParams . intervals + settings . getBottomLabelMargin ( ) ; } return new Dimension ( ( int ) Math . ceil ( width ) , ( int ) Math . ceil ( height ) ) ; }
Get the size of the painting area required to draw the scalebar with labels .