Class SymbolManager

java.lang.Object
com.trimblemaps.mapsdk.plugins.annotation.AnnotationManager<com.trimblemaps.mapsdk.style.layers.SymbolLayer,Symbol,SymbolOptions,OnSymbolDragListener,OnSymbolClickListener,OnSymbolLongClickListener>
com.trimblemaps.mapsdk.plugins.annotation.SymbolManager

public class SymbolManager extends AnnotationManager<com.trimblemaps.mapsdk.style.layers.SymbolLayer,Symbol,SymbolOptions,OnSymbolDragListener,OnSymbolClickListener,OnSymbolLongClickListener>
The symbol manager allows to add symbols to a map.
  • Constructor Details

    • SymbolManager

      @UiThread public SymbolManager(@NonNull com.trimblemaps.mapsdk.maps.MapView mapView, @NonNull com.trimblemaps.mapsdk.maps.TrimbleMapsMap trimbleMapsMap, @NonNull com.trimblemaps.mapsdk.maps.Style style)
      Create a symbol manager, used to manage symbols.
      Parameters:
      trimbleMapsMap - the map object to add symbols to
      style - a valid a fully loaded style object
    • SymbolManager

      @UiThread public SymbolManager(@NonNull com.trimblemaps.mapsdk.maps.MapView mapView, @NonNull com.trimblemaps.mapsdk.maps.TrimbleMapsMap trimbleMapsMap, @NonNull com.trimblemaps.mapsdk.maps.Style style, @Nullable String belowLayerId)
      Create a symbol manager, used to manage symbols.
      Parameters:
      trimbleMapsMap - the map object to add symbols to
      style - a valid a fully loaded style object
      belowLayerId - the id of the layer above the circle layer
    • SymbolManager

      @UiThread public SymbolManager(@NonNull com.trimblemaps.mapsdk.maps.MapView mapView, @NonNull com.trimblemaps.mapsdk.maps.TrimbleMapsMap trimbleMapsMap, @NonNull com.trimblemaps.mapsdk.maps.Style style, @Nullable String belowLayerId, @Nullable com.trimblemaps.mapsdk.style.sources.GeoJsonOptions geoJsonOptions)
      Create a symbol manager, used to manage symbols.
      Parameters:
      trimbleMapsMap - the map object to add symbols to
      style - a valid a fully loaded style object
      belowLayerId - the id of the layer above the circle layer
      geoJsonOptions - options for the internal source
  • Method Details

    • setDataDrivenPropertyIsUsed

      protected void setDataDrivenPropertyIsUsed(@NonNull String property)
      Specified by:
      setDataDrivenPropertyIsUsed in class AnnotationManager<com.trimblemaps.mapsdk.style.layers.SymbolLayer,Symbol,SymbolOptions,OnSymbolDragListener,OnSymbolClickListener,OnSymbolLongClickListener>
    • create

      @UiThread public List<Symbol> create(@NonNull String json)
      Create a list of symbols on the map.

      Symbols are going to be created only for features with a matching geometry.

      All supported properties are:
      SymbolOptions.PROPERTY_SYMBOL_SORT_KEY - Float
      SymbolOptions.PROPERTY_ICON_SIZE - Float
      SymbolOptions.PROPERTY_ICON_IMAGE - String
      SymbolOptions.PROPERTY_ICON_ROTATE - Float
      SymbolOptions.PROPERTY_ICON_OFFSET - Float[]
      SymbolOptions.PROPERTY_ICON_ANCHOR - String
      SymbolOptions.PROPERTY_TEXT_FIELD - String
      SymbolOptions.PROPERTY_TEXT_FONT - String[]
      SymbolOptions.PROPERTY_TEXT_SIZE - Float
      SymbolOptions.PROPERTY_TEXT_MAX_WIDTH - Float
      SymbolOptions.PROPERTY_TEXT_LETTER_SPACING - Float
      SymbolOptions.PROPERTY_TEXT_JUSTIFY - String
      SymbolOptions.PROPERTY_TEXT_RADIAL_OFFSET - Float
      SymbolOptions.PROPERTY_TEXT_ANCHOR - String
      SymbolOptions.PROPERTY_TEXT_ROTATE - Float
      SymbolOptions.PROPERTY_TEXT_TRANSFORM - String
      SymbolOptions.PROPERTY_TEXT_OFFSET - Float[]
      SymbolOptions.PROPERTY_ICON_OPACITY - Float
      SymbolOptions.PROPERTY_ICON_COLOR - String
      SymbolOptions.PROPERTY_ICON_HALO_COLOR - String
      SymbolOptions.PROPERTY_ICON_HALO_WIDTH - Float
      SymbolOptions.PROPERTY_ICON_HALO_BLUR - Float
      SymbolOptions.PROPERTY_TEXT_OPACITY - Float
      SymbolOptions.PROPERTY_TEXT_COLOR - String
      SymbolOptions.PROPERTY_TEXT_HALO_COLOR - String
      SymbolOptions.PROPERTY_TEXT_HALO_WIDTH - Float
      SymbolOptions.PROPERTY_TEXT_HALO_BLUR - Float

      Out of spec properties:
      "is-draggable" - Boolean, true if the symbol should be draggable, false otherwise

      Parameters:
      json - the GeoJSON defining the list of symbols to build
      Returns:
      the list of built symbols
    • create

      @UiThread public List<Symbol> create(@NonNull com.trimblemaps.geojson.FeatureCollection featureCollection)
      Create a list of symbols on the map.

      Symbols are going to be created only for features with a matching geometry.

      All supported properties are:
      SymbolOptions.PROPERTY_SYMBOL_SORT_KEY - Float
      SymbolOptions.PROPERTY_ICON_SIZE - Float
      SymbolOptions.PROPERTY_ICON_IMAGE - String
      SymbolOptions.PROPERTY_ICON_ROTATE - Float
      SymbolOptions.PROPERTY_ICON_OFFSET - Float[]
      SymbolOptions.PROPERTY_ICON_ANCHOR - String
      SymbolOptions.PROPERTY_TEXT_FIELD - String
      SymbolOptions.PROPERTY_TEXT_FONT - String[]
      SymbolOptions.PROPERTY_TEXT_SIZE - Float
      SymbolOptions.PROPERTY_TEXT_MAX_WIDTH - Float
      SymbolOptions.PROPERTY_TEXT_LETTER_SPACING - Float
      SymbolOptions.PROPERTY_TEXT_JUSTIFY - String
      SymbolOptions.PROPERTY_TEXT_RADIAL_OFFSET - Float
      SymbolOptions.PROPERTY_TEXT_ANCHOR - String
      SymbolOptions.PROPERTY_TEXT_ROTATE - Float
      SymbolOptions.PROPERTY_TEXT_TRANSFORM - String
      SymbolOptions.PROPERTY_TEXT_OFFSET - Float[]
      SymbolOptions.PROPERTY_ICON_OPACITY - Float
      SymbolOptions.PROPERTY_ICON_COLOR - String
      SymbolOptions.PROPERTY_ICON_HALO_COLOR - String
      SymbolOptions.PROPERTY_ICON_HALO_WIDTH - Float
      SymbolOptions.PROPERTY_ICON_HALO_BLUR - Float
      SymbolOptions.PROPERTY_TEXT_OPACITY - Float
      SymbolOptions.PROPERTY_TEXT_COLOR - String
      SymbolOptions.PROPERTY_TEXT_HALO_COLOR - String
      SymbolOptions.PROPERTY_TEXT_HALO_WIDTH - Float
      SymbolOptions.PROPERTY_TEXT_HALO_BLUR - Float

      Out of spec properties:
      "is-draggable" - Boolean, true if the symbol should be draggable, false otherwise

      Parameters:
      featureCollection - the featureCollection defining the list of symbols to build
      Returns:
      the list of built symbols
    • getSymbolPlacement

      public String getSymbolPlacement()
      Get the SymbolPlacement property

      Label placement relative to its geometry.

      Returns:
      property wrapper value around String
    • setSymbolPlacement

      public void setSymbolPlacement(String value)
      Set the SymbolPlacement property

      Label placement relative to its geometry.

      Parameters:
      value - property wrapper value around String
    • getSymbolSpacing

      public Float getSymbolSpacing()
      Get the SymbolSpacing property

      Distance between two symbol anchors.

      Returns:
      property wrapper value around Float
    • setSymbolSpacing

      public void setSymbolSpacing(Float value)
      Set the SymbolSpacing property

      Distance between two symbol anchors.

      Parameters:
      value - property wrapper value around Float
    • getSymbolAvoidEdges

      public Boolean getSymbolAvoidEdges()
      Get the SymbolAvoidEdges property

      If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.

      Returns:
      property wrapper value around Boolean
    • setSymbolAvoidEdges

      public void setSymbolAvoidEdges(Boolean value)
      Set the SymbolAvoidEdges property

      If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer.

      Parameters:
      value - property wrapper value around Boolean
    • getIconAllowOverlap

      public Boolean getIconAllowOverlap()
      Get the IconAllowOverlap property

      If true, the icon will be visible even if it collides with other previously drawn symbols.

      Returns:
      property wrapper value around Boolean
    • setIconAllowOverlap

      public void setIconAllowOverlap(Boolean value)
      Set the IconAllowOverlap property

      If true, the icon will be visible even if it collides with other previously drawn symbols.

      Parameters:
      value - property wrapper value around Boolean
    • getIconIgnorePlacement

      public Boolean getIconIgnorePlacement()
      Get the IconIgnorePlacement property

      If true, other symbols can be visible even if they collide with the icon.

      Returns:
      property wrapper value around Boolean
    • setIconIgnorePlacement

      public void setIconIgnorePlacement(Boolean value)
      Set the IconIgnorePlacement property

      If true, other symbols can be visible even if they collide with the icon.

      Parameters:
      value - property wrapper value around Boolean
    • getIconOptional

      public Boolean getIconOptional()
      Get the IconOptional property

      If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.

      Returns:
      property wrapper value around Boolean
    • setIconOptional

      public void setIconOptional(Boolean value)
      Set the IconOptional property

      If true, text will display without their corresponding icons when the icon collides with other symbols and the text does not.

      Parameters:
      value - property wrapper value around Boolean
    • getIconRotationAlignment

      public String getIconRotationAlignment()
      Get the IconRotationAlignment property

      In combination with Property.SYMBOL_PLACEMENT, determines the rotation behavior of icons.

      Returns:
      property wrapper value around String
    • setIconRotationAlignment

      public void setIconRotationAlignment(String value)
      Set the IconRotationAlignment property

      In combination with Property.SYMBOL_PLACEMENT, determines the rotation behavior of icons.

      Parameters:
      value - property wrapper value around String
    • getIconTextFit

      public String getIconTextFit()
      Get the IconTextFit property

      Scales the icon to fit around the associated text.

      Returns:
      property wrapper value around String
    • setIconTextFit

      public void setIconTextFit(String value)
      Set the IconTextFit property

      Scales the icon to fit around the associated text.

      Parameters:
      value - property wrapper value around String
    • getIconTextFitPadding

      public Float[] getIconTextFitPadding()
      Get the IconTextFitPadding property

      Size of the additional area added to dimensions determined by Property.ICON_TEXT_FIT, in clockwise order: top, right, bottom, left.

      Returns:
      property wrapper value around Float[]
    • setIconTextFitPadding

      public void setIconTextFitPadding(Float[] value)
      Set the IconTextFitPadding property

      Size of the additional area added to dimensions determined by Property.ICON_TEXT_FIT, in clockwise order: top, right, bottom, left.

      Parameters:
      value - property wrapper value around Float[]
    • getIconPadding

      public Float getIconPadding()
      Get the IconPadding property

      Size of the additional area around the icon bounding box used for detecting symbol collisions.

      Returns:
      property wrapper value around Float
    • setIconPadding

      public void setIconPadding(Float value)
      Set the IconPadding property

      Size of the additional area around the icon bounding box used for detecting symbol collisions.

      Parameters:
      value - property wrapper value around Float
    • getIconKeepUpright

      public Boolean getIconKeepUpright()
      Get the IconKeepUpright property

      If true, the icon may be flipped to prevent it from being rendered upside-down.

      Returns:
      property wrapper value around Boolean
    • setIconKeepUpright

      public void setIconKeepUpright(Boolean value)
      Set the IconKeepUpright property

      If true, the icon may be flipped to prevent it from being rendered upside-down.

      Parameters:
      value - property wrapper value around Boolean
    • getIconPitchAlignment

      public String getIconPitchAlignment()
      Get the IconPitchAlignment property

      Orientation of icon when map is pitched.

      Returns:
      property wrapper value around String
    • setIconPitchAlignment

      public void setIconPitchAlignment(String value)
      Set the IconPitchAlignment property

      Orientation of icon when map is pitched.

      Parameters:
      value - property wrapper value around String
    • getTextPitchAlignment

      public String getTextPitchAlignment()
      Get the TextPitchAlignment property

      Orientation of text when map is pitched.

      Returns:
      property wrapper value around String
    • setTextPitchAlignment

      public void setTextPitchAlignment(String value)
      Set the TextPitchAlignment property

      Orientation of text when map is pitched.

      Parameters:
      value - property wrapper value around String
    • getTextRotationAlignment

      public String getTextRotationAlignment()
      Get the TextRotationAlignment property

      In combination with Property.SYMBOL_PLACEMENT, determines the rotation behavior of the individual glyphs forming the text.

      Returns:
      property wrapper value around String
    • setTextRotationAlignment

      public void setTextRotationAlignment(String value)
      Set the TextRotationAlignment property

      In combination with Property.SYMBOL_PLACEMENT, determines the rotation behavior of the individual glyphs forming the text.

      Parameters:
      value - property wrapper value around String
    • getTextLineHeight

      public Float getTextLineHeight()
      Get the TextLineHeight property

      Text leading value for multi-line text.

      Returns:
      property wrapper value around Float
    • setTextLineHeight

      public void setTextLineHeight(Float value)
      Set the TextLineHeight property

      Text leading value for multi-line text.

      Parameters:
      value - property wrapper value around Float
    • getTextVariableAnchor

      public String[] getTextVariableAnchor()
      Get the TextVariableAnchor property

      To increase the chance of placing high-priority labels on the map, you can provide an array of Property.TEXT_ANCHOR locations: the render will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the PropertyFactory.textRadialOffset(java.lang.Float) instead of the two-dimensional PropertyFactory.textOffset(java.lang.Float[]).

      Returns:
      property wrapper value around String[]
    • setTextVariableAnchor

      public void setTextVariableAnchor(String[] value)
      Set the TextVariableAnchor property

      To increase the chance of placing high-priority labels on the map, you can provide an array of Property.TEXT_ANCHOR locations: the render will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the PropertyFactory.textRadialOffset(java.lang.Float) instead of the two-dimensional PropertyFactory.textOffset(java.lang.Float[]).

      Parameters:
      value - property wrapper value around String[]
    • getTextMaxAngle

      public Float getTextMaxAngle()
      Get the TextMaxAngle property

      Maximum angle change between adjacent characters.

      Returns:
      property wrapper value around Float
    • setTextMaxAngle

      public void setTextMaxAngle(Float value)
      Set the TextMaxAngle property

      Maximum angle change between adjacent characters.

      Parameters:
      value - property wrapper value around Float
    • getTextPadding

      public Float getTextPadding()
      Get the TextPadding property

      Size of the additional area around the text bounding box used for detecting symbol collisions.

      Returns:
      property wrapper value around Float
    • setTextPadding

      public void setTextPadding(Float value)
      Set the TextPadding property

      Size of the additional area around the text bounding box used for detecting symbol collisions.

      Parameters:
      value - property wrapper value around Float
    • getTextKeepUpright

      public Boolean getTextKeepUpright()
      Get the TextKeepUpright property

      If true, the text may be flipped vertically to prevent it from being rendered upside-down.

      Returns:
      property wrapper value around Boolean
    • setTextKeepUpright

      public void setTextKeepUpright(Boolean value)
      Set the TextKeepUpright property

      If true, the text may be flipped vertically to prevent it from being rendered upside-down.

      Parameters:
      value - property wrapper value around Boolean
    • getTextAllowOverlap

      public Boolean getTextAllowOverlap()
      Get the TextAllowOverlap property

      If true, the text will be visible even if it collides with other previously drawn symbols.

      Returns:
      property wrapper value around Boolean
    • setTextAllowOverlap

      public void setTextAllowOverlap(Boolean value)
      Set the TextAllowOverlap property

      If true, the text will be visible even if it collides with other previously drawn symbols.

      Parameters:
      value - property wrapper value around Boolean
    • getTextIgnorePlacement

      public Boolean getTextIgnorePlacement()
      Get the TextIgnorePlacement property

      If true, other symbols can be visible even if they collide with the text.

      Returns:
      property wrapper value around Boolean
    • setTextIgnorePlacement

      public void setTextIgnorePlacement(Boolean value)
      Set the TextIgnorePlacement property

      If true, other symbols can be visible even if they collide with the text.

      Parameters:
      value - property wrapper value around Boolean
    • getTextOptional

      public Boolean getTextOptional()
      Get the TextOptional property

      If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.

      Returns:
      property wrapper value around Boolean
    • setTextOptional

      public void setTextOptional(Boolean value)
      Set the TextOptional property

      If true, icons will display without their corresponding text when the text collides with other symbols and the icon does not.

      Parameters:
      value - property wrapper value around Boolean
    • getIconTranslate

      public Float[] getIconTranslate()
      Get the IconTranslate property

      Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      property wrapper value around Float[]
    • setIconTranslate

      public void setIconTranslate(Float[] value)
      Set the IconTranslate property

      Distance that the icon's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Parameters:
      value - property wrapper value around Float[]
    • getIconTranslateAnchor

      public String getIconTranslateAnchor()
      Get the IconTranslateAnchor property

      Controls the frame of reference for PropertyFactory.iconTranslate(java.lang.Float[]).

      Returns:
      property wrapper value around String
    • setIconTranslateAnchor

      public void setIconTranslateAnchor(String value)
      Set the IconTranslateAnchor property

      Controls the frame of reference for PropertyFactory.iconTranslate(java.lang.Float[]).

      Parameters:
      value - property wrapper value around String
    • getTextTranslate

      public Float[] getTextTranslate()
      Get the TextTranslate property

      Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Returns:
      property wrapper value around Float[]
    • setTextTranslate

      public void setTextTranslate(Float[] value)
      Set the TextTranslate property

      Distance that the text's anchor is moved from its original placement. Positive values indicate right and down, while negative values indicate left and up.

      Parameters:
      value - property wrapper value around Float[]
    • getTextTranslateAnchor

      public String getTextTranslateAnchor()
      Get the TextTranslateAnchor property

      Controls the frame of reference for PropertyFactory.textTranslate(java.lang.Float[]).

      Returns:
      property wrapper value around String
    • setTextTranslateAnchor

      public void setTextTranslateAnchor(String value)
      Set the TextTranslateAnchor property

      Controls the frame of reference for PropertyFactory.textTranslate(java.lang.Float[]).

      Parameters:
      value - property wrapper value around String
    • setFilter

      public void setFilter(@NonNull com.trimblemaps.mapsdk.style.expressions.Expression expression)
      Set filter on the managed symbols.
      Parameters:
      expression - expression
    • getFilter

      @Nullable public com.trimblemaps.mapsdk.style.expressions.Expression getFilter()
      Get filter of the managed symbols.
      Returns:
      expression