Class ScaleBarOptions

java.lang.Object
com.trimblemaps.mapsdk.plugins.scalebar.ScaleBarOptions

public class ScaleBarOptions extends Object
Builder class from which a scale bar is created.
  • Field Details

    • REFRESH_INTERVAL_DEFAULT

      public static final int REFRESH_INTERVAL_DEFAULT
      See Also:
  • Constructor Details

    • ScaleBarOptions

      public ScaleBarOptions(@NonNull android.content.Context context)
  • Method Details

    • setRefreshInterval

      public ScaleBarOptions setRefreshInterval(int refreshInterval)
      Set plugin's minimum refresh interval, default value is REFRESH_INTERVAL_DEFAULT.
      Parameters:
      refreshInterval - the min refresh interval, in millisecond.
      Returns:
      this
    • setTextColor

      public ScaleBarOptions setTextColor(@ColorRes int textColor)
      Set the text color on scale bar, default value is android.R.color.black.
      Parameters:
      textColor - the text color on scale bar.
      Returns:
      this.
    • setPrimaryColor

      public ScaleBarOptions setPrimaryColor(@ColorRes int primaryColor)
      Set the primary color of the scale bar, will be used to draw odd index blocks, default value is android.R.color.black.
      Parameters:
      primaryColor - the primary color of the scale bar.
      Returns:
      this.
    • setSecondaryColor

      public ScaleBarOptions setSecondaryColor(@ColorRes int secondaryColor)
      Set the secondary color of the scale bar, will be used to draw even index blocks, default value is android.R.color.white.
      Parameters:
      secondaryColor - the secondaryColor color of the scale bar.
      Returns:
      this.
    • setMarginTop

      public ScaleBarOptions setMarginTop(float marginTop)
      Set the margin between scale bar and the top of mapView.
      Parameters:
      marginTop - the margin between scale bar and the top of mapView, in pixel.
      Returns:
      this.
    • setMarginTop

      public ScaleBarOptions setMarginTop(@DimenRes int marginTop)
      Set the margin between scale bar and the top of mapView.
      Parameters:
      marginTop - the margin between scale bar and the top of mapView, in dp.
      Returns:
      this.
    • setBarHeight

      public ScaleBarOptions setBarHeight(float barHeight)
      Set the height for blocks in scale bar.
      Parameters:
      barHeight - the height for blocks in scale bar, in pixel.
      Returns:
      this.
    • setBarHeight

      public ScaleBarOptions setBarHeight(@DimenRes int barHeight)
      Set the height for blocks in scale bar.
      Parameters:
      barHeight - the height for blocks in scale bar, in dp.
      Returns:
      this.
    • setBorderWidth

      public ScaleBarOptions setBorderWidth(float borderWidth)
      Set the border width in scale bar.
      Parameters:
      borderWidth - the border width in scale bar, in pixel.
      Returns:
      this.
    • setBorderWidth

      public ScaleBarOptions setBorderWidth(@DimenRes int borderWidth)
      Set the border width in scale bar.
      Parameters:
      borderWidth - the border width in scale bar, in dp.
      Returns:
      this.
    • setTextBorderWidth

      public ScaleBarOptions setTextBorderWidth(@DimenRes int textBorderWidth)
      Set the border width for texts in scale bar.
      Parameters:
      textBorderWidth - the border width for texts in scale bar, in dp.
      Returns:
      this.
    • setTextBorderWidth

      public ScaleBarOptions setTextBorderWidth(float textBorderWidth)
      Set the border width for texts in scale bar.
      Parameters:
      textBorderWidth - the border width for texts in scale bar, in pixel.
      Returns:
      this.
    • setShowTextBorder

      public ScaleBarOptions setShowTextBorder(boolean showTextBorder)
      Set whether to show the text border.
      Parameters:
      showTextBorder - whether to show the text border or not.
      Returns:
      this.
    • setTextSize

      public ScaleBarOptions setTextSize(float textSize)
      Set the text size of scale bar.
      Parameters:
      textSize - the text size of scale bar, in pixel.
      Returns:
      this.
    • setTextSize

      public ScaleBarOptions setTextSize(@DimenRes int textSize)
      Set the text size of scale bar.
      Parameters:
      textSize - the text size of scale bar, in dp.
      Returns:
      this.
    • setMetricUnit

      public ScaleBarOptions setMetricUnit(boolean metricUnit)
      Set whether to use metric unit or not. The default value is depends on settings of device.
      Parameters:
      metricUnit - whether to use metric unit or not.
      Returns:
      this.
    • setMarginLeft

      public ScaleBarOptions setMarginLeft(float marginLeft)
      Set the left margin between scale bar and mapView.
      Parameters:
      marginLeft - the left margin between scale bar and mapView, in pixel.
      Returns:
      this.
    • setMarginLeft

      public ScaleBarOptions setMarginLeft(@DimenRes int marginLeft)
      Set the left margin between scale bar and mapView.
      Parameters:
      marginLeft - the left margin between scale bar and mapView, in dp.
      Returns:
      this.
    • setTextBarMargin

      public ScaleBarOptions setTextBarMargin(float textBarMargin)
      Set the margin between text and blocks inside scale bar.
      Parameters:
      textBarMargin - the margin between text and blocks inside scale bar, in pixel.
      Returns:
      this.
    • setTextBarMargin

      public ScaleBarOptions setTextBarMargin(@DimenRes int textBarMargin)
      Set the margin between text and blocks inside scale bar.
      Parameters:
      textBarMargin - the margin between text and blocks inside scale bar, in dp.
      Returns:
      this.
    • setMaxWidthRatio

      public ScaleBarOptions setMaxWidthRatio(@FloatRange(from=0.10000000149011612,to=1.0) float ratio)
      Set the ratio of scale bar max width compared with MapView width.
      Parameters:
      ratio - the ratio scale bar will use, must be in the range from 0.1f to 1.0f.