[android] return source ownership on remove

This commit is contained in:
Ivo van Dongen
2016-11-14 12:07:14 +01:00
committed by Ivo van Dongen
parent 8d53f9f091
commit 36dea5ea0d
6 changed files with 99 additions and 5 deletions

View File

@@ -212,6 +212,17 @@ public class MapboxMap {
getMapView().getNativeMapView().removeSource(sourceId);
}
/**
* Removes the source, preserving the reverence for re-use
*
* @param source the source to remove
* @throws NoSuchSourceException
*/
@UiThread
public void removeSource(@NonNull Source source) throws NoSuchSourceException {
getMapView().getNativeMapView().removeSource(source);
}
/**
* Add an image to be used int hte map's style
*

View File

@@ -507,7 +507,11 @@ final class NativeMapView {
}
public void removeSource(@NonNull String sourceId) throws NoSuchSourceException {
nativeRemoveSource(nativeMapViewPtr, sourceId);
nativeRemoveSourceById(nativeMapViewPtr, sourceId);
}
public void removeSource(@NonNull Source source) throws NoSuchSourceException {
nativeRemoveSource(nativeMapViewPtr, source.getNativePtr());
}
public void addImage(@NonNull String name, @NonNull Bitmap image) {
@@ -755,7 +759,9 @@ final class NativeMapView {
private native void nativeAddSource(long nativeMapViewPtr, long nativeSourcePtr);
private native void nativeRemoveSource(long nativeMapViewPtr, String sourceId) throws NoSuchSourceException;
private native void nativeRemoveSourceById(long nativeMapViewPtr, String sourceId) throws NoSuchSourceException;
private native void nativeRemoveSource(long nativeMapViewPtr, long sourcePtr) throws NoSuchSourceException;
private native void nativeAddImage(long nativeMapViewPtr, String name, int width, int height, float pixelRatio, byte[] array);