Skip to content

Commit

Permalink
Layers: bind added layer in set (#1119)
Browse files Browse the repository at this point in the history
  • Loading branch information
devemux86 authored Apr 29, 2024
1 parent 6eecba7 commit 6d5cf43
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions vtm/src/org/oscim/map/Layers.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,30 @@ public synchronized Layer set(int index, Layer layer) {
return layer;
}

// bind added layer
if (layer instanceof UpdateListener)
mMap.events.bind((UpdateListener) layer);
if (layer instanceof InputListener)
mMap.input.bind((InputListener) layer);
// add zoom limit to tile manager
if (layer instanceof ZoomLimiter.IZoomLimiter)
((ZoomLimiter.IZoomLimiter) layer).addZoomLimit();

// bind added group layer
if (layer instanceof GroupLayer) {
GroupLayer groupLayer = (GroupLayer) layer;
for (Layer gl : groupLayer.layers) {
if (gl instanceof UpdateListener)
mMap.events.bind((UpdateListener) gl);
if (gl instanceof InputListener)
mMap.input.bind((InputListener) gl);
if (gl instanceof ZoomLimiter.IZoomLimiter)
((ZoomLimiter.IZoomLimiter) gl).addZoomLimit();
}
}

layer.setEnableHandler(mEnableHandler);

mDirtyLayers = true;
Layer remove = mLayerList.set(index, layer);

Expand Down

0 comments on commit 6d5cf43

Please sign in to comment.