Add set and get api for volatile and minimumTileUpdateInterval in Source (#355)
* Add set and get api for Volatile and minimumTileUpdateInterval in Source * Format codes.
This commit is contained in:
@@ -180,6 +180,22 @@ static std::unique_ptr<Source> createSourcePeer(jni::JNIEnv& env,
|
||||
return ownedSource != nullptr;
|
||||
}
|
||||
|
||||
jni::Local<jni::Boolean> Source::isVolatile(jni::JNIEnv& env) {
|
||||
return jni::Box(env, jni::jboolean(source.isVolatile()));
|
||||
}
|
||||
|
||||
void Source::setVolatile(JNIEnv& env, jni::Boolean& value) {
|
||||
source.setVolatile(jni::Unbox(env, value));
|
||||
}
|
||||
|
||||
void Source::setMinimumTileUpdateInterval(JNIEnv& env, jni::Long& interval) {
|
||||
source.setMinimumTileUpdateInterval(Milliseconds(jni::Unbox(env, interval)));
|
||||
}
|
||||
|
||||
jni::Local<jni::Long> Source::getMinimumTileUpdateInterval(JNIEnv& env) {
|
||||
return jni::Box(env, jni::jlong(source.getMinimumTileUpdateInterval().count() / 1000000));
|
||||
}
|
||||
|
||||
void Source::releaseJavaPeer() {
|
||||
// We can't release the peer if the source was not removed from the map
|
||||
if (!ownedSource) {
|
||||
@@ -214,7 +230,12 @@ static std::unique_ptr<Source> createSourcePeer(jni::JNIEnv& env,
|
||||
METHOD(&Source::setPrefetchZoomDelta, "nativeSetPrefetchZoomDelta"),
|
||||
METHOD(&Source::getPrefetchZoomDelta, "nativeGetPrefetchZoomDelta"),
|
||||
METHOD(&Source::setMaxOverscaleFactorForParentTiles, "nativeSetMaxOverscaleFactorForParentTiles"),
|
||||
METHOD(&Source::getMaxOverscaleFactorForParentTiles, "nativeGetMaxOverscaleFactorForParentTiles"));
|
||||
METHOD(&Source::getMaxOverscaleFactorForParentTiles, "nativeGetMaxOverscaleFactorForParentTiles"),
|
||||
METHOD(&Source::isVolatile, "nativeIsVolatile"),
|
||||
METHOD(&Source::setVolatile, "nativeSetVolatile"),
|
||||
METHOD(&Source::setMinimumTileUpdateInterval, "nativeSetMinimumTileUpdateInterval"),
|
||||
METHOD(&Source::getMinimumTileUpdateInterval, "nativeGetMinimumTileUpdateInterval"));
|
||||
|
||||
|
||||
// Register subclasses
|
||||
GeoJSONSource::registerNative(env);
|
||||
@@ -225,6 +246,5 @@ static std::unique_ptr<Source> createSourcePeer(jni::JNIEnv& env,
|
||||
CustomGeometrySource::registerNative(env);
|
||||
RasterDEMSource::registerNative(env);
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -54,6 +54,14 @@ public:
|
||||
|
||||
void addToStyle(JNIEnv& env, const jni::Object<Source>& obj, mbgl::style::Style& style);
|
||||
|
||||
jni::Local<jni::Boolean > isVolatile(JNIEnv&);
|
||||
|
||||
void setVolatile(JNIEnv&, jni::Boolean&);
|
||||
|
||||
void setMinimumTileUpdateInterval(JNIEnv&, jni::Long &);
|
||||
|
||||
jni::Local<jni::Long> getMinimumTileUpdateInterval(JNIEnv&);
|
||||
|
||||
protected:
|
||||
// Set on newly created sources until added to the map.
|
||||
std::unique_ptr<mbgl::style::Source> ownedSource;
|
||||
|
||||
Reference in New Issue
Block a user