Class GroupLayerHelper

java.lang.Object
slash.navigation.mapview.mapsforge.helpers.GroupLayerHelper

public class GroupLayerHelper extends Object
A helper for putting Layers into the child list of a GroupLayer and taking them out again.
Author:
Christian Pesch
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addToGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, org.mapsforge.map.model.DisplayModel displayModel, Collection<? extends org.mapsforge.map.layer.Layer> layers)
    Adds layers to the child list of a GroupLayer.
    static void
    addToGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, org.mapsforge.map.model.DisplayModel displayModel, org.mapsforge.map.layer.Layer layer)
     
    static void
    removeFromGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, Collection<? extends org.mapsforge.map.layer.Layer> layers)
    Removes the given layers from a GroupLayer's child list, leaving the rest of the group untouched.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • addToGroupLayer

      public static void addToGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, org.mapsforge.map.model.DisplayModel displayModel, Collection<? extends org.mapsforge.map.layer.Layer> layers)
      Adds layers to the child list of a GroupLayer. Always use this instead of touching GroupLayer.layers directly: Layers.add(int, org.mapsforge.map.layer.Layer) is the only place that assigns the DisplayModel, and GroupLayer.setDisplayModel(org.mapsforge.map.model.DisplayModel) only reaches the children that are present when it is called. A child added afterwards would keep a null display model and let Marker.draw(org.mapsforge.core.model.BoundingBox, byte, org.mapsforge.core.graphics.Canvas, org.mapsforge.core.model.Point, org.mapsforge.core.model.Rotation) kill the LayerManager thread with a NullPointerException.
    • addToGroupLayer

      public static void addToGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, org.mapsforge.map.model.DisplayModel displayModel, org.mapsforge.map.layer.Layer layer)
    • removeFromGroupLayer

      public static void removeFromGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, Collection<? extends org.mapsforge.map.layer.Layer> layers)
      Removes the given layers from a GroupLayer's child list, leaving the rest of the group untouched. Clearing the whole group instead would drop the layers of every position that was not part of this update.