Enable FastPFOR encodings in MLT (#4146)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
@@ -47,5 +47,11 @@ bool NativeMapOptions::asyncRendererCleanup(jni::JNIEnv &env, const jni::Object<
|
||||
return obj.Get(env, asyncRendererCleanupField);
|
||||
}
|
||||
|
||||
bool NativeMapOptions::fastPFOREnabled(jni::JNIEnv &env, const jni::Object<NativeMapOptions> &obj) {
|
||||
auto &javaClass = jni::Class<NativeMapOptions>::Singleton(env);
|
||||
auto field = javaClass.GetField<jni::jboolean>(env, "fastPFOREnabled");
|
||||
return obj.Get(env, field);
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -20,6 +20,7 @@ public:
|
||||
static float pixelRatio(jni::JNIEnv&, const jni::Object<NativeMapOptions>&);
|
||||
static bool crossSourceCollisions(jni::JNIEnv&, const jni::Object<NativeMapOptions>&);
|
||||
static bool asyncRendererCleanup(jni::JNIEnv&, const jni::Object<NativeMapOptions>&);
|
||||
static bool fastPFOREnabled(jni::JNIEnv&, const jni::Object<NativeMapOptions>&);
|
||||
};
|
||||
|
||||
} // namespace android
|
||||
|
||||
@@ -87,7 +87,8 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env,
|
||||
.withPixelRatio(pixelRatio)
|
||||
.withConstrainMode(ConstrainMode::HeightOnly)
|
||||
.withViewportMode(ViewportMode::Default)
|
||||
.withCrossSourceCollisions(NativeMapOptions::crossSourceCollisions(_env, jNativeMapOptions));
|
||||
.withCrossSourceCollisions(NativeMapOptions::crossSourceCollisions(_env, jNativeMapOptions))
|
||||
.withFastPFOREnabled(NativeMapOptions::fastPFOREnabled(_env, jNativeMapOptions));
|
||||
|
||||
// Create the core map
|
||||
map = std::make_unique<mbgl::Map>(
|
||||
|
||||
@@ -102,6 +102,8 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
|
||||
private boolean asyncRendererCleanup = false;
|
||||
|
||||
private boolean fastPFOREnabled = false;
|
||||
|
||||
/**
|
||||
* Creates a new MapLibreMapOptions object.
|
||||
*
|
||||
@@ -167,6 +169,8 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
actionJournalRenderingReportInterval = in.readInt();
|
||||
|
||||
asyncRendererCleanup = in.readByte() != 0;
|
||||
|
||||
fastPFOREnabled = in.readByte() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,6 +344,10 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
maplibreMapOptions.asyncRendererCleanup(
|
||||
typedArray.getBoolean(R.styleable.maplibre_MapView_maplibre_asyncRendererCleanup, false)
|
||||
);
|
||||
|
||||
maplibreMapOptions.fastPFOREnabled(
|
||||
typedArray.getBoolean(R.styleable.maplibre_MapView_maplibre_fastPFOREnabled, false)
|
||||
);
|
||||
} finally {
|
||||
typedArray.recycle();
|
||||
}
|
||||
@@ -852,6 +860,16 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable FastPFOR decompression for vector tiles, defaults to false.
|
||||
* @param enable true to enable, false to disable
|
||||
* @return This
|
||||
*/
|
||||
@NonNull public MapLibreMapOptions fastPFOREnabled(boolean enable) {
|
||||
this.fastPFOREnabled = enable;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable local ideograph font family, defaults to true.
|
||||
*
|
||||
@@ -999,6 +1017,15 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
return asyncRendererCleanup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether FastPFOR decompression is enabled for vector tiles.
|
||||
*
|
||||
* @return true if enabled
|
||||
*/
|
||||
public boolean getFastPFOREnabled() {
|
||||
return fastPFOREnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the flag to render the map surface on top of another surface.
|
||||
*
|
||||
@@ -1391,6 +1418,8 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
dest.writeInt(actionJournalRenderingReportInterval);
|
||||
|
||||
dest.writeByte((byte) (asyncRendererCleanup ? 1 : 0));
|
||||
|
||||
dest.writeByte((byte) (fastPFOREnabled ? 1 : 0));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1535,6 +1564,10 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fastPFOREnabled != options.fastPFOREnabled) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1588,6 +1621,7 @@ public class MapLibreMapOptions implements Parcelable {
|
||||
result = 31 * result + (int) actionJournalLogFileCount;
|
||||
result = 31 * result + (int) actionJournalRenderingReportInterval;
|
||||
result = 31 * result + (asyncRendererCleanup ? 1 : 0);
|
||||
result = 31 * result + (fastPFOREnabled ? 1 : 0);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ public class NativeMapOptions {
|
||||
private final int actionJournalRenderingReportInterval;
|
||||
private final boolean asyncRendererCleanup;
|
||||
|
||||
private final boolean fastPFOREnabled;
|
||||
|
||||
public NativeMapOptions(MapLibreMapOptions options) {
|
||||
pixelRatio = options.getPixelRatio();
|
||||
crossSourceCollisions = options.getCrossSourceCollisions();
|
||||
@@ -22,6 +24,7 @@ public class NativeMapOptions {
|
||||
actionJournalLogFileCount = options.getActionJournalLogFileCount();
|
||||
actionJournalRenderingReportInterval = options.getActionJournalRenderingReportInterval();
|
||||
asyncRendererCleanup = options.getAsyncRendererCleanup();
|
||||
fastPFOREnabled = options.getFastPFOREnabled();
|
||||
}
|
||||
|
||||
public NativeMapOptions(float pixelRatio, boolean crossSourceCollisions) {
|
||||
@@ -35,6 +38,7 @@ public class NativeMapOptions {
|
||||
actionJournalRenderingReportInterval = 0;
|
||||
|
||||
asyncRendererCleanup = false;
|
||||
fastPFOREnabled = false;
|
||||
}
|
||||
|
||||
public float pixelRatio() {
|
||||
@@ -68,4 +72,8 @@ public class NativeMapOptions {
|
||||
public boolean asyncRendererCleanup() {
|
||||
return asyncRendererCleanup;
|
||||
}
|
||||
|
||||
public boolean fastPFOREnabled() {
|
||||
return fastPFOREnabled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
<attr name="maplibre_localIdeographFontFamily" format="string"/>
|
||||
<attr name="maplibre_localIdeographFontFamilies" format="reference"/>
|
||||
<attr name="maplibre_cross_source_collisions" format="boolean"/>
|
||||
<attr name="maplibre_fastPFOREnabled" format="boolean"/>
|
||||
|
||||
<!--Action Journal-->
|
||||
<attr name="maplibre_actionJournalEnabled" format="boolean"/>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#Mon Jun 15 10:28:30 CDT 2026
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -21,7 +21,7 @@ dependencyResolutionManagement {
|
||||
}
|
||||
|
||||
plugins {
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
|
||||
}
|
||||
|
||||
include(":MapLibreAndroid", ":MapLibreAndroidTestApp", ":MapLibreAndroidLint")
|
||||
|
||||
@@ -37,6 +37,11 @@ MLN_EXPORT
|
||||
*/
|
||||
@property NSArray *pluginLayers;
|
||||
|
||||
/**
|
||||
Enable FastPFOR decoding for vector tiles. Defaults to `NO`.
|
||||
*/
|
||||
@property bool fastPFOREnabled;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
_styleURL = nil;
|
||||
_styleJSON = nil;
|
||||
_pluginLayers = nil;
|
||||
|
||||
_actionJournalOptions = [[MLNActionJournalOptions alloc] init];
|
||||
_fastPFOREnabled = NO;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -710,7 +710,8 @@ public:
|
||||
.withPixelRatio(config.scaleFactor)
|
||||
.withConstrainMode(mbgl::ConstrainMode::None)
|
||||
.withViewportMode(mbgl::ViewportMode::Default)
|
||||
.withCrossSourceCollisions(enableCrossSourceCollisions);
|
||||
.withCrossSourceCollisions(enableCrossSourceCollisions)
|
||||
.withFastPFOREnabled(mlnMapoptions.fastPFOREnabled);
|
||||
|
||||
mbgl::TileServerOptions *tileServerOptions =
|
||||
[[MLNSettings sharedSettings] tileServerOptionsInternal];
|
||||
|
||||
Reference in New Issue
Block a user