Class GroupLayerHelper
java.lang.Object
slash.navigation.mapview.mapsforge.helpers.GroupLayerHelper
A helper for putting
Layers into the child list of a GroupLayer and taking them
out again.- Author:
- Christian Pesch
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddToGroupLayer(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 aGroupLayer.static voidaddToGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, org.mapsforge.map.model.DisplayModel displayModel, org.mapsforge.map.layer.Layer layer) static voidremoveFromGroupLayer(org.mapsforge.map.layer.GroupLayer groupLayer, Collection<? extends org.mapsforge.map.layer.Layer> layers) Removes the given layers from aGroupLayer's child list, leaving the rest of the group untouched.
-
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 aGroupLayer. Always use this instead of touchingGroupLayer.layersdirectly:Layers.add(int, org.mapsforge.map.layer.Layer)is the only place that assigns theDisplayModel, andGroupLayer.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 letMarker.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 aGroupLayer'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.
-