Skip to content

Commit fd649fd

Browse files
authored
Run code generation and expose new properties (#1074)
* Run code generation and expose new properties * Add allowed list for breaking changes and update script to evaluate it
1 parent f5d1894 commit fd649fd

30 files changed

+1607
-654
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
### main
22

33
* Add experimental MapRecorder API to record and replay map interactions for debugging and performance testing.
4+
* Promote `ModelLayer` to stable.
5+
* Add `SymbolLayer.iconColorBrightnessMax`, `SymbolLayer.iconColorBrightnessMin`, `SymbolLayer.iconColorContrast`, `SymbolLayer.occlusionOpacityMode`, `FillExtrusionLayer.fillExtrusionCastShadows`, `RasterArraySource.volatile`, and `PolylineAnnotation.lineEmissiveStrength` properties.
6+
* Update default value for experimental `LineLayer.lineCutoutOpacity` from 0 to 1.0.
7+
* Remove experimental `LineLayer.lineCutoutWidth`.
48

59
### 2.17.0-rc.1
610

android/src/main/kotlin/com/mapbox/maps/mapbox_maps/annotation/PointAnnotationController.kt

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import toFLTIconPitchAlignment
1111
import toFLTIconRotationAlignment
1212
import toFLTIconTextFit
1313
import toFLTIconTranslateAnchor
14+
import toFLTOcclusionOpacityMode
1415
import toFLTSymbolElevationReference
1516
import toFLTSymbolPlacement
1617
import toFLTSymbolZOrder
@@ -25,6 +26,7 @@ import toIconPitchAlignment
2526
import toIconRotationAlignment
2627
import toIconTextFit
2728
import toIconTranslateAnchor
29+
import toOcclusionOpacityMode
2830
import toSymbolElevationReference
2931
import toSymbolPlacement
3032
import toSymbolZOrder
@@ -1281,6 +1283,75 @@ class PointAnnotationController(private val delegate: ControllerDelegate) : _Poi
12811283
}
12821284
}
12831285

1286+
override fun setIconColorBrightnessMax(
1287+
managerId: String,
1288+
iconColorBrightnessMax: Double,
1289+
callback: (Result<Unit>) -> Unit
1290+
) {
1291+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1292+
manager.iconColorBrightnessMax = iconColorBrightnessMax
1293+
callback(Result.success(Unit))
1294+
}
1295+
1296+
override fun getIconColorBrightnessMax(
1297+
managerId: String,
1298+
callback: (Result<Double?>) -> Unit
1299+
) {
1300+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1301+
val value = manager.iconColorBrightnessMax
1302+
if (value != null) {
1303+
callback(Result.success(value))
1304+
} else {
1305+
callback(Result.success(null))
1306+
}
1307+
}
1308+
1309+
override fun setIconColorBrightnessMin(
1310+
managerId: String,
1311+
iconColorBrightnessMin: Double,
1312+
callback: (Result<Unit>) -> Unit
1313+
) {
1314+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1315+
manager.iconColorBrightnessMin = iconColorBrightnessMin
1316+
callback(Result.success(Unit))
1317+
}
1318+
1319+
override fun getIconColorBrightnessMin(
1320+
managerId: String,
1321+
callback: (Result<Double?>) -> Unit
1322+
) {
1323+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1324+
val value = manager.iconColorBrightnessMin
1325+
if (value != null) {
1326+
callback(Result.success(value))
1327+
} else {
1328+
callback(Result.success(null))
1329+
}
1330+
}
1331+
1332+
override fun setIconColorContrast(
1333+
managerId: String,
1334+
iconColorContrast: Double,
1335+
callback: (Result<Unit>) -> Unit
1336+
) {
1337+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1338+
manager.iconColorContrast = iconColorContrast
1339+
callback(Result.success(Unit))
1340+
}
1341+
1342+
override fun getIconColorContrast(
1343+
managerId: String,
1344+
callback: (Result<Double?>) -> Unit
1345+
) {
1346+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1347+
val value = manager.iconColorContrast
1348+
if (value != null) {
1349+
callback(Result.success(value))
1350+
} else {
1351+
callback(Result.success(null))
1352+
}
1353+
}
1354+
12841355
override fun setIconColorSaturation(
12851356
managerId: String,
12861357
iconColorSaturation: Double,
@@ -1511,6 +1582,29 @@ class PointAnnotationController(private val delegate: ControllerDelegate) : _Poi
15111582
}
15121583
}
15131584

1585+
override fun setOcclusionOpacityMode(
1586+
managerId: String,
1587+
occlusionOpacityMode: OcclusionOpacityMode,
1588+
callback: (Result<Unit>) -> Unit
1589+
) {
1590+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1591+
manager.occlusionOpacityMode = occlusionOpacityMode.toOcclusionOpacityMode()
1592+
callback(Result.success(Unit))
1593+
}
1594+
1595+
override fun getOcclusionOpacityMode(
1596+
managerId: String,
1597+
callback: (Result<OcclusionOpacityMode?>) -> Unit
1598+
) {
1599+
val manager = delegate.getManager(managerId) as PointAnnotationManager
1600+
val value = manager.occlusionOpacityMode
1601+
if (value != null) {
1602+
callback(Result.success(value.toFLTOcclusionOpacityMode()))
1603+
} else {
1604+
callback(Result.success(null))
1605+
}
1606+
}
1607+
15141608
override fun setSymbolZOffset(
15151609
managerId: String,
15161610
symbolZOffset: Double,

android/src/main/kotlin/com/mapbox/maps/mapbox_maps/annotation/PointAnnotationEnumsExtensions.kt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ fun IconTranslateAnchor.toIconTranslateAnchor(): com.mapbox.maps.extension.style
121121
else -> throw(RuntimeException("Unsupported IconTranslateAnchor: $this"))
122122
}
123123
}
124+
fun OcclusionOpacityMode.toOcclusionOpacityMode(): com.mapbox.maps.extension.style.layers.properties.generated.OcclusionOpacityMode {
125+
return when (this) {
126+
OcclusionOpacityMode.ANCHOR -> com.mapbox.maps.extension.style.layers.properties.generated.OcclusionOpacityMode.ANCHOR
127+
OcclusionOpacityMode.PIXEL -> com.mapbox.maps.extension.style.layers.properties.generated.OcclusionOpacityMode.PIXEL
128+
else -> throw(RuntimeException("Unsupported OcclusionOpacityMode: $this"))
129+
}
130+
}
124131
fun TextTranslateAnchor.toTextTranslateAnchor(): com.mapbox.maps.extension.style.layers.properties.generated.TextTranslateAnchor {
125132
return when (this) {
126133
TextTranslateAnchor.MAP -> com.mapbox.maps.extension.style.layers.properties.generated.TextTranslateAnchor.MAP
@@ -248,6 +255,13 @@ fun com.mapbox.maps.extension.style.layers.properties.generated.IconTranslateAnc
248255
else -> throw(RuntimeException("Unsupported IconTranslateAnchor: $this"))
249256
}
250257
}
258+
fun com.mapbox.maps.extension.style.layers.properties.generated.OcclusionOpacityMode.toFLTOcclusionOpacityMode(): OcclusionOpacityMode {
259+
return when (this) {
260+
com.mapbox.maps.extension.style.layers.properties.generated.OcclusionOpacityMode.ANCHOR -> OcclusionOpacityMode.ANCHOR
261+
com.mapbox.maps.extension.style.layers.properties.generated.OcclusionOpacityMode.PIXEL -> OcclusionOpacityMode.PIXEL
262+
else -> throw(RuntimeException("Unsupported OcclusionOpacityMode: $this"))
263+
}
264+
}
251265
fun com.mapbox.maps.extension.style.layers.properties.generated.TextTranslateAnchor.toFLTTextTranslateAnchor(): TextTranslateAnchor {
252266
return when (this) {
253267
com.mapbox.maps.extension.style.layers.properties.generated.TextTranslateAnchor.MAP -> TextTranslateAnchor.MAP

android/src/main/kotlin/com/mapbox/maps/mapbox_maps/annotation/PolylineAnnotationController.kt

Lines changed: 53 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ class PolylineAnnotationController(private val delegate: ControllerDelegate) : _
159159
annotation.lineColor?.let {
160160
originalAnnotation.lineColorInt = it.toInt()
161161
}
162+
annotation.lineEmissiveStrength?.let {
163+
originalAnnotation.lineEmissiveStrength = it
164+
}
162165
annotation.lineGapWidth?.let {
163166
originalAnnotation.lineGapWidth = it
164167
}
@@ -223,75 +226,6 @@ class PolylineAnnotationController(private val delegate: ControllerDelegate) : _
223226
}
224227
}
225228

226-
override fun setLineCutoutFadeWidth(
227-
managerId: String,
228-
lineCutoutFadeWidth: Double,
229-
callback: (Result<Unit>) -> Unit
230-
) {
231-
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
232-
manager.lineCutoutFadeWidth = lineCutoutFadeWidth
233-
callback(Result.success(Unit))
234-
}
235-
236-
override fun getLineCutoutFadeWidth(
237-
managerId: String,
238-
callback: (Result<Double?>) -> Unit
239-
) {
240-
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
241-
val value = manager.lineCutoutFadeWidth
242-
if (value != null) {
243-
callback(Result.success(value))
244-
} else {
245-
callback(Result.success(null))
246-
}
247-
}
248-
249-
override fun setLineCutoutOpacity(
250-
managerId: String,
251-
lineCutoutOpacity: Double,
252-
callback: (Result<Unit>) -> Unit
253-
) {
254-
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
255-
manager.lineCutoutOpacity = lineCutoutOpacity
256-
callback(Result.success(Unit))
257-
}
258-
259-
override fun getLineCutoutOpacity(
260-
managerId: String,
261-
callback: (Result<Double?>) -> Unit
262-
) {
263-
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
264-
val value = manager.lineCutoutOpacity
265-
if (value != null) {
266-
callback(Result.success(value))
267-
} else {
268-
callback(Result.success(null))
269-
}
270-
}
271-
272-
override fun setLineCutoutWidth(
273-
managerId: String,
274-
lineCutoutWidth: Double,
275-
callback: (Result<Unit>) -> Unit
276-
) {
277-
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
278-
manager.lineCutoutWidth = lineCutoutWidth
279-
callback(Result.success(Unit))
280-
}
281-
282-
override fun getLineCutoutWidth(
283-
managerId: String,
284-
callback: (Result<Double?>) -> Unit
285-
) {
286-
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
287-
val value = manager.lineCutoutWidth
288-
if (value != null) {
289-
callback(Result.success(value))
290-
} else {
291-
callback(Result.success(null))
292-
}
293-
}
294-
295229
override fun setLineElevationReference(
296230
managerId: String,
297231
lineElevationReference: LineElevationReference,
@@ -545,6 +479,52 @@ class PolylineAnnotationController(private val delegate: ControllerDelegate) : _
545479
}
546480
}
547481

482+
override fun setLineCutoutFadeWidth(
483+
managerId: String,
484+
lineCutoutFadeWidth: Double,
485+
callback: (Result<Unit>) -> Unit
486+
) {
487+
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
488+
manager.lineCutoutFadeWidth = lineCutoutFadeWidth
489+
callback(Result.success(Unit))
490+
}
491+
492+
override fun getLineCutoutFadeWidth(
493+
managerId: String,
494+
callback: (Result<Double?>) -> Unit
495+
) {
496+
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
497+
val value = manager.lineCutoutFadeWidth
498+
if (value != null) {
499+
callback(Result.success(value))
500+
} else {
501+
callback(Result.success(null))
502+
}
503+
}
504+
505+
override fun setLineCutoutOpacity(
506+
managerId: String,
507+
lineCutoutOpacity: Double,
508+
callback: (Result<Unit>) -> Unit
509+
) {
510+
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
511+
manager.lineCutoutOpacity = lineCutoutOpacity
512+
callback(Result.success(Unit))
513+
}
514+
515+
override fun getLineCutoutOpacity(
516+
managerId: String,
517+
callback: (Result<Double?>) -> Unit
518+
) {
519+
val manager = delegate.getManager(managerId) as PolylineAnnotationManager
520+
val value = manager.lineCutoutOpacity
521+
if (value != null) {
522+
callback(Result.success(value))
523+
} else {
524+
callback(Result.success(null))
525+
}
526+
}
527+
548528
override fun setLineDasharray(
549529
managerId: String,
550530
lineDasharray: List<Double?>,
@@ -881,6 +861,7 @@ fun com.mapbox.maps.plugin.annotation.generated.PolylineAnnotation.toFLTPolyline
881861
lineBorderWidth = lineBorderWidth,
882862
// colorInt is 32 bit and may be bigger than MAX_INT, so transfer to UInt firstly and then to Long.
883863
lineColor = lineColorInt?.toUInt()?.toLong(),
864+
lineEmissiveStrength = lineEmissiveStrength,
884865
lineGapWidth = lineGapWidth,
885866
lineOffset = lineOffset,
886867
lineOpacity = lineOpacity,
@@ -919,6 +900,9 @@ fun PolylineAnnotationOptions.toPolylineAnnotationOptions(): com.mapbox.maps.plu
919900
this.lineColor?.let {
920901
options.withLineColor(it.toInt())
921902
}
903+
this.lineEmissiveStrength?.let {
904+
options.withLineEmissiveStrength(it)
905+
}
922906
this.lineGapWidth?.let {
923907
options.withLineGapWidth(it)
924908
}

0 commit comments

Comments
 (0)