Skip to content

Commit b0d6cf0

Browse files
dzinadgithub-actions[bot]
authored andcommitted
MAPSAND-2380: add AnnotationConfig#slotName
GitOrigin-RevId: b59f3481ccd62f164a7299786274d3d51453c418
1 parent fcb31ed commit b0d6cf0

5 files changed

Lines changed: 27 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Mapbox welcomes participation and contributions from everyone.
88

99
## Features ✨ and improvements 🏁
1010
* Introduce experimental `queryRenderedRasterValues` API for querying the rendered raster array value at a point on the map.
11+
* Introduce new `AnnotationConfig#slotName` property to allow to specify a slot to position annotation layer.
1112

1213
## Bug fixes 🐞
1314
* Fix rare scenario where map render surface size was wrong.

plugin-annotation/src/main/java/com/mapbox/maps/plugin/annotation/AnnotationManagerImpl.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ internal constructor(
177177
if (styleManager.styleLayerExists(belowLayerId)) {
178178
styleManager.addPersistentLayer(
179179
layer,
180-
LayerPosition(null, annotationConfig.belowLayerId, null)
180+
LayerPosition(null, belowLayerId, null),
181181
)
182182
layerAdded = true
183183
} else {
@@ -190,6 +190,17 @@ internal constructor(
190190
if (!layerAdded) {
191191
styleManager.addPersistentLayer(layer)
192192
}
193+
annotationConfig?.slotName?.let { slotName ->
194+
if (slotName in styleManager.styleSlots) {
195+
layer.slot(slotName)
196+
} else {
197+
logW(
198+
TAG,
199+
"Slot with name $slotName doesn't exist in style ${styleManager.styleURI}, " +
200+
"it will not be applied to the annotation layer."
201+
)
202+
}
203+
}
193204
associatedLayers.add(layer.layerId)
194205
}
195206
if (!styleManager.styleSourceExists(dragSource.sourceId)) {

sdk-base/api/Release/metalava.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,7 @@ package com.mapbox.maps.plugin.annotation {
15571557
}
15581558

15591559
public final class AnnotationConfig {
1560+
ctor public AnnotationConfig(String? belowLayerId = null, String? layerId = null, String? sourceId = null, com.mapbox.maps.plugin.annotation.AnnotationSourceOptions? annotationSourceOptions = null, String? slotName = null);
15601561
ctor public AnnotationConfig(String? belowLayerId = null, String? layerId = null, String? sourceId = null, com.mapbox.maps.plugin.annotation.AnnotationSourceOptions? annotationSourceOptions = null);
15611562
ctor public AnnotationConfig(String? belowLayerId = null, String? layerId = null, String? sourceId = null);
15621563
ctor public AnnotationConfig(String? belowLayerId = null, String? layerId = null);
@@ -1566,14 +1567,17 @@ package com.mapbox.maps.plugin.annotation {
15661567
method public String? component2();
15671568
method public String? component3();
15681569
method public com.mapbox.maps.plugin.annotation.AnnotationSourceOptions? component4();
1569-
method public com.mapbox.maps.plugin.annotation.AnnotationConfig copy(String? belowLayerId, String? layerId, String? sourceId, com.mapbox.maps.plugin.annotation.AnnotationSourceOptions? annotationSourceOptions);
1570+
method public String? component5();
1571+
method public com.mapbox.maps.plugin.annotation.AnnotationConfig copy(String? belowLayerId, String? layerId, String? sourceId, com.mapbox.maps.plugin.annotation.AnnotationSourceOptions? annotationSourceOptions, String? slotName);
15701572
method public com.mapbox.maps.plugin.annotation.AnnotationSourceOptions? getAnnotationSourceOptions();
15711573
method public String? getBelowLayerId();
15721574
method public String? getLayerId();
1575+
method public String? getSlotName();
15731576
method public String? getSourceId();
15741577
property public final com.mapbox.maps.plugin.annotation.AnnotationSourceOptions? annotationSourceOptions;
15751578
property public final String? belowLayerId;
15761579
property public final String? layerId;
1580+
property public final String? slotName;
15771581
property public final String? sourceId;
15781582
}
15791583

sdk-base/api/sdk-base.api

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,17 +1622,20 @@ public final class com/mapbox/maps/plugin/annotation/AnnotationConfig {
16221622
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
16231623
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V
16241624
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;)V
1625-
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
1625+
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;Ljava/lang/String;)V
1626+
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
16261627
public final fun component1 ()Ljava/lang/String;
16271628
public final fun component2 ()Ljava/lang/String;
16281629
public final fun component3 ()Ljava/lang/String;
16291630
public final fun component4 ()Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;
1630-
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;)Lcom/mapbox/maps/plugin/annotation/AnnotationConfig;
1631-
public static synthetic fun copy$default (Lcom/mapbox/maps/plugin/annotation/AnnotationConfig;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;ILjava/lang/Object;)Lcom/mapbox/maps/plugin/annotation/AnnotationConfig;
1631+
public final fun component5 ()Ljava/lang/String;
1632+
public final fun copy (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;Ljava/lang/String;)Lcom/mapbox/maps/plugin/annotation/AnnotationConfig;
1633+
public static synthetic fun copy$default (Lcom/mapbox/maps/plugin/annotation/AnnotationConfig;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;Ljava/lang/String;ILjava/lang/Object;)Lcom/mapbox/maps/plugin/annotation/AnnotationConfig;
16321634
public fun equals (Ljava/lang/Object;)Z
16331635
public final fun getAnnotationSourceOptions ()Lcom/mapbox/maps/plugin/annotation/AnnotationSourceOptions;
16341636
public final fun getBelowLayerId ()Ljava/lang/String;
16351637
public final fun getLayerId ()Ljava/lang/String;
1638+
public final fun getSlotName ()Ljava/lang/String;
16361639
public final fun getSourceId ()Ljava/lang/String;
16371640
public fun hashCode ()I
16381641
public fun toString ()Ljava/lang/String;

sdk-base/src/main/java/com/mapbox/maps/plugin/annotation/AnnotationConfig.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,7 @@ data class AnnotationConfig @JvmOverloads constructor(
1111
/** The source id for layer inside of annotation manager, if not set will use the default id managed by annotation manager.*/
1212
val sourceId: String? = null,
1313
/** The configure for GeoJsonSource inside of AnnotationManager*/
14-
val annotationSourceOptions: AnnotationSourceOptions? = null
14+
val annotationSourceOptions: AnnotationSourceOptions? = null,
15+
/** The slot name used to position the annotations layer. If not set, null slot (on top of everything) will be used. */
16+
val slotName: String? = null,
1517
)

0 commit comments

Comments
 (0)