[android] insert layer above

This commit is contained in:
Ivo van Dongen
2017-02-24 17:18:26 +02:00
committed by Ivo van Dongen
parent 3040d40772
commit dc21396d71
9 changed files with 118 additions and 15 deletions

View File

@@ -257,18 +257,29 @@ public final class MapboxMap {
*/
@UiThread
public void addLayer(@NonNull Layer layer) {
addLayer(layer, null);
nativeMapView.addLayer(layer);
}
/**
* Adds the layer to the map. The layer must be newly created and not added to the map before
*
* @param layer the layer to add
* @param before the layer id to add this layer before
* @param below the layer id to add this layer before
*/
@UiThread
public void addLayer(@NonNull Layer layer, String before) {
nativeMapView.addLayer(layer, before);
public void addLayerBelow(@NonNull Layer layer, @NonNull String below) {
nativeMapView.addLayerBelow(layer, below);
}
/**
* Adds the layer to the map. The layer must be newly created and not added to the map before
*
* @param layer the layer to add
* @param above the layer id to add this layer above
*/
@UiThread
public void addLayerAbove(@NonNull Layer layer, @NonNull String above) {
nativeMapView.addLayerAbove(layer, above);
}
/**

View File

@@ -761,11 +761,25 @@ final class NativeMapView {
return nativeGetLayer(layerId);
}
public void addLayer(@NonNull Layer layer, @Nullable String before) {
if (isDestroyedOn("")) {
public void addLayer(@NonNull Layer layer) {
if (isDestroyedOn("addLayer")) {
return;
}
nativeAddLayer(layer.getNativePtr(), before);
nativeAddLayer(layer.getNativePtr(), null);
}
public void addLayerBelow(@NonNull Layer layer, @NonNull String below) {
if (isDestroyedOn("addLayerBelow")) {
return;
}
nativeAddLayer(layer.getNativePtr(), below);
}
public void addLayerAbove(@NonNull Layer layer, @NonNull String above) {
if (isDestroyedOn("addLayerAbove")) {
return;
}
nativeAddLayerAbove(layer.getNativePtr(), above);
}
@Nullable
@@ -1079,6 +1093,8 @@ final class NativeMapView {
private native void nativeAddLayer(long layerPtr, String before) throws CannotAddLayerException;
private native void nativeAddLayerAbove(long layerPtr, String above) throws CannotAddLayerException;
private native Layer nativeRemoveLayerById(String layerId);
private native void nativeRemoveLayer(long layerId);