diff options
author | Chris Loer <chris.loer@gmail.com> | 2018-12-18 17:26:31 -0800 |
---|---|---|
committer | Chris Loer <chris.loer@mapbox.com> | 2018-12-21 15:13:48 -0800 |
commit | a889ff6523bc017e3989ea57c7054fc38de4ebaa (patch) | |
tree | d1a24f7573c49755456d22c4c9964662355b61bb /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk | |
parent | 387fa1800f24a40f5cae2bd9457a5628fe55ba49 (diff) | |
download | qtlocation-mapboxgl-a889ff6523bc017e3989ea57c7054fc38de4ebaa.tar.gz |
[android] Add "localIdeographs" option to OfflineRegionDefinition.
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk')
3 files changed, 70 insertions, 3 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineGeometryRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineGeometryRegionDefinition.java index 7cf9d4b2db..01ceb66b2b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineGeometryRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineGeometryRegionDefinition.java @@ -21,6 +21,8 @@ import com.mapbox.turf.TurfMeasurement; * tiles from minZoom up to the maximum zoom level provided by that source. * <p> * pixelRatio must be ≥ 0 and should typically be 1.0 or 2.0. + * <p> + * if includeIdeographs is false, offline region will not include CJK glyphs */ public class OfflineGeometryRegionDefinition implements OfflineRegionDefinition, Parcelable { @@ -35,6 +37,23 @@ public class OfflineGeometryRegionDefinition implements OfflineRegionDefinition, private double maxZoom; @Keep private float pixelRatio; + @Keep + private boolean includeIdeographs; + + /** + * Constructor to create an OfflineGeometryRegionDefinition from parameters. + * + * @param styleURL the style + * @param geometry the geometry + * @param minZoom min zoom + * @param maxZoom max zoom + * @param pixelRatio pixel ratio of the device + */ + @Keep + public OfflineGeometryRegionDefinition( + String styleURL, Geometry geometry, double minZoom, double maxZoom, float pixelRatio) { + this(styleURL, geometry, minZoom, maxZoom, pixelRatio, true); + } /** * Constructor to create an OfflineGeometryRegionDefinition from parameters. @@ -44,16 +63,19 @@ public class OfflineGeometryRegionDefinition implements OfflineRegionDefinition, * @param minZoom min zoom * @param maxZoom max zoom * @param pixelRatio pixel ratio of the device + * @param includeIdeographs include glyphs for CJK languages */ @Keep public OfflineGeometryRegionDefinition( - String styleURL, Geometry geometry, double minZoom, double maxZoom, float pixelRatio) { + String styleURL, Geometry geometry, double minZoom, double maxZoom, float pixelRatio, + boolean includeIdeographs) { // Note: Also used in JNI this.styleURL = styleURL; this.geometry = geometry; this.minZoom = minZoom; this.maxZoom = maxZoom; this.pixelRatio = pixelRatio; + this.includeIdeographs = includeIdeographs; } /** @@ -110,6 +132,11 @@ public class OfflineGeometryRegionDefinition implements OfflineRegionDefinition, return pixelRatio; } + @Override + public boolean getIncludeIdeographs() { + return includeIdeographs; + } + @NonNull @Override public String getType() { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java index 473d905f1a..782968fb00 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineRegionDefinition.java @@ -48,7 +48,20 @@ public interface OfflineRegionDefinition { float getPixelRatio(); /** - * Gest the type of the OfflineRegionDefinition for telemetry ("tileregion", "shaperegion"). + * Specifies whether to include ideographic glyphs in downloaded font data. + * Ideographic glyphs make up the majority of downloaded font data, but + * it is possible to configure the renderer to use locally installed fonts + * instead of relying on fonts downloaded as part of the offline pack. + * + * Defaults to `true` + * + * @return true if offline region will include ideographic glyphs + * @see MapboxMapOptions localIdeographFontFamily + */ + boolean getIncludeIdeographs(); + + /** + * Gets the type of the OfflineRegionDefinition for telemetry ("tileregion", "shaperegion"). * * @return The type of the OfflineRegionDefinition. */ diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java index 8649c70acb..a5339fcac0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineTilePyramidRegionDefinition.java @@ -18,6 +18,8 @@ import com.mapbox.mapboxsdk.geometry.LatLngBounds; * tiles from minZoom up to the maximum zoom level provided by that source. * <p> * pixelRatio must be ≥ 0 and should typically be 1.0 or 2.0. + * <p> + * if includeIdeographs is false, offline region will not include CJK glyphs */ public class OfflineTilePyramidRegionDefinition implements OfflineRegionDefinition, Parcelable { @@ -31,6 +33,23 @@ public class OfflineTilePyramidRegionDefinition implements OfflineRegionDefiniti private double maxZoom; @Keep private float pixelRatio; + @Keep + private boolean includeIdeographs; + + /** + * Constructor to create an OfflineTilePyramidDefinition from parameters. + * + * @param styleURL the style + * @param bounds the bounds + * @param minZoom min zoom + * @param maxZoom max zoom + * @param pixelRatio pixel ratio of the device + */ + @Keep + public OfflineTilePyramidRegionDefinition( + String styleURL, LatLngBounds bounds, double minZoom, double maxZoom, float pixelRatio) { + this(styleURL, bounds, minZoom, maxZoom, pixelRatio, true); + } /** * Constructor to create an OfflineTilePyramidDefinition from parameters. @@ -40,16 +59,19 @@ public class OfflineTilePyramidRegionDefinition implements OfflineRegionDefiniti * @param minZoom min zoom * @param maxZoom max zoom * @param pixelRatio pixel ratio of the device + * @param includeIdeographs include glyphs for CJK languages */ @Keep public OfflineTilePyramidRegionDefinition( - String styleURL, LatLngBounds bounds, double minZoom, double maxZoom, float pixelRatio) { + String styleURL, LatLngBounds bounds, double minZoom, double maxZoom, float pixelRatio, + boolean includeIdeographs) { // Note: Also used in JNI this.styleURL = styleURL; this.bounds = bounds; this.minZoom = minZoom; this.maxZoom = maxZoom; this.pixelRatio = pixelRatio; + this.includeIdeographs = includeIdeographs; } /** @@ -94,6 +116,11 @@ public class OfflineTilePyramidRegionDefinition implements OfflineRegionDefiniti return pixelRatio; } + @Override + public boolean getIncludeIdeographs() { + return includeIdeographs; + } + @NonNull @Override public String getType() { |