Class TextProperties

java.lang.Object
journeymap.api.v2.client.model.TextProperties

public class TextProperties extends Object
Properties defining the display of text.

Setters use the Builder pattern so they can be chained.

  • Field Details

    • activeUIs

      protected Set<Context.UI> activeUIs
    • activeMapTypes

      protected Set<Context.MapType> activeMapTypes
    • scale

      protected float scale
    • color

      protected int color
    • backgroundColor

      protected int backgroundColor
    • opacity

      protected float opacity
    • backgroundOpacity

      protected float backgroundOpacity
    • fontShadow

      protected boolean fontShadow
    • minZoom

      protected int minZoom
    • maxZoom

      protected int maxZoom
    • offsetX

      protected int offsetX
    • offsetY

      protected int offsetY
  • Constructor Details

    • TextProperties

      public TextProperties()
  • Method Details

    • getScale

      public float getScale()
      Font scale.
      Returns:
      1 scale
    • setScale

      public TextProperties setScale(float scale)
      Sets the font scale. Best results are powers of 2: 1,2,4,8. Range is 1f - 8f;
      Parameters:
      scale - the scale
      Returns:
      this
    • getColor

      public int getColor()
      Gets the font color.
      Returns:
      rgb color
    • setColor

      public TextProperties setColor(int color)
      Sets the font color (rgb). Range is 0x000000 - 0xffffff.
      Parameters:
      color - rgb
      Returns:
      this
    • getBackgroundColor

      public int getBackgroundColor()
      Gets background color.
      Returns:
      the background color
    • setBackgroundColor

      public TextProperties setBackgroundColor(int backgroundColor)
      Sets background color.
      Parameters:
      backgroundColor - the background color
      Returns:
      this
    • getOpacity

      public float getOpacity()
      Gets opacity.
      Returns:
      the opacity
    • setOpacity

      public TextProperties setOpacity(float opacity)
      Sets opacity.
      Parameters:
      opacity - the opacity
      Returns:
      this
    • getBackgroundOpacity

      public float getBackgroundOpacity()
      Gets background opacity.
      Returns:
      the background opacity
    • setBackgroundOpacity

      public TextProperties setBackgroundOpacity(float backgroundOpacity)
      Sets background opacity. Range is 0f - 1f.
      Parameters:
      backgroundOpacity - the background opacity
      Returns:
      this
    • hasFontShadow

      public boolean hasFontShadow()
      Whether font shadow should be used.
      Returns:
      true if shadowed
    • setFontShadow

      public TextProperties setFontShadow(boolean fontShadow)
      Sets whether font shadow should be used.
      Parameters:
      fontShadow - true if shadow
      Returns:
      this
    • getActiveUIs

      public Set<Context.UI> getActiveUIs()
      Returns a set of enums indicating which JourneyMap UIs (Fullscreen, Minimap, Webmap) the text should be displayed in. This is only checked if the overlay containing these text properties is already active.

      For example, this can be specified to have labels only displayed in the fullscreen map, but not the minimap.

      Returns:
      enumset
    • setActiveUIs

      public TextProperties setActiveUIs(Context.UI... activeUIs)
      Set of enums indicating which JourneyMap UIs (Fullscreen, Minimap, Webmap) the text should be displayed in. This is only checked if the overlay containing these text properties is already active.

      For example, this can be specified to have labels only displayed in the fullscreen map, but not the minimap.

      Parameters:
      activeUIs - active UIs
      Returns:
      this
    • getActiveMapTypes

      public Set<Context.MapType> getActiveMapTypes()
      Returns a set of enums indicating which map types (Day, Night) the text should be active in.
      Returns:
      enumset
    • setActiveMapTypes

      public TextProperties setActiveMapTypes(Context.MapType... activeMapTypes)
      Set of enums indicating which JourneyMap map types (Day, Night) the text should be active in.
      Parameters:
      activeMapTypes - active types
      Returns:
      this
    • isActiveIn

      public boolean isActiveIn(UIState uiState)
      Whether the overlay should be active for the given contexts.
      Parameters:
      uiState - UIState
      Returns:
      true if the overlay should be active
    • getMinZoom

      public int getMinZoom()
      The minimum zoom level (UIState.FULLSCREEN_ZOOM_MIN is lowest) where the polygon should be visible.
      Returns:
      the min zoom
    • setMinZoom

      public TextProperties setMinZoom(int minZoom)
      Sets the minimum zoom level (UIState.FULLSCREEN_ZOOM_MIN is lowest) where text should be visible.
      Parameters:
      minZoom - the min zoom
      Returns:
      this
    • getMaxZoom

      public int getMaxZoom()
      The maximum zoom level (UIState.ZOOM_IN_MAX is highest) where text should be visible.
      Returns:
      the max zoom
    • setMaxZoom

      public TextProperties setMaxZoom(int maxZoom)
      Sets the maximum zoom level (UIState.ZOOM_IN_MAX is highest) where the polygon should be visible.
      Parameters:
      maxZoom - the max zoom
      Returns:
      this
    • getOffsetX

      public int getOffsetX()
      Gets how many horizontal pixels to shift the center of the label from the center of the overlay. (For MarkerOverlays, the "center" is directly over MarkerOverlay.getPoint(), regardless of how it's icon is placed.)
      Returns:
      pixels to offset
    • setOffsetX

      public TextProperties setOffsetX(int offsetX)
      Sets how many horizontal pixels to shift the center of the label from the center of the overlay. (For MarkerOverlays, the "center" is directly over MarkerOverlay.getPoint(), regardless of how it's icon is placed.)
      Parameters:
      offsetX -
      Returns:
      this
    • getOffsetY

      public int getOffsetY()
      Gets how many vertical pixels to shift the center of the label from the center of the overlay. (For MarkerOverlays, the "center" is directly over MarkerOverlay.getPoint(), regardless of how it's icon is placed.)
      Returns:
      pixels to offset
    • setOffsetY

      public TextProperties setOffsetY(int offsetY)
      Sets how many vertical pixels to shift the center of the label from the center of the overlay. (For MarkerOverlays, the "center" is directly over MarkerOverlay.getPoint(), regardless of how it's icon is placed.)
      Parameters:
      offsetY -
      Returns:
      this
    • toString

      public String toString()
      Overrides:
      toString in class Object