code: @VisibleForTesting
      protected static int getLabelDistance(final ScaleBarRenderSettings settings) {
          if (settings.getParams().labelDistance != null) {
              return settings.getParams().labelDistance;
          } else {
              if (settings.getParams().getOrientation().isHorizontal()) {
                  return settings.getMaxSize().width / 40;
              } else {
                  return settings.getMaxSize().height / 40;
              }
          }
      }
docs: Get the label distance..
  
  @param settings Parameters for rendering the scalebar.