[android] expose ImageSource coordinates setter (#11262)
This commit is contained in:
@@ -124,6 +124,15 @@ public class ImageSource extends Source {
|
||||
return nativeGetUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the latitude and longitude of the four corners of the image
|
||||
*
|
||||
* @param latLngQuad latitude and longitude of the four corners of the image
|
||||
*/
|
||||
public void setCoordinates(LatLngQuad latLngQuad) {
|
||||
nativeSetCoordinates(latLngQuad);
|
||||
}
|
||||
|
||||
protected native void initialize(String layerId, LatLngQuad payload);
|
||||
|
||||
protected native void nativeSetUrl(String url);
|
||||
@@ -132,6 +141,8 @@ public class ImageSource extends Source {
|
||||
|
||||
protected native void nativeSetImage(Bitmap bitmap);
|
||||
|
||||
protected native void nativeSetCoordinates(LatLngQuad latLngQuad);
|
||||
|
||||
@Override
|
||||
protected native void finalize() throws Throwable;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,11 @@ namespace android {
|
||||
source.as<mbgl::style::ImageSource>()->setImage(Bitmap::GetImage(env, bitmap));
|
||||
}
|
||||
|
||||
void ImageSource::setCoordinates(jni::JNIEnv& env, jni::Object<LatLngQuad> coordinatesObject) {
|
||||
source.as<mbgl::style::ImageSource>()->setCoordinates(
|
||||
LatLngQuad::getLatLngArray(env, coordinatesObject));
|
||||
}
|
||||
|
||||
jni::Class<ImageSource> ImageSource::javaClass;
|
||||
|
||||
jni::Object<Source> ImageSource::createJavaPeer(jni::JNIEnv& env) {
|
||||
@@ -66,7 +71,8 @@ namespace android {
|
||||
"finalize",
|
||||
METHOD(&ImageSource::setURL, "nativeSetUrl"),
|
||||
METHOD(&ImageSource::getURL, "nativeGetUrl"),
|
||||
METHOD(&ImageSource::setImage, "nativeSetImage")
|
||||
METHOD(&ImageSource::setImage, "nativeSetImage"),
|
||||
METHOD(&ImageSource::setCoordinates, "nativeSetCoordinates")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ public:
|
||||
|
||||
void setImage(jni::JNIEnv&, jni::Object<Bitmap>);
|
||||
|
||||
void setCoordinates(jni::JNIEnv&, jni::Object<LatLngQuad>);
|
||||
|
||||
private:
|
||||
jni::Object<Source> createJavaPeer(jni::JNIEnv&);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user