Use latest MapLibre Style Spec (#2756)

This commit is contained in:
Bart Louwers
2024-08-27 00:09:29 +02:00
committed by GitHub
parent 1bdc3425db
commit db95ba147a
23 changed files with 2807 additions and 1207 deletions

View File

@@ -70,6 +70,19 @@ jni::Local<jni::Object<>> LocationIndicatorLayer::getBearing(jni::JNIEnv& env) {
return std::move(*convert<jni::Local<jni::Object<>>>(env, toLocationIndicatorLayer(layer).getBearing()));
}
jni::Local<jni::Object<TransitionOptions>> LocationIndicatorLayer::getBearingTransition(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
mbgl::style::TransitionOptions options = toLocationIndicatorLayer(layer).getBearingTransition();
return std::move(*convert<jni::Local<jni::Object<TransitionOptions>>>(env, options));
}
void LocationIndicatorLayer::setBearingTransition(jni::JNIEnv&, jlong duration, jlong delay) {
mbgl::style::TransitionOptions options;
options.duration.emplace(mbgl::Milliseconds(duration));
options.delay.emplace(mbgl::Milliseconds(delay));
toLocationIndicatorLayer(layer).setBearingTransition(options);
}
jni::Local<jni::Object<>> LocationIndicatorLayer::getLocation(jni::JNIEnv& env) {
using namespace mbgl::android::conversion;
return std::move(*convert<jni::Local<jni::Object<>>>(env, toLocationIndicatorLayer(layer).getLocation()));
@@ -244,6 +257,8 @@ void LocationIndicatorJavaLayerPeerFactory::registerNative(jni::JNIEnv& env) {
METHOD(&LocationIndicatorLayer::getShadowImage, "nativeGetShadowImage"),
METHOD(&LocationIndicatorLayer::getPerspectiveCompensation, "nativeGetPerspectiveCompensation"),
METHOD(&LocationIndicatorLayer::getImageTiltDisplacement, "nativeGetImageTiltDisplacement"),
METHOD(&LocationIndicatorLayer::getBearingTransition, "nativeGetBearingTransition"),
METHOD(&LocationIndicatorLayer::setBearingTransition, "nativeSetBearingTransition"),
METHOD(&LocationIndicatorLayer::getBearing, "nativeGetBearing"),
METHOD(&LocationIndicatorLayer::getLocationTransition, "nativeGetLocationTransition"),
METHOD(&LocationIndicatorLayer::setLocationTransition, "nativeSetLocationTransition"),

View File

@@ -37,6 +37,8 @@ public:
jni::Local<jni::Object<jni::ObjectTag>> getImageTiltDisplacement(jni::JNIEnv&);
jni::Local<jni::Object<jni::ObjectTag>> getBearing(jni::JNIEnv&);
void setBearingTransition(jni::JNIEnv&, jlong duration, jlong delay);
jni::Local<jni::Object<TransitionOptions>> getBearingTransition(jni::JNIEnv&);
jni::Local<jni::Object<jni::ObjectTag>> getLocation(jni::JNIEnv&);
void setLocationTransition(jni::JNIEnv&, jlong duration, jlong delay);

View File

@@ -134,6 +134,27 @@ class LocationIndicatorLayer extends Layer {
return (PropertyValue<Double>) new PropertyValue("bearing", nativeGetBearing());
}
/**
* Get the Bearing property transition options
*
* @return transition options for Double
*/
@NonNull
public TransitionOptions getBearingTransition() {
checkThread();
return nativeGetBearingTransition();
}
/**
* Set the Bearing property transition options
*
* @param options transition options for Double
*/
public void setBearingTransition(@NonNull TransitionOptions options) {
checkThread();
nativeSetBearingTransition(options.getDuration(), options.getDelay());
}
/**
* Get the Location property
*
@@ -423,6 +444,13 @@ class LocationIndicatorLayer extends Layer {
@Keep
private native Object nativeGetBearing();
@NonNull
@Keep
private native TransitionOptions nativeGetBearingTransition();
@Keep
private native void nativeSetBearingTransition(long duration, long delay);
@NonNull
@Keep
private native Object nativeGetLocation();

View File

@@ -16,7 +16,7 @@ import org.maplibre.android.style.expressions.Expression;
import org.maplibre.android.style.layers.TransitionOptions;
/**
* Client-side hillshading visualization based on DEM data. Currently, the implementation only supports Mapbox Terrain RGB and Mapzen Terrarium tiles.
* Client-side hillshading visualization based on DEM data. The implementation supports Mapbox Terrain RGB, Mapzen Terrarium tiles and custom encodings.
*
* @see <a href="https://maplibre.org/maplibre-style-spec/#layers-hillshade">The online documentation</a>
*/

View File

@@ -108,23 +108,23 @@ public final class Property {
@Retention(RetentionPolicy.SOURCE)
public @interface SYMBOL_PLACEMENT {}
// SYMBOL_Z_ORDER: Controls the order in which overlapping symbols in the same layer are rendered
// SYMBOL_Z_ORDER: Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use `symbol-sort-key`.
/**
* If symbol sort key is set, sort based on that. Otherwise sort symbols by their y-position relative to the viewport.
* Sorts symbols by symbol sort key if set. Otherwise, sorts symbols by their y-position relative to the viewport if {@link ICON_ALLOW_OVERLAP} or {@link TEXT_ALLOW_OVERLAP} is set to {@link TRUE} or {@link ICON_IGNORE_PLACEMENT} or {@link TEXT_IGNORE_PLACEMENT} is {@link FALSE}.
*/
public static final String SYMBOL_Z_ORDER_AUTO = "auto";
/**
* Symbols will be sorted by their y-position relative to the viewport.
* Sorts symbols by their y-position relative to the viewport if {@link ICON_ALLOW_OVERLAP} or {@link TEXT_ALLOW_OVERLAP} is set to {@link TRUE} or {@link ICON_IGNORE_PLACEMENT} or {@link TEXT_IGNORE_PLACEMENT} is {@link FALSE}.
*/
public static final String SYMBOL_Z_ORDER_VIEWPORT_Y = "viewport-y";
/**
* Symbols will be rendered in the same order as the source data with no sorting applied.
* Sorts symbols by symbol sort key if set. Otherwise, no sorting is applied; symbols are rendered in the same order as the source data.
*/
public static final String SYMBOL_Z_ORDER_SOURCE = "source";
/**
* Controls the order in which overlapping symbols in the same layer are rendered
* Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use `symbol-sort-key`.
*/
@StringDef({
SYMBOL_Z_ORDER_AUTO,

View File

@@ -446,7 +446,7 @@ public class PropertyFactory {
}
/**
* The color of the icon. This can only be used with sdf icons.
* The color of the icon. This can only be used with SDF icons.
*
* @param value a int color value
* @return property wrapper around String color
@@ -456,7 +456,7 @@ public class PropertyFactory {
}
/**
* The color of the icon. This can only be used with sdf icons.
* The color of the icon. This can only be used with SDF icons.
*
* @param value a String value
* @return property wrapper around String
@@ -466,7 +466,7 @@ public class PropertyFactory {
}
/**
* The color of the icon. This can only be used with sdf icons.
* The color of the icon. This can only be used with SDF icons.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
@@ -506,7 +506,8 @@ public class PropertyFactory {
}
/**
* Distance of halo to the icon outline.
* Distance of halo to the icon outline.
The unit is in density-independent pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc.
*
* @param value a Float value
* @return property wrapper around Float
@@ -516,7 +517,8 @@ public class PropertyFactory {
}
/**
* Distance of halo to the icon outline.
* Distance of halo to the icon outline.
The unit is in density-independent pixels only for SDF sprites that were created with a blur radius of 8, multiplied by the display density. I.e., the radius needs to be 16 for `@2x` sprites, etc.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
@@ -1406,7 +1408,7 @@ public class PropertyFactory {
}
/**
* Fade duration when a new tile is added.
* Fade duration when a new tile is added, or when a video is started or its coordinates are updated.
*
* @param value a Float value
* @return property wrapper around Float
@@ -1416,7 +1418,7 @@ public class PropertyFactory {
}
/**
* Fade duration when a new tile is added.
* Fade duration when a new tile is added, or when a video is started or its coordinates are updated.
*
* @param expression an expression statement
* @return property wrapper around an expression statement
@@ -1806,7 +1808,7 @@ public class PropertyFactory {
}
/**
* If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like Mapbox GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.
* If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like MapLibre GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.
*
* @param value a Boolean value
* @return property wrapper around Boolean
@@ -1816,7 +1818,7 @@ public class PropertyFactory {
}
/**
* If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like Mapbox GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.
* If true, the symbols will not cross tile edges to avoid mutual collisions. Recommended in layers that don't have enough padding in the vector tile to prevent collisions, or if it is a point symbol layer placed after a line symbol layer. When using a client that supports global collision detection, like MapLibre GL JS version 0.42.0 or greater, enabling this property is not needed to prevent clipped labels at tile boundaries.
*
* @param value a Boolean value
* @return property wrapper around Boolean
@@ -1846,7 +1848,7 @@ public class PropertyFactory {
}
/**
* Controls the order in which overlapping symbols in the same layer are rendered
* Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use {@link PropertyFactory#symbolSortKey}.
*
* @param value a String value
* @return property wrapper around String
@@ -1856,7 +1858,7 @@ public class PropertyFactory {
}
/**
* Controls the order in which overlapping symbols in the same layer are rendered
* Determines whether overlapping symbols in the same layer are rendered in the order that they appear in the data source or by their y-position relative to the viewport. To control the order and prioritization of symbols otherwise, use {@link PropertyFactory#symbolSortKey}.
*
* @param value a String value
* @return property wrapper around String
@@ -2046,7 +2048,7 @@ public class PropertyFactory {
}
/**
* Size of the additional area around the icon bounding box used for detecting symbol collisions.
* Size of additional area round the icon bounding box used for detecting symbol collisions.
*
* @param value a Float value
* @return property wrapper around Float
@@ -2056,7 +2058,7 @@ public class PropertyFactory {
}
/**
* Size of the additional area around the icon bounding box used for detecting symbol collisions.
* Size of additional area round the icon bounding box used for detecting symbol collisions.
*
* @param value a Float value
* @return property wrapper around Float

View File

@@ -683,7 +683,7 @@ public class SymbolLayer extends Layer {
}
/**
* The color of the icon. This can only be used with sdf icons.
* The color of the icon. This can only be used with SDF icons.
*
* @return int representation of a rgba string color
* @throws RuntimeException thrown if property isn't a value