[android] return layer ownership on remove
This commit is contained in:
committed by
Ivo van Dongen
parent
f66ea0bef9
commit
8d53f9f091
@@ -155,6 +155,17 @@ public class MapboxMap {
|
||||
getMapView().getNativeMapView().removeLayer(layerId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the layer. The reference is re-usable after this and can be re-added
|
||||
*
|
||||
* @param layer the layer to remove
|
||||
* @throws NoSuchLayerException
|
||||
*/
|
||||
@UiThread
|
||||
public void removeLayer(@NonNull Layer layer) throws NoSuchLayerException {
|
||||
getMapView().getNativeMapView().removeLayer(layer);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@UiThread
|
||||
public Source getSource(@NonNull String sourceId) {
|
||||
|
||||
@@ -491,7 +491,11 @@ final class NativeMapView {
|
||||
}
|
||||
|
||||
public void removeLayer(@NonNull String layerId) throws NoSuchLayerException {
|
||||
nativeRemoveLayer(nativeMapViewPtr, layerId);
|
||||
nativeRemoveLayerById(nativeMapViewPtr, layerId);
|
||||
}
|
||||
|
||||
public void removeLayer(@NonNull Layer layer) throws NoSuchLayerException {
|
||||
nativeRemoveLayer(nativeMapViewPtr, layer.getNativePtr());
|
||||
}
|
||||
|
||||
public Source getSource(@NonNull String sourceId) {
|
||||
@@ -743,7 +747,9 @@ final class NativeMapView {
|
||||
|
||||
private native void nativeAddLayer(long nativeMapViewPtr, long layerPtr, String before);
|
||||
|
||||
private native void nativeRemoveLayer(long nativeMapViewPtr, String layerId) throws NoSuchLayerException;
|
||||
private native void nativeRemoveLayerById(long nativeMapViewPtr, String layerId) throws NoSuchLayerException;
|
||||
|
||||
private native void nativeRemoveLayer(long nativeMapViewPtr, long layerId) throws NoSuchLayerException;
|
||||
|
||||
private native Source nativeGetSource(long nativeMapViewPtr, String sourceId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user