Skip to content

Commit

Permalink
Bump GL-Native v11.0.0-beta.6 and Common 24.0.0-beta.6 (#2064)
Browse files Browse the repository at this point in the history
  • Loading branch information
jush authored Oct 9, 2023
1 parent 01c3eda commit 54dd31c
Show file tree
Hide file tree
Showing 11 changed files with 61 additions and 68 deletions.
22 changes: 21 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,35 @@ Mapbox welcomes participation and contributions from everyone.
# 11.0.0-beta.5
## Breaking changes ⚠️
* Rename `MapCameraManagerDelegate` properties for methods `cameraForCoordinateBounds`, `cameraForCoordinates` and `cameraForGeometry` to align them with `MapboxMap` methods.
* Consolidate `FetchTileFunctionCallback` and `CancelTileFunctionCallback` by single type `TileFunctionCallback`.
* Make `Image` parameter nullable in `setStyleCustomRasterSourceTileData()` method.

## Features ✨ and improvements 🏁
* Add `GeoJsonSource.data(..)` overloads to allow Java to call with and without `dataId`.
* Add a new layer type `CustomLayer` and style DSL to create it. `CustomLayer` allows to use custom OpenGL ES rendering through `CustomLayerHost`. `CustomLayer` contains the `slot` property allowing using it with the Standard style.

* Improve the caching model for the custom raster source.
* Optimize custom raster source data update.
* Increase rendering performance of shadows.
* Print warning log message for unknown style layer properties instead of causing fatal errors.
* Optimise memory usage in the `FillExtrusionLayer`.
* Improve the rendering performance of a `SymbolLayer` that uses `SymbolLayer.symbolSortKey` property.
* Reduce memory usage in fill-extrusion flood light and ground ambient occlusion.

## Bug fixes 🐞
* Hide methods and properties from Java in `MapView`, `MapboxMap` and `Snapshotter` that are not supposed to be public.
* Fix `Style` docs for methods `setStyleImportConfigProperties`, `setStyleImportConfigProperty`, `removeGeoJSONSourceFeatures`.
* Fix flood light not working by changing default EGL config to RGBA_8888.
* Fix a bug where the map would not zoom above a certain threshold on high-pitched views.
* Fix crashes if 3D layers are used alone on terrain or globe without any other layer types.
* Fix `LineLayer` leaking if placed behind the satellite layer.
* Fix line and raster layers interop for draped mode.
* Fix a crash when consecutive snapshot requests were made.
* Fix erroneous shadow map sampling of distant landmarks.
* Fix incorrect level-of-detail model being chosen for trees in some scenarios.
* Fix the style layer minimum and maximum zoom default values from infinity to actual ones.

## Dependencies
* Update gl-native to v11.0.0-beta.6 and common to v24.0.0-beta.6.

# 11.0.0-beta.4 September 21, 2023
## Breaking changes ⚠️
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens

===========================================================================

### MapboxCoreMaps,11.0.0-beta.5,Mapbox ToS,Mapbox,https://www.mapbox.com/
### MapboxCoreMaps,11.0.0-beta.6,Mapbox ToS,Mapbox,https://www.mapbox.com/

```
Mapbox Core Maps version 10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ class MapboxMapRecorderActivity : AppCompatActivity() {
setContentView(mapView)

val mapboxMap = mapView.getMapboxMap()
// Make the ``MapboxMapRecorder`` and start the recording
val recorder = mapboxMap.createRecorder()
recorder.startRecording()
mapboxMap.loadStyle(Style.STANDARD) {
// Once the Style is loaded, make the ``MapboxMapRecorder`` and start the recording
val recorder = mapboxMap.createRecorder()
recorder.startRecording()

// Build a new set of CameraOptions for the map to fly to
val cameraOptions = cameraOptions {
center(Point.fromLngLat(-73.581, 45.4588))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ class CustomGeometrySourceTest {
private val style = mockk<Style>(relaxUnitFun = true, relaxed = true)
private val expected = mockk<Expected<String, None>>(relaxUnitFun = true, relaxed = true)

private val fetchTileFunctionCallback: FetchTileFunctionCallback = mockk()
private val cancelTileFunctionCallback: CancelTileFunctionCallback = mockk()
private val tileFunctionCallback: TileFunctionCallback = mockk()
private val tileOptions: TileOptions = mockk()

@Before
Expand All @@ -27,31 +26,27 @@ class CustomGeometrySourceTest {
every { style.invalidateStyleCustomGeometrySourceTile(any(), any()) } returns expected

every { expected.error } returns null
}

@Test
fun bindTest() {
val testSource = customGeometrySource("testId") {
fetchTileFunction(fetchTileFunctionCallback)
cancelTileFunction(cancelTileFunctionCallback)
testSource = customGeometrySource("testId") {
fetchTileFunction(tileFunctionCallback)
cancelTileFunction(tileFunctionCallback)
minZoom(0)
maxZoom(20)
tileOptions(tileOptions)
}
}

private lateinit var testSource: CustomGeometrySource

@Test
fun bindTest() {
testSource.bindTo(style)
verify { style.addStyleCustomGeometrySource("testId", any()) }
}

@Test
fun setTileDataTest() {
val tileData = mutableListOf<Feature>(Feature.fromGeometry(Point.fromLngLat(0.0, 0.0)))
val testSource = customGeometrySource("testId") {
fetchTileFunction(fetchTileFunctionCallback)
cancelTileFunction(cancelTileFunctionCallback)
minZoom(0)
maxZoom(20)
tileOptions(tileOptions)
}
val tileID: CanonicalTileID = mockk()
testSource.bindTo(style)
testSource.setTileData(tileID, tileData)
Expand All @@ -61,27 +56,13 @@ class CustomGeometrySourceTest {
@Test(expected = RuntimeException::class)
fun setTileDataBeforeBindTest() {
val tileData = mutableListOf<Feature>(Feature.fromGeometry(Point.fromLngLat(0.0, 0.0)))
val testSource = customGeometrySource("testId") {
fetchTileFunction(fetchTileFunctionCallback)
cancelTileFunction(cancelTileFunctionCallback)
minZoom(0)
maxZoom(20)
tileOptions(tileOptions)
}
val tileID: CanonicalTileID = mockk()
testSource.setTileData(tileID, tileData)
verify { style.setStyleCustomGeometrySourceTileData("testId", tileID, tileData) }
}

@Test
fun invalidRegionTest() {
val testSource = customGeometrySource("testId") {
fetchTileFunction(fetchTileFunctionCallback)
cancelTileFunction(cancelTileFunctionCallback)
minZoom(0)
maxZoom(20)
tileOptions(tileOptions)
}
val coordinateBounds: CoordinateBounds = mockk()
testSource.bindTo(style)
testSource.invalidRegion(coordinateBounds)
Expand All @@ -90,27 +71,13 @@ class CustomGeometrySourceTest {

@Test(expected = RuntimeException::class)
fun invalidRegionBeforeBindTest() {
val testSource = customGeometrySource("testId") {
fetchTileFunction(fetchTileFunctionCallback)
cancelTileFunction(cancelTileFunctionCallback)
minZoom(0)
maxZoom(20)
tileOptions(tileOptions)
}
val coordinateBounds: CoordinateBounds = mockk()
testSource.invalidRegion(coordinateBounds)
verify { style.invalidateStyleCustomGeometrySourceRegion("testId", coordinateBounds) }
}

@Test
fun invalidTileTest() {
val testSource = customGeometrySource("testId") {
fetchTileFunction(fetchTileFunctionCallback)
cancelTileFunction(cancelTileFunctionCallback)
minZoom(0)
maxZoom(20)
tileOptions(tileOptions)
}
val tileID: CanonicalTileID = mockk()
testSource.bindTo(style)
testSource.invalidTile(tileID)
Expand All @@ -119,13 +86,6 @@ class CustomGeometrySourceTest {

@Test(expected = RuntimeException::class)
fun invalidTileBeforeBindTest() {
val testSource = customGeometrySource("testId") {
fetchTileFunction(fetchTileFunctionCallback)
cancelTileFunction(cancelTileFunctionCallback)
minZoom(0)
maxZoom(20)
tileOptions(tileOptions)
}
val tileID: CanonicalTileID = mockk()
testSource.invalidTile(tileID)
verify { style.invalidateStyleCustomGeometrySourceTile("testId", tileID) }
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ detekt = "1.22.0"
# Dependencies

mapboxBase = "0.8.0"
mapboxGlNative = "11.0.0-beta.5"
mapboxCommon = "24.0.0-beta.5"
mapboxGlNative = "11.0.0-beta.6"
mapboxCommon = "24.0.0-beta.6"
mapboxGestures = "0.8.0"
mapboxJavaServices = "5.4.1"

Expand Down
2 changes: 1 addition & 1 deletion sdk-base/api/Release/metalava.txt
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ package com.mapbox.maps {
method public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleAtmosphere(com.mapbox.bindgen.Value properties);
method public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleAtmosphereProperty(String property, com.mapbox.bindgen.Value value);
method public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomGeometrySourceTileData(String sourceId, com.mapbox.maps.CanonicalTileID tileId, java.util.List<com.mapbox.geojson.Feature> featureCollection);
method @com.mapbox.maps.MapboxExperimental public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomRasterSourceTileData(String sourceId, com.mapbox.maps.CanonicalTileID tileId, com.mapbox.maps.Image square);
method @com.mapbox.maps.MapboxExperimental public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomRasterSourceTileData(String sourceId, com.mapbox.maps.CanonicalTileID tileId, com.mapbox.maps.Image? image);
method @MainThread public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleGeoJSONSourceData(String sourceId, String dataId, com.mapbox.maps.GeoJSONSourceData data);
method @com.mapbox.maps.MapboxExperimental public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleImportConfigProperties(String importId, java.util.HashMap<java.lang.String,com.mapbox.bindgen.Value> configs);
method @com.mapbox.maps.MapboxExperimental public com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleImportConfigProperty(String importId, String config, com.mapbox.bindgen.Value value);
Expand Down
9 changes: 6 additions & 3 deletions sdk-base/src/main/java/com/mapbox/maps/Style.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1136,18 +1136,21 @@ class Style {
*
* Set tile data for a raster tile.
*
* By default, the provided data is not cached, and the implementation will call the fetch callback each time the tile reappears.
* Use the [MapboxMap.setTileCacheBudget] API to establish an internal cache for the source.
*
* @param sourceId A style source identifier.
* @param tileId A `canonical tile id` of the tile.
* @param square `Image` content of the tile.
* @param image `Image` content of the tile. If an empty image is provided then the tile gets removed from the map.
*/
@MapboxExperimental
fun setStyleCustomRasterSourceTileData(
sourceId: String,
tileId: CanonicalTileID,
square: Image
image: Image?
): Expected<String, None> {
checkNativeStyle("setStyleCustomRasterSourceTileData")
return styleManager.setStyleCustomRasterSourceTileData(sourceId, tileId, square)
return styleManager.setStyleCustomRasterSourceTileData(sourceId, tileId, image)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion sdk/api/Release/metalava.txt
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ package com.mapbox.maps {
method public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleAtmosphere(com.mapbox.bindgen.Value properties);
method public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleAtmosphereProperty(String property, com.mapbox.bindgen.Value value);
method public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomGeometrySourceTileData(String sourceId, com.mapbox.maps.CanonicalTileID tileId, java.util.List<com.mapbox.geojson.Feature> featureCollection);
method @com.mapbox.maps.MapboxExperimental public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomRasterSourceTileData(String sourceId, com.mapbox.maps.CanonicalTileID tileId, com.mapbox.maps.Image square);
method @com.mapbox.maps.MapboxExperimental public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleCustomRasterSourceTileData(String sourceId, com.mapbox.maps.CanonicalTileID tileId, com.mapbox.maps.Image? image);
method @com.mapbox.maps.MapboxExperimental public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleImportConfigProperties(String importId, java.util.HashMap<java.lang.String,com.mapbox.bindgen.Value> configs);
method @com.mapbox.maps.MapboxExperimental public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleImportConfigProperty(String importId, String config, com.mapbox.bindgen.Value value);
method public final com.mapbox.bindgen.Expected<java.lang.String,com.mapbox.bindgen.None> setStyleLayerProperties(String layerId, com.mapbox.bindgen.Value properties);
Expand Down
11 changes: 9 additions & 2 deletions sdk/src/main/java/com/mapbox/maps/MapboxMap.kt
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,17 @@ class MapboxMap :
}

/**
* Create a new instance of [MapboxMapRecorder] for this map.
* @return The [MapboxMapRecorder] instance for this map or null if it can't be created
*/
@MapboxExperimental
fun createRecorder() = MapboxMapRecorder(MapRecorder(nativeMap.map))
fun createRecorder(): MapboxMapRecorder {
val expected = MapRecorder.createInstance(nativeMap.map)
return if (expected.isValue) {
MapboxMapRecorder(expected.value!!)
} else {
throw RuntimeException(expected.error ?: "Error occurred in MapboxMap.createRecorder!")
}
}

private fun String.isValidUri(): Boolean {
val isMapboxStyleUri = startsWith("mapbox://", ignoreCase = true)
Expand Down
9 changes: 6 additions & 3 deletions sdk/src/main/java/com/mapbox/maps/MapboxStyleManager.kt
Original file line number Diff line number Diff line change
Expand Up @@ -828,17 +828,20 @@ open class MapboxStyleManager internal constructor(
*
* Set tile data for a raster tile.
*
* By default, the provided data is not cached, and the implementation will call the fetch callback each time the tile reappears.
* Use the [MapboxMap.setTileCacheBudget] API to establish an internal cache for the source.
*
* @param sourceId A style source identifier.
* @param tileId A `canonical tile id` of the tile.
* @param square `Image` content of the tile.
* @param image `Image` content of the tile. If an empty image is provided then the tile gets removed from the map.
*/
@MapboxExperimental
fun setStyleCustomRasterSourceTileData(
sourceId: String,
tileId: CanonicalTileID,
square: Image
image: Image?
): Expected<String, None> {
return styleManager.setStyleCustomRasterSourceTileData(sourceId, tileId, square)
return styleManager.setStyleCustomRasterSourceTileData(sourceId, tileId, image)
}

/**
Expand Down
1 change: 1 addition & 0 deletions sdk/src/test/java/com/mapbox/maps/StyleTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import org.junit.runner.RunWith
import org.robolectric.RobolectricTestRunner
import org.robolectric.annotation.Config

@OptIn(MapboxExperimental::class)
@Config(
shadows = [
ShadowStyleManager::class,
Expand Down

0 comments on commit 54dd31c

Please sign in to comment.