Class VectorTileLayer

Direct Known Subclasses:
CompositeVectorTileLayer, TorqueTileLayer

public class VectorTileLayer extends TileLayer
A tile layer where each tile is a bitmap. Should be used together with corresponding data source.
  • Constructor Details

    • VectorTileLayer

      public VectorTileLayer(TileDataSource dataSource, VectorTileDecoder decoder)
      Constructs a VectorTileLayer object from a data source and tile decoder.
      Parameters:
      dataSource - The data source from which this layer loads data.
      decoder - The tile decoder that decoder loaded tiles and applies styles.
  • Method Details

    • getTileDecoder

      public VectorTileDecoder getTileDecoder()
      Returns the tile decoder assigned to this layer.
      Returns:
      The tile decoder assigned to this layer.
    • getTileCacheCapacity

      public long getTileCacheCapacity()
      Returns the tile cache capacity.
      Returns:
      The tile cache capacity in bytes.
    • setTileCacheCapacity

      public void setTileCacheCapacity(long capacityInBytes)
      Sets the vector tile cache capacity. Tile cache is the primary storage for vector data,
      all tiles contained within the cache are stored as uncompressed vertex buffers and can immediately be
      drawn to the screen. Setting the cache size too small may cause artifacts, such as disappearing tiles.
      The more tiles are visible on the screen, the larger this cache should be.
      The default is 10MB, which should be enough for most use cases with preloading enabled. If preloading is
      disabled, the cache size should be reduced by the user to conserve memory.
      Parameters:
      capacityInBytes - The new tile bitmap cache capacity in bytes.
    • getLabelRenderOrder

      public int getLabelRenderOrder()
      Returns the current display order of the labels.
      Returns:
      The display order of the labels. Default is VECTOR_TILE_RENDER_ORDER_LAYER.
    • setLabelRenderOrder

      public void setLabelRenderOrder(int renderOrder)
      Sets the current display order of the labels.
      Parameters:
      renderOrder - The new display order of the labels.
    • getBuildingRenderOrder

      public int getBuildingRenderOrder()
      Returns the current display order of the buildings.
      Returns:
      The display order of the buildings. Default is VECTOR_TILE_RENDER_ORDER_LAST.

      LAST draws over the flat labels too, so a label that must clear a building is a BILLBOARD
      one - that pass runs after the buildings, and moving this order is not the mechanism.
    • setBuildingRenderOrder

      public void setBuildingRenderOrder(int renderOrder)
      Sets the current display order of the buildings.
      Parameters:
      renderOrder - The new display order of the labels.
    • getClickRadius

      public float getClickRadius()
      Returns the click radius of vector tile features.
      Units are screen density independent pixels (DP or DIP).
      Returns:
      The click radius of vector tile features.
    • setClickRadius

      public void setClickRadius(float radius)
      Sets the click radius of vector tile features.
      The click radius is applied as an extra buffer to the vector tile features to make clicking on small features less sensitive.
      Units are screen density independent pixels (DP or DIP).
      Parameters:
      radius - The new click radius of vector tile features. The default value is 4.
    • getLayerBlendingSpeed

      public float getLayerBlendingSpeed()
      Returns the current relative layer blending speed.
      Returns:
      The current relative layer blending speed. Default is 0.0 (no blending).
    • setLayerBlendingSpeed

      public void setLayerBlendingSpeed(float speed)
      Sets the relative layer blending speed.

      The default is 0 - a tile's geometry appears, as maplibre and mapbox-gl do it; they fade
      rasters only. A cased road cross-fades badly, because its fill is usually near the
      background colour: for the length of the fade only the casing reads and the road looks
      like an outline waiting to be filled. Set 1 for the fade this SDK used to do.
      Parameters:
      speed - The new relative speed value. Use zero or negative values to disable blending.
    • getLabelBlendingSpeed

      public float getLabelBlendingSpeed()
      Returns the current relative label blending speed.
      Returns:
      The current relative label blending speed. Default is 1.0.
    • setLabelBlendingSpeed

      public void setLabelBlendingSpeed(float speed)
      Sets the relative label blending speed.
      Parameters:
      speed - The new relative speed value. Default is 1.0. Use zero or negative values to disable blending.
    • getLabelPerspectiveScaling

      public float getLabelPerspectiveScaling()
      Returns how much of the perspective divide a label keeps as it recedes from the camera.
      Returns:
      The label perspective scaling, 0 to 1. Default is 0.5.
    • setLabelPerspectiveScaling

      public void setLabelPerspectiveScaling(float scaling)
      Sets how much of the perspective divide a label keeps as it recedes from the camera.
      At 0 a label holds a constant on-screen size at any distance. At 0.5, mapbox's and
      maplibre's own value, a distant label shrinks at half the rate the projection would
      shrink it. At 1 it shrinks with the map. Callout labels always hold their size.
      Parameters:
      scaling - The new scaling, clamped to 0 to 1. Default is 0.5.
    • getRendererLayerFilter

      public String getRendererLayerFilter()
      Returns the renderer layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.
      Returns:
      The renderer layer filter. Default is empty string, which means no filter is used.
    • setRendererLayerFilter

      public void setRendererLayerFilter(String filter)
      Sets the renderer layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.
      If non-empty, then only layers that pass the filter are rendered.
      Parameters:
      filter - The new renderer layer filter.
      Throws:
      Exception - If the filter expression is not valid.
    • getClickHandlerLayerFilter

      public String getClickHandlerLayerFilter()
      Returns the click handler layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.
      Returns:
      The click handler layer filter. Default is empty string, which means no filter is used.
    • setClickHandlerLayerFilter

      public void setClickHandlerLayerFilter(String filter)
      Sets the click handler layer filter. The filter is given as ECMA regular expression that is applied to qualified layer names.
      If non-empty, then only layers that pass the filter are tested when handling clicks.
      Parameters:
      filter - The new click handler layer filter.
      Throws:
      Exception - If the filter expression is not valid.
    • getVectorTileEventListener

      public VectorTileEventListener getVectorTileEventListener()
      Returns the vector tile event listener.
      Returns:
      The vector tile event listener.
    • setVectorTileEventListener

      public void setVectorTileEventListener(VectorTileEventListener eventListener)
      Sets the vector tile event listener.
      Parameters:
      eventListener - The vector tile event listener.