From ce1a46d6453ad8a4606775b8c462fa15948822f5 Mon Sep 17 00:00:00 2001 From: tobrun Date: Thu, 7 Mar 2019 15:21:23 +0100 Subject: [android] - remove base idlingResource setup --- .../mapboxsdk/location/LocationComponentTest.kt | 96 +++--- .../location/LocationLayerControllerTest.kt | 34 +-- .../com/mapbox/mapboxsdk/maps/OrientationTest.java | 44 +-- .../com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt | 12 +- .../testapp/action/OrientationAction.java | 78 +++++ .../testapp/action/OrientationChangeAction.java | 74 ----- .../mapboxsdk/testapp/action/WaitAction.java | 7 +- .../mapboxsdk/testapp/activity/BaseTest.java | 126 ++++---- .../mapboxsdk/testapp/activity/EspressoTest.java | 18 +- .../mapboxsdk/testapp/annotations/IconTest.java | 161 +++++----- .../mapboxsdk/testapp/camera/CameraForTest.java | 340 ++++++++++----------- .../testapp/geometry/GeoJsonConversionTest.java | 118 ++++--- .../mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt | 8 - .../testapp/maps/widgets/CompassViewTest.java | 3 +- .../testapp/style/CustomGeometrySourceTest.kt | 21 +- .../mapboxsdk/testapp/style/ExpressionTest.java | 26 +- .../testapp/style/GeoJsonSourceTests.java | 2 +- .../mapbox/mapboxsdk/testapp/style/ImageTest.java | 2 - .../mapboxsdk/testapp/style/RuntimeStyleTests.java | 13 +- .../utils/FinishLoadingStyleIdlingResource.java | 35 --- .../testapp/utils/LoadStyleIdlingResource.java | 40 --- .../testapp/utils/MapboxIdlingResource.java | 46 --- .../testapp/utils/OnMapReadyIdlingResource.java | 60 ---- 23 files changed, 562 insertions(+), 802 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationChangeAction.java delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/FinishLoadingStyleIdlingResource.java delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/LoadStyleIdlingResource.java delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/MapboxIdlingResource.java delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt index dde03d8a14..f9827c767e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationComponentTest.kt @@ -82,7 +82,7 @@ class LocationComponentTest : EspressoTest() { val locationEngine = component.locationEngine assertThat(locationEngine, notNullValue()) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) } } @@ -118,7 +118,7 @@ class LocationComponentTest : EspressoTest() { assertThat(locationEngine, notNullValue()) assertThat(componentOptions, notNullValue()) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(componentOptions?.accuracyAlpha(), `is`(.5f)) assertThat(componentOptions?.accuracyColor(), `is`(Color.BLUE)) } @@ -157,7 +157,7 @@ class LocationComponentTest : EspressoTest() { assertThat(locationEngine, nullValue()) assertThat(componentOptions, notNullValue()) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(componentOptions?.accuracyAlpha(), `is`(.5f)) assertThat(componentOptions?.accuracyColor(), `is`(Color.BLUE)) } @@ -205,7 +205,7 @@ class LocationComponentTest : EspressoTest() { // Force the first location update component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) // Check if the puck is visible assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(false)) @@ -240,7 +240,7 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(300) // waiting for stale state mapboxMap.querySourceFeatures(LOCATION_SOURCE).also { feature -> @@ -287,7 +287,7 @@ class LocationComponentTest : EspressoTest() { } component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val feature = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0] assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(false)) @@ -329,7 +329,7 @@ class LocationComponentTest : EspressoTest() { mapboxMap.addImageFromDrawable("custom-foreground-bitmap", it) mapboxMap.addImageFromDrawable("custom-gps-bitmap", it) } - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON) assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap"))) @@ -360,13 +360,13 @@ class LocationComponentTest : EspressoTest() { component.renderMode = RenderMode.GPS component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON) assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap"))) component.applyStyle(LocationComponentOptions.builder(context).build()) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(FOREGROUND_ICON, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)) } @@ -395,13 +395,13 @@ class LocationComponentTest : EspressoTest() { component.renderMode = RenderMode.GPS component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val foregroundId = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON) assertThat(foregroundId, `is`(equalTo("custom-gps-bitmap"))) component.renderMode = RenderMode.NORMAL - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(FOREGROUND_ICON, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getStringProperty(PROPERTY_FOREGROUND_ICON)) } @@ -430,14 +430,14 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(250) // engaging stale state assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true)) component.onStop() component.onStart() - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true)) assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(false)) @@ -461,13 +461,13 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false)) component.onStop() component.onStart() - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(false)) assertThat(mapboxMap.isLayerVisible(ACCURACY_LAYER), `is`(true)) @@ -499,7 +499,7 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) mapboxMap.querySourceFeatures(LOCATION_SOURCE).also { feature -> feature.forEach { @@ -526,7 +526,7 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point assertThat(component.locationEngine, nullValue()) @@ -550,14 +550,14 @@ class LocationComponentTest : EspressoTest() { .build()) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val point: Point = mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER)[0].geometry() as Point assertEquals(point.latitude(), location.latitude, 0.1) assertEquals(point.longitude(), location.longitude, 0.1) component.isLocationComponentEnabled = false - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(true)) } } @@ -580,7 +580,7 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = false mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT)) component.isLocationComponentEnabled = true - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true)) } @@ -675,7 +675,7 @@ class LocationComponentTest : EspressoTest() { component.onStart() mapboxMap.setStyle(Style.Builder().fromUrl(Style.DARK)) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) } } executeComponentTest(componentAction) @@ -695,7 +695,7 @@ class LocationComponentTest : EspressoTest() { mapboxMap.setStyle(Style.Builder().fromUrl(Style.DARK)) component.onStop() component.onStart() - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) } } executeComponentTest(componentAction) @@ -714,7 +714,7 @@ class LocationComponentTest : EspressoTest() { component.isLocationComponentEnabled = true component.onStop() component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE).isEmpty(), `is`(true)) } @@ -736,7 +736,7 @@ class LocationComponentTest : EspressoTest() { component.onStop() component.forceLocationUpdate(location) component.onStart() - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point assertEquals(point.latitude(), location.latitude, 0.1) @@ -760,9 +760,9 @@ class LocationComponentTest : EspressoTest() { component.forceLocationUpdate(location) mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT)) component.onStop() - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) component.onStart() - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) val point: Point = mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].geometry() as Point assertEquals(point.latitude(), location.latitude, 0.1) @@ -797,7 +797,7 @@ class LocationComponentTest : EspressoTest() { component.applyStyle(options) } - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) } } executeComponentTest(componentAction) @@ -823,7 +823,7 @@ class LocationComponentTest : EspressoTest() { component.forceLocationUpdate(location) } - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) } } executeComponentTest(componentAction) @@ -839,7 +839,7 @@ class LocationComponentTest : EspressoTest() { override fun onLocationComponentAction(component: LocationComponent, mapboxMap: MapboxMap, style: Style, uiController: UiController, context: Context) { styleChangeIdlingResource.waitForStyle(mapboxMap, MAPBOX_HEAVY_STYLE) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) locationComponentActivationOptions = LocationComponentActivationOptions .builder(context, mapboxMap.style!!) @@ -878,13 +878,13 @@ class LocationComponentTest : EspressoTest() { component.renderMode = RenderMode.GPS location.bearing = 77f component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) assertEquals(77f, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_GPS_BEARING).toFloat(), 0.1f) location.bearing = 92f component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) // Waiting for the animation to finish assertEquals(92.0f, mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getNumberProperty(PROPERTY_GPS_BEARING).toFloat(), 0.1f) } @@ -906,7 +906,7 @@ class LocationComponentTest : EspressoTest() { component.cameraMode = CameraMode.TRACKING_GPS location.bearing = 77f component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) assertEquals(77.0, mapboxMap.cameraPosition.bearing, 0.1) @@ -917,7 +917,7 @@ class LocationComponentTest : EspressoTest() { location.latitude = 30.0 location.longitude = 35.0 component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) // Waiting for the animation to finish assertEquals(92.0, mapboxMap.cameraPosition.bearing, 0.1) @@ -945,7 +945,7 @@ class LocationComponentTest : EspressoTest() { location.bearing = 77f component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) assertEquals(77.0, mapboxMap.cameraPosition.bearing, 0.1) @@ -956,7 +956,7 @@ class LocationComponentTest : EspressoTest() { location.latitude = 30.0 location.longitude = 35.0 component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) assertEquals(92.0, mapboxMap.cameraPosition.bearing, 0.1) @@ -985,7 +985,7 @@ class LocationComponentTest : EspressoTest() { location.bearing = 77f component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) assertEquals(bearing, mapboxMap.cameraPosition.bearing, 0.1) @@ -996,7 +996,7 @@ class LocationComponentTest : EspressoTest() { location.latitude = 30.0 location.longitude = 35.0 component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) assertEquals(bearing, mapboxMap.cameraPosition.bearing, 0.1) @@ -1021,7 +1021,7 @@ class LocationComponentTest : EspressoTest() { component.cameraMode = CameraMode.TRACKING component.cameraMode = CameraMode.NONE component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.uiSettings.focalPoint, nullValue()) } @@ -1044,7 +1044,7 @@ class LocationComponentTest : EspressoTest() { val zoom = mapboxMap.cameraPosition.zoom component.zoomWhileTracking(10.0) uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(zoom, mapboxMap.cameraPosition.zoom, 0.1) } @@ -1066,7 +1066,7 @@ class LocationComponentTest : EspressoTest() { component.cameraMode = CameraMode.TRACKING component.zoomWhileTracking(10.0) uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(10.0, mapboxMap.cameraPosition.zoom, 0.1) } @@ -1091,7 +1091,7 @@ class LocationComponentTest : EspressoTest() { uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2) component.cameraMode = CameraMode.NONE uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(15.0 / 2.0, mapboxMap.cameraPosition.zoom, 3.0) } @@ -1117,7 +1117,7 @@ class LocationComponentTest : EspressoTest() { component.onStop() component.zoomWhileTracking(10.0) uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(zoom, mapboxMap.cameraPosition.zoom, 0.1) } @@ -1142,7 +1142,7 @@ class LocationComponentTest : EspressoTest() { uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2) component.cancelZoomWhileTrackingAnimation() uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_ZOOM_ANIM_DURATION / 2) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(15.0 / 2.0, mapboxMap.cameraPosition.zoom, 3.0) } @@ -1165,7 +1165,7 @@ class LocationComponentTest : EspressoTest() { val tilt = mapboxMap.cameraPosition.tilt component.tiltWhileTracking(30.0) uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(tilt, mapboxMap.cameraPosition.tilt, 0.1) } @@ -1187,7 +1187,7 @@ class LocationComponentTest : EspressoTest() { component.cameraMode = CameraMode.TRACKING component.tiltWhileTracking(30.0) uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(30.0, mapboxMap.cameraPosition.tilt, 0.1) } @@ -1212,7 +1212,7 @@ class LocationComponentTest : EspressoTest() { uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION / 2) component.cameraMode = CameraMode.NONE uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION / 2) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(30.0 / 2.0, mapboxMap.cameraPosition.tilt, 3.0) } @@ -1237,7 +1237,7 @@ class LocationComponentTest : EspressoTest() { component.onStop() component.tiltWhileTracking(30.0) uiController.loopMainThreadForAtLeast(DEFAULT_TRACKING_TILT_ANIM_DURATION) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertEquals(tilt, mapboxMap.cameraPosition.tilt, 0.1) } @@ -1286,7 +1286,7 @@ class LocationComponentTest : EspressoTest() { mapboxMap.moveCamera(CameraUpdateFactory.newLatLng(LatLng(51.0, 17.0))) mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(90.0)) component.isLocationComponentEnabled = true - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(MAX_ANIMATION_DURATION_MS) assertEquals(location.bearing.toDouble(), mapboxMap.cameraPosition.bearing, 0.1) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt index 37b3e8b802..fb450de527 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.kt @@ -75,7 +75,7 @@ class LocationLayerControllerTest : EspressoTest() { .build()) component.isLocationComponentEnabled = true component.renderMode = RenderMode.NORMAL - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(style.getSource(LOCATION_SOURCE), notNullValue()) } @@ -99,7 +99,7 @@ class LocationLayerControllerTest : EspressoTest() { component.isLocationComponentEnabled = true component.renderMode = RenderMode.NORMAL component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true)) assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true)) @@ -123,7 +123,7 @@ class LocationLayerControllerTest : EspressoTest() { component.isLocationComponentEnabled = true component.renderMode = RenderMode.COMPASS component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true)) assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true)) @@ -147,7 +147,7 @@ class LocationLayerControllerTest : EspressoTest() { component.isLocationComponentEnabled = true component.renderMode = RenderMode.GPS component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(true)) assertThat(mapboxMap.isLayerVisible(BACKGROUND_LAYER), `is`(true)) @@ -171,7 +171,7 @@ class LocationLayerControllerTest : EspressoTest() { component.isLocationComponentEnabled = true component.forceLocationUpdate(location) component.isLocationComponentEnabled = false - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) component.renderMode = RenderMode.GPS assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(false)) @@ -197,7 +197,7 @@ class LocationLayerControllerTest : EspressoTest() { component.renderMode = RenderMode.NORMAL component.forceLocationUpdate(location) component.isLocationComponentEnabled = false - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) // Check that all layers visibilities are set to none assertThat(mapboxMap.isLayerVisible(FOREGROUND_LAYER), `is`(false)) @@ -223,7 +223,7 @@ class LocationLayerControllerTest : EspressoTest() { component.renderMode = RenderMode.NORMAL component.forceLocationUpdate(location) styleChangeIdlingResource.waitForStyle(mapboxMap, Style.LIGHT) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(component.renderMode, `is`(equalTo(RenderMode.NORMAL))) @@ -254,13 +254,13 @@ class LocationLayerControllerTest : EspressoTest() { component.isLocationComponentEnabled = true component.applyStyle(LocationComponentOptions.builder(context).staleStateTimeout(100).build()) component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(150) assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true)) mapboxMap.setStyle(Style.Builder().fromUrl(Style.LIGHT)) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.querySourceFeatures(LOCATION_SOURCE)[0].getBooleanProperty(PROPERTY_LOCATION_STALE), `is`(true)) } @@ -279,9 +279,9 @@ class LocationLayerControllerTest : EspressoTest() { .build()) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) component.isLocationComponentEnabled = false - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(true)) val options = @@ -291,7 +291,7 @@ class LocationLayerControllerTest : EspressoTest() { .build() component.applyStyle(options) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(mapboxMap.queryRenderedFeatures(location, FOREGROUND_LAYER).isEmpty(), `is`(true)) } } @@ -338,7 +338,7 @@ class LocationLayerControllerTest : EspressoTest() { show = !show } - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) } } executeComponentTest(componentAction) @@ -359,7 +359,7 @@ class LocationLayerControllerTest : EspressoTest() { component.isLocationComponentEnabled = true mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(location), 16.0)) component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) uiController.loopMainThreadForAtLeast(ACCURACY_RADIUS_ANIMATION_DURATION) assertEquals(Utils.calculateZoomLevelRadius(mapboxMap, location) /*meters projected to radius on zoom 16*/, @@ -386,7 +386,7 @@ class LocationLayerControllerTest : EspressoTest() { val zoom = 16.0 mapboxMap.easeCamera(CameraUpdateFactory.newLatLngZoom(target, zoom), 300) uiController.loopMainThreadForAtLeast(300) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(Math.abs(zoom - mapboxMap.cameraPosition.zoom) < 0.1 @@ -418,7 +418,7 @@ class LocationLayerControllerTest : EspressoTest() { val target = LatLng(location) val zoom = 16.0 mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(target, zoom)) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) assertThat(Math.abs(zoom - mapboxMap.cameraPosition.zoom) < 0.1 && Math.abs(target.latitude - mapboxMap.cameraPosition.target.latitude) < 0.1 @@ -445,7 +445,7 @@ class LocationLayerControllerTest : EspressoTest() { .build()) component.isLocationComponentEnabled = true component.forceLocationUpdate(location) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) component.applyStyle(LocationComponentOptions.builder(context).layerBelow("road-label").build()) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java index 14a2c3bdbf..536f452493 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java @@ -1,36 +1,36 @@ package com.mapbox.mapboxsdk.maps; +import com.mapbox.mapboxsdk.testapp.action.OrientationAction; +import com.mapbox.mapboxsdk.testapp.action.WaitAction; import com.mapbox.mapboxsdk.testapp.activity.BaseTest; import com.mapbox.mapboxsdk.testapp.activity.camera.CameraAnimationTypeActivity; import org.junit.Test; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.matcher.ViewMatchers.isRoot; -import static com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationLandscape; -import static com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationLandscapeReverse; -import static com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationPortrait; -import static com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationPortraitReverse; +import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationLandscape; +import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationLandscapeReverse; +import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationPortrait; +import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationPortraitReverse; public class OrientationTest extends BaseTest { @Test public void testChangeDeviceOrientation() { - onView(isRoot()).perform(orientationLandscape()); - waitAction(2200); - onView(isRoot()).perform(orientationPortrait()); - waitAction(2500); - onView(isRoot()).perform(orientationLandscapeReverse()); - waitAction(500); - onView(isRoot()).perform(orientationPortraitReverse()); - waitAction(1250); - onView(isRoot()).perform(orientationLandscape()); - waitAction(750); - onView(isRoot()).perform(orientationPortrait()); - waitAction(950); - onView(isRoot()).perform(orientationLandscapeReverse()); - onView(isRoot()).perform(orientationPortraitReverse()); - onView(isRoot()).perform(orientationLandscape()); - onView(isRoot()).perform(orientationPortrait()); + OrientationAction.invoke(orientationLandscape()); + WaitAction.invoke(2200); + OrientationAction.invoke(orientationPortrait()); + WaitAction.invoke(2500); + OrientationAction.invoke(orientationLandscapeReverse()); + WaitAction.invoke(500); + OrientationAction.invoke(orientationPortraitReverse()); + WaitAction.invoke(1250); + OrientationAction.invoke(orientationLandscape()); + WaitAction.invoke(750); + OrientationAction.invoke(orientationPortrait()); + WaitAction.invoke(950); + OrientationAction.invoke(orientationLandscapeReverse()); + OrientationAction.invoke(orientationPortraitReverse()); + OrientationAction.invoke(orientationLandscape()); + OrientationAction.invoke(orientationPortrait()); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt index 4866812e67..2e8cb27292 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt @@ -1,27 +1,17 @@ -package com.mapbox.mapboxsdk.testapp.maps +package com.mapbox.mapboxsdk.maps import android.graphics.PointF import android.support.test.espresso.UiController import com.mapbox.mapboxsdk.camera.CameraUpdateFactory import com.mapbox.mapboxsdk.geometry.LatLng -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.MapboxMap import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke import com.mapbox.mapboxsdk.testapp.activity.EspressoTest -import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test class VisibleRegionTest : EspressoTest() { - private lateinit var mapView: MapView - - override fun beforeTest() { - super.beforeTest() - mapView = (rule.activity as EspressoTestActivity).mapView - } - @Test fun visibleRegionTest() { validateTestSetup() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java new file mode 100644 index 0000000000..1bf5a87970 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationAction.java @@ -0,0 +1,78 @@ +package com.mapbox.mapboxsdk.testapp.action; + +import android.app.Activity; +import android.content.Context; +import android.content.ContextWrapper; +import android.content.pm.ActivityInfo; +import android.support.test.espresso.UiController; +import android.support.test.espresso.ViewAction; +import android.view.View; +import android.view.ViewGroup; +import org.hamcrest.Matcher; + +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.matcher.ViewMatchers.isRoot; + +public class OrientationAction implements ViewAction { + + private final int orientation; + + private OrientationAction(int orientation) { + this.orientation = orientation; + } + + public static ViewAction orientationLandscape() { + return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); + } + + public static ViewAction orientationPortrait() { + return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); + } + + public static ViewAction orientationLandscapeReverse() { + return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); + } + + public static ViewAction orientationPortraitReverse() { + return new OrientationAction(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); + } + + @Override + public Matcher getConstraints() { + return isRoot(); + } + + @Override + public String getDescription() { + return "change orientation to " + orientation; + } + + @Override + public void perform(UiController uiController, View view) { + uiController.loopMainThreadUntilIdle(); + Activity activity = getActivity(view.getContext()); + if (activity == null && view instanceof ViewGroup) { + ViewGroup v = (ViewGroup) view; + int c = v.getChildCount(); + for (int i = 0; i < c && activity == null; ++i) { + activity = getActivity(v.getChildAt(i).getContext()); + } + } + activity.setRequestedOrientation(orientation); + } + + public static void invoke(ViewAction action) { + onView(isRoot()).perform(action); + } + + private Activity getActivity(Context context) { + while (context instanceof ContextWrapper) { + if (context instanceof Activity) { + return (Activity) context; + } + context = ((ContextWrapper) context).getBaseContext(); + } + return null; + } + +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationChangeAction.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationChangeAction.java deleted file mode 100644 index 7f73d6a7f3..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/OrientationChangeAction.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.action; - - -import android.app.Activity; -import android.content.Context; -import android.content.ContextWrapper; -import android.content.pm.ActivityInfo; -import android.support.test.espresso.UiController; -import android.support.test.espresso.ViewAction; -import android.view.View; -import android.view.ViewGroup; -import org.hamcrest.Matcher; - -import static android.support.test.espresso.matcher.ViewMatchers.isRoot; - -public class OrientationChangeAction implements ViewAction { - - private final int orientation; - - private OrientationChangeAction(int orientation) { - this.orientation = orientation; - } - - public static ViewAction orientationLandscape() { - return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); - } - - public static ViewAction orientationPortrait() { - return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); - } - - public static ViewAction orientationLandscapeReverse() { - return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE); - } - - public static ViewAction orientationPortraitReverse() { - return new OrientationChangeAction(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT); - } - - @Override - public Matcher getConstraints() { - return isRoot(); - } - - @Override - public String getDescription() { - return "change orientation to " + orientation; - } - - @Override - public void perform(UiController uiController, View view) { - uiController.loopMainThreadUntilIdle(); - Activity activity = getActivity(view.getContext()); - if (activity == null && view instanceof ViewGroup) { - ViewGroup v = (ViewGroup) view; - int c = v.getChildCount(); - for (int i = 0; i < c && activity == null; ++i) { - activity = getActivity(v.getChildAt(i).getContext()); - } - } - activity.setRequestedOrientation(orientation); - } - - private Activity getActivity(Context context) { - while (context instanceof ContextWrapper) { - if (context instanceof Activity) { - return (Activity) context; - } - context = ((ContextWrapper) context).getBaseContext(); - } - return null; - } - -} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java index 5d98ccb7f8..e3741f3d42 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/action/WaitAction.java @@ -3,10 +3,11 @@ package com.mapbox.mapboxsdk.testapp.action; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.view.View; - import org.hamcrest.Matcher; +import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; +import static android.support.test.espresso.matcher.ViewMatchers.isRoot; public final class WaitAction implements ViewAction { @@ -30,5 +31,9 @@ public final class WaitAction implements ViewAction { public void perform(UiController uiController, View view) { uiController.loopMainThreadForAtLeast(loopTime); } + + public static void invoke(long loopTime) { + onView(isRoot()).perform(new WaitAction(loopTime)); + } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java index ea69f8adae..c91afe9b60 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/BaseTest.java @@ -1,116 +1,96 @@ package com.mapbox.mapboxsdk.testapp.activity; -import android.app.Activity; -import android.support.test.espresso.Espresso; -import android.support.test.espresso.IdlingRegistry; -import android.support.test.espresso.IdlingResource; -import android.support.test.espresso.IdlingResourceTimeoutException; -import android.support.test.espresso.ViewInteraction; +import android.support.annotation.CallSuper; +import android.support.annotation.UiThread; import android.support.test.rule.ActivityTestRule; - import com.mapbox.mapboxsdk.Mapbox; +import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; -import com.mapbox.mapboxsdk.testapp.action.WaitAction; -import com.mapbox.mapboxsdk.testapp.utils.FinishLoadingStyleIdlingResource; - -import com.mapbox.mapboxsdk.testapp.utils.MapboxIdlingResource; -import junit.framework.Assert; - import org.junit.After; import org.junit.Before; import org.junit.Rule; import org.junit.rules.TestName; - import timber.log.Timber; -import static android.support.test.espresso.Espresso.onView; -import static android.support.test.espresso.assertion.ViewAssertions.matches; -import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; -import static android.support.test.espresso.matcher.ViewMatchers.withId; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import static junit.framework.TestCase.assertNotNull; +import static junit.framework.TestCase.assertTrue; /** * Base class for all Activity test hooking into an existing Activity that will load style. */ public abstract class BaseTest { + private static final int WAIT_TIMEOUT = 30; //seconds + @Rule - public ActivityTestRule rule = new ActivityTestRule<>(getActivityClass()); + public ActivityTestRule rule = new ActivityTestRule<>(getActivityClass()); @Rule - public TestName testNameRule = new TestName(); + public TestName testName = new TestName(); protected MapboxMap mapboxMap; - protected MapboxIdlingResource idlingResource; + protected MapView mapView; + private final CountDownLatch latch = new CountDownLatch(1); @Before + @CallSuper public void beforeTest() { - try { - Timber.e(String.format( - "%s - %s - %s", - getClass().getSimpleName(), - testNameRule.getMethodName(), - "@Before test: register idle resource" - )); - idlingResource = (MapboxIdlingResource) generateIdlingResource(); - IdlingRegistry.getInstance().register(idlingResource); - Espresso.onIdle(); - mapboxMap = idlingResource.getMapboxMap(); - } catch (IdlingResourceTimeoutException idlingResourceTimeoutException) { - throw new RuntimeException( - String.format( - "Could not start %s test for %s.", - testNameRule.getMethodName(), - getActivityClass().getSimpleName() - ) - ); - } + initialiseMap(); + holdTestRunnerForStyleLoad(); } - protected IdlingResource generateIdlingResource() { - return new FinishLoadingStyleIdlingResource(rule.getActivity()); + @After + @CallSuper + public void afterTest() { + // override to add logic + } + + @UiThread + @CallSuper + protected void initMap(MapboxMap mapboxMap) { + this.mapboxMap = mapboxMap; + mapboxMap.getStyle(style -> latch.countDown()); } protected void validateTestSetup() { if (!Mapbox.isConnected()) { Timber.e("Not connected to the internet while running test"); } - - checkViewIsDisplayed(R.id.mapView); - Assert.assertNotNull(mapboxMap); - } - - protected MapboxMap getMapboxMap() { - return mapboxMap; + assertNotNull("MapView isn't initialised", mapView); + assertNotNull("MapboxMap isn't initialised", mapboxMap); + assertNotNull("Style isn't initialised", mapboxMap.getStyle()); + assertTrue("Style isn't fully loaded", mapboxMap.getStyle().isFullyLoaded()); } protected abstract Class getActivityClass(); - protected void checkViewIsDisplayed(int id) { - onView(withId(id)).check(matches(isDisplayed())); - } - - protected void waitAction() { - waitAction(500); - } - - protected void waitAction(long waitTime) { - onView(withId(R.id.mapView)).perform(new WaitAction(waitTime)); - } - - protected ViewInteraction onMapView() { - return onView(withId(R.id.mapView)); + private void initialiseMap() { + try { + rule.runOnUiThread(() -> { + mapView = rule.getActivity().findViewById(R.id.mapView); + mapView.getMapAsync(this::initMap); + }); + } catch (Throwable throwable) { + throwable.printStackTrace(); + } } - protected MapboxMapAction getMapboxMapAction(MapboxMapAction.OnInvokeActionListener onInvokeActionListener) { - return new MapboxMapAction(onInvokeActionListener, mapboxMap); - } + private void holdTestRunnerForStyleLoad() { + boolean interrupted; + try { + interrupted = latch.await(WAIT_TIMEOUT, TimeUnit.SECONDS); + } catch (InterruptedException ignore) { + interrupted = true; + } - @After - public void afterTest() { - Timber.e(String.format("%s - %s", testNameRule.getMethodName(), "@After test: unregister idle resource")); - IdlingRegistry.getInstance().unregister(idlingResource); + if (!interrupted) { + Timber.e("Timeout occurred for %s", testName.getMethodName()); + validateTestSetup(); + } } -} +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java index dfb4a46180..97a73ba1cb 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/activity/EspressoTest.java @@ -1,24 +1,28 @@ package com.mapbox.mapboxsdk.testapp.activity; -import android.support.test.espresso.IdlingResource; +import android.support.annotation.UiThread; +import com.mapbox.mapboxsdk.maps.MapboxMap; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.activity.espresso.EspressoTestActivity; -import com.mapbox.mapboxsdk.testapp.utils.LoadStyleIdlingResource; + /** * Base class for all tests using EspressoTestActivity as wrapper. *

- * Uses {@link LoadStyleIdlingResource} to load "assets/streets.json" as style. + * Loads "assets/streets.json" as style. *

*/ public class EspressoTest extends BaseTest { @Override - protected IdlingResource generateIdlingResource() { - return new LoadStyleIdlingResource(rule.getActivity()); + protected final Class getActivityClass() { + return EspressoTestActivity.class; } + @UiThread @Override - protected final Class getActivityClass() { - return EspressoTestActivity.class; + protected void initMap(MapboxMap mapboxMap) { + mapboxMap.setStyle(new Style.Builder().fromUrl("asset://streets.json")); + super.initMap(mapboxMap); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java index 9fb823a377..559213af3d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/annotations/IconTest.java @@ -1,6 +1,7 @@ package com.mapbox.mapboxsdk.testapp.annotations; import android.app.Activity; +import android.support.test.annotation.UiThreadTest; import android.support.v4.content.res.ResourcesCompat; import com.mapbox.mapboxsdk.annotations.Icon; import com.mapbox.mapboxsdk.annotations.IconFactory; @@ -31,117 +32,107 @@ public class IconTest extends EspressoTest { @Before public void beforeTest() { super.beforeTest(); - iconMap = new IconManagerResolver(getMapboxMap()).getIconMap(); - } - - @Test - public void testEmpty() { - assertTrue(iconMap.isEmpty()); + iconMap = new IconManagerResolver(mapboxMap).getIconMap(); } @Test + @UiThreadTest public void testAddSameIconMarker() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - Icon defaultMarker = IconFactory.getInstance(rule.getActivity()).defaultMarker(); - mapboxMap.addMarker(new MarkerOptions().position(new LatLng())); - mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); - assertEquals(1, iconMap.size()); - assertEquals(2, iconMap.get(defaultMarker), 0); - })); + Icon defaultMarker = IconFactory.getInstance(rule.getActivity()).defaultMarker(); + mapboxMap.addMarker(new MarkerOptions().position(new LatLng())); + mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); + assertEquals(1, iconMap.size()); + assertEquals(2, iconMap.get(defaultMarker), 0); } @Test + @UiThreadTest public void testAddDifferentIconMarker() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - Icon icon = IconFactory.getInstance(rule.getActivity()).fromResource(R.drawable.mapbox_logo_icon); - getMapboxMap().addMarker(new MarkerOptions().icon(icon).position(new LatLng())); - getMapboxMap().addMarker(new MarkerOptions().position(new LatLng(1, 1))); - assertEquals(iconMap.size(), 2); - assertTrue(iconMap.containsKey(icon)); - assertTrue(iconMap.get(icon) == 1); - })); + Icon icon = IconFactory.getInstance(rule.getActivity()).fromResource(R.drawable.mapbox_logo_icon); + mapboxMap.addMarker(new MarkerOptions().icon(icon).position(new LatLng())); + mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); + assertEquals(iconMap.size(), 2); + assertTrue(iconMap.containsKey(icon)); + assertTrue(iconMap.get(icon) == 1); } @Test + @UiThreadTest public void testAddRemoveIconMarker() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - Icon icon = IconFactory.getInstance(rule.getActivity()).fromResource(R.drawable.mapbox_logo_icon); - Marker marker = mapboxMap.addMarker(new MarkerOptions().icon(icon).position(new LatLng())); - mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); - assertEquals(iconMap.size(), 2); - assertTrue(iconMap.containsKey(icon)); - assertTrue(iconMap.get(icon) == 1); - - mapboxMap.removeMarker(marker); - assertEquals(iconMap.size(), 1); - assertFalse(iconMap.containsKey(icon)); - })); + Icon icon = IconFactory.getInstance(rule.getActivity()).fromResource(R.drawable.mapbox_logo_icon); + Marker marker = mapboxMap.addMarker(new MarkerOptions().icon(icon).position(new LatLng())); + mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); + assertEquals(iconMap.size(), 2); + assertTrue(iconMap.containsKey(icon)); + assertTrue(iconMap.get(icon) == 1); + + mapboxMap.removeMarker(marker); + assertEquals(iconMap.size(), 1); + assertFalse(iconMap.containsKey(icon)); } @Test + @UiThreadTest public void testAddRemoveDefaultMarker() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); - assertEquals(iconMap.size(), 1); + Marker marker = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); + assertEquals(iconMap.size(), 1); - mapboxMap.removeMarker(marker); - assertEquals(iconMap.size(), 0); + mapboxMap.removeMarker(marker); + assertEquals(iconMap.size(), 0); - mapboxMap.addMarker(new MarkerOptions().position(new LatLng())); - assertEquals(iconMap.size(), 1); - })); + mapboxMap.addMarker(new MarkerOptions().position(new LatLng())); + assertEquals(iconMap.size(), 1); } @Test + @UiThreadTest public void testAddRemoveMany() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - Activity activity = rule.getActivity(); - IconFactory iconFactory = IconFactory.getInstance(activity); - - // add 2 default icon markers - Marker defaultMarkerOne = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); - Marker defaultMarkerTwo = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(2, 1))); - - // add 4 unique icon markers - mapboxMap.addMarker(new MarkerOptions() - .icon(iconFactory.fromResource(R.drawable.mapbox_logo_icon)) - .position(new LatLng(3, 1)) - ); - mapboxMap.addMarker(new MarkerOptions() - .icon(iconFactory.fromResource(R.drawable.mapbox_compass_icon)) - .position(new LatLng(4, 1)) - ); - mapboxMap.addMarker(new MarkerOptions() - .icon(IconUtils.drawableToIcon(activity, R.drawable.ic_stars, - ResourcesCompat.getColor(activity.getResources(), - R.color.blueAccent, activity.getTheme()))) - .position(new LatLng(5, 1)) - ); - mapboxMap.addMarker(new MarkerOptions() - .icon(iconFactory.fromResource(R.drawable.ic_android)) - .position(new LatLng(6, 1)) - ); - - assertEquals("Amount of icons should match 5", 5, iconMap.size()); - assertEquals("Refcounter of default marker should match 2", 2, iconMap.get(iconFactory.defaultMarker()), 0); - - mapboxMap.removeMarker(defaultMarkerOne); - - assertEquals("Amount of icons should match 5", 5, iconMap.size()); - assertEquals("Refcounter of default marker should match 1", 1, iconMap.get(iconFactory.defaultMarker()), 0); - - mapboxMap.removeMarker(defaultMarkerTwo); - - assertEquals("Amount of icons should match 4", 4, iconMap.size()); - assertNull("DefaultMarker shouldn't exist anymore", iconMap.get(iconFactory.defaultMarker())); - - mapboxMap.clear(); - assertEquals("Amount of icons should match 0", 0, iconMap.size()); - })); + Activity activity = rule.getActivity(); + IconFactory iconFactory = IconFactory.getInstance(activity); + + // add 2 default icon markers + Marker defaultMarkerOne = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(1, 1))); + Marker defaultMarkerTwo = mapboxMap.addMarker(new MarkerOptions().position(new LatLng(2, 1))); + + // add 4 unique icon markers + mapboxMap.addMarker(new MarkerOptions() + .icon(iconFactory.fromResource(R.drawable.mapbox_logo_icon)) + .position(new LatLng(3, 1)) + ); + mapboxMap.addMarker(new MarkerOptions() + .icon(iconFactory.fromResource(R.drawable.mapbox_compass_icon)) + .position(new LatLng(4, 1)) + ); + mapboxMap.addMarker(new MarkerOptions() + .icon(IconUtils.drawableToIcon(activity, R.drawable.ic_stars, + ResourcesCompat.getColor(activity.getResources(), + R.color.blueAccent, activity.getTheme()))) + .position(new LatLng(5, 1)) + ); + mapboxMap.addMarker(new MarkerOptions() + .icon(iconFactory.fromResource(R.drawable.ic_android)) + .position(new LatLng(6, 1)) + ); + + assertEquals("Amount of icons should match 5", 5, iconMap.size()); + assertEquals("Refcounter of default marker should match 2", 2, iconMap.get(iconFactory.defaultMarker()), 0); + + mapboxMap.removeMarker(defaultMarkerOne); + + assertEquals("Amount of icons should match 5", 5, iconMap.size()); + assertEquals("Refcounter of default marker should match 1", 1, iconMap.get(iconFactory.defaultMarker()), 0); + + mapboxMap.removeMarker(defaultMarkerTwo); + + assertEquals("Amount of icons should match 4", 4, iconMap.size()); + assertNull("DefaultMarker shouldn't exist anymore", iconMap.get(iconFactory.defaultMarker())); + + mapboxMap.clear(); + assertEquals("Amount of icons should match 0", 0, iconMap.size()); } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java index eb38bddf84..4365ea95ff 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/camera/CameraForTest.java @@ -1,6 +1,7 @@ package com.mapbox.mapboxsdk.testapp.camera; import android.support.annotation.NonNull; +import android.support.test.annotation.UiThreadTest; import com.mapbox.geojson.Point; import com.mapbox.geojson.Polygon; import com.mapbox.mapboxsdk.camera.CameraPosition; @@ -18,123 +19,117 @@ import static org.junit.Assert.assertEquals; public class CameraForTest extends BaseTest { @Test + @UiThreadTest public void testGetCameraForLatLngBounds() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( - LatLngBounds.from(10, 10, -10, -10)); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Bearing should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", expectedPosition.tilt, actualPosition.tilt, 0.01f); - })); + CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( + LatLngBounds.from(10, 10, -10, -10)); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Bearing should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", expectedPosition.tilt, actualPosition.tilt, 0.01f); } @Test + @UiThreadTest public void testGetCameraForLatLngBoundsPadding() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( - LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5}); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( + LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5}); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForLatLngBoundsBearing() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( - LatLngBounds.from(10, 10, -10, -10), 45, 0); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( + LatLngBounds.from(10, 10, -10, -10), 45, 0); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForLatLngBoundsTilt() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( - LatLngBounds.from(10, 10, -10, -10), 0, 45); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng(-0.264576975267, 0)).zoom(4.13).tilt(45).bearing(0).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( + LatLngBounds.from(10, 10, -10, -10), 0, 45); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng(-0.264576975267, 0)).zoom(4.13).tilt(45).bearing(0).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForLatLngBoundsAll() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( - LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5}, 45, 45); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng(-0.3732134634, -0.3713191053)).zoom(3.63).tilt(45).bearing(45).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + CameraPosition actualPosition = mapboxMap.getCameraForLatLngBounds( + LatLngBounds.from(10, 10, -10, -10), new int[] {5, 5, 5, 5}, 45, 45); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng(-0.3732134634, -0.3713191053)).zoom(3.63).tilt(45).bearing(45).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForGeometry() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - List> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition)); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Bearing should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", expectedPosition.tilt, actualPosition.tilt, 0.01f); - })); + List> polygonDefinition = getPolygonDefinition(); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition)); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng()).zoom(4.16).tilt(0).bearing(0).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Bearing should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", expectedPosition.tilt, actualPosition.tilt, 0.01f); } @NonNull @@ -154,113 +149,108 @@ public class CameraForTest extends BaseTest { } @Test + @UiThreadTest public void testGetCameraForGeometryPadding() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - List> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), - new int[] {5, 5, 5, 5}); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + List> polygonDefinition = getPolygonDefinition(); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), + new int[] {5, 5, 5, 5}); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng()).zoom(4.13).tilt(0).bearing(0).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForGeometryBearing() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - List> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 45, 0); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + List> polygonDefinition = getPolygonDefinition(); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 45, 0); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng()).zoom(3.66).tilt(0).bearing(45).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForGeometryTilt() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - List> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 0, 45); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng(-0.2645769752, 0)).zoom(4.13).tilt(45).bearing(0).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + List> polygonDefinition = getPolygonDefinition(); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), 0, 45); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng(-0.2645769752, 0)).zoom(4.13).tilt(45).bearing(0).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForGeometryAll() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - List> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), - new int[] {5, 5, 5, 5}, 45, 45); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng(-0.373213463, -0.37131910534)).zoom(3.63).tilt(45).bearing(45).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + List> polygonDefinition = getPolygonDefinition(); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry(Polygon.fromLngLats(polygonDefinition), + new int[] {5, 5, 5, 5}, 45, 45); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng(-0.373213463, -0.37131910534)).zoom(3.63).tilt(45).bearing(45).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Test + @UiThreadTest public void testGetCameraForGeometryDeprecatedApi() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - List> polygonDefinition = getPolygonDefinition(); - CameraPosition actualPosition = mapboxMap.getCameraForGeometry( - Polygon.fromLngLats(polygonDefinition), - new int[] {5, 5, 5, 5}, - 45, 0); - CameraPosition expectedPosition = new CameraPosition.Builder() - .target(new LatLng()).zoom(3.63).tilt(0).bearing(45).build(); - assertEquals("Latitude should match", - expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); - assertEquals("Longitude should match", - expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); - assertEquals("Zoom should match", - expectedPosition.zoom, actualPosition.zoom, 0.01f); - assertEquals("Tilt should match", - expectedPosition.tilt, actualPosition.tilt, 0.01f); - assertEquals("Bearing should match", - expectedPosition.bearing, actualPosition.bearing, 0.01f); - })); + List> polygonDefinition = getPolygonDefinition(); + CameraPosition actualPosition = mapboxMap.getCameraForGeometry( + Polygon.fromLngLats(polygonDefinition), + new int[] {5, 5, 5, 5}, + 45, 0); + CameraPosition expectedPosition = new CameraPosition.Builder() + .target(new LatLng()).zoom(3.63).tilt(0).bearing(45).build(); + assertEquals("Latitude should match", + expectedPosition.target.getLatitude(), actualPosition.target.getLatitude(), 0.00001f); + assertEquals("Longitude should match", + expectedPosition.target.getLongitude(), actualPosition.target.getLongitude(), 0.00001f); + assertEquals("Zoom should match", + expectedPosition.zoom, actualPosition.zoom, 0.01f); + assertEquals("Tilt should match", + expectedPosition.tilt, actualPosition.tilt, 0.01f); + assertEquals("Bearing should match", + expectedPosition.bearing, actualPosition.bearing, 0.01f); } @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java index c34e76a6e5..f30b3aa8cf 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/geometry/GeoJsonConversionTest.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.testapp.geometry; +import android.support.test.annotation.UiThreadTest; import com.google.gson.JsonArray; import com.mapbox.geojson.Feature; import com.mapbox.geojson.FeatureCollection; @@ -13,11 +14,13 @@ import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; import com.mapbox.mapboxsdk.style.sources.GeometryTileProvider; +import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; import com.mapbox.mapboxsdk.testapp.utils.TestingAsyncUtils; - import org.junit.Test; +import static android.support.test.espresso.Espresso.onView; +import static android.support.test.espresso.matcher.ViewMatchers.isRoot; import static com.mapbox.geojson.Feature.fromGeometry; import static com.mapbox.geojson.FeatureCollection.fromFeatures; import static com.mapbox.geojson.GeometryCollection.fromGeometries; @@ -35,101 +38,94 @@ public class GeoJsonConversionTest extends EspressoTest { // Regression test for #12343 @Test + @UiThreadTest public void testEmptyFeatureCollection() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromGeometries(emptyList()))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - })); + mapboxMap.getStyle().addSource( + new CustomGeometrySource("test-id", + new CustomProvider(fromFeatures(singletonList(fromGeometry(fromGeometries(emptyList()))))) + ) + ); + mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); } @Test + @UiThreadTest public void testPointFeatureCollection() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(Point.fromLngLat(0.0, 0.0))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - })); + mapboxMap.getStyle().addSource( + new CustomGeometrySource("test-id", + new CustomProvider(fromFeatures(singletonList(fromGeometry(Point.fromLngLat(0.0, 0.0))))) + ) + ); + mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); } @Test + @UiThreadTest public void testMultiPointFeatureCollection() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - })); + mapboxMap.getStyle().addSource( + new CustomGeometrySource("test-id", + new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))) + ) + ); + mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); } - @Test + @UiThreadTest public void testPolygonFeatureCollection() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(Polygon.fromLngLats(emptyList()))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - })); + mapboxMap.getStyle().addSource( + new CustomGeometrySource("test-id", + new CustomProvider(fromFeatures(singletonList(fromGeometry(Polygon.fromLngLats(emptyList()))))) + ) + ); + mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); } @Test + @UiThreadTest public void testMultiPolygonFeatureCollection() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromPolygon(Polygon.fromLngLats(emptyList())))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - })); + mapboxMap.getStyle().addSource( + new CustomGeometrySource("test-id", + new CustomProvider(fromFeatures(singletonList(fromGeometry(fromPolygon(Polygon.fromLngLats(emptyList())))))) + ) + ); + mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); } @Test + @UiThreadTest public void testLineStringFeatureCollection() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - })); + mapboxMap.getStyle().addSource( + new CustomGeometrySource("test-id", + new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList()))))) + ) + ); + mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); } @Test + @UiThreadTest public void testMultiLineStringFeatureCollection() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { - mapboxMap.getStyle().addSource( - new CustomGeometrySource("test-id", - new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLineString(fromLngLats(emptyList())))))) - ) - ); - mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); - })); + mapboxMap.getStyle().addSource( + new CustomGeometrySource("test-id", + new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLineString(fromLngLats(emptyList())))))) + ) + ); + mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id")); } + @Test public void testNegativeNumberPropertyConversion() { validateTestSetup(); - onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> { + onView(isRoot()).perform(new MapboxMapAction((uiController, mapboxMap) -> { LatLng latLng = new LatLng(); Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())); @@ -148,10 +144,10 @@ public class GeoJsonConversionTest extends EspressoTest { ); mapboxMap.getStyle().addLayer(layer); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng)).isEmpty()); - })); + }, mapboxMap)); } class CustomProvider implements GeometryTileProvider { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt index 84af279bd0..ac73b028f3 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/StyleLoadTest.kt @@ -18,14 +18,6 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class StyleLoadTest : EspressoTest() { - private lateinit var mapView: MapView - - @Before - override fun beforeTest() { - super.beforeTest() - mapView = (rule.activity as EspressoTestActivity).mapView - } - @Test fun updateSourceAfterStyleLoad() { validateTestSetup() diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java index 1cdf1423a3..8b62ee7612 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/CompassViewTest.java @@ -4,6 +4,7 @@ import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.testapp.R; +import com.mapbox.mapboxsdk.testapp.action.WaitAction; import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; import com.mapbox.mapboxsdk.testapp.utils.TestConstants; import org.junit.Ignore; @@ -55,7 +56,7 @@ public class CompassViewTest extends EspressoTest { .build() ))); onView(withId(R.id.compassView)).perform(click()); - waitAction(); + WaitAction.invoke(500); onView(withId(R.id.compassView)).check(matches(not(isDisplayed()))); invoke(mapboxMap, (uiController, mapboxMap) -> { CameraPosition cameraPosition = mapboxMap.getCameraPosition(); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt index eb458ab8f5..a6238ebf14 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CustomGeometrySourceTest.kt @@ -6,8 +6,9 @@ import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.THREAD_POOL_LIMIT import com.mapbox.mapboxsdk.style.sources.CustomGeometrySource.THREAD_PREFIX import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke -import com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationLandscape -import com.mapbox.mapboxsdk.testapp.action.OrientationChangeAction.orientationPortrait +import com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationLandscape +import com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationPortrait +import com.mapbox.mapboxsdk.testapp.action.WaitAction import com.mapbox.mapboxsdk.testapp.activity.BaseTest import com.mapbox.mapboxsdk.testapp.activity.style.GridSourceActivity import com.mapbox.mapboxsdk.testapp.activity.style.GridSourceActivity.ID_GRID_LAYER @@ -25,11 +26,11 @@ class CustomGeometrySourceTest : BaseTest() { @Ignore fun sourceNotLeakingThreadsTest() { validateTestSetup() - waitAction(4000) + WaitAction.invoke(4000) onView(isRoot()).perform(orientationLandscape()) - waitAction(2000) + WaitAction.invoke(2000) onView(isRoot()).perform(orientationPortrait()) - waitAction(2000) + WaitAction.invoke(2000) Assert.assertFalse("Threads should be shutdown when the source is destroyed.", Thread.getAllStackTraces().keys.filter { it.name.startsWith(THREAD_PREFIX) @@ -42,9 +43,9 @@ class CustomGeometrySourceTest : BaseTest() { validateTestSetup() invoke(mapboxMap) { uiController, mapboxMap -> mapboxMap.style!!.removeLayer(ID_GRID_LAYER) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) mapboxMap.style!!.removeSource(ID_GRID_SOURCE) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) Assert.assertTrue("There should be no threads running when the source is removed.", Thread.getAllStackTraces().keys.filter { it.name.startsWith(CustomGeometrySource.THREAD_PREFIX) @@ -58,12 +59,12 @@ class CustomGeometrySourceTest : BaseTest() { validateTestSetup() invoke(mapboxMap) { uiController, mapboxMap -> mapboxMap.style!!.removeLayer((rule.activity as GridSourceActivity).layer) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) mapboxMap.style!!.removeSource(ID_GRID_SOURCE) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) mapboxMap.style!!.addSource((rule.activity as GridSourceActivity).source) mapboxMap.style!!.addLayer((rule.activity as GridSourceActivity).layer) - TestingAsyncUtils.waitForLayer(uiController, idlingResource.mapView) + TestingAsyncUtils.waitForLayer(uiController, mapView) Assert.assertTrue("Threads should be restarted when the source is re-added to the map.", Thread.getAllStackTraces().keys.filter { it.name.startsWith(CustomGeometrySource.THREAD_PREFIX) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java index 75dcbf1209..ff3b2a9d6d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ExpressionTest.java @@ -252,7 +252,7 @@ public class ExpressionTest extends EspressoTest { ) )); mapboxMap.getStyle().addLayer(layer); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); @@ -262,7 +262,7 @@ public class ExpressionTest extends EspressoTest { literal(ColorUtils.colorToRgbaString(Color.RED)) ) )); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); @@ -272,7 +272,7 @@ public class ExpressionTest extends EspressoTest { literal(ColorUtils.colorToRgbaString(Color.RED)) ) )); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); }); @@ -292,7 +292,7 @@ public class ExpressionTest extends EspressoTest { formatEntry("test") ); layer.setProperties(textField(expression)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); @@ -315,7 +315,7 @@ public class ExpressionTest extends EspressoTest { formatEntry("test", formatFontScale(1.75)) ); layer.setProperties(textField(expression)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); @@ -341,7 +341,7 @@ public class ExpressionTest extends EspressoTest { ) ); layer.setProperties(textField(expression)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse( mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty() @@ -371,7 +371,7 @@ public class ExpressionTest extends EspressoTest { ) ); layer.setProperties(textField(expression)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse( mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty() @@ -402,7 +402,7 @@ public class ExpressionTest extends EspressoTest { ) ); layer.setProperties(textField(expression)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse( mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty() @@ -436,7 +436,7 @@ public class ExpressionTest extends EspressoTest { formatEntry("\ntest2", formatFontScale(2), formatTextColor(Color.BLUE)) ); layer.setProperties(textField(expression)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse( mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer").isEmpty() @@ -472,7 +472,7 @@ public class ExpressionTest extends EspressoTest { ) ); layer.setProperties(textField(expression)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); @@ -504,7 +504,7 @@ public class ExpressionTest extends EspressoTest { formatEntry("\ntest2", formatFontScale(2)) ); layer.setProperties(textField(expression), textColor("rgba(128, 0, 0, 1)")); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); @@ -524,7 +524,7 @@ public class ExpressionTest extends EspressoTest { mapboxMap.getStyle().addLayer(layer); layer.setProperties(textField("test")); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); @@ -550,7 +550,7 @@ public class ExpressionTest extends EspressoTest { new FormattedSection("test", null, null, "rgba(0, 255, 0, 1)") ); layer.setProperties(textField(formatted), textColor("rgba(128, 0, 0, 1)")); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer") .isEmpty()); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java index 92d060fee4..99e0ae4016 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/GeoJsonSourceTests.java @@ -94,7 +94,7 @@ public class GeoJsonSourceTests extends EspressoTest { } source.setGeoJson(Point.fromLngLat(20, 55)); - TestingAsyncUtils.INSTANCE.waitForLayer(uiController, idlingResource.getMapView()); + TestingAsyncUtils.INSTANCE.waitForLayer(uiController, mapView); assertEquals(1, mapboxMap.queryRenderedFeatures( mapboxMap.getProjection().toScreenLocation( new LatLng(55, 20)), "layer").size()); diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java index 0e4c8f3f2e..1c49801e05 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java @@ -4,10 +4,8 @@ import android.graphics.Bitmap; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.support.test.runner.AndroidJUnit4; - import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; - import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; import org.junit.Test; import org.junit.runner.RunWith; diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java index ed39f36e32..a4a34e752e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RuntimeStyleTests.java @@ -2,12 +2,10 @@ package com.mapbox.mapboxsdk.testapp.style; import android.graphics.Color; import android.graphics.PointF; -import android.support.test.espresso.Espresso; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.support.test.runner.AndroidJUnit4; import android.view.View; - import com.mapbox.mapboxsdk.style.layers.CannotAddLayerException; import com.mapbox.mapboxsdk.style.layers.CircleLayer; import com.mapbox.mapboxsdk.style.layers.FillLayer; @@ -22,20 +20,16 @@ import com.mapbox.mapboxsdk.style.sources.Source; import com.mapbox.mapboxsdk.style.sources.VectorSource; import com.mapbox.mapboxsdk.testapp.R; import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; - import junit.framework.Assert; - import org.hamcrest.Matcher; -import org.junit.After; import org.junit.Test; import org.junit.runner.RunWith; +import timber.log.Timber; import java.net.MalformedURLException; import java.net.URL; import java.util.List; -import timber.log.Timber; - import static android.support.test.espresso.Espresso.onView; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; @@ -366,11 +360,6 @@ public class RuntimeStyleTests extends EspressoTest { } } - @After - public void unregisterIntentServiceIdlingResource() { - Espresso.unregisterIdlingResources(idlingResource); - } - public abstract class BaseViewAction implements ViewAction { @Override diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/FinishLoadingStyleIdlingResource.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/FinishLoadingStyleIdlingResource.java deleted file mode 100644 index 323d2c0f15..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/FinishLoadingStyleIdlingResource.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.utils; - -import android.app.Activity; -import android.os.Handler; -import android.os.Looper; -import android.support.annotation.WorkerThread; -import com.mapbox.mapboxsdk.maps.MapboxMap; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class FinishLoadingStyleIdlingResource extends MapboxIdlingResource { - - @WorkerThread - public FinishLoadingStyleIdlingResource(final Activity activity) { - new Handler(Looper.getMainLooper()).post(() -> inflateMap(activity)); - } - - @Override - public void initMap(MapboxMap mapboxMap) { - super.initMap(mapboxMap); - mapboxMap.getStyle(style -> { - assertNotNull(style); - assertTrue(style.isFullyLoaded()); - if (resourceCallback != null) { - resourceCallback.onTransitionToIdle(); - } - }); - } - - @Override - public boolean isIdleNow() { - return getMapboxMap() != null && getMapboxMap().getStyle() != null; - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/LoadStyleIdlingResource.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/LoadStyleIdlingResource.java deleted file mode 100644 index 5dead21fbb..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/LoadStyleIdlingResource.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.utils; - -import android.app.Activity; -import android.os.Handler; -import android.os.Looper; -import android.support.annotation.UiThread; -import android.support.annotation.WorkerThread; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class LoadStyleIdlingResource extends MapboxIdlingResource { - - private Style style; - - @WorkerThread - public LoadStyleIdlingResource(final Activity activity) { - new Handler(Looper.getMainLooper()).post(() -> inflateMap(activity)); - } - - @UiThread - public void initMap(MapboxMap mapboxMap) { - super.initMap(mapboxMap); - mapboxMap.setStyle("asset://streets.json", style -> { - assertNotNull(style); - assertTrue(style.isFullyLoaded()); - this.style = style; - if (resourceCallback != null) { - resourceCallback.onTransitionToIdle(); - } - }); - } - - @Override - public boolean isIdleNow() { - return style != null; - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/MapboxIdlingResource.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/MapboxIdlingResource.java deleted file mode 100644 index a05221d618..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/MapboxIdlingResource.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.utils; - -import android.app.Activity; -import android.support.annotation.UiThread; -import android.support.test.espresso.IdlingResource; -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.testapp.R; - -public abstract class MapboxIdlingResource implements IdlingResource { - - private MapView mapView; - private MapboxMap mapboxMap; - IdlingResource.ResourceCallback resourceCallback; - - @UiThread - void inflateMap(Activity activity) { - mapView = activity.findViewById(R.id.mapView); - if (mapView != null) { - mapView.getMapAsync(this::initMap); - } - } - - @UiThread - protected void initMap(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - } - - @Override - public String getName() { - return getClass().getSimpleName(); - } - - @Override - public void registerIdleTransitionCallback(ResourceCallback resourceCallback) { - this.resourceCallback = resourceCallback; - } - - public MapboxMap getMapboxMap() { - return mapboxMap; - } - - public MapView getMapView() { - return mapView; - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java deleted file mode 100644 index 7696447289..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.utils; - -import android.app.Activity; -import android.os.Handler; -import android.os.Looper; -import android.support.annotation.WorkerThread; -import android.support.test.espresso.IdlingResource; - -import com.mapbox.mapboxsdk.maps.MapView; -import com.mapbox.mapboxsdk.maps.MapboxMap; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.testapp.R; - -public class OnMapReadyIdlingResource implements IdlingResource { - - private boolean styleLoaded; - private MapboxMap mapboxMap; - private IdlingResource.ResourceCallback resourceCallback; - - @WorkerThread - public OnMapReadyIdlingResource(final Activity activity) { - Handler handler = new Handler(Looper.getMainLooper()); - handler.post(() -> { - MapView mapView = activity.findViewById(R.id.mapView); - if (mapView != null) { - mapView.addOnDidFinishLoadingStyleListener(() -> { - styleLoaded = true; - if (resourceCallback != null) { - resourceCallback.onTransitionToIdle(); - } - }); - mapView.getMapAsync(this::initMap); - } - }); - } - - private void initMap(MapboxMap mapboxMap) { - this.mapboxMap = mapboxMap; - mapboxMap.setStyle(new Style.Builder().fromUrl("asset://streets.json")); - } - - @Override - public String getName() { - return getClass().getSimpleName(); - } - - @Override - public boolean isIdleNow() { - return styleLoaded; - } - - @Override - public void registerIdleTransitionCallback(ResourceCallback resourceCallback) { - this.resourceCallback = resourceCallback; - } - - public MapboxMap getMapboxMap() { - return mapboxMap; - } -} \ No newline at end of file -- cgit v1.2.1 From 0f947b912b3cbee4e78f0e059396231b9285ae5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Mon, 18 Mar 2019 11:36:49 +0100 Subject: [android] cache location layer IDs in a set instead of a list --- .../location/LocationLayerController.java | 17 ++++----- .../location/LocationLayerControllerTest.java | 40 +++++++++++++--------- 2 files changed, 33 insertions(+), 24 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java index f11acacf31..aa8a82bf6d 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationLayerController.java @@ -5,6 +5,7 @@ import android.graphics.PointF; import android.support.annotation.ColorInt; import android.support.annotation.NonNull; import android.support.annotation.Nullable; +import android.support.annotation.VisibleForTesting; import com.google.gson.JsonArray; import com.google.gson.JsonObject; @@ -18,7 +19,6 @@ import com.mapbox.mapboxsdk.style.layers.Layer; import com.mapbox.mapboxsdk.style.layers.SymbolLayer; import com.mapbox.mapboxsdk.style.sources.GeoJsonSource; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -70,7 +70,8 @@ final class LocationLayerController { private LocationComponentOptions options; private final OnRenderModeChangedListener internalRenderModeChangedListener; - private final List layerMap = new ArrayList<>(); + @VisibleForTesting + final Set layerSet = new HashSet<>(); private Feature locationFeature; private GeoJsonSource locationSource; @@ -112,7 +113,7 @@ final class LocationLayerController { removeLayers(); addLayers(newLayerBelowOption); if (isHidden) { - for (String layerId : layerMap) { + for (String layerId : layerSet) { setLayerVisibility(layerId, false); } } @@ -193,7 +194,7 @@ final class LocationLayerController { void hide() { isHidden = true; - for (String layerId : layerMap) { + for (String layerId : layerSet) { setLayerVisibility(layerId, false); } } @@ -257,14 +258,14 @@ final class LocationLayerController { private void addLayerToMap(Layer layer, @NonNull String idBelowLayer) { style.addLayerBelow(layer, idBelowLayer); - layerMap.add(layer.getId()); + layerSet.add(layer.getId()); } private void removeLayers() { - for (String layerId : layerMap) { + for (String layerId : layerSet) { style.removeLayer(layerId); } - layerMap.clear(); + layerSet.clear(); } private void setBearingProperty(@NonNull String propertyId, float bearing) { @@ -351,7 +352,7 @@ final class LocationLayerController { } private void styleScaling(@NonNull LocationComponentOptions options) { - for (String layerId : layerMap) { + for (String layerId : layerSet) { Layer layer = style.getLayer(layerId); if (layer instanceof SymbolLayer) { layer.setProperties( diff --git a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.java b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.java index 10553700b3..6a44cf1f79 100644 --- a/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.java +++ b/platform/android/MapboxGLAndroidSDK/src/test/java/com/mapbox/mapboxsdk/location/LocationLayerControllerTest.java @@ -39,6 +39,7 @@ import static com.mapbox.mapboxsdk.location.MapboxAnimator.ANIMATOR_LAYER_ACCURA import static com.mapbox.mapboxsdk.location.MapboxAnimator.ANIMATOR_LAYER_COMPASS_BEARING; import static com.mapbox.mapboxsdk.location.MapboxAnimator.ANIMATOR_LAYER_GPS_BEARING; import static com.mapbox.mapboxsdk.location.MapboxAnimator.ANIMATOR_LAYER_LATLNG; +import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertNull; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; @@ -159,6 +160,24 @@ public class LocationLayerControllerTest { verify(style).addLayerBelow(accuracyLayer, BACKGROUND_LAYER); } + @Test + public void onInitialization_numberOfCachedLayerIdsIsConstant() { + OnRenderModeChangedListener internalRenderModeChangedListener = mock(OnRenderModeChangedListener.class); + LayerSourceProvider sourceProvider = buildLayerProvider(); + GeoJsonSource locationSource = mock(GeoJsonSource.class); + when(sourceProvider.generateSource(any(Feature.class))).thenReturn(locationSource); + LayerBitmapProvider bitmapProvider = mock(LayerBitmapProvider.class); + LocationComponentOptions options = mock(LocationComponentOptions.class); + + LocationLayerController controller = + new LocationLayerController(mapboxMap, mapboxMap.getStyle(), sourceProvider, buildFeatureProvider(options), + bitmapProvider, options, internalRenderModeChangedListener); + + controller.initializeComponents(mapboxMap.getStyle(), options); + + assertEquals(5, controller.layerSet.size()); + } + @Test public void applyStyle_styleShadowWithValidElevation() { OnRenderModeChangedListener internalRenderModeChangedListener = mock(OnRenderModeChangedListener.class); @@ -300,22 +319,6 @@ public class LocationLayerControllerTest { LayerSourceProvider sourceProvider = buildLayerProvider(); when(sourceProvider.generateSource(any(Feature.class))).thenReturn(mock(GeoJsonSource.class)); - Layer bearingLayer = mock(Layer.class); - when(bearingLayer.getId()).thenReturn(BEARING_LAYER); - when(sourceProvider.generateLayer(BEARING_LAYER)).thenReturn(bearingLayer); - Layer foregroundLayer = mock(Layer.class); - when(foregroundLayer.getId()).thenReturn(FOREGROUND_LAYER); - when(sourceProvider.generateLayer(FOREGROUND_LAYER)).thenReturn(foregroundLayer); - Layer backgroundLayer = mock(Layer.class); - when(backgroundLayer.getId()).thenReturn(BACKGROUND_LAYER); - when(sourceProvider.generateLayer(BACKGROUND_LAYER)).thenReturn(backgroundLayer); - Layer shadowLayer = mock(Layer.class); - when(shadowLayer.getId()).thenReturn(SHADOW_LAYER); - when(sourceProvider.generateLayer(SHADOW_LAYER)).thenReturn(shadowLayer); - Layer accuracyLayer = mock(Layer.class); - when(accuracyLayer.getId()).thenReturn(ACCURACY_LAYER); - when(sourceProvider.generateAccuracyLayer()).thenReturn(accuracyLayer); - LocationComponentOptions options = mock(LocationComponentOptions.class); LayerBitmapProvider bitmapProvider = mock(LayerBitmapProvider.class); Bitmap bitmap = mock(Bitmap.class); @@ -606,18 +609,23 @@ public class LocationLayerControllerTest { LayerSourceProvider layerSourceProvider = mock(LayerSourceProvider.class); Layer shadowLayer = mock(Layer.class); + when(shadowLayer.getId()).thenReturn(SHADOW_LAYER); when(layerSourceProvider.generateLayer(SHADOW_LAYER)).thenReturn(shadowLayer); Layer backgroundLayer = mock(Layer.class); + when(backgroundLayer.getId()).thenReturn(BACKGROUND_LAYER); when(layerSourceProvider.generateLayer(BACKGROUND_LAYER)).thenReturn(backgroundLayer); Layer foregroundLayer = mock(Layer.class); + when(foregroundLayer.getId()).thenReturn(FOREGROUND_LAYER); when(layerSourceProvider.generateLayer(FOREGROUND_LAYER)).thenReturn(foregroundLayer); Layer bearingLayer = mock(Layer.class); + when(bearingLayer.getId()).thenReturn(BEARING_LAYER); when(layerSourceProvider.generateLayer(BEARING_LAYER)).thenReturn(bearingLayer); Layer accuracyLayer = mock(Layer.class); + when(accuracyLayer.getId()).thenReturn(ACCURACY_LAYER); when(layerSourceProvider.generateAccuracyLayer()).thenReturn(accuracyLayer); return layerSourceProvider; } -- cgit v1.2.1 From c2fe532b9bbc9db9b2bbab109f0f47f7cc9584d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Mon, 18 Mar 2019 11:04:58 +0100 Subject: [android] bump telemetry version to 4.3.0 --- platform/android/gradle/dependencies.gradle | 2 +- platform/android/vendor/mapbox-events-android | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index 600901ca76..bc8184b5cd 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -8,7 +8,7 @@ ext { versions = [ mapboxServices : '4.3.0', - mapboxTelemetry : '4.2.0', + mapboxTelemetry : '4.3.0', mapboxGestures : '0.4.0', supportLib : '27.1.1', constraintLayout: '1.1.2', diff --git a/platform/android/vendor/mapbox-events-android b/platform/android/vendor/mapbox-events-android index 1636d1ae9d..5bdf0d9029 160000 --- a/platform/android/vendor/mapbox-events-android +++ b/platform/android/vendor/mapbox-events-android @@ -1 +1 @@ -Subproject commit 1636d1ae9d5b0f0dd2367c8f32f1af958640b14e +Subproject commit 5bdf0d90292fb46cd8b1f795763d281b5ac83e01 -- cgit v1.2.1 From 41b25e2aa205a54b916ba987c9c0ae600204ebfd Mon Sep 17 00:00:00 2001 From: Jordan Kiley Date: Mon, 18 Mar 2019 17:53:15 -0700 Subject: [build] Add sha to the coverage json (#14145) --- scripts/code-coverage.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/code-coverage.sh b/scripts/code-coverage.sh index d6866f61b8..c58501605d 100755 --- a/scripts/code-coverage.sh +++ b/scripts/code-coverage.sh @@ -17,12 +17,16 @@ if [[ ! $2 = "iOS" && ! $2 = "Android" ]]; then exit 1 fi +circle_sha="" +if [[ $CIRCLE_SHA1 ]]; then + circle_sha="$CIRCLE_SHA1" +fi # Create a formatted JSON file that contains the current coverage. -current_date=$(TZ=UTC date +"%Y-%m-%d") +current_date=$(TZ=UTC date +"%F-%T") file_name=$2_coverage.json cat < $file_name - {"code_coverage":$1,"platform":"$2","sdk":"Maps","scheme":"$3","created_at":"$current_date"} + {"code_coverage":$1,"platform":"$2","sdk":"Maps","scheme":"$3","created_at":"$current_date","sha":"$circle_sha"} EOF gzip -f $file_name -- cgit v1.2.1 From 40458177b7a03b32fd72ea7cdc685efc2349b6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 18 Mar 2019 17:21:42 -0700 Subject: [ios] Deleted unused NSData category --- platform/darwin/src/MGLOfflineStorage.mm | 1 - platform/darwin/src/NSData+MGLAdditions.h | 13 -------- platform/darwin/src/NSData+MGLAdditions.mm | 23 -------------- platform/ios/ios.xcodeproj/project.pbxproj | 16 ---------- platform/ios/sdk-files.json | 2 -- platform/ios/test/MGLNSDataAdditionsTests.m | 48 ----------------------------- 6 files changed, 103 deletions(-) delete mode 100644 platform/darwin/src/NSData+MGLAdditions.h delete mode 100644 platform/darwin/src/NSData+MGLAdditions.mm delete mode 100644 platform/ios/test/MGLNSDataAdditionsTests.m diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 4613b402fd..d1c5dadde8 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -10,7 +10,6 @@ #import "NSBundle+MGLAdditions.h" #import "NSValue+MGLAdditions.h" #import "NSDate+MGLAdditions.h" -#import "NSData+MGLAdditions.h" #import "MGLLoggingConfiguration_Private.h" #if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR diff --git a/platform/darwin/src/NSData+MGLAdditions.h b/platform/darwin/src/NSData+MGLAdditions.h deleted file mode 100644 index 38af7961b6..0000000000 --- a/platform/darwin/src/NSData+MGLAdditions.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface NSData (MGLAdditions) - -- (NSData *)mgl_compressedData; - -- (NSData *)mgl_decompressedData; - -@end - -NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/NSData+MGLAdditions.mm b/platform/darwin/src/NSData+MGLAdditions.mm deleted file mode 100644 index 97c3bb4a26..0000000000 --- a/platform/darwin/src/NSData+MGLAdditions.mm +++ /dev/null @@ -1,23 +0,0 @@ -#import "NSData+MGLAdditions.h" - -#include - -@implementation NSData (MGLAdditions) - -- (NSData *)mgl_compressedData -{ - std::string string(static_cast(self.bytes), self.length); - std::string compressed_string = mbgl::util::compress(string); - - return [NSData dataWithBytes:&compressed_string[0] length:compressed_string.length()]; -} - -- (NSData *)mgl_decompressedData -{ - std::string string(static_cast(self.bytes), self.length); - std::string decompressed_string = mbgl::util::decompress(string); - - return [NSData dataWithBytes:&decompressed_string[0] length:decompressed_string.length()]; -} - -@end diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index b24bcbe110..73f2e04167 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -98,9 +98,6 @@ 35136D4D1D4277FC00C20EFD /* MGLSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 35136D4A1D4277FC00C20EFD /* MGLSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; 35136D4E1D4277FC00C20EFD /* MGLSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D4B1D4277FC00C20EFD /* MGLSource.mm */; }; 35136D4F1D4277FC00C20EFD /* MGLSource.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35136D4B1D4277FC00C20EFD /* MGLSource.mm */; }; - 35305D481D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; - 35305D491D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */ = {isa = PBXBuildFile; fileRef = 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */; }; - 35305D4A1D22AA6A0007D005 /* NSData+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */; }; 3538AA1D1D542239008EC33D /* MGLForegroundStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3538AA1B1D542239008EC33D /* MGLForegroundStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3538AA1E1D542239008EC33D /* MGLForegroundStyleLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 3538AA1B1D542239008EC33D /* MGLForegroundStyleLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; 3538AA1F1D542239008EC33D /* MGLForegroundStyleLayer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3538AA1C1D542239008EC33D /* MGLForegroundStyleLayer.mm */; }; @@ -179,7 +176,6 @@ 35E0CFE71D3E501500188327 /* MGLStyle_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E0CFE51D3E501500188327 /* MGLStyle_Private.h */; }; 35E1A4D81D74336F007AA97F /* MGLValueEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E1A4D71D74336F007AA97F /* MGLValueEvaluator.h */; }; 35E1A4D91D74336F007AA97F /* MGLValueEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E1A4D71D74336F007AA97F /* MGLValueEvaluator.h */; }; - 35E208A71D24210F00EC9A46 /* MGLNSDataAdditionsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */; }; 35E79F201D41266300957B9E /* MGLStyleLayer_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */; }; 35E79F211D41266300957B9E /* MGLStyleLayer_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */; }; 3E6465D62065767A00685536 /* LimeGreenStyleLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E6465D42065767A00685536 /* LimeGreenStyleLayer.m */; }; @@ -451,7 +447,6 @@ 96E516F12000596800A02306 /* NSString+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848171CBAFA6200AB86E3 /* NSString+MGLAdditions.h */; }; 96E516F22000596D00A02306 /* NSException+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848141CBAFA6200AB86E3 /* NSException+MGLAdditions.h */; }; 96E516F32000597100A02306 /* NSDictionary+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */; }; - 96E516F42000597D00A02306 /* NSData+MGLAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */; }; 96E516F5200059B100A02306 /* MGLNetworkConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = DD0902A41DB18F1B00C5BDCE /* MGLNetworkConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 96E516F6200059EC00A02306 /* MGLRendererFrontend.h in Headers */ = {isa = PBXBuildFile; fileRef = 92F2C3EC1F0E3C3A00268EC0 /* MGLRendererFrontend.h */; }; 96E516F720005A2700A02306 /* MGLAnnotationContainerView.h in Headers */ = {isa = PBXBuildFile; fileRef = 40EDA1BD1CFE0D4A00D9EA68 /* MGLAnnotationContainerView.h */; }; @@ -914,8 +909,6 @@ 35136D441D42275100C20EFD /* MGLSymbolStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLSymbolStyleLayer.mm; sourceTree = ""; }; 35136D4A1D4277FC00C20EFD /* MGLSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLSource.h; sourceTree = ""; }; 35136D4B1D4277FC00C20EFD /* MGLSource.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLSource.mm; sourceTree = ""; }; - 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+MGLAdditions.h"; sourceTree = ""; }; - 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = "NSData+MGLAdditions.mm"; sourceTree = ""; }; 3538AA1B1D542239008EC33D /* MGLForegroundStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLForegroundStyleLayer.h; sourceTree = ""; }; 3538AA1C1D542239008EC33D /* MGLForegroundStyleLayer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLForegroundStyleLayer.mm; sourceTree = ""; }; 353933F11D3FB753003F57D7 /* MGLCircleStyleLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLCircleStyleLayer.h; sourceTree = ""; }; @@ -964,7 +957,6 @@ 35DE35531EB7CBA8004917C5 /* sv */ = {isa = PBXFileReference; lastKnownFileType = text.plist.stringsdict; name = sv; path = sv.lproj/Localizable.stringsdict; sourceTree = ""; }; 35E0CFE51D3E501500188327 /* MGLStyle_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyle_Private.h; sourceTree = ""; }; 35E1A4D71D74336F007AA97F /* MGLValueEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLValueEvaluator.h; sourceTree = ""; }; - 35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLNSDataAdditionsTests.m; sourceTree = ""; }; 35E79F1F1D41266300957B9E /* MGLStyleLayer_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLStyleLayer_Private.h; sourceTree = ""; }; 36F1153C1D46080700878E1A /* libmbgl-platform-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libmbgl-platform-ios.a"; path = "build/Debug-iphoneos/libmbgl-platform-ios.a"; sourceTree = ""; }; 3E6465D42065767A00685536 /* LimeGreenStyleLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = LimeGreenStyleLayer.m; path = ../../darwin/app/LimeGreenStyleLayer.m; sourceTree = ""; }; @@ -2041,7 +2033,6 @@ 96ED34DD22374C0900E9FCA9 /* MGLMapViewDirectionTests.mm */, 16376B481FFEED010000563E /* MGLMapViewLayoutTests.m */, 9658C154204761FC00D8A674 /* MGLMapViewScaleBarTests.m */, - 35E208A61D24210F00EC9A46 /* MGLNSDataAdditionsTests.m */, 1F95931C1E6DE2E900D5B294 /* MGLNSDateAdditionsTests.mm */, 96036A0520059BBA00510F3D /* MGLNSOrthographyAdditionsTests.m */, DAE7DEC11E245455007505A6 /* MGLNSStringAdditionsTests.m */, @@ -2318,8 +2309,6 @@ 3510FFE91D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm */, 3510FFF71D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.h */, 3510FFF81D6DCC4700F413B2 /* NSCompoundPredicate+MGLAdditions.mm */, - 35305D461D22AA450007D005 /* NSData+MGLAdditions.h */, - 35305D471D22AA450007D005 /* NSData+MGLAdditions.mm */, 353AFA121D65AB17005A69F4 /* NSDate+MGLAdditions.h */, 353AFA131D65AB17005A69F4 /* NSDate+MGLAdditions.mm */, 408AA8551DAEDA0800022900 /* NSDictionary+MGLAdditions.h */, @@ -2530,7 +2519,6 @@ DA72620B1DEEE3480043BB89 /* MGLOpenGLStyleLayer.h in Headers */, 404C26E71D89C55D000AA13D /* MGLTileSource_Private.h in Headers */, DA88485C1CBAFB9800AB86E3 /* MGLFaux3DUserLocationAnnotationView.h in Headers */, - 35305D4A1D22AA6A0007D005 /* NSData+MGLAdditions.h in Headers */, 359F57461D2FDDA6005217F1 /* MGLUserLocationAnnotationView_Private.h in Headers */, 404C26E21D89B877000AA13D /* MGLTileSource.h in Headers */, DA8847FD1CBAFA5100AB86E3 /* MGLTilePyramidOfflineRegion.h in Headers */, @@ -2724,7 +2712,6 @@ 74CB5EB2219B252C00102936 /* MGLStyleLayerManager.h in Headers */, 9221BAB020699F8A0054BDF4 /* MGLTilePyramidOfflineRegion_Private.h in Headers */, 96E516F5200059B100A02306 /* MGLNetworkConfiguration.h in Headers */, - 96E516F42000597D00A02306 /* NSData+MGLAdditions.h in Headers */, 96E516DD200054F200A02306 /* MGLPolygon_Private.h in Headers */, 353933F91D3FB79F003F57D7 /* MGLLineStyleLayer.h in Headers */, 96E516EB2000560B00A02306 /* MGLUserLocation_Private.h in Headers */, @@ -3177,7 +3164,6 @@ 357579831D502AE6000B822E /* MGLRasterStyleLayerTests.mm in Sources */, DAF25720201902BC00367EF5 /* MGLHillshadeStyleLayerTests.mm in Sources */, 353D23961D0B0DFE002BE09D /* MGLAnnotationViewTests.m in Sources */, - 35E208A71D24210F00EC9A46 /* MGLNSDataAdditionsTests.m in Sources */, DA0CD5901CF56F6A00A5F5A5 /* MGLFeatureTests.mm in Sources */, 556660D81E1D085500E2C41B /* MGLVersionNumber.m in Sources */, 4031ACFF1E9FD29F00A3EA26 /* MGLSDKTestHelpers.swift in Sources */, @@ -3272,7 +3258,6 @@ DA35A2A11CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, 92FC0AEE207CEE16007B6B54 /* MGLShapeOfflineRegion.mm in Sources */, ACD0245E2187EACB00D8C8A7 /* MMEMetrics.m in Sources */, - 35305D481D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */, 40834BF61FE05E1800C1BD0D /* MMEUIApplicationWrapper.m in Sources */, DA8848291CBAFA6200AB86E3 /* MGLStyle.mm in Sources */, 357FE2DF1E02D2B20068B753 /* NSCoder+MGLAdditions.mm in Sources */, @@ -3405,7 +3390,6 @@ DAA4E4281CBB730400178DFB /* MGLTypes.m in Sources */, DA35A2A21CC9E95F00E826B2 /* MGLCoordinateFormatter.m in Sources */, 40834C511FE05F7600C1BD0D /* reporting_utils.m in Sources */, - 35305D491D22AA680007D005 /* NSData+MGLAdditions.mm in Sources */, 357FE2E01E02D2B20068B753 /* NSCoder+MGLAdditions.mm in Sources */, 92FC0AEF207CEE16007B6B54 /* MGLShapeOfflineRegion.mm in Sources */, DAA4E42D1CBB730400178DFB /* MGLAnnotationImage.m in Sources */, diff --git a/platform/ios/sdk-files.json b/platform/ios/sdk-files.json index 7dbfee1a2d..af295c4266 100644 --- a/platform/ios/sdk-files.json +++ b/platform/ios/sdk-files.json @@ -84,7 +84,6 @@ "platform/darwin/src/MGLCoordinateFormatter.m", "platform/darwin/src/MGLShapeOfflineRegion.mm", "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEMetrics.m", - "platform/darwin/src/NSData+MGLAdditions.mm", "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEUIApplicationWrapper.m", "platform/darwin/src/MGLStyle.mm", "platform/darwin/src/NSCoder+MGLAdditions.mm", @@ -279,7 +278,6 @@ "MGLOpenGLStyleLayer_Private.h": "platform/darwin/src/MGLOpenGLStyleLayer_Private.h", "MGLTileSource_Private.h": "platform/darwin/src/MGLTileSource_Private.h", "MGLFaux3DUserLocationAnnotationView.h": "platform/ios/src/MGLFaux3DUserLocationAnnotationView.h", - "NSData+MGLAdditions.h": "platform/darwin/src/NSData+MGLAdditions.h", "MGLUserLocationAnnotationView_Private.h": "platform/ios/src/MGLUserLocationAnnotationView_Private.h", "NSProcessInfo+MGLAdditions.h": "platform/darwin/src/NSProcessInfo+MGLAdditions.h", "MGLRasterTileSource_Private.h": "platform/darwin/src/MGLRasterTileSource_Private.h", diff --git a/platform/ios/test/MGLNSDataAdditionsTests.m b/platform/ios/test/MGLNSDataAdditionsTests.m deleted file mode 100644 index 8d145be4a0..0000000000 --- a/platform/ios/test/MGLNSDataAdditionsTests.m +++ /dev/null @@ -1,48 +0,0 @@ -#import - -#import "../../darwin/src/NSData+MGLAdditions.h" - -@interface MGLNSDataAdditionsTests : XCTestCase -@end - -@implementation MGLNSDataAdditionsTests - -- (void)testCompressDecompress -{ - NSArray *originalArray = [self mockDataWithCount:180]; - - NSData *originalData = [NSJSONSerialization dataWithJSONObject:originalArray options:0 error:nil]; - - NSData *compressedData = [originalData mgl_compressedData]; - NSData *decompressedData = [compressedData mgl_decompressedData]; - - NSArray *decompressedArray = [NSJSONSerialization JSONObjectWithData:decompressedData options:0 error:nil]; - - XCTAssertTrue([originalArray isEqualToArray:decompressedArray], @"originalArray and decompressedArray should be equal"); -} - -- (NSArray *)mockDataWithCount:(NSUInteger)count -{ - NSMutableArray *array = [NSMutableArray array]; - - for (NSUInteger i=0;i Date: Tue, 19 Mar 2019 13:32:06 +0100 Subject: [android] unit and instrumentation tests code coverage report --- Makefile | 11 ++++++++ circle.yml | 11 +++++++- platform/android/MapboxGLAndroidSDK/build.gradle | 11 ++++---- platform/android/build.gradle | 1 + platform/android/gradle/dependencies.gradle | 4 ++- platform/android/gradle/jacoco-report.gradle | 33 ++++++++++++++++++++++++ platform/android/scripts/parse-jacoco-report.py | 31 ++++++++++++++++++++++ 7 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 platform/android/gradle/jacoco-report.gradle create mode 100755 platform/android/scripts/parse-jacoco-report.py diff --git a/Makefile b/Makefile index ecc4273cff..a6aa414068 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ export BUILDTYPE ?= Debug +export IS_LOCAL_DEVELOPMENT ?= true export WITH_CXX11ABI ?= $(shell scripts/check-cxx11abi.sh) ifeq ($(BUILDTYPE), Release) @@ -691,6 +692,16 @@ run-android-unit-test: platform/android/gradle/configuration.gradle run-android-unit-test-%: platform/android/gradle/configuration.gradle cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:testDebugUnitTest --info --tests "$*" +# Run unit test and build a coverage report from .exec file generated by unit tests and .ec file generated by instrumentation tests +.PHONY: android-create-jacoco-report +android-create-jacoco-report: platform/android/gradle/configuration.gradle + cd platform/android && $(MBGL_ANDROID_GRADLE) -Pmapbox.abis=none :MapboxGLAndroidSDK:jacocoTestReport + +# Parse merged jacoco report and send it to S3 +.PHONY: android-parse-and-send-jacoco-report +android-parse-and-send-jacoco-report: + python platform/android/scripts/parse-jacoco-report.py + # Builds a release package of the Android SDK .PHONY: apackage apackage: platform/android/gradle/configuration.gradle diff --git a/circle.yml b/circle.yml index 6883cd6f5a..87de7109ac 100644 --- a/circle.yml +++ b/circle.yml @@ -571,7 +571,16 @@ jobs: gcloud firebase test android run --type instrumentation \ --app platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug/MapboxGLAndroidSDKTestApp-debug.apk \ --test platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/androidTest/debug/MapboxGLAndroidSDKTestApp-debug-androidTest.apk \ - --device-ids << parameters.firebase_device_id >> --os-version-ids << parameters.firebase_device_os >> --locales en --orientations portrait --timeout 20m + --device-ids << parameters.firebase_device_id >> --os-version-ids << parameters.firebase_device_os >> --locales en --orientations portrait --timeout 20m \ + --environment-variables coverage=true,coverageFile="/sdcard/coverage.ec" --directories-to-pull /sdcard --results-dir mapbox-android-sdk-${CIRCLE_BUILD_NUM} + coverageFile=`gsutil ls gs://test-lab-186672a0qp5bq-ycr70axads3nc/mapbox-android-sdk-${CIRCLE_BUILD_NUM}/**/*.ec | tail -1` + gsutil cp $coverageFile $PWD/platform/android/MapboxGLAndroidSDK/build/jacoco | true + fi + - run: + name: Parse and send Jacoco reports + command: | + if [[ $CIRCLE_BRANCH == master ]]; then + make android-create-jacoco-report && make android-parse-and-send-jacoco-report fi - store_artifacts: path: platform/android/MapboxGLAndroidSDKTestApp/build/outputs/apk/debug diff --git a/platform/android/MapboxGLAndroidSDK/build.gradle b/platform/android/MapboxGLAndroidSDK/build.gradle index 89937448e9..927317996b 100644 --- a/platform/android/MapboxGLAndroidSDK/build.gradle +++ b/platform/android/MapboxGLAndroidSDK/build.gradle @@ -23,10 +23,6 @@ dependencies { android { compileSdkVersion androidVersions.compileSdkVersion - // Roboelectric 4.0 required config - // http://robolectric.org/migrating/#migrating-to-40 - testOptions.unitTests.includeAndroidResources = true - defaultConfig { minSdkVersion androidVersions.minSdkVersion targetSdkVersion androidVersions.targetSdkVersion @@ -134,12 +130,16 @@ android { testOptions { unitTests { returnDefaultValues true + + // Roboelectric 4.0 required config + // http://robolectric.org/migrating/#migrating-to-40 includeAndroidResources = true } } buildTypes { debug { + testCoverageEnabled true jniDebuggable true } } @@ -169,4 +169,5 @@ apply from: "${rootDir}/gradle/gradle-checkstyle.gradle" apply from: "${rootDir}/gradle/gradle-dependencies-graph.gradle" apply from: "${rootDir}/gradle/gradle-update-vendor-modules.gradle" apply from: "${rootDir}/gradle/android-nitpick.gradle" -apply from: "${rootDir}/gradle/gradle-bintray.gradle" \ No newline at end of file +apply from: "${rootDir}/gradle/gradle-bintray.gradle" +apply from: "${rootDir}/gradle/jacoco-report.gradle" \ No newline at end of file diff --git a/platform/android/build.gradle b/platform/android/build.gradle index 5334c93ce9..97f3037afb 100644 --- a/platform/android/build.gradle +++ b/platform/android/build.gradle @@ -12,6 +12,7 @@ buildscript { classpath dependenciesList.bintrayPlugin classpath dependenciesList.artifactoryPlugin classpath dependenciesList.androidPublishPlugin + classpath dependenciesList.jacocoPlugin } } diff --git a/platform/android/gradle/dependencies.gradle b/platform/android/gradle/dependencies.gradle index bc8184b5cd..1d17e7f83d 100644 --- a/platform/android/gradle/dependencies.gradle +++ b/platform/android/gradle/dependencies.gradle @@ -29,7 +29,8 @@ ext { androidPublish : '3.6.2', lint : '26.1.4', gms : '16.0.0', - reLinker : '1.3.1' + reLinker : '1.3.1', + jacoco : '0.8.3' ] dependenciesList = [ @@ -72,6 +73,7 @@ ext { bintrayPlugin : "com.jfrog.bintray.gradle:gradle-bintray-plugin:${versions.bintray}", artifactoryPlugin : "org.jfrog.buildinfo:build-info-extractor-gradle:${versions.artifactory}", androidPublishPlugin : "digital.wup:android-maven-publish:${versions.androidPublish}", + jacocoPlugin : "org.jacoco:org.jacoco.core:${versions.jacoco}", lint : "com.android.tools.lint:lint:${versions.lint}", lintApi : "com.android.tools.lint:lint-api:${versions.lint}", diff --git a/platform/android/gradle/jacoco-report.gradle b/platform/android/gradle/jacoco-report.gradle new file mode 100644 index 0000000000..e50facb683 --- /dev/null +++ b/platform/android/gradle/jacoco-report.gradle @@ -0,0 +1,33 @@ +apply plugin: 'jacoco' +apply from: "${rootDir}/gradle/dependencies.gradle" + +jacoco { + toolVersion = versions.jacoco +} + +task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { + group = "Reporting" + description = "Combine code coverage to unified report." + + reports { + xml.enabled = true + html.enabled = true + } + + def fileExcludes = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*'] + def debugTree = fileTree(dir: "${project.buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes", excludes: fileExcludes) + def mainSrc = "${project.projectDir}/src/main/java" + println(mainSrc) + def ecSrc = fileTree(dir: "$project.buildDir", include: "**/*.ec") + def execSrc = fileTree(dir: "$project.buildDir", include: "**/*.exec") + + doFirst { + def files = files([ecSrc, execSrc]).files + println "Creating Jacoco Report for ${files.size()} coverage files" + files.each { file -> println file } + } + + sourceDirectories = files([mainSrc]) + classDirectories = files([debugTree]) + executionData = files([ecSrc, execSrc]) +} \ No newline at end of file diff --git a/platform/android/scripts/parse-jacoco-report.py b/platform/android/scripts/parse-jacoco-report.py new file mode 100755 index 0000000000..4d06fda6cc --- /dev/null +++ b/platform/android/scripts/parse-jacoco-report.py @@ -0,0 +1,31 @@ +#!/usr/bin/python + +import os +import re +from io import open + +reportPath = os.getcwd() + "/platform/android/MapboxGLAndroidSDK/build/reports/jacoco/jacocoTestReport/jacocoTestReport.xml" +with open(reportPath, 'r', encoding='utf-8') as jacocoReport: + line = jacocoReport.readline().strip() + + # find the last INSTRUCTION coverage report which is a sum of all separate ones + instructionIndex = line.rfind('type="INSTRUCTION"') + startIndex = line.find('missed', instructionIndex) + endIndex = line.find('/>', startIndex) + + # find the missed and covered lines counts + numbers = re.match(r'missed="(\d+)" covered="(\d+)"', line[startIndex:endIndex]) + missed = int(numbers.group(1)) + covered = int(numbers.group(2)) + + # calculate the code coverage percentage + percentage = round(covered * 100.0 / (missed + covered), 2) + print("Android tests code coverage: %s%%" % (str(percentage))) + + # invoke the script that send the data to s3 + testEnvironment = "LOCAL" + if os.environ.get('IS_LOCAL_DEVELOPMENT').lower()=='false': + testEnvironment = "CI" + + cmd = os.getcwd() + ("/scripts/code-coverage.sh %.2f %s %s" % (percentage, "Android", testEnvironment)) + os.system(cmd) -- cgit v1.2.1 From eaddcf8bed7394bea53fb8f3a6347a0d5a6dfbd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Tue, 19 Mar 2019 13:52:22 +0100 Subject: [android] expose LocationComponent's layer IDs --- .../location/LocationComponentConstants.java | 32 ++++++++++++++++++---- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentConstants.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentConstants.java index 093c91e799..c0173cb8e8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentConstants.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/location/LocationComponentConstants.java @@ -1,7 +1,7 @@ package com.mapbox.mapboxsdk.location; /** - * Contains all the constants being used for the Location layer. + * Contains all the constants being used for the {@link LocationComponent}. */ final class LocationComponentConstants { @@ -49,11 +49,31 @@ final class LocationComponentConstants { static final String PROPERTY_BEARING_ICON = "mapbox-property-shadow-icon"; // Layers - static final String SHADOW_LAYER = "mapbox-location-shadow"; - static final String FOREGROUND_LAYER = "mapbox-location-layer"; - static final String BACKGROUND_LAYER = "mapbox-location-stroke-layer"; - static final String ACCURACY_LAYER = "mapbox-location-accuracy-layer"; - static final String BEARING_LAYER = "mapbox-location-bearing-layer"; + + /** + * Layer ID of the location shadow. + */ + public static final String SHADOW_LAYER = "mapbox-location-shadow-layer"; + + /** + * Layer ID of the location foreground icon. + */ + public static final String FOREGROUND_LAYER = "mapbox-location-foreground-layer"; + + /** + * Layer ID of the location background icon. + */ + public static final String BACKGROUND_LAYER = "mapbox-location-background-layer"; + + /** + * Layer ID of the location accuracy. + */ + public static final String ACCURACY_LAYER = "mapbox-location-accuracy-layer"; + + /** + * Layer ID of the location bearing icon. + */ + public static final String BEARING_LAYER = "mapbox-location-bearing-layer"; // Icons static final String FOREGROUND_ICON = "mapbox-location-icon"; -- cgit v1.2.1 From 10e1e63aee95f579f951e3c2001640a268d3d95c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Tue, 19 Mar 2019 18:02:48 +0100 Subject: [android] update licenses --- platform/android/LICENSE.md | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/platform/android/LICENSE.md b/platform/android/LICENSE.md index f69b393541..fa287094f5 100644 --- a/platform/android/LICENSE.md +++ b/platform/android/LICENSE.md @@ -18,18 +18,6 @@ License: [The Apache Software License, Version 2.0](http://www.apache.org/licens =========================================================================== -Mapbox GL uses portions of the Android Lifecycle Extensions. -URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html) -License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - -=========================================================================== - -Mapbox GL uses portions of the Android Lifecycle LiveData. -URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html) -License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) - -=========================================================================== - Mapbox GL uses portions of the Android Lifecycle LiveData Core. URL: [https://developer.android.com/topic/libraries/architecture/index.html](https://developer.android.com/topic/libraries/architecture/index.html) License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) @@ -157,6 +145,12 @@ License: [Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) =========================================================================== +Mapbox GL uses portions of the ReLinker. +URL: [https://github.com/KeepSafe/ReLinker](https://github.com/KeepSafe/ReLinker) +License: [The Apache Software License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.txt) + +=========================================================================== + Mapbox GL uses portions of the Retrofit. License: [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt) -- cgit v1.2.1 From 174c8fa7e4927ebf28a3d0e07c995d3e3d69de76 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Tue, 19 Mar 2019 14:53:35 -0700 Subject: [ios, macos] Add text-color support to format expressions. (#14146) Added the possibility of overriding paint properties inside the format expression. Added an example of how to create an MGLAttributedExpression object and documented the attributes keys and value types. Fixed a bug that ignored the font names. --- .../darwin/docs/guides/For Style Authors.md.ejs | 11 ++++++ .../docs/guides/Predicates and Expressions.md | 8 +++++ platform/darwin/src/MGLAttributedExpression.h | 41 ++++++++++++++++++++-- platform/darwin/src/MGLAttributedExpression.m | 13 +++++-- platform/darwin/src/NSExpression+MGLAdditions.mm | 27 ++++++++++++-- .../darwin/test/MGLDocumentationExampleTests.swift | 18 ++++++++++ platform/darwin/test/MGLExpressionTests.mm | 37 +++++++++++++++++++ platform/ios/docs/guides/For Style Authors.md | 11 ++++++ platform/ios/src/UIColor+MGLAdditions.h | 1 + platform/macos/docs/guides/For Style Authors.md | 11 ++++++ platform/macos/src/NSColor+MGLAdditions.h | 1 + platform/macos/src/NSColor+MGLAdditions.mm | 6 ++-- 12 files changed, 176 insertions(+), 9 deletions(-) diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs index cf0f79f419..cff6e2f41c 100644 --- a/platform/darwin/docs/guides/For Style Authors.md.ejs +++ b/platform/darwin/docs/guides/For Style Authors.md.ejs @@ -431,5 +431,16 @@ In style JSON | In the format string `["any", f0, …, fn]` | `p0 OR … OR pn` `["none", f0, …, fn]` | `NOT (p0 OR … OR pn)` +## Specifying the text format + +The following format attributes are defined as `NSString` constans that you +can use to update the formatting of `MGLSymbolStyleLayer.text` property. + +In style JSON | In Objective-C | In Swift +--------------|-----------------------|--------- +`text-font` | `MGLFontNamesAttribute` | `.fontNamesAttribute` +`font-scale` | `MGLFontSizeAttribute` | `.fontSizeAttribute` +`text-color` | `MGLFontColorAttribute` | `.fontColorAttribute` + See the “[Predicates and Expressions](predicates-and-expressions.html)” guide for a full description of the supported operators and operand types. diff --git a/platform/darwin/docs/guides/Predicates and Expressions.md b/platform/darwin/docs/guides/Predicates and Expressions.md index 5f5d9a22a8..51617c8508 100644 --- a/platform/darwin/docs/guides/Predicates and Expressions.md +++ b/platform/darwin/docs/guides/Predicates and Expressions.md @@ -546,6 +546,14 @@ operator in the Mapbox Style Specification. Concatenates and returns the array of `MGLAttributedExpression` objects, for use with the `MGLSymbolStyleLayer.text` property. +`MGLAttributedExpression.attributes` valid attributes. + + Key | Value Type + --- | --- + `MGLFontNamesAttribute` | `NSArray*` + `MGLFontSizeAttribute` | `NSNumber` + `MGLFontColorAttribute` | `UIColor` or `NSColor` on macos + This function corresponds to the [`format`](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-format) operator in the Mapbox Style Specification. diff --git a/platform/darwin/src/MGLAttributedExpression.h b/platform/darwin/src/MGLAttributedExpression.h index aa5d51c66e..32f1a96dae 100644 --- a/platform/darwin/src/MGLAttributedExpression.h +++ b/platform/darwin/src/MGLAttributedExpression.h @@ -6,10 +6,23 @@ typedef NSString * MGLAttributedExpressionKey NS_EXTENSIBLE_STRING_ENUM; FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontNamesAttribute; FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontSizeAttribute; +FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontColorAttribute; /** An `MGLAttributedExpression` object associates text formatting attibutes (such as font size or font names) to an `NSExpression`. + + ### Example + ```swift + let redColor = UIColor.red + let expression = NSExpression(forConstantValue: "Foo") + let attributes: Dictionary = [.fontNamesAttribute : ["DIN Offc Pro Italic", + "Arial Unicode MS Regular"], + .fontSizeAttribute: 1.2, + .fontColorAttribute: redColor] + let attributedExpression = MGLAttributedExpression(expression, attributes:attributes) + ``` + */ MGL_EXPORT @interface MGLAttributedExpression : NSObject @@ -19,10 +32,29 @@ MGL_EXPORT */ @property (strong, nonatomic) NSExpression *expression; +#if TARGET_OS_IPHONE /** - The formatting attributes. + The formatting attributes dictionary. + Key | Value Type + --- | --- + `MGLFontNamesAttribute` | `NSArray*` + `MGLFontSizeAttribute` | `NSNumber` + `MGLFontColorAttribute` | `UIColor` + + */ +@property (strong, nonatomic, readonly) NSDictionary *attributes; +#else +/** + The formatting attributes dictionary. + Key | Value Type + --- | --- + `MGLFontNamesAttribute` | `NSArray*` + `MGLFontSizeAttribute` | `NSNumber` + `MGLFontColorAttribute` | `NSColor` */ @property (strong, nonatomic, readonly) NSDictionary *attributes; +#endif + /** Returns an `MGLAttributedExpression` object initialized with an expression and no attribute information. @@ -32,13 +64,18 @@ MGL_EXPORT /** Returns an `MGLAttributedExpression` object initialized with an expression and text format attributes. */ -- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nullable NSDictionary *)attrs; +- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs; /** Creates an `MGLAttributedExpression` object initialized with an expression and the format attributes for font names and font size. */ + (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray *)fontNames fontSize:(nullable NSNumber *)fontSize; +/** + Creates an `MGLAttributedExpression` object initialized with an expression and the format attributes dictionary. + */ ++ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs; + @end NS_ASSUME_NONNULL_END diff --git a/platform/darwin/src/MGLAttributedExpression.m b/platform/darwin/src/MGLAttributedExpression.m index 715f74e42f..000701f7cf 100644 --- a/platform/darwin/src/MGLAttributedExpression.m +++ b/platform/darwin/src/MGLAttributedExpression.m @@ -3,11 +3,12 @@ const MGLAttributedExpressionKey MGLFontNamesAttribute = @"text-font"; const MGLAttributedExpressionKey MGLFontSizeAttribute = @"font-scale"; +const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color"; @implementation MGLAttributedExpression - (instancetype)initWithExpression:(NSExpression *)expression { - self = [self initWithExpression:expression attributes:nil]; + self = [self initWithExpression:expression attributes:@{}]; return self; } @@ -28,7 +29,15 @@ const MGLAttributedExpressionKey MGLFontSizeAttribute = @"font-scale"; return attributedExpression; } -- (instancetype)initWithExpression:(NSExpression *)expression attributes:(NSDictionary *)attrs { ++ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs { + MGLAttributedExpression *attributedExpression; + + attributedExpression = [[self alloc] initWithExpression:expression attributes:attrs]; + + return attributedExpression; +} + +- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs { if (self = [super init]) { MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class])); diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index c4e2908888..f0f1d62ef7 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -1,3 +1,4 @@ +#import "MGLFoundation_Private.h" #import "NSExpression+MGLPrivateAdditions.h" #import "MGLTypes.h" @@ -878,9 +879,23 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { NSExpression *expression = [NSExpression expressionWithMGLJSONObject:argumentObjects[index]]; NSMutableDictionary *attrs = [NSMutableDictionary dictionary]; if ((index + 1) < argumentObjects.count) { - attrs = argumentObjects[index + 1]; + attrs = [NSMutableDictionary dictionaryWithDictionary:argumentObjects[index + 1]]; } + if (attrs.count) { + if (NSArray *fontNames = MGL_OBJC_DYNAMIC_CAST(attrs[MGLFontNamesAttribute], NSArray)) { + attrs[MGLFontNamesAttribute] = fontNames[1]; + } + if (NSArray *colorArray = MGL_OBJC_DYNAMIC_CAST(attrs[MGLFontColorAttribute], NSArray)) { + if ([colorArray[0] isEqualToString:@"rgb"] || [colorArray[0] isEqualToString:@"rgba"]) { + NSArray *colorArguments = [colorArray subarrayWithRange:NSMakeRange(1, colorArray.count - 1)]; + NSArray *subexpressions = MGLSubexpressionsWithJSONObjects(colorArguments); + MGLColor *color = [NSExpression mgl_colorWithRGBComponents:subexpressions]; + + attrs[MGLFontColorAttribute] = color; + } + } + } MGLAttributedExpression *attributedExpression = [[MGLAttributedExpression alloc] initWithExpression:expression attributes:attrs]; [attributedExpressions addObject:[NSExpression expressionForConstantValue:attributedExpression]]; @@ -1008,7 +1023,15 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { [attributes addObject:jsonObject]; } if (attributedExpression.attributes) { - [attributes addObject:attributedExpression.attributes]; + NSMutableDictionary *attributedDictionary = [NSMutableDictionary dictionaryWithDictionary:attributedExpression.attributes]; + if (attributedDictionary[MGLFontNamesAttribute]) { + attributedDictionary[MGLFontNamesAttribute] = @[@"literal", attributedDictionary[MGLFontNamesAttribute]]; + } + if (attributedDictionary[MGLFontColorAttribute] && [attributedDictionary[MGLFontColorAttribute] isKindOfClass:[MGLColor class]]) { + MGLColor *color = attributedDictionary[MGLFontColorAttribute]; + attributedDictionary[MGLFontColorAttribute] = color.mgl_jsonExpressionObject; + } + [attributes addObject:attributedDictionary]; } else { [attributes addObject:@{}]; } diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 91fb02dfd2..45efe4c591 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -542,6 +542,24 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { } } + func testMGLAttributedExpression() { + //#-example-code + #if os(macOS) + let redColor = NSColor.red + #else + let redColor = UIColor.red + #endif + let expression = NSExpression(forConstantValue: "Foo") + let attributes: Dictionary = [.fontNamesAttribute : ["DIN Offc Pro Italic", + "Arial Unicode MS Regular"], + .fontSizeAttribute: 1.2, + .fontColorAttribute: redColor] + let attributedExpression = MGLAttributedExpression(expression, attributes:attributes) + //#-end-example-code + + XCTAssertNotNil(attributedExpression) + } + // For testMGLMapView(). func myCustomFunction() {} } diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index 8b8a79f184..8e99ed596e 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -1049,6 +1049,43 @@ using namespace std::string_literals; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } + { + MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"] + attributes:@{ MGLFontSizeAttribute: @(1.2), + MGLFontColorAttribute: @"yellow"}] ; + NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; + + NSExpression *compatibilityExpression = [NSExpression expressionForFunction:@"mgl_attributed:" arguments:@[MGLConstantExpression(attribute1)]]; + NSArray *jsonExpression = @[ @"format", @"foo", @{ @"font-scale": @1.2, @"text-color": @"yellow" } ]; + XCTAssertEqualObjects(compatibilityExpression.mgl_jsonExpressionObject, expression.mgl_jsonExpressionObject); + XCTAssertEqualObjects(compatibilityExpression, expression); + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); + } + { + MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"] + attributes:@{ MGLFontSizeAttribute: @(1.2), + MGLFontColorAttribute: @"yellow", + MGLFontNamesAttribute: @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ] + }] ; + NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; + + NSArray *jsonExpression = @[ @"format", @"foo", @{ @"font-scale": @1.2, @"text-color": @"yellow" , @"text-font" : @[ @"literal", @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ]]} ]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); + } + { + MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"] + attributes:@{ MGLFontSizeAttribute: @(1.2), + MGLFontColorAttribute: [MGLColor redColor], + MGLFontNamesAttribute: @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ] + }] ; + NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; + + NSArray *jsonExpression = @[ @"format", @"foo", @{ @"font-scale": @1.2, @"text-color": @[@"rgb", @255, @0, @0] , @"text-font" : @[ @"literal", @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ]]} ]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); + } { MGLAttributedExpression *attribute1 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"foo"] fontNames:nil diff --git a/platform/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md index 73394ff6ed..44d5e47262 100644 --- a/platform/ios/docs/guides/For Style Authors.md +++ b/platform/ios/docs/guides/For Style Authors.md @@ -418,5 +418,16 @@ In style JSON | In the format string `["any", f0, …, fn]` | `p0 OR … OR pn` `["none", f0, …, fn]` | `NOT (p0 OR … OR pn)` +## Specifying the text format + +The following format attributes are defined as `NSString` constans that you +can use to update the formatting of `MGLSymbolStyleLayer.text` property. + +In style JSON | In Objective-C | In Swift +--------------|-----------------------|--------- +`text-font` | `MGLFontNamesAttribute` | `.fontNamesAttribute` +`font-scale` | `MGLFontSizeAttribute` | `.fontSizeAttribute` +`text-color` | `MGLFontColorAttribute` | `.fontColorAttribute` + See the “[Predicates and Expressions](predicates-and-expressions.html)” guide for a full description of the supported operators and operand types. diff --git a/platform/ios/src/UIColor+MGLAdditions.h b/platform/ios/src/UIColor+MGLAdditions.h index 60cfe1c58b..19702fa105 100644 --- a/platform/ios/src/UIColor+MGLAdditions.h +++ b/platform/ios/src/UIColor+MGLAdditions.h @@ -17,5 +17,6 @@ + (NSExpression *)mgl_expressionForRGBComponents:(NSArray *)components; + (NSExpression *)mgl_expressionForRGBAComponents:(NSArray *)components; ++ (UIColor *)mgl_colorWithRGBComponents:(NSArray *)components; @end diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md index 038ddf1f93..220ce3d50e 100644 --- a/platform/macos/docs/guides/For Style Authors.md +++ b/platform/macos/docs/guides/For Style Authors.md @@ -411,5 +411,16 @@ In style JSON | In the format string `["any", f0, …, fn]` | `p0 OR … OR pn` `["none", f0, …, fn]` | `NOT (p0 OR … OR pn)` +## Specifying the text format + +The following format attributes are defined as `NSString` constans that you +can use to update the formatting of `MGLSymbolStyleLayer.text` property. + +In style JSON | In Objective-C | In Swift +--------------|-----------------------|--------- +`text-font` | `MGLFontNamesAttribute` | `.fontNamesAttribute` +`font-scale` | `MGLFontSizeAttribute` | `.fontSizeAttribute` +`text-color` | `MGLFontColorAttribute` | `.fontColorAttribute` + See the “[Predicates and Expressions](predicates-and-expressions.html)” guide for a full description of the supported operators and operand types. diff --git a/platform/macos/src/NSColor+MGLAdditions.h b/platform/macos/src/NSColor+MGLAdditions.h index 21c939fec6..a3c5aba63f 100644 --- a/platform/macos/src/NSColor+MGLAdditions.h +++ b/platform/macos/src/NSColor+MGLAdditions.h @@ -23,5 +23,6 @@ + (NSExpression *)mgl_expressionForRGBComponents:(NSArray *)components; + (NSExpression *)mgl_expressionForRGBAComponents:(NSArray *)components; ++ (NSColor *)mgl_colorWithRGBComponents:(NSArray *)componentExpressions; @end diff --git a/platform/macos/src/NSColor+MGLAdditions.mm b/platform/macos/src/NSColor+MGLAdditions.mm index c73c1a41b7..ea7d99f66d 100644 --- a/platform/macos/src/NSColor+MGLAdditions.mm +++ b/platform/macos/src/NSColor+MGLAdditions.mm @@ -37,7 +37,7 @@ @implementation NSExpression (MGLColorAdditions) + (NSExpression *)mgl_expressionForRGBComponents:(NSArray *)components { - if (NSColor *color = [self mgl_colorWithComponentExpressions:components]) { + if (NSColor *color = [self mgl_colorWithRGBComponents:components]) { return [NSExpression expressionForConstantValue:color]; } @@ -49,7 +49,7 @@ } + (NSExpression *)mgl_expressionForRGBAComponents:(NSArray *)components { - if (NSColor *color = [self mgl_colorWithComponentExpressions:components]) { + if (NSColor *color = [self mgl_colorWithRGBComponents:components]) { return [NSExpression expressionForConstantValue:color]; } @@ -62,7 +62,7 @@ /** Returns a color object corresponding to the given component expressions. */ -+ (NSColor *)mgl_colorWithComponentExpressions:(NSArray *)componentExpressions { ++ (NSColor *)mgl_colorWithRGBComponents:(NSArray *)componentExpressions { // Map the component expressions to constant components. If any component is // a non-constant expression, the components cannot be converted into a // constant color value. -- cgit v1.2.1 From 11cacb3f8c67edb5962c8785900095846a2a11bf Mon Sep 17 00:00:00 2001 From: tobrun Date: Tue, 19 Mar 2019 15:34:28 +0100 Subject: [android] - refactor idling resource from test --- .../testapp/offline/OfflineManagerTest.kt | 102 +++++++++------------ 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt index 144d67feee..017c0f1f04 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt @@ -1,59 +1,39 @@ package com.mapbox.mapboxsdk.testapp.offline import android.content.Context -import android.support.test.espresso.Espresso -import android.support.test.espresso.IdlingRegistry -import android.support.test.espresso.UiController -import android.support.test.espresso.idling.CountingIdlingResource +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 -import com.mapbox.mapboxsdk.maps.MapboxMap import com.mapbox.mapboxsdk.offline.OfflineManager import com.mapbox.mapboxsdk.offline.OfflineRegion import com.mapbox.mapboxsdk.storage.FileSource -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke -import com.mapbox.mapboxsdk.testapp.activity.EspressoTest +import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity import com.mapbox.mapboxsdk.testapp.utils.FileUtils +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import java.io.IOException +import java.util.concurrent.CountDownLatch @RunWith(AndroidJUnit4::class) -class OfflineManagerTest : EspressoTest() { +class OfflineManagerTest { companion object { private const val TEST_DB_FILE_NAME = "offline_test.db" } - private val context: Context by lazy { rule.activity } - - private lateinit var offlineIdlingResource: CountingIdlingResource + @Rule + @JvmField + var rule = ActivityTestRule(FeatureOverviewActivity::class.java) - override fun beforeTest() { - super.beforeTest() - offlineIdlingResource = CountingIdlingResource("idling_resource") - IdlingRegistry.getInstance().register(offlineIdlingResource) - } + private val context: Context by lazy { rule.activity } + private val latch: CountDownLatch = CountDownLatch(1) @Test fun offlineMergeListDeleteTest() { - validateTestSetup() - - invoke(mapboxMap) { _: UiController, _: MapboxMap -> - offlineIdlingResource.increment() + rule.runOnUiThread { FileUtils.CopyFileFromAssetsTask(rule.activity, object : FileUtils.OnFileCopiedFromAssetsListener { override fun onFileCopiedFromAssets() { - OfflineManager.getInstance(context).mergeOfflineRegions( - FileSource.getResourcesCachePath(rule.activity) + "/" + TEST_DB_FILE_NAME, - object : OfflineManager.MergeOfflineRegionsCallback { - override fun onMerge(offlineRegions: Array?) { - assert(offlineRegions?.size == 1) - offlineIdlingResource.decrement() - } - - override fun onError(error: String?) { - throw RuntimeException("Unable to merge external offline database. $error") - } - }) + mergeRegion() } override fun onError() { @@ -61,43 +41,45 @@ class OfflineManagerTest : EspressoTest() { } }).execute(TEST_DB_FILE_NAME, FileSource.getResourcesCachePath(rule.activity)) } + latch.await() + } - invoke(mapboxMap) { _: UiController, _: MapboxMap -> - offlineIdlingResource.increment() - OfflineManager.getInstance(context).listOfflineRegions(object : OfflineManager.ListOfflineRegionsCallback { - override fun onList(offlineRegions: Array?) { + private fun mergeRegion() { + OfflineManager.getInstance(context).mergeOfflineRegions( + FileSource.getResourcesCachePath(rule.activity) + "/" + TEST_DB_FILE_NAME, + object : OfflineManager.MergeOfflineRegionsCallback { + override fun onMerge(offlineRegions: Array?) { assert(offlineRegions?.size == 1) - if (offlineRegions != null) { - for (region in offlineRegions) { - offlineIdlingResource.increment() - region.delete(object : OfflineRegion.OfflineRegionDeleteCallback { - override fun onDelete() { - offlineIdlingResource.decrement() - } - - override fun onError(error: String?) { - throw RuntimeException("Unable to delete region with ID: ${region.id}. $error") - } - }) - } - } else { - throw RuntimeException("Unable to find merged region.") - } - offlineIdlingResource.decrement() + listRegion() } override fun onError(error: String?) { - throw RuntimeException("Unable to obtain offline regions list. $error") + throw RuntimeException("Unable to merge external offline database. $error") } }) - } + } - // waiting for offline idling resource - Espresso.onIdle() + private fun listRegion() { + OfflineManager.getInstance(context).listOfflineRegions(object : OfflineManager.ListOfflineRegionsCallback { + override fun onList(offlineRegions: Array?) { + assert(offlineRegions?.size == 1) + deleteRegion(offlineRegions!![0]) + } + override fun onError(error: String?) { + throw RuntimeException("Unable to merge external offline database. $error") + } + }) } - override fun afterTest() { - super.afterTest() - IdlingRegistry.getInstance().unregister(offlineIdlingResource) + private fun deleteRegion(offlineRegion: OfflineRegion) { + offlineRegion.delete(object : OfflineRegion.OfflineRegionDeleteCallback { + override fun onDelete() { + latch.countDown() + } + + override fun onError(error: String?) { + throw RuntimeException("Unable to delete region") + } + }) } } \ No newline at end of file -- cgit v1.2.1 From 52cf9a1af385113cee523ce826d7c86c8739e0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Fri, 15 Mar 2019 13:54:42 +0100 Subject: [core] remove gl/context.hpp from more files, cast where necessary --- src/mbgl/gl/debugging.cpp | 6 +- src/mbgl/gl/debugging.hpp | 9 ++- src/mbgl/programs/symbol_program.hpp | 1 - .../renderer/layers/render_background_layer.cpp | 1 - src/mbgl/renderer/layers/render_circle_layer.cpp | 1 - src/mbgl/renderer/layers/render_custom_layer.cpp | 3 +- .../layers/render_fill_extrusion_layer.cpp | 7 ++- src/mbgl/renderer/layers/render_fill_layer.cpp | 7 ++- src/mbgl/renderer/layers/render_heatmap_layer.cpp | 11 ++-- .../renderer/layers/render_hillshade_layer.cpp | 1 - src/mbgl/renderer/layers/render_line_layer.cpp | 1 - src/mbgl/renderer/layers/render_raster_layer.cpp | 1 - src/mbgl/renderer/layers/render_symbol_layer.cpp | 1 - src/mbgl/renderer/paint_parameters.cpp | 2 +- src/mbgl/renderer/paint_parameters.hpp | 8 +-- src/mbgl/renderer/render_layer.cpp | 11 ++-- src/mbgl/renderer/render_static_data.cpp | 4 +- src/mbgl/renderer/render_static_data.hpp | 5 +- src/mbgl/renderer/render_tile.cpp | 2 +- src/mbgl/renderer/renderer_impl.cpp | 66 ++++++++++++---------- src/mbgl/renderer/sources/render_image_source.cpp | 2 +- src/mbgl/util/offscreen_texture.cpp | 10 ++-- src/mbgl/util/offscreen_texture.hpp | 9 +-- 23 files changed, 92 insertions(+), 77 deletions(-) diff --git a/src/mbgl/gl/debugging.cpp b/src/mbgl/gl/debugging.cpp index 7b8121f003..54cee5fc09 100644 --- a/src/mbgl/gl/debugging.cpp +++ b/src/mbgl/gl/debugging.cpp @@ -9,8 +9,8 @@ using namespace platform; #ifndef NDEBUG -DebugGroup::DebugGroup(const Context& context_, const std::string& name) : context(context_) { - if (auto debugging = context.getDebuggingExtension()) { +DebugGroup::DebugGroup(const gfx::Context& context_, const std::string& name) : context(context_) { + if (auto debugging = reinterpret_cast(context).getDebuggingExtension()) { if (debugging->pushDebugGroup) { MBGL_CHECK_ERROR(debugging->pushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(name.size()), name.c_str())); } else if (debugging->pushGroupMarkerEXT) { @@ -20,7 +20,7 @@ DebugGroup::DebugGroup(const Context& context_, const std::string& name) : conte } DebugGroup::~DebugGroup() { - if (auto debugging = context.getDebuggingExtension()) { + if (auto debugging = reinterpret_cast(context).getDebuggingExtension()) { if (debugging->popDebugGroup) { MBGL_CHECK_ERROR(debugging->popDebugGroup()); } else if (debugging->popGroupMarkerEXT) { diff --git a/src/mbgl/gl/debugging.hpp b/src/mbgl/gl/debugging.hpp index d24b727295..d85eb631be 100644 --- a/src/mbgl/gl/debugging.hpp +++ b/src/mbgl/gl/debugging.hpp @@ -5,19 +5,22 @@ #include namespace mbgl { -namespace gl { +namespace gfx { class Context; +} // namespace gfx + +namespace gl { #ifndef NDEBUG class DebugGroup : private util::noncopyable { public: - DebugGroup(const Context&, const std::string&); + DebugGroup(const gfx::Context&, const std::string&); ~DebugGroup(); private: - const Context& context; + const gfx::Context& context; }; #define __MBGL_DEBUG_GROUP_NAME2(counter) __MBGL_DEBUG_GROUP_##counter diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 383f5162d8..d5fb153bbb 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -1,6 +1,5 @@ #pragma once -#include #include #include diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp index 32e05a38ab..68c792517c 100644 --- a/src/mbgl/renderer/layers/render_background_layer.cpp +++ b/src/mbgl/renderer/layers/render_background_layer.cpp @@ -9,7 +9,6 @@ #include #include #include -#include namespace mbgl { diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 60a3bf8e01..2cc0d2e329 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include diff --git a/src/mbgl/renderer/layers/render_custom_layer.cpp b/src/mbgl/renderer/layers/render_custom_layer.cpp index bcb0decb74..8ac7d29ff6 100644 --- a/src/mbgl/renderer/layers/render_custom_layer.cpp +++ b/src/mbgl/renderer/layers/render_custom_layer.cpp @@ -57,7 +57,8 @@ void RenderCustomLayer::render(PaintParameters& paintParameters, RenderSource*) MBGL_CHECK_ERROR(host->initialize()); } - gl::Context& glContext = paintParameters.context; + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(paintParameters.context); const TransformState& state = paintParameters.state; // Reset GL state to a known state so the CustomLayer always has a clean slate. diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 5af4732aa3..a8c9f7a1c4 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -51,6 +51,9 @@ bool RenderFillExtrusionLayer::hasCrossfade() const { } void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*) { + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (parameters.pass == RenderPass::Opaque) { return; } @@ -69,8 +72,8 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* // Flag the depth buffer as no longer needing to be cleared for the remainder of this pass. parameters.staticData.depthRenderbuffer->shouldClear(false); - parameters.context.setStencilMode(gfx::StencilMode::disabled()); - parameters.context.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, depthClearValue, {}); + glContext.setStencilMode(gfx::StencilMode::disabled()); + glContext.clear(Color{ 0.0f, 0.0f, 0.0f, 0.0f }, depthClearValue, {}); auto draw = [&](auto& programInstance, const auto& tileBucket, auto&& uniformValues, const optional& patternPositionA, diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 64f3448c69..b11c2d23b6 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -63,6 +63,9 @@ bool RenderFillLayer::hasCrossfade() const { } void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (unevaluated.get().isUndefined()) { for (const RenderTile& tile : renderTiles) { auto bucket_ = tile.tile.getBucket(*baseImpl); @@ -88,7 +91,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { evaluated.get(), parameters.state) ), - uniforms::u_world::Value( parameters.context.viewport.getCurrentValue().size ), + uniforms::u_world::Value( glContext.viewport.getCurrentValue().size ), }, paintPropertyBinders, evaluated, @@ -175,7 +178,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { tile.translatedMatrix(evaluated.get(), evaluated.get(), parameters.state), - parameters.context.viewport.getCurrentValue().size, + glContext.viewport.getCurrentValue().size, geometryTile.iconAtlasTexture->size, crossfade, tile.id, diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index efc16fb28a..8ec6f7707b 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -52,12 +52,15 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { return; } + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (parameters.pass == RenderPass::Pass3D) { const auto& viewportSize = parameters.staticData.backendSize; const auto size = Size{viewportSize.width / 4, viewportSize.height / 4}; if (!renderTexture || renderTexture->getSize() != size) { - if (parameters.context.supportsHalfFloatTextures) { + if (glContext.supportsHalfFloatTextures) { renderTexture = OffscreenTexture(parameters.context, size, gfx::TextureChannelDataType::HalfFloat); try { @@ -65,11 +68,11 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { } catch (const std::runtime_error& ex) { // can't render to a half-float texture; falling back to unsigned byte one renderTexture = nullopt; - parameters.context.supportsHalfFloatTextures = false; + glContext.supportsHalfFloatTextures = false; } } - if (!parameters.context.supportsHalfFloatTextures || !renderTexture) { + if (!glContext.supportsHalfFloatTextures || !renderTexture) { renderTexture = OffscreenTexture(parameters.context, size, gfx::TextureChannelDataType::UnsignedByte); renderTexture->bind(); } @@ -82,7 +85,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { colorRampTexture = parameters.context.createTexture(colorRamp, gfx::TextureChannelDataType::UnsignedByte); } - parameters.context.clear(Color{ 0.0f, 0.0f, 0.0f, 1.0f }, {}, {}); + glContext.clear(Color{ 0.0f, 0.0f, 0.0f, 1.0f }, {}, {}); for (const RenderTile& tile : renderTiles) { auto bucket_ = tile.tile.getBucket(*baseImpl); diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index 00ecad444c..ff1def3d9a 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index eee151ccaa..b52c28e6c6 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp index c8f00eb1fd..c237cfe317 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.cpp +++ b/src/mbgl/renderer/layers/render_raster_layer.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include namespace mbgl { diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index 31d92dd414..fc05439010 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include diff --git a/src/mbgl/renderer/paint_parameters.cpp b/src/mbgl/renderer/paint_parameters.cpp index 2237b016d2..639041202f 100644 --- a/src/mbgl/renderer/paint_parameters.cpp +++ b/src/mbgl/renderer/paint_parameters.cpp @@ -5,7 +5,7 @@ namespace mbgl { -PaintParameters::PaintParameters(gl::Context& context_, +PaintParameters::PaintParameters(gfx::Context& context_, float pixelRatio_, GLContextMode contextMode_, RendererBackend& backend_, diff --git a/src/mbgl/renderer/paint_parameters.hpp b/src/mbgl/renderer/paint_parameters.hpp index ea3b41adfe..847093166a 100644 --- a/src/mbgl/renderer/paint_parameters.hpp +++ b/src/mbgl/renderer/paint_parameters.hpp @@ -23,13 +23,13 @@ class ImageManager; class LineAtlas; class UnwrappedTileID; -namespace gl { +namespace gfx { class Context; -} // namespace gl +} // namespace gfx class PaintParameters { public: - PaintParameters(gl::Context&, + PaintParameters(gfx::Context&, float pixelRatio, GLContextMode, RendererBackend&, @@ -39,7 +39,7 @@ public: ImageManager&, LineAtlas&); - gl::Context& context; + gfx::Context& context; RendererBackend& backend; const TransformState& state; diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index 32236d0f24..0bec14a0da 100644 --- a/src/mbgl/renderer/render_layer.cpp +++ b/src/mbgl/renderer/render_layer.cpp @@ -99,22 +99,25 @@ void RenderLayer::checkRenderability(const PaintParameters& parameters, return; } - if (activeBindingCount > parameters.context.maximumVertexBindingCount) { + // TODO: remove cast + auto& glContext = reinterpret_cast(parameters.context); + + if (activeBindingCount > glContext.maximumVertexBindingCount) { Log::Error(Event::OpenGL, "The layer '%s' uses more data-driven properties than the current device " "supports, and will have rendering errors. To ensure compatibility with this " "device, use %d fewer data driven properties in this layer.", getID().c_str(), - activeBindingCount - parameters.context.minimumRequiredVertexBindingCount); + activeBindingCount - glContext.minimumRequiredVertexBindingCount); hasRenderFailures = true; - } else if (activeBindingCount > parameters.context.minimumRequiredVertexBindingCount) { + } else if (activeBindingCount > glContext.minimumRequiredVertexBindingCount) { Log::Warning(Event::OpenGL, "The layer '%s' uses more data-driven properties than some devices may support. " "Though it will render correctly on this device, it may have rendering errors " "on other devices. To ensure compatibility with all devices, use %d fewer " "data-driven properties in this layer.", getID().c_str(), - activeBindingCount - parameters.context.minimumRequiredVertexBindingCount); + activeBindingCount - glContext.minimumRequiredVertexBindingCount); hasRenderFailures = true; } } diff --git a/src/mbgl/renderer/render_static_data.cpp b/src/mbgl/renderer/render_static_data.cpp index 16d0d64a33..24eed0326c 100644 --- a/src/mbgl/renderer/render_static_data.cpp +++ b/src/mbgl/renderer/render_static_data.cpp @@ -1,5 +1,5 @@ #include -#include +#include #include namespace mbgl { @@ -48,7 +48,7 @@ static gfx::VertexVector extrusionTextureVertices( return result; } -RenderStaticData::RenderStaticData(gl::Context& context, float pixelRatio, const optional& programCacheDir) +RenderStaticData::RenderStaticData(gfx::Context& context, float pixelRatio, const optional& programCacheDir) : tileVertexBuffer(context.createVertexBuffer(tileVertices())), rasterVertexBuffer(context.createVertexBuffer(rasterVertices())), extrusionTextureVertexBuffer(context.createVertexBuffer(extrusionTextureVertices())), diff --git a/src/mbgl/renderer/render_static_data.hpp b/src/mbgl/renderer/render_static_data.hpp index b9b52b09ca..23f632bc12 100644 --- a/src/mbgl/renderer/render_static_data.hpp +++ b/src/mbgl/renderer/render_static_data.hpp @@ -12,10 +12,13 @@ #include namespace mbgl { +namespace gfx { +class Context; +} // namespace gfx class RenderStaticData { public: - RenderStaticData(gl::Context&, float pixelRatio, const optional& programCacheDir); + RenderStaticData(gfx::Context&, float pixelRatio, const optional& programCacheDir); gfx::VertexBuffer> tileVertexBuffer; gfx::VertexBuffer rasterVertexBuffer; diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp index 24826bfd78..8490b41d37 100644 --- a/src/mbgl/renderer/render_tile.cpp +++ b/src/mbgl/renderer/render_tile.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index 471536cf40..d12cb00de0 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -278,8 +279,11 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { backend.updateAssumedState(); + // TODO: remove cast + gl::Context& glContext = reinterpret_cast(parameters.context); + if (parameters.contextMode == GLContextMode::Shared) { - parameters.context.setDirtyState(); + glContext.setDirtyState(); } Color backgroundColor; @@ -402,7 +406,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { if (!parameters.staticData.depthRenderbuffer || parameters.staticData.depthRenderbuffer->size != parameters.staticData.backendSize) { parameters.staticData.depthRenderbuffer = - parameters.context.createRenderbuffer(parameters.staticData.backendSize); + glContext.createRenderbuffer(parameters.staticData.backendSize); } parameters.staticData.depthRenderbuffer->shouldClear(true); @@ -425,11 +429,11 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { MBGL_DEBUG_GROUP(parameters.context, "clear"); parameters.backend.bind(); if (parameters.debugOptions & MapDebugOptions::Overdraw) { - parameters.context.clear(Color::black(), ClearDepth::Default, ClearStencil::Default); + glContext.clear(Color::black(), ClearDepth::Default, ClearStencil::Default); } else if (parameters.contextMode == GLContextMode::Shared) { - parameters.context.clear({}, ClearDepth::Default, ClearStencil::Default); + glContext.clear({}, ClearDepth::Default, ClearStencil::Default); } else { - parameters.context.clear(backgroundColor, ClearDepth::Default, ClearStencil::Default); + glContext.clear(backgroundColor, ClearDepth::Default, ClearStencil::Default); } } @@ -482,17 +486,17 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { #if not MBGL_USE_GLES2 and not defined(NDEBUG) // Render tile clip boundaries, using stencil buffer to calculate fill color. if (parameters.debugOptions & MapDebugOptions::StencilClip) { - parameters.context.setStencilMode(gfx::StencilMode::disabled()); - parameters.context.setDepthMode(gfx::DepthMode::disabled()); - parameters.context.setColorMode(gfx::ColorMode::unblended()); - parameters.context.program = 0; + glContext.setStencilMode(gfx::StencilMode::disabled()); + glContext.setDepthMode(gfx::DepthMode::disabled()); + glContext.setColorMode(gfx::ColorMode::unblended()); + glContext.program = 0; // Reset the value in case someone else changed it, or it's dirty. - parameters.context.pixelTransferStencil = gl::value::PixelTransferStencil::Default; + glContext.pixelTransferStencil = gl::value::PixelTransferStencil::Default; // Read the stencil buffer - const auto viewport = parameters.context.viewport.getCurrentValue(); - auto image = parameters.context.readFramebuffer(viewport.size, false); + const auto viewport = glContext.viewport.getCurrentValue(); + auto image = glContext.readFramebuffer(viewport.size, false); // Scale the Stencil buffer to cover the entire color space. auto it = image.data.get(); @@ -502,9 +506,9 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { *it *= factor; } - parameters.context.pixelZoom = { 1, 1 }; - parameters.context.rasterPos = { -1, -1, 0, 1 }; - parameters.context.drawPixels(image); + glContext.pixelZoom = { 1, 1 }; + glContext.rasterPos = { -1, -1, 0, 1 }; + glContext.drawPixels(image); return; } @@ -565,23 +569,23 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { #if not MBGL_USE_GLES2 and not defined(NDEBUG) // Render the depth buffer. if (parameters.debugOptions & MapDebugOptions::DepthBuffer) { - parameters.context.setStencilMode(gfx::StencilMode::disabled()); - parameters.context.setDepthMode(gfx::DepthMode::disabled()); - parameters.context.setColorMode(gfx::ColorMode::unblended()); - parameters.context.program = 0; + glContext.setStencilMode(gfx::StencilMode::disabled()); + glContext.setDepthMode(gfx::DepthMode::disabled()); + glContext.setColorMode(gfx::ColorMode::unblended()); + glContext.program = 0; // Scales the values in the depth buffer so that they cover the entire grayscale range. This // makes it easier to spot tiny differences. const float base = 1.0f / (1.0f - parameters.depthRangeSize); - parameters.context.pixelTransferDepth = { base, 1.0f - base }; + glContext.pixelTransferDepth = { base, 1.0f - base }; // Read the stencil buffer - auto viewport = parameters.context.viewport.getCurrentValue(); - auto image = parameters.context.readFramebuffer(viewport.size, false); + auto viewport = glContext.viewport.getCurrentValue(); + auto image = glContext.readFramebuffer(viewport.size, false); - parameters.context.pixelZoom = { 1, 1 }; - parameters.context.rasterPos = { -1, -1, 0, 1 }; - parameters.context.drawPixels(image); + glContext.pixelZoom = { 1, 1 }; + glContext.rasterPos = { -1, -1, 0, 1 }; + glContext.drawPixels(image); } #endif @@ -590,12 +594,12 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { { MBGL_DEBUG_GROUP(parameters.context, "cleanup"); - parameters.context.activeTextureUnit = 1; - parameters.context.texture[1] = 0; - parameters.context.activeTextureUnit = 0; - parameters.context.texture[0] = 0; + glContext.activeTextureUnit = 1; + glContext.texture[1] = 0; + glContext.activeTextureUnit = 0; + glContext.texture[0] = 0; - parameters.context.bindVertexArray = 0; + glContext.bindVertexArray = 0; } observer->onDidFinishRenderingFrame( @@ -611,7 +615,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { } // Cleanup only after signaling completion - parameters.context.performCleanup(); + glContext.performCleanup(); } std::vector Renderer::Impl::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp index 1b135a2838..5bb520be78 100644 --- a/src/mbgl/renderer/sources/render_image_source.cpp +++ b/src/mbgl/renderer/sources/render_image_source.cpp @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/mbgl/util/offscreen_texture.cpp b/src/mbgl/util/offscreen_texture.cpp index 2a58ff86a3..6bc09c7b16 100644 --- a/src/mbgl/util/offscreen_texture.cpp +++ b/src/mbgl/util/offscreen_texture.cpp @@ -62,18 +62,20 @@ private: const gfx::TextureChannelDataType type; }; -OffscreenTexture::OffscreenTexture(gl::Context& context, +OffscreenTexture::OffscreenTexture(gfx::Context& context, const Size size, const gfx::TextureChannelDataType type) - : impl(std::make_unique(context, std::move(size), type)) { + // TODO: remove cast + : impl(std::make_unique(reinterpret_cast(context), std::move(size), type)) { assert(!size.isEmpty()); } -OffscreenTexture::OffscreenTexture(gl::Context& context, +OffscreenTexture::OffscreenTexture(gfx::Context& context, const Size size, gl::Renderbuffer& renderbuffer, const gfx::TextureChannelDataType type) - : impl(std::make_unique(context, std::move(size), renderbuffer, type)) { + // TODO: remove cast + : impl(std::make_unique(reinterpret_cast(context), std::move(size), renderbuffer, type)) { assert(!size.isEmpty()); } diff --git a/src/mbgl/util/offscreen_texture.hpp b/src/mbgl/util/offscreen_texture.hpp index 9446fabecf..f4459556b8 100644 --- a/src/mbgl/util/offscreen_texture.hpp +++ b/src/mbgl/util/offscreen_texture.hpp @@ -6,20 +6,17 @@ namespace mbgl { -namespace gl { -class Context; -} // namespace gl - namespace gfx { +class Context; class Texture; } // namespace gfx class OffscreenTexture { public: - OffscreenTexture(gl::Context&, + OffscreenTexture(gfx::Context&, Size size = { 256, 256 }, gfx::TextureChannelDataType type = gfx::TextureChannelDataType::UnsignedByte); - OffscreenTexture(gl::Context&, + OffscreenTexture(gfx::Context&, Size size, gl::Renderbuffer&, gfx::TextureChannelDataType type = gfx::TextureChannelDataType::UnsignedByte); -- cgit v1.2.1 From 9ee1de575af4ef332ad8812c11d9d63edc94d76e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Fri, 15 Mar 2019 14:10:25 +0100 Subject: [core] expose vertex binding count in gfx::Context --- src/mbgl/gfx/context.hpp | 6 +++++- src/mbgl/gl/context.cpp | 2 +- src/mbgl/gl/context.hpp | 4 +--- src/mbgl/renderer/render_layer.cpp | 13 +++++-------- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/mbgl/gfx/context.hpp b/src/mbgl/gfx/context.hpp index 90b62c94a4..3653eeebe1 100644 --- a/src/mbgl/gfx/context.hpp +++ b/src/mbgl/gfx/context.hpp @@ -17,10 +17,14 @@ namespace gfx { class Context { protected: - Context(ContextType type_) : backend(type_) { + Context(ContextType type_, uint32_t maximumVertexBindingCount_) + : backend(type_), maximumVertexBindingCount(maximumVertexBindingCount_) { } +public: const ContextType backend; + static constexpr const uint32_t minimumRequiredVertexBindingCount = 8; + const uint32_t maximumVertexBindingCount; public: Context(Context&&) = delete; diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 5193381251..1f780331c2 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -67,7 +67,7 @@ static_assert(underlying_type(UniformDataType::SamplerCube) == GL_SAMPLER_CUBE, static_assert(std::is_same::value, "OpenGL type mismatch"); Context::Context() - : gfx::Context(gfx::ContextType::OpenGL), maximumVertexBindingCount([] { + : gfx::Context(gfx::ContextType::OpenGL, [] { GLint value; MBGL_CHECK_ERROR(glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value)); return value; diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index fe09390cc6..754b29c03e 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -172,9 +172,7 @@ public: #endif // MBGL_USE_GLES2 bool supportsHalfFloatTextures = false; - const uint32_t maximumVertexBindingCount; - static constexpr const uint32_t minimumRequiredVertexBindingCount = 8; - + private: State stencilFunc; State stencilMask; diff --git a/src/mbgl/renderer/render_layer.cpp b/src/mbgl/renderer/render_layer.cpp index 0bec14a0da..803b5b2190 100644 --- a/src/mbgl/renderer/render_layer.cpp +++ b/src/mbgl/renderer/render_layer.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include namespace mbgl { @@ -99,25 +99,22 @@ void RenderLayer::checkRenderability(const PaintParameters& parameters, return; } - // TODO: remove cast - auto& glContext = reinterpret_cast(parameters.context); - - if (activeBindingCount > glContext.maximumVertexBindingCount) { + if (activeBindingCount > parameters.context.maximumVertexBindingCount) { Log::Error(Event::OpenGL, "The layer '%s' uses more data-driven properties than the current device " "supports, and will have rendering errors. To ensure compatibility with this " "device, use %d fewer data driven properties in this layer.", getID().c_str(), - activeBindingCount - glContext.minimumRequiredVertexBindingCount); + activeBindingCount - parameters.context.minimumRequiredVertexBindingCount); hasRenderFailures = true; - } else if (activeBindingCount > glContext.minimumRequiredVertexBindingCount) { + } else if (activeBindingCount > parameters.context.minimumRequiredVertexBindingCount) { Log::Warning(Event::OpenGL, "The layer '%s' uses more data-driven properties than some devices may support. " "Though it will render correctly on this device, it may have rendering errors " "on other devices. To ensure compatibility with all devices, use %d fewer " "data-driven properties in this layer.", getID().c_str(), - activeBindingCount - glContext.minimumRequiredVertexBindingCount); + activeBindingCount - parameters.context.minimumRequiredVertexBindingCount); hasRenderFailures = true; } } -- cgit v1.2.1 From 0ad2375e1047353fc65fabce3ac9123dc095179e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Fri, 15 Mar 2019 23:32:45 +0100 Subject: [core] remove a_/u_ prefix from attribute/uniform types --- scripts/generate-style-code.js | 2 +- src/mbgl/gfx/attribute.hpp | 4 +- src/mbgl/gfx/texture.hpp | 4 +- src/mbgl/gfx/uniform.hpp | 12 +- src/mbgl/gl/attribute.hpp | 6 +- src/mbgl/gl/texture.hpp | 6 +- src/mbgl/gl/uniform.hpp | 10 +- src/mbgl/programs/attributes.hpp | 74 ++++++------ src/mbgl/programs/background_program.cpp | 30 ++--- src/mbgl/programs/background_program.hpp | 38 +++--- src/mbgl/programs/circle_program.hpp | 14 +-- src/mbgl/programs/clipping_mask_program.hpp | 2 +- src/mbgl/programs/collision_box_program.hpp | 24 ++-- src/mbgl/programs/debug_program.hpp | 6 +- src/mbgl/programs/extrusion_texture_program.hpp | 10 +- src/mbgl/programs/fill_extrusion_program.cpp | 28 ++--- src/mbgl/programs/fill_extrusion_program.hpp | 42 +++---- src/mbgl/programs/fill_program.cpp | 14 +-- src/mbgl/programs/fill_program.hpp | 22 ++-- src/mbgl/programs/heatmap_program.hpp | 10 +- src/mbgl/programs/heatmap_texture_program.hpp | 12 +- src/mbgl/programs/hillshade_prepare_program.hpp | 18 +-- src/mbgl/programs/hillshade_program.hpp | 28 ++--- src/mbgl/programs/line_program.cpp | 24 ++-- src/mbgl/programs/line_program.hpp | 66 +++++----- src/mbgl/programs/raster_program.hpp | 48 ++++---- src/mbgl/programs/symbol_program.cpp | 28 ++--- src/mbgl/programs/symbol_program.hpp | 134 ++++++++++----------- src/mbgl/programs/textures.hpp | 10 +- src/mbgl/programs/uniforms.hpp | 96 +++++++-------- .../renderer/layers/render_background_layer.cpp | 8 +- src/mbgl/renderer/layers/render_circle_layer.cpp | 10 +- .../layers/render_fill_extrusion_layer.cpp | 10 +- src/mbgl/renderer/layers/render_fill_layer.cpp | 8 +- src/mbgl/renderer/layers/render_heatmap_layer.cpp | 16 +-- .../renderer/layers/render_hillshade_layer.cpp | 26 ++-- src/mbgl/renderer/layers/render_line_layer.cpp | 4 +- src/mbgl/renderer/layers/render_line_layer.hpp | 2 +- src/mbgl/renderer/layers/render_raster_layer.cpp | 34 +++--- src/mbgl/renderer/layers/render_symbol_layer.cpp | 14 +-- src/mbgl/renderer/paint_property_binder.hpp | 8 +- src/mbgl/renderer/render_tile.cpp | 12 +- src/mbgl/renderer/renderer_impl.cpp | 2 +- src/mbgl/renderer/sources/render_image_source.cpp | 4 +- src/mbgl/style/layers/circle_layer_properties.hpp | 14 +-- .../layers/fill_extrusion_layer_properties.hpp | 8 +- src/mbgl/style/layers/fill_layer_properties.hpp | 8 +- src/mbgl/style/layers/heatmap_layer_properties.hpp | 4 +- src/mbgl/style/layers/line_layer_properties.hpp | 14 +-- src/mbgl/style/layers/symbol_layer_properties.hpp | 20 +-- test/programs/symbol_program.test.cpp | 34 +++--- 51 files changed, 541 insertions(+), 541 deletions(-) diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index ae25a856a8..72f4857a96 100755 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -99,7 +99,7 @@ function attributeUniformType(property, type) { [ property.name.replace(type + '-', '').replace(/-/g, '_') ]; return names.map(name => { - return `attributes::a_${name}, uniforms::u_${name}` + return `attributes::${name}, uniforms::${name}` }).join(', '); } diff --git a/src/mbgl/gfx/attribute.hpp b/src/mbgl/gfx/attribute.hpp index 4f44d68d7b..aff27d9c1d 100644 --- a/src/mbgl/gfx/attribute.hpp +++ b/src/mbgl/gfx/attribute.hpp @@ -14,8 +14,8 @@ #define MBGL_DEFINE_ATTRIBUTE(type_, n_, name_) \ struct name_ { \ using Type = ::mbgl::gfx::AttributeType; \ - static auto name() { \ - return #name_; \ + static auto attributeName() { \ + return "a_" #name_; \ } \ } diff --git a/src/mbgl/gfx/texture.hpp b/src/mbgl/gfx/texture.hpp index a957c4ebdf..05f98686a1 100644 --- a/src/mbgl/gfx/texture.hpp +++ b/src/mbgl/gfx/texture.hpp @@ -10,8 +10,8 @@ #define MBGL_DEFINE_TEXTURE(name_) \ struct name_ { \ using Value = ::mbgl::gfx::TextureBinding; \ - static constexpr auto name() { \ - return #name_; \ + static constexpr auto uniformName() { \ + return "u_" #name_; \ } \ } diff --git a/src/mbgl/gfx/uniform.hpp b/src/mbgl/gfx/uniform.hpp index f6896b9138..44cfe35510 100644 --- a/src/mbgl/gfx/uniform.hpp +++ b/src/mbgl/gfx/uniform.hpp @@ -8,24 +8,24 @@ #define MBGL_DEFINE_UNIFORM_SCALAR(type_, name_) \ struct name_ { \ using Value = type_; \ - static constexpr auto name() { \ - return #name_; \ + static constexpr auto uniformName() { \ + return "u_" #name_; \ } \ } #define MBGL_DEFINE_UNIFORM_VECTOR(type_, n_, name_) \ struct name_ { \ using Value = std::array; \ - static constexpr auto name() { \ - return #name_; \ + static constexpr auto uniformName() { \ + return "u_" #name_; \ } \ } #define MBGL_DEFINE_UNIFORM_MATRIX(type_, n_, name_) \ struct name_ { \ using Value = std::array; \ - static constexpr auto name() { \ - return #name_; \ + static constexpr auto uniformName() { \ + return "u_" #name_; \ } \ } diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index c4fe8b993f..32493d207a 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -50,13 +50,13 @@ public: } }; - return Locations{ maybeBindLocation(As::name())... }; + return Locations{ maybeBindLocation(As::attributeName())... }; }()) { } template AttributeLocations(const BinaryProgram& program) - : locations{ program.attributeLocation(As::name())... } { + : locations{ program.attributeLocation(As::attributeName())... } { } NamedAttributeLocations getNamedLocations() const { @@ -68,7 +68,7 @@ public: } }; - util::ignore({ (maybeAddLocation(As::name(), locations.template get()), 0)... }); + util::ignore({ (maybeAddLocation(As::attributeName(), locations.template get()), 0)... }); return result; } diff --git a/src/mbgl/gl/texture.hpp b/src/mbgl/gl/texture.hpp index 0569adc3b0..2058ecd495 100644 --- a/src/mbgl/gl/texture.hpp +++ b/src/mbgl/gl/texture.hpp @@ -27,16 +27,16 @@ private: public: void queryLocations(const ProgramID& id) { - state = State{ gl::uniformLocation(id, Ts::name())... }; + state = State{ gl::uniformLocation(id, Ts::uniformName())... }; } template void loadNamedLocations(const BinaryProgram& program) { - state = State{ program.textureLocation(Ts::name())... }; + state = State{ program.textureLocation(Ts::uniformName())... }; } NamedUniformLocations getNamedLocations() const { - return NamedUniformLocations{ { Ts::name(), state.template get().location }... }; + return NamedUniformLocations{ { Ts::uniformName(), state.template get().location }... }; } void bind(gl::Context& context, const gfx::TextureBindings>& bindings) { diff --git a/src/mbgl/gl/uniform.hpp b/src/mbgl/gl/uniform.hpp index 770f3e2294..64c83cab6b 100644 --- a/src/mbgl/gl/uniform.hpp +++ b/src/mbgl/gl/uniform.hpp @@ -73,21 +73,21 @@ public: util::ignore( { // Some shader programs have uniforms declared, but not used, so they're not active. // Therefore, we'll only verify them when they are indeed active. - (active.find(Us::name()) != active.end() - ? verifyUniform(active.at(Us::name())) + (active.find(Us::uniformName()) != active.end() + ? verifyUniform(active.at(Us::uniformName())) : false)... }); #endif - state = State{ gl::uniformLocation(id, Us::name())... }; + state = State{ gl::uniformLocation(id, Us::uniformName())... }; } template void loadNamedLocations(const BinaryProgram& program) { - state = State{ UniformState(program.uniformLocation(Us::name()))... }; + state = State{ UniformState(program.uniformLocation(Us::uniformName()))... }; } NamedUniformLocations getNamedLocations() const { - return NamedUniformLocations{ { Us::name(), state.template get().location }... }; + return NamedUniformLocations{ { Us::uniformName(), state.template get().location }... }; } void bind(const gfx::UniformValues>& values) { diff --git a/src/mbgl/programs/attributes.hpp b/src/mbgl/programs/attributes.hpp index 6106eedb53..2ee2218fcb 100644 --- a/src/mbgl/programs/attributes.hpp +++ b/src/mbgl/programs/attributes.hpp @@ -7,52 +7,52 @@ namespace attributes { // Layout attributes -MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_pos); -MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_extrude); -MBGL_DEFINE_ATTRIBUTE(int16_t, 4, a_pos_offset); -MBGL_DEFINE_ATTRIBUTE(int16_t, 4, a_pos_normal); -MBGL_DEFINE_ATTRIBUTE(float, 3, a_projected_pos); -MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_label_pos); -MBGL_DEFINE_ATTRIBUTE(int16_t, 2, a_anchor_pos); -MBGL_DEFINE_ATTRIBUTE(uint16_t, 2, a_texture_pos); -MBGL_DEFINE_ATTRIBUTE(int16_t, 4, a_normal_ed); -MBGL_DEFINE_ATTRIBUTE(uint8_t, 1, a_fade_opacity); -MBGL_DEFINE_ATTRIBUTE(uint8_t, 2, a_placed); -MBGL_DEFINE_ATTRIBUTE(uint16_t, 3, a_size); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_offset); -MBGL_DEFINE_ATTRIBUTE(float, 2, a_shift); +MBGL_DEFINE_ATTRIBUTE(int16_t, 2, pos); +MBGL_DEFINE_ATTRIBUTE(int16_t, 2, extrude); +MBGL_DEFINE_ATTRIBUTE(int16_t, 4, pos_offset); +MBGL_DEFINE_ATTRIBUTE(int16_t, 4, pos_normal); +MBGL_DEFINE_ATTRIBUTE(float, 3, projected_pos); +MBGL_DEFINE_ATTRIBUTE(int16_t, 2, label_pos); +MBGL_DEFINE_ATTRIBUTE(int16_t, 2, anchor_pos); +MBGL_DEFINE_ATTRIBUTE(uint16_t, 2, texture_pos); +MBGL_DEFINE_ATTRIBUTE(int16_t, 4, normal_ed); +MBGL_DEFINE_ATTRIBUTE(uint8_t, 1, fade_opacity); +MBGL_DEFINE_ATTRIBUTE(uint8_t, 2, placed); +MBGL_DEFINE_ATTRIBUTE(uint16_t, 3, size); +MBGL_DEFINE_ATTRIBUTE(float, 1, offset); +MBGL_DEFINE_ATTRIBUTE(float, 2, shift); template -struct a_data { +struct data { using Type = gfx::AttributeType; - static auto name() { return "a_data"; } + static auto attributeName() { return "a_data"; } }; // Paint attributes -MBGL_DEFINE_ATTRIBUTE(float, 2, a_color); -MBGL_DEFINE_ATTRIBUTE(float, 2, a_fill_color); -MBGL_DEFINE_ATTRIBUTE(float, 2, a_halo_color); -MBGL_DEFINE_ATTRIBUTE(float, 2, a_stroke_color); -MBGL_DEFINE_ATTRIBUTE(float, 2, a_outline_color); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_opacity); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_stroke_opacity); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_blur); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_radius); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_width); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_floorwidth); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_height); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_base); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_gapwidth); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_stroke_width); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_halo_width); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_halo_blur); -MBGL_DEFINE_ATTRIBUTE(float, 1, a_weight); -MBGL_DEFINE_ATTRIBUTE(uint16_t, 4, a_pattern_to); -MBGL_DEFINE_ATTRIBUTE(uint16_t, 4, a_pattern_from); +MBGL_DEFINE_ATTRIBUTE(float, 2, color); +MBGL_DEFINE_ATTRIBUTE(float, 2, fill_color); +MBGL_DEFINE_ATTRIBUTE(float, 2, halo_color); +MBGL_DEFINE_ATTRIBUTE(float, 2, stroke_color); +MBGL_DEFINE_ATTRIBUTE(float, 2, outline_color); +MBGL_DEFINE_ATTRIBUTE(float, 1, opacity); +MBGL_DEFINE_ATTRIBUTE(float, 1, stroke_opacity); +MBGL_DEFINE_ATTRIBUTE(float, 1, blur); +MBGL_DEFINE_ATTRIBUTE(float, 1, radius); +MBGL_DEFINE_ATTRIBUTE(float, 1, width); +MBGL_DEFINE_ATTRIBUTE(float, 1, floorwidth); +MBGL_DEFINE_ATTRIBUTE(float, 1, height); +MBGL_DEFINE_ATTRIBUTE(float, 1, base); +MBGL_DEFINE_ATTRIBUTE(float, 1, gapwidth); +MBGL_DEFINE_ATTRIBUTE(float, 1, stroke_width); +MBGL_DEFINE_ATTRIBUTE(float, 1, halo_width); +MBGL_DEFINE_ATTRIBUTE(float, 1, halo_blur); +MBGL_DEFINE_ATTRIBUTE(float, 1, weight); +MBGL_DEFINE_ATTRIBUTE(uint16_t, 4, pattern_to); +MBGL_DEFINE_ATTRIBUTE(uint16_t, 4, pattern_from); } // namespace attributes -using PositionOnlyLayoutAttributes = TypeList; +using PositionOnlyLayoutAttributes = TypeList; } // namespace mbgl diff --git a/src/mbgl/programs/background_program.cpp b/src/mbgl/programs/background_program.cpp index 7d68f62fb1..772d481578 100644 --- a/src/mbgl/programs/background_program.cpp +++ b/src/mbgl/programs/background_program.cpp @@ -28,21 +28,21 @@ BackgroundPatternProgram::layoutUniformValues(mat4 matrix, int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y; return { - uniforms::u_matrix::Value( matrix ), - uniforms::u_opacity::Value( opacity ), - uniforms::u_texsize::Value( atlasSize ), - uniforms::u_pattern_tl_a::Value( a.tl() ), - uniforms::u_pattern_br_a::Value( a.br() ), - uniforms::u_pattern_tl_b::Value( b.tl() ), - uniforms::u_pattern_br_b::Value( b.br() ), - uniforms::u_pattern_size_a::Value( a.displaySize() ), - uniforms::u_pattern_size_b::Value( b.displaySize() ), - uniforms::u_scale_a::Value( fading.fromScale ), - uniforms::u_scale_b::Value( fading.toScale ), - uniforms::u_mix::Value( fading.t ), - uniforms::u_pixel_coord_upper::Value( std::array {{ float(pixelX >> 16), float(pixelY >> 16) }}), - uniforms::u_pixel_coord_lower::Value( std::array {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF)}}), - uniforms::u_tile_units_to_pixels::Value( 1.0f / tileID.pixelsToTileUnits(1.0f, state.getIntegerZoom()) ), + uniforms::matrix::Value( matrix ), + uniforms::opacity::Value( opacity ), + uniforms::texsize::Value( atlasSize ), + uniforms::pattern_tl_a::Value( a.tl() ), + uniforms::pattern_br_a::Value( a.br() ), + uniforms::pattern_tl_b::Value( b.tl() ), + uniforms::pattern_br_b::Value( b.br() ), + uniforms::pattern_size_a::Value( a.displaySize() ), + uniforms::pattern_size_b::Value( b.displaySize() ), + uniforms::scale_a::Value( fading.fromScale ), + uniforms::scale_b::Value( fading.toScale ), + uniforms::mix::Value( fading.t ), + uniforms::pixel_coord_upper::Value( std::array {{ float(pixelX >> 16), float(pixelY >> 16) }}), + uniforms::pixel_coord_lower::Value( std::array {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF)}}), + uniforms::tile_units_to_pixels::Value( 1.0f / tileID.pixelsToTileUnits(1.0f, state.getIntegerZoom()) ), }; } diff --git a/src/mbgl/programs/background_program.hpp b/src/mbgl/programs/background_program.hpp index b1ade6dc84..dd0683776c 100644 --- a/src/mbgl/programs/background_program.hpp +++ b/src/mbgl/programs/background_program.hpp @@ -18,26 +18,26 @@ template class Faded; using BackgroundLayoutAttributes = PositionOnlyLayoutAttributes; using BackgroundUniforms = TypeList< - uniforms::u_matrix, - uniforms::u_color, - uniforms::u_opacity>; + uniforms::matrix, + uniforms::color, + uniforms::opacity>; using BackgroundPatternUniforms = TypeList< - uniforms::u_matrix, - uniforms::u_opacity, - uniforms::u_texsize, - uniforms::u_pattern_tl_a, - uniforms::u_pattern_br_a, - uniforms::u_pattern_tl_b, - uniforms::u_pattern_br_b, - uniforms::u_pattern_size_a, - uniforms::u_pattern_size_b, - uniforms::u_scale_a, - uniforms::u_scale_b, - uniforms::u_mix, - uniforms::u_pixel_coord_upper, - uniforms::u_pixel_coord_lower, - uniforms::u_tile_units_to_pixels>; + uniforms::matrix, + uniforms::opacity, + uniforms::texsize, + uniforms::pattern_tl_a, + uniforms::pattern_br_a, + uniforms::pattern_tl_b, + uniforms::pattern_br_b, + uniforms::pattern_size_a, + uniforms::pattern_size_b, + uniforms::scale_a, + uniforms::scale_b, + uniforms::mix, + uniforms::pixel_coord_upper, + uniforms::pixel_coord_lower, + uniforms::tile_units_to_pixels>; class BackgroundProgram : public Program< BackgroundProgram, @@ -57,7 +57,7 @@ class BackgroundPatternProgram : public Program< BackgroundLayoutAttributes, BackgroundPatternUniforms, TypeList< - textures::u_image>, + textures::image>, style::Properties<>> { public: diff --git a/src/mbgl/programs/circle_program.hpp b/src/mbgl/programs/circle_program.hpp index 0caa1b2a15..b108a43da3 100644 --- a/src/mbgl/programs/circle_program.hpp +++ b/src/mbgl/programs/circle_program.hpp @@ -9,20 +9,20 @@ namespace mbgl { namespace uniforms { -MBGL_DEFINE_UNIFORM_SCALAR(bool, u_scale_with_map); +MBGL_DEFINE_UNIFORM_SCALAR(bool, scale_with_map); } // namespace uniforms class CircleProgram : public Program< CircleProgram, gfx::PrimitiveType::Triangle, TypeList< - attributes::a_pos>, + attributes::pos>, TypeList< - uniforms::u_matrix, - uniforms::u_scale_with_map, - uniforms::u_extrude_scale, - uniforms::u_camera_to_center_distance, - uniforms::u_pitch_with_map>, + uniforms::matrix, + uniforms::scale_with_map, + uniforms::extrude_scale, + uniforms::camera_to_center_distance, + uniforms::pitch_with_map>, TypeList<>, style::CirclePaintProperties> { diff --git a/src/mbgl/programs/clipping_mask_program.hpp b/src/mbgl/programs/clipping_mask_program.hpp index 874708a52f..14d66a8703 100644 --- a/src/mbgl/programs/clipping_mask_program.hpp +++ b/src/mbgl/programs/clipping_mask_program.hpp @@ -12,7 +12,7 @@ class ClippingMaskProgram : public Program< gfx::PrimitiveType::Triangle, PositionOnlyLayoutAttributes, TypeList< - uniforms::u_matrix>, + uniforms::matrix>, TypeList<>, style::Properties<>> { diff --git a/src/mbgl/programs/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp index 7b81752a94..0fa7ea4b4f 100644 --- a/src/mbgl/programs/collision_box_program.hpp +++ b/src/mbgl/programs/collision_box_program.hpp @@ -11,21 +11,21 @@ namespace mbgl { using CollisionBoxLayoutAttributes = TypeList< - attributes::a_pos, - attributes::a_anchor_pos, - attributes::a_extrude, - attributes::a_shift>; + attributes::pos, + attributes::anchor_pos, + attributes::extrude, + attributes::shift>; -using CollisionBoxDynamicAttributes = TypeList; +using CollisionBoxDynamicAttributes = TypeList; class CollisionBoxProgram : public Program< CollisionBoxProgram, gfx::PrimitiveType::Line, TypeListConcat, TypeList< - uniforms::u_matrix, - uniforms::u_extrude_scale, - uniforms::u_camera_to_center_distance>, + uniforms::matrix, + uniforms::extrude_scale, + uniforms::camera_to_center_distance>, TypeList<>, style::Properties<>> { @@ -116,10 +116,10 @@ class CollisionCircleProgram : public Program< gfx::PrimitiveType::Triangle, TypeListConcat, TypeList< - uniforms::u_matrix, - uniforms::u_extrude_scale, - uniforms::u_overscale_factor, - uniforms::u_camera_to_center_distance>, + uniforms::matrix, + uniforms::extrude_scale, + uniforms::overscale_factor, + uniforms::camera_to_center_distance>, TypeList<>, style::Properties<>> { diff --git a/src/mbgl/programs/debug_program.hpp b/src/mbgl/programs/debug_program.hpp index 61125b55bf..f1782e19e3 100644 --- a/src/mbgl/programs/debug_program.hpp +++ b/src/mbgl/programs/debug_program.hpp @@ -11,10 +11,10 @@ class DebugProgram : public Program< DebugProgram, gfx::PrimitiveType::Line, TypeList< - attributes::a_pos>, + attributes::pos>, TypeList< - uniforms::u_matrix, - uniforms::u_color>, + uniforms::matrix, + uniforms::color>, TypeList<>, style::Properties<>> { diff --git a/src/mbgl/programs/extrusion_texture_program.hpp b/src/mbgl/programs/extrusion_texture_program.hpp index bdeeabb8cd..10dfdc8a16 100644 --- a/src/mbgl/programs/extrusion_texture_program.hpp +++ b/src/mbgl/programs/extrusion_texture_program.hpp @@ -12,13 +12,13 @@ namespace mbgl { class ExtrusionTextureProgram : public Program< ExtrusionTextureProgram, gfx::PrimitiveType::Triangle, - TypeList, + TypeList, TypeList< - uniforms::u_matrix, - uniforms::u_world, - uniforms::u_opacity>, + uniforms::matrix, + uniforms::world, + uniforms::opacity>, TypeList< - textures::u_image>, + textures::image>, style::Properties<>> { public: using Program::Program; diff --git a/src/mbgl/programs/fill_extrusion_program.cpp b/src/mbgl/programs/fill_extrusion_program.cpp index 7688d09299..d301f32707 100644 --- a/src/mbgl/programs/fill_extrusion_program.cpp +++ b/src/mbgl/programs/fill_extrusion_program.cpp @@ -38,10 +38,10 @@ float lightIntensity(const EvaluatedLight& light) { FillExtrusionProgram::LayoutUniformValues FillExtrusionProgram::layoutUniformValues( mat4 matrix, const TransformState& state, const EvaluatedLight& light) { return { - uniforms::u_matrix::Value( matrix ), - uniforms::u_lightcolor::Value( lightColor(light) ), - uniforms::u_lightpos::Value( lightPosition(light, state) ), - uniforms::u_lightintensity::Value( lightIntensity(light) ) + uniforms::matrix::Value( matrix ), + uniforms::lightcolor::Value( lightColor(light) ), + uniforms::lightpos::Value( lightPosition(light, state) ), + uniforms::lightintensity::Value( lightIntensity(light) ) }; } @@ -60,16 +60,16 @@ FillExtrusionPatternProgram::layoutUniformValues(mat4 matrix, int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y; return { - uniforms::u_matrix::Value( matrix ), - uniforms::u_scale::Value( {{pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale}} ), - uniforms::u_texsize::Value( atlasSize ), - uniforms::u_fade::Value( crossfade.t ), - uniforms::u_pixel_coord_upper::Value( std::array{{ float(pixelX >> 16), float(pixelY >> 16) }} ), - uniforms::u_pixel_coord_lower::Value( std::array{{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} ), - uniforms::u_height_factor::Value( heightFactor ), - uniforms::u_lightcolor::Value( lightColor(light) ), - uniforms::u_lightpos::Value( lightPosition(light, state) ), - uniforms::u_lightintensity::Value( lightIntensity(light) ), + uniforms::matrix::Value( matrix ), + uniforms::scale::Value( {{pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale}} ), + uniforms::texsize::Value( atlasSize ), + uniforms::fade::Value( crossfade.t ), + uniforms::pixel_coord_upper::Value( std::array{{ float(pixelX >> 16), float(pixelY >> 16) }} ), + uniforms::pixel_coord_lower::Value( std::array{{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} ), + uniforms::height_factor::Value( heightFactor ), + uniforms::lightcolor::Value( lightColor(light) ), + uniforms::lightpos::Value( lightPosition(light, state) ), + uniforms::lightintensity::Value( lightIntensity(light) ), }; } diff --git a/src/mbgl/programs/fill_extrusion_program.hpp b/src/mbgl/programs/fill_extrusion_program.hpp index e1c3ca7f17..ca696230b4 100644 --- a/src/mbgl/programs/fill_extrusion_program.hpp +++ b/src/mbgl/programs/fill_extrusion_program.hpp @@ -22,33 +22,33 @@ class TransformState; template class Faded; namespace uniforms { -MBGL_DEFINE_UNIFORM_VECTOR(float, 3, u_lightpos); -MBGL_DEFINE_UNIFORM_VECTOR(float, 3, u_lightcolor); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_lightintensity); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_height_factor); +MBGL_DEFINE_UNIFORM_VECTOR(float, 3, lightpos); +MBGL_DEFINE_UNIFORM_VECTOR(float, 3, lightcolor); +MBGL_DEFINE_UNIFORM_SCALAR(float, lightintensity); +MBGL_DEFINE_UNIFORM_SCALAR(float, height_factor); } // namespace uniforms using FillExtrusionLayoutAttributes = TypeList< - attributes::a_pos, - attributes::a_normal_ed>; + attributes::pos, + attributes::normal_ed>; using FillExtrusionUniforms = TypeList< - uniforms::u_matrix, - uniforms::u_lightcolor, - uniforms::u_lightpos, - uniforms::u_lightintensity>; + uniforms::matrix, + uniforms::lightcolor, + uniforms::lightpos, + uniforms::lightintensity>; using FillExtrusionPatternUniforms = TypeList< - uniforms::u_matrix, - uniforms::u_scale, - uniforms::u_texsize, - uniforms::u_fade, - uniforms::u_pixel_coord_upper, - uniforms::u_pixel_coord_lower, - uniforms::u_height_factor, - uniforms::u_lightcolor, - uniforms::u_lightpos, - uniforms::u_lightintensity>; + uniforms::matrix, + uniforms::scale, + uniforms::texsize, + uniforms::fade, + uniforms::pixel_coord_upper, + uniforms::pixel_coord_lower, + uniforms::height_factor, + uniforms::lightcolor, + uniforms::lightpos, + uniforms::lightintensity>; class FillExtrusionProgram : public Program< FillExtrusionProgram, @@ -91,7 +91,7 @@ class FillExtrusionPatternProgram : public Program< FillExtrusionLayoutAttributes, FillExtrusionPatternUniforms, TypeList< - textures::u_image>, + textures::image>, style::FillExtrusionPaintProperties> { public: diff --git a/src/mbgl/programs/fill_program.cpp b/src/mbgl/programs/fill_program.cpp index e0dfc71f81..703d61399f 100644 --- a/src/mbgl/programs/fill_program.cpp +++ b/src/mbgl/programs/fill_program.cpp @@ -30,13 +30,13 @@ FillPatternProgram::layoutUniformValues(mat4 matrix, int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y; return { - uniforms::u_matrix::Value( matrix ), - uniforms::u_world::Value( framebufferSize ), - uniforms::u_texsize::Value( atlasSize ), - uniforms::u_scale::Value({ {pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale} } ), - uniforms::u_fade::Value( crossfade.t ), - uniforms::u_pixel_coord_upper::Value( std::array {{ float(pixelX >> 16), float(pixelY >> 16) }}), - uniforms::u_pixel_coord_lower::Value( std::array {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} ) + uniforms::matrix::Value( matrix ), + uniforms::world::Value( framebufferSize ), + uniforms::texsize::Value( atlasSize ), + uniforms::scale::Value({ {pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale} } ), + uniforms::fade::Value( crossfade.t ), + uniforms::pixel_coord_upper::Value( std::array {{ float(pixelX >> 16), float(pixelY >> 16) }}), + uniforms::pixel_coord_lower::Value( std::array {{ float(pixelX & 0xFFFF), float(pixelY & 0xFFFF) }} ) }; } diff --git a/src/mbgl/programs/fill_program.hpp b/src/mbgl/programs/fill_program.hpp index 8519e482d6..4684a84f54 100644 --- a/src/mbgl/programs/fill_program.hpp +++ b/src/mbgl/programs/fill_program.hpp @@ -21,17 +21,17 @@ template class Faded; using FillLayoutAttributes = PositionOnlyLayoutAttributes; using FillUniforms = TypeList< - uniforms::u_matrix, - uniforms::u_world>; + uniforms::matrix, + uniforms::world>; using FillPatternUniforms = TypeList< - uniforms::u_matrix, - uniforms::u_world, - uniforms::u_texsize, - uniforms::u_scale, - uniforms::u_fade, - uniforms::u_pixel_coord_upper, - uniforms::u_pixel_coord_lower>; + uniforms::matrix, + uniforms::world, + uniforms::texsize, + uniforms::scale, + uniforms::fade, + uniforms::pixel_coord_upper, + uniforms::pixel_coord_lower>; class FillProgram : public Program< FillProgram, @@ -60,7 +60,7 @@ class FillPatternProgram : public Program< FillLayoutAttributes, FillPatternUniforms, TypeList< - textures::u_image>, + textures::image>, style::FillPaintProperties> { public: @@ -93,7 +93,7 @@ class FillOutlinePatternProgram : public Program< FillLayoutAttributes, FillPatternUniforms, TypeList< - textures::u_image>, + textures::image>, style::FillPaintProperties> { public: diff --git a/src/mbgl/programs/heatmap_program.hpp b/src/mbgl/programs/heatmap_program.hpp index 9563dd8d1b..89ba655105 100644 --- a/src/mbgl/programs/heatmap_program.hpp +++ b/src/mbgl/programs/heatmap_program.hpp @@ -10,18 +10,18 @@ namespace mbgl { namespace uniforms { -MBGL_DEFINE_UNIFORM_SCALAR(float, u_intensity); +MBGL_DEFINE_UNIFORM_SCALAR(float, intensity); } // namespace uniforms class HeatmapProgram : public Program< HeatmapProgram, gfx::PrimitiveType::Triangle, TypeList< - attributes::a_pos>, + attributes::pos>, TypeList< - uniforms::u_intensity, - uniforms::u_matrix, - uniforms::heatmap::u_extrude_scale>, + uniforms::intensity, + uniforms::matrix, + uniforms::heatmap::extrude_scale>, TypeList<>, style::HeatmapPaintProperties> { diff --git a/src/mbgl/programs/heatmap_texture_program.hpp b/src/mbgl/programs/heatmap_texture_program.hpp index 954e03f9b6..6762f8c7f4 100644 --- a/src/mbgl/programs/heatmap_texture_program.hpp +++ b/src/mbgl/programs/heatmap_texture_program.hpp @@ -12,14 +12,14 @@ namespace mbgl { class HeatmapTextureProgram : public Program< HeatmapTextureProgram, gfx::PrimitiveType::Triangle, - TypeList, + TypeList, TypeList< - uniforms::u_matrix, - uniforms::u_world, - uniforms::u_opacity>, + uniforms::matrix, + uniforms::world, + uniforms::opacity>, TypeList< - textures::u_image, - textures::u_color_ramp>, + textures::image, + textures::color_ramp>, style::Properties<>> { public: using Program::Program; diff --git a/src/mbgl/programs/hillshade_prepare_program.hpp b/src/mbgl/programs/hillshade_prepare_program.hpp index 0243cc1879..2d76145bc3 100644 --- a/src/mbgl/programs/hillshade_prepare_program.hpp +++ b/src/mbgl/programs/hillshade_prepare_program.hpp @@ -9,23 +9,23 @@ namespace mbgl { namespace uniforms { -MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_dimension); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_maxzoom); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, dimension); +MBGL_DEFINE_UNIFORM_SCALAR(float, maxzoom); } // namespace uniforms class HillshadePrepareProgram : public Program< HillshadePrepareProgram, gfx::PrimitiveType::Triangle, TypeList< - attributes::a_pos, - attributes::a_texture_pos>, + attributes::pos, + attributes::texture_pos>, TypeList< - uniforms::u_matrix, - uniforms::u_dimension, - uniforms::u_zoom, - uniforms::u_maxzoom>, + uniforms::matrix, + uniforms::dimension, + uniforms::zoom, + uniforms::maxzoom>, TypeList< - textures::u_image>, + textures::image>, style::Properties<>> { public: using Program::Program; diff --git a/src/mbgl/programs/hillshade_program.hpp b/src/mbgl/programs/hillshade_program.hpp index 68d67917df..33f91abef0 100644 --- a/src/mbgl/programs/hillshade_program.hpp +++ b/src/mbgl/programs/hillshade_program.hpp @@ -11,28 +11,28 @@ namespace mbgl { namespace uniforms { -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_shadow); -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_highlight); -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_accent); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_light); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_latrange); +MBGL_DEFINE_UNIFORM_SCALAR(Color, shadow); +MBGL_DEFINE_UNIFORM_SCALAR(Color, highlight); +MBGL_DEFINE_UNIFORM_SCALAR(Color, accent); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, light); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, latrange); } // namespace uniforms class HillshadeProgram : public Program< HillshadeProgram, gfx::PrimitiveType::Triangle, TypeList< - attributes::a_pos, - attributes::a_texture_pos>, + attributes::pos, + attributes::texture_pos>, TypeList< - uniforms::u_matrix, - uniforms::u_highlight, - uniforms::u_shadow, - uniforms::u_accent, - uniforms::u_light, - uniforms::u_latrange>, + uniforms::matrix, + uniforms::highlight, + uniforms::shadow, + uniforms::accent, + uniforms::light, + uniforms::latrange>, TypeList< - textures::u_image>, + textures::image>, style::HillshadePaintProperties>{ public: using Program::Program; diff --git a/src/mbgl/programs/line_program.cpp b/src/mbgl/programs/line_program.cpp index 74a1ba3162..9e035ff245 100644 --- a/src/mbgl/programs/line_program.cpp +++ b/src/mbgl/programs/line_program.cpp @@ -26,13 +26,13 @@ Values makeValues(const RenderLinePaintProperties::PossiblyEvaluated& properties Args&&... args) { return Values { - uniforms::u_matrix::Value( + uniforms::matrix::Value( tile.translatedMatrix(properties.get(), properties.get(), state) ), - uniforms::u_ratio::Value( 1.0f / tile.id.pixelsToTileUnits(1.0, state.getZoom()) ), - uniforms::u_gl_units_to_pixels::Value({ {1.0f / pixelsToGLUnits[0], 1.0f / pixelsToGLUnits[1]} }), + uniforms::ratio::Value( 1.0f / tile.id.pixelsToTileUnits(1.0, state.getZoom()) ), + uniforms::gl_units_to_pixels::Value({ {1.0f / pixelsToGLUnits[0], 1.0f / pixelsToGLUnits[1]} }), std::forward(args)... }; } @@ -78,12 +78,12 @@ LineSDFProgram::layoutUniformValues(const RenderLinePaintProperties::PossiblyEva tile, state, pixelsToGLUnits, - uniforms::u_patternscale_a::Value( scaleA ), - uniforms::u_patternscale_b::Value( scaleB ), - uniforms::u_tex_y_a::Value( posA.y ), - uniforms::u_tex_y_b::Value( posB.y ), - uniforms::u_mix::Value( crossfade.t ), - uniforms::u_sdfgamma::Value( atlasWidth / (std::min(widthA, widthB) * 256.0f * pixelRatio) / 2.0f ) + uniforms::patternscale_a::Value( scaleA ), + uniforms::patternscale_b::Value( scaleB ), + uniforms::tex_y_a::Value( posA.y ), + uniforms::tex_y_b::Value( posB.y ), + uniforms::mix::Value( crossfade.t ), + uniforms::sdfgamma::Value( atlasWidth / (std::min(widthA, widthB) * 256.0f * pixelRatio) / 2.0f ) ); } @@ -103,9 +103,9 @@ LinePatternProgram::LayoutUniformValues LinePatternProgram::layoutUniformValues( tile, state, pixelsToGLUnits, - uniforms::u_scale::Value ({ {pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale} }), - uniforms::u_texsize::Value( atlasSize ), - uniforms::u_fade::Value( crossfade.t ) + uniforms::scale::Value ({ {pixelRatio, tileRatio, crossfade.fromScale, crossfade.toScale} }), + uniforms::texsize::Value( atlasSize ), + uniforms::fade::Value( crossfade.t ) ); } diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp index 05546e3cbe..9ec01bd3ac 100644 --- a/src/mbgl/programs/line_program.hpp +++ b/src/mbgl/programs/line_program.hpp @@ -17,27 +17,27 @@ class LinePatternPos; class ImagePosition; namespace uniforms { -MBGL_DEFINE_UNIFORM_SCALAR(float, u_ratio); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_tex_y_a); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_tex_y_b); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_sdfgamma); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_patternscale_a); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_patternscale_b); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_gl_units_to_pixels); +MBGL_DEFINE_UNIFORM_SCALAR(float, ratio); +MBGL_DEFINE_UNIFORM_SCALAR(float, tex_y_a); +MBGL_DEFINE_UNIFORM_SCALAR(float, tex_y_b); +MBGL_DEFINE_UNIFORM_SCALAR(float, sdfgamma); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, patternscale_a); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, patternscale_b); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, gl_units_to_pixels); } // namespace uniforms using LineLayoutAttributes = TypeList< - attributes::a_pos_normal, - attributes::a_data>; + attributes::pos_normal, + attributes::data>; class LineProgram : public Program< LineProgram, gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< - uniforms::u_matrix, - uniforms::u_ratio, - uniforms::u_gl_units_to_pixels>, + uniforms::matrix, + uniforms::ratio, + uniforms::gl_units_to_pixels>, TypeList<>, RenderLinePaintProperties> { @@ -101,14 +101,14 @@ class LinePatternProgram : public Program< gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< - uniforms::u_matrix, - uniforms::u_ratio, - uniforms::u_gl_units_to_pixels, - uniforms::u_scale, - uniforms::u_texsize, - uniforms::u_fade>, + uniforms::matrix, + uniforms::ratio, + uniforms::gl_units_to_pixels, + uniforms::scale, + uniforms::texsize, + uniforms::fade>, TypeList< - textures::u_image>, + textures::image>, RenderLinePaintProperties> { public: @@ -129,17 +129,17 @@ class LineSDFProgram : public Program< gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< - uniforms::u_matrix, - uniforms::u_ratio, - uniforms::u_gl_units_to_pixels, - uniforms::u_patternscale_a, - uniforms::u_patternscale_b, - uniforms::u_tex_y_a, - uniforms::u_tex_y_b, - uniforms::u_mix, - uniforms::u_sdfgamma>, + uniforms::matrix, + uniforms::ratio, + uniforms::gl_units_to_pixels, + uniforms::patternscale_a, + uniforms::patternscale_b, + uniforms::tex_y_a, + uniforms::tex_y_b, + uniforms::mix, + uniforms::sdfgamma>, TypeList< - textures::u_image>, + textures::image>, RenderLinePaintProperties> { public: @@ -162,11 +162,11 @@ class LineGradientProgram : public Program< gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< - uniforms::u_matrix, - uniforms::u_ratio, - uniforms::u_gl_units_to_pixels>, + uniforms::matrix, + uniforms::ratio, + uniforms::gl_units_to_pixels>, TypeList< - textures::u_image>, + textures::image>, RenderLinePaintProperties> { public: diff --git a/src/mbgl/programs/raster_program.hpp b/src/mbgl/programs/raster_program.hpp index 55f1fb0a2e..e84ada0bdc 100644 --- a/src/mbgl/programs/raster_program.hpp +++ b/src/mbgl/programs/raster_program.hpp @@ -10,38 +10,38 @@ namespace mbgl { namespace uniforms { -MBGL_DEFINE_UNIFORM_SCALAR(float, u_fade_t); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_buffer_scale); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_brightness_low); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_brightness_high); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_saturation_factor); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_contrast_factor); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_scale_parent); -MBGL_DEFINE_UNIFORM_VECTOR(float, 3, u_spin_weights); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_tl_parent); +MBGL_DEFINE_UNIFORM_SCALAR(float, fade_t); +MBGL_DEFINE_UNIFORM_SCALAR(float, buffer_scale); +MBGL_DEFINE_UNIFORM_SCALAR(float, brightness_low); +MBGL_DEFINE_UNIFORM_SCALAR(float, brightness_high); +MBGL_DEFINE_UNIFORM_SCALAR(float, saturation_factor); +MBGL_DEFINE_UNIFORM_SCALAR(float, contrast_factor); +MBGL_DEFINE_UNIFORM_SCALAR(float, scale_parent); +MBGL_DEFINE_UNIFORM_VECTOR(float, 3, spin_weights); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, tl_parent); } // namespace uniforms class RasterProgram : public Program< RasterProgram, gfx::PrimitiveType::Triangle, TypeList< - attributes::a_pos, - attributes::a_texture_pos>, + attributes::pos, + attributes::texture_pos>, TypeList< - uniforms::u_matrix, - uniforms::u_opacity, - uniforms::u_fade_t, - uniforms::u_brightness_low, - uniforms::u_brightness_high, - uniforms::u_saturation_factor, - uniforms::u_contrast_factor, - uniforms::u_spin_weights, - uniforms::u_buffer_scale, - uniforms::u_scale_parent, - uniforms::u_tl_parent>, + uniforms::matrix, + uniforms::opacity, + uniforms::fade_t, + uniforms::brightness_low, + uniforms::brightness_high, + uniforms::saturation_factor, + uniforms::contrast_factor, + uniforms::spin_weights, + uniforms::buffer_scale, + uniforms::scale_parent, + uniforms::tl_parent>, TypeList< - textures::u_image0, - textures::u_image1>, + textures::image0, + textures::image1>, style::RasterPaintProperties> { public: diff --git a/src/mbgl/programs/symbol_program.cpp b/src/mbgl/programs/symbol_program.cpp index 2300dedff3..0195506129 100644 --- a/src/mbgl/programs/symbol_program.cpp +++ b/src/mbgl/programs/symbol_program.cpp @@ -82,24 +82,24 @@ Values makeValues(const bool isText, mat4 glCoordMatrix = getGlCoordMatrix(tile.matrix, pitchWithMap, rotateWithMap, state, pixelsToTileUnits); return Values { - uniforms::u_matrix::Value( tile.translatedMatrix(values.translate, + uniforms::matrix::Value( tile.translatedMatrix(values.translate, values.translateAnchor, state) ), - uniforms::u_label_plane_matrix::Value(labelPlaneMatrix), - uniforms::u_gl_coord_matrix::Value( tile.translateVtxMatrix(glCoordMatrix, + uniforms::label_plane_matrix::Value(labelPlaneMatrix), + uniforms::gl_coord_matrix::Value( tile.translateVtxMatrix(glCoordMatrix, values.translate, values.translateAnchor, state, true) ), - uniforms::u_extrude_scale::Value( extrudeScale ), - uniforms::u_texsize::Value( texsize ), - uniforms::u_fade_change::Value( symbolFadeChange ), - uniforms::u_is_text::Value( isText ), - uniforms::u_camera_to_center_distance::Value( state.getCameraToCenterDistance() ), - uniforms::u_pitch::Value( state.getPitch() ), - uniforms::u_pitch_with_map::Value( pitchWithMap ), - uniforms::u_rotate_symbol::Value( rotateInShader ), - uniforms::u_aspect_ratio::Value( state.getSize().aspectRatio() ), + uniforms::extrude_scale::Value( extrudeScale ), + uniforms::texsize::Value( texsize ), + uniforms::fade_change::Value( symbolFadeChange ), + uniforms::is_text::Value( isText ), + uniforms::camera_to_center_distance::Value( state.getCameraToCenterDistance() ), + uniforms::pitch::Value( state.getPitch() ), + uniforms::pitch_with_map::Value( pitchWithMap ), + uniforms::rotate_symbol::Value( rotateInShader ), + uniforms::aspect_ratio::Value( state.getSize().aspectRatio() ), std::forward(args)... }; } @@ -149,8 +149,8 @@ SymbolSDFProgram::layoutUniformValues(const bool isText, tile, state, symbolFadeChange, - uniforms::u_gamma_scale::Value( gammaScale ), - uniforms::u_is_halo::Value( part == SymbolSDFPart::Halo ) + uniforms::gamma_scale::Value( gammaScale ), + uniforms::is_halo::Value( part == SymbolSDFPart::Halo ) ); } diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index d5fb153bbb..66e53647ef 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -28,27 +28,27 @@ class RenderTile; class TransformState; namespace uniforms { -MBGL_DEFINE_UNIFORM_MATRIX(double, 4, u_gl_coord_matrix); -MBGL_DEFINE_UNIFORM_MATRIX(double, 4, u_label_plane_matrix); -MBGL_DEFINE_UNIFORM_SCALAR(bool, u_is_halo); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_gamma_scale); - -MBGL_DEFINE_UNIFORM_SCALAR(bool, u_is_text); -MBGL_DEFINE_UNIFORM_SCALAR(bool, u_is_size_zoom_constant); -MBGL_DEFINE_UNIFORM_SCALAR(bool, u_is_size_feature_constant); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_size_t); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_size); -MBGL_DEFINE_UNIFORM_SCALAR(bool, u_rotate_symbol); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_aspect_ratio); +MBGL_DEFINE_UNIFORM_MATRIX(double, 4, gl_coord_matrix); +MBGL_DEFINE_UNIFORM_MATRIX(double, 4, label_plane_matrix); +MBGL_DEFINE_UNIFORM_SCALAR(bool, is_halo); +MBGL_DEFINE_UNIFORM_SCALAR(float, gamma_scale); + +MBGL_DEFINE_UNIFORM_SCALAR(bool, is_text); +MBGL_DEFINE_UNIFORM_SCALAR(bool, is_size_zoom_constant); +MBGL_DEFINE_UNIFORM_SCALAR(bool, is_size_feature_constant); +MBGL_DEFINE_UNIFORM_SCALAR(float, size_t); +MBGL_DEFINE_UNIFORM_SCALAR(float, size); +MBGL_DEFINE_UNIFORM_SCALAR(bool, rotate_symbol); +MBGL_DEFINE_UNIFORM_SCALAR(float, aspect_ratio); } // namespace uniforms using SymbolLayoutAttributes = TypeList< - attributes::a_pos_offset, - attributes::a_data>; + attributes::pos_offset, + attributes::data>; -using SymbolDynamicLayoutAttributes = TypeList; +using SymbolDynamicLayoutAttributes = TypeList; -using SymbolOpacityAttributes = TypeList; +using SymbolOpacityAttributes = TypeList; struct ZoomEvaluatedSize { bool isZoomConstant; @@ -66,10 +66,10 @@ public: virtual ~SymbolSizeBinder() = default; using UniformList = TypeList< - uniforms::u_is_size_zoom_constant, - uniforms::u_is_size_feature_constant, - uniforms::u_size_t, - uniforms::u_size>; + uniforms::is_size_zoom_constant, + uniforms::is_size_feature_constant, + uniforms::size_t, + uniforms::size>; using UniformValues = gfx::UniformValues; static std::unique_ptr create(const float tileZoom, @@ -82,10 +82,10 @@ public: UniformValues uniformValues(float currentZoom) const { const ZoomEvaluatedSize u = evaluateForZoom(currentZoom); return UniformValues { - uniforms::u_is_size_zoom_constant::Value( u.isZoomConstant ), - uniforms::u_is_size_feature_constant::Value( u.isFeatureConstant), - uniforms::u_size_t::Value( u.sizeT ), - uniforms::u_size::Value( u.size ) + uniforms::is_size_zoom_constant::Value( u.isZoomConstant ), + uniforms::is_size_feature_constant::Value( u.isFeatureConstant), + uniforms::size_t::Value( u.sizeT ), + uniforms::size::Value( u.size ) }; } }; @@ -347,20 +347,20 @@ class SymbolIconProgram : public SymbolProgram< gfx::PrimitiveType::Triangle, SymbolLayoutAttributes, TypeList< - uniforms::u_matrix, - uniforms::u_label_plane_matrix, - uniforms::u_gl_coord_matrix, - uniforms::u_extrude_scale, - uniforms::u_texsize, - uniforms::u_fade_change, - uniforms::u_is_text, - uniforms::u_camera_to_center_distance, - uniforms::u_pitch, - uniforms::u_pitch_with_map, - uniforms::u_rotate_symbol, - uniforms::u_aspect_ratio>, + uniforms::matrix, + uniforms::label_plane_matrix, + uniforms::gl_coord_matrix, + uniforms::extrude_scale, + uniforms::texsize, + uniforms::fade_change, + uniforms::is_text, + uniforms::camera_to_center_distance, + uniforms::pitch, + uniforms::pitch_with_map, + uniforms::rotate_symbol, + uniforms::aspect_ratio>, TypeList< - textures::u_texture>, + textures::texture>, style::IconPaintProperties> { public: @@ -387,22 +387,22 @@ class SymbolSDFProgram : public SymbolProgram< gfx::PrimitiveType::Triangle, SymbolLayoutAttributes, TypeList< - uniforms::u_matrix, - uniforms::u_label_plane_matrix, - uniforms::u_gl_coord_matrix, - uniforms::u_extrude_scale, - uniforms::u_texsize, - uniforms::u_fade_change, - uniforms::u_is_text, - uniforms::u_camera_to_center_distance, - uniforms::u_pitch, - uniforms::u_pitch_with_map, - uniforms::u_rotate_symbol, - uniforms::u_aspect_ratio, - uniforms::u_gamma_scale, - uniforms::u_is_halo>, + uniforms::matrix, + uniforms::label_plane_matrix, + uniforms::gl_coord_matrix, + uniforms::extrude_scale, + uniforms::texsize, + uniforms::fade_change, + uniforms::is_text, + uniforms::camera_to_center_distance, + uniforms::pitch, + uniforms::pitch_with_map, + uniforms::rotate_symbol, + uniforms::aspect_ratio, + uniforms::gamma_scale, + uniforms::is_halo>, TypeList< - textures::u_texture>, + textures::texture>, PaintProperties> { public: @@ -411,22 +411,22 @@ public: gfx::PrimitiveType::Triangle, SymbolLayoutAttributes, TypeList< - uniforms::u_matrix, - uniforms::u_label_plane_matrix, - uniforms::u_gl_coord_matrix, - uniforms::u_extrude_scale, - uniforms::u_texsize, - uniforms::u_fade_change, - uniforms::u_is_text, - uniforms::u_camera_to_center_distance, - uniforms::u_pitch, - uniforms::u_pitch_with_map, - uniforms::u_rotate_symbol, - uniforms::u_aspect_ratio, - uniforms::u_gamma_scale, - uniforms::u_is_halo>, + uniforms::matrix, + uniforms::label_plane_matrix, + uniforms::gl_coord_matrix, + uniforms::extrude_scale, + uniforms::texsize, + uniforms::fade_change, + uniforms::is_text, + uniforms::camera_to_center_distance, + uniforms::pitch, + uniforms::pitch_with_map, + uniforms::rotate_symbol, + uniforms::aspect_ratio, + uniforms::gamma_scale, + uniforms::is_halo>, TypeList< - textures::u_texture>, + textures::texture>, PaintProperties>; using LayoutUniformValues = typename BaseProgram::LayoutUniformValues; diff --git a/src/mbgl/programs/textures.hpp b/src/mbgl/programs/textures.hpp index 32bc4a4a35..4c9de53366 100644 --- a/src/mbgl/programs/textures.hpp +++ b/src/mbgl/programs/textures.hpp @@ -5,11 +5,11 @@ namespace mbgl { namespace textures { -MBGL_DEFINE_TEXTURE(u_image); -MBGL_DEFINE_TEXTURE(u_image0); -MBGL_DEFINE_TEXTURE(u_image1); -MBGL_DEFINE_TEXTURE(u_color_ramp); -MBGL_DEFINE_TEXTURE(u_texture); +MBGL_DEFINE_TEXTURE(image); +MBGL_DEFINE_TEXTURE(image0); +MBGL_DEFINE_TEXTURE(image1); +MBGL_DEFINE_TEXTURE(color_ramp); +MBGL_DEFINE_TEXTURE(texture); } // namespace textures } // namespace mbgl diff --git a/src/mbgl/programs/uniforms.hpp b/src/mbgl/programs/uniforms.hpp index 79febf7f73..702b21def9 100644 --- a/src/mbgl/programs/uniforms.hpp +++ b/src/mbgl/programs/uniforms.hpp @@ -9,61 +9,61 @@ namespace uniforms { // Uniforms common to several shaders. -MBGL_DEFINE_UNIFORM_MATRIX(double, 4, u_matrix); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_opacity); -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_color); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_blur); +MBGL_DEFINE_UNIFORM_MATRIX(double, 4, matrix); +MBGL_DEFINE_UNIFORM_SCALAR(float, opacity); +MBGL_DEFINE_UNIFORM_SCALAR(Color, color); +MBGL_DEFINE_UNIFORM_SCALAR(float, blur); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_zoom); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_collision_y_stretch); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_pitch); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_bearing); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_radius); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_width); -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_stroke_color); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_stroke_opacity); -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_fill_color); -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_halo_color); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_halo_width); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_halo_blur); -MBGL_DEFINE_UNIFORM_SCALAR(Color, u_outline_color); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_height); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_base); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_width); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_floorwidth); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_gapwidth); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_offset); -MBGL_DEFINE_UNIFORM_SCALAR(Size, u_world); -MBGL_DEFINE_UNIFORM_SCALAR(Size, u_texsize); -MBGL_DEFINE_UNIFORM_SCALAR(bool, u_pitch_with_map); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_camera_to_center_distance); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_fade); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_fade_change); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_weight); +MBGL_DEFINE_UNIFORM_SCALAR(float, zoom); +MBGL_DEFINE_UNIFORM_SCALAR(float, collision_y_stretch); +MBGL_DEFINE_UNIFORM_SCALAR(float, pitch); +MBGL_DEFINE_UNIFORM_SCALAR(float, bearing); +MBGL_DEFINE_UNIFORM_SCALAR(float, radius); +MBGL_DEFINE_UNIFORM_SCALAR(float, stroke_width); +MBGL_DEFINE_UNIFORM_SCALAR(Color, stroke_color); +MBGL_DEFINE_UNIFORM_SCALAR(float, stroke_opacity); +MBGL_DEFINE_UNIFORM_SCALAR(Color, fill_color); +MBGL_DEFINE_UNIFORM_SCALAR(Color, halo_color); +MBGL_DEFINE_UNIFORM_SCALAR(float, halo_width); +MBGL_DEFINE_UNIFORM_SCALAR(float, halo_blur); +MBGL_DEFINE_UNIFORM_SCALAR(Color, outline_color); +MBGL_DEFINE_UNIFORM_SCALAR(float, height); +MBGL_DEFINE_UNIFORM_SCALAR(float, base); +MBGL_DEFINE_UNIFORM_SCALAR(float, width); +MBGL_DEFINE_UNIFORM_SCALAR(float, floorwidth); +MBGL_DEFINE_UNIFORM_SCALAR(float, gapwidth); +MBGL_DEFINE_UNIFORM_SCALAR(float, offset); +MBGL_DEFINE_UNIFORM_SCALAR(Size, world); +MBGL_DEFINE_UNIFORM_SCALAR(Size, texsize); +MBGL_DEFINE_UNIFORM_SCALAR(bool, pitch_with_map); +MBGL_DEFINE_UNIFORM_SCALAR(float, camera_to_center_distance); +MBGL_DEFINE_UNIFORM_SCALAR(float, fade); +MBGL_DEFINE_UNIFORM_SCALAR(float, fade_change); +MBGL_DEFINE_UNIFORM_SCALAR(float, weight); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_extrude_scale); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, extrude_scale); namespace heatmap { -MBGL_DEFINE_UNIFORM_SCALAR(float, u_extrude_scale); +MBGL_DEFINE_UNIFORM_SCALAR(float, extrude_scale); } // namespace heatmap -MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 4, u_pattern_from); -MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 4, u_pattern_to); -MBGL_DEFINE_UNIFORM_VECTOR(float, 4, u_scale); -MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_pattern_tl_a); -MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_pattern_br_a); -MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_pattern_tl_b); -MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_pattern_br_b); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_pattern_size_a); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_pattern_size_b); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_pixel_coord_upper); -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_pixel_coord_lower); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 4, pattern_from); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 4, pattern_to); +MBGL_DEFINE_UNIFORM_VECTOR(float, 4, scale); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, pattern_tl_a); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, pattern_br_a); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, pattern_tl_b); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, pattern_br_b); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, pattern_size_a); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, pattern_size_b); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, pixel_coord_upper); +MBGL_DEFINE_UNIFORM_VECTOR(float, 2, pixel_coord_lower); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_mix); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_scale_a); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_scale_b); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_tile_units_to_pixels); -MBGL_DEFINE_UNIFORM_SCALAR(float, u_overscale_factor); +MBGL_DEFINE_UNIFORM_SCALAR(float, mix); +MBGL_DEFINE_UNIFORM_SCALAR(float, scale_a); +MBGL_DEFINE_UNIFORM_SCALAR(float, scale_b); +MBGL_DEFINE_UNIFORM_SCALAR(float, tile_units_to_pixels); +MBGL_DEFINE_UNIFORM_SCALAR(float, overscale_factor); } // namespace uniforms } // namespace mbgl diff --git a/src/mbgl/renderer/layers/render_background_layer.cpp b/src/mbgl/renderer/layers/render_background_layer.cpp index 68c792517c..269b227a7d 100644 --- a/src/mbgl/renderer/layers/render_background_layer.cpp +++ b/src/mbgl/renderer/layers/render_background_layer.cpp @@ -102,7 +102,7 @@ void RenderBackgroundLayer::render(PaintParameters& parameters, RenderSource*) { parameters.state ), BackgroundPatternProgram::TextureBindings{ - textures::u_image::Value{ parameters.imageManager.textureBinding(parameters.context) }, + textures::image::Value{ parameters.imageManager.textureBinding(parameters.context) }, } ); } @@ -111,9 +111,9 @@ void RenderBackgroundLayer::render(PaintParameters& parameters, RenderSource*) { draw( parameters.programs.getBackgroundLayerPrograms().background, BackgroundProgram::LayoutUniformValues { - uniforms::u_matrix::Value( parameters.matrixForTile(tileID) ), - uniforms::u_color::Value( evaluated.get() ), - uniforms::u_opacity::Value( evaluated.get() ), + uniforms::matrix::Value( parameters.matrixForTile(tileID) ), + uniforms::color::Value( evaluated.get() ), + uniforms::opacity::Value( evaluated.get() ), }, BackgroundProgram::TextureBindings{} ); diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 2cc0d2e329..9b463e6a6f 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -69,19 +69,19 @@ void RenderCircleLayer::render(PaintParameters& parameters, RenderSource*) { const auto allUniformValues = programInstance.computeAllUniformValues( CircleProgram::LayoutUniformValues { - uniforms::u_matrix::Value( + uniforms::matrix::Value( tile.translatedMatrix(evaluated.get(), evaluated.get(), parameters.state) ), - uniforms::u_scale_with_map::Value( scaleWithMap ), - uniforms::u_extrude_scale::Value( pitchWithMap + uniforms::scale_with_map::Value( scaleWithMap ), + uniforms::extrude_scale::Value( pitchWithMap ? std::array {{ tile.id.pixelsToTileUnits(1, parameters.state.getZoom()), tile.id.pixelsToTileUnits(1, parameters.state.getZoom()) }} : parameters.pixelsToGLUnits ), - uniforms::u_camera_to_center_distance::Value( parameters.state.getCameraToCenterDistance() ), - uniforms::u_pitch_with_map::Value( pitchWithMap ) + uniforms::camera_to_center_distance::Value( parameters.state.getCameraToCenterDistance() ), + uniforms::pitch_with_map::Value( pitchWithMap ) }, paintPropertyBinders, evaluated, diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index a8c9f7a1c4..0d0c9034e1 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -163,7 +163,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* patternPosA, patternPosB, FillExtrusionPatternProgram::TextureBindings{ - textures::u_image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, } ); } @@ -182,9 +182,9 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* const auto allUniformValues = programInstance.computeAllUniformValues( ExtrusionTextureProgram::LayoutUniformValues{ - uniforms::u_matrix::Value( viewportMat ), - uniforms::u_world::Value( size ), - uniforms::u_opacity::Value( evaluated.get() ) + uniforms::matrix::Value( viewportMat ), + uniforms::world::Value( size ), + uniforms::opacity::Value( evaluated.get() ) }, paintAttributeData, properties, @@ -210,7 +210,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* allUniformValues, allAttributeBindings, ExtrusionTextureProgram::TextureBindings{ - textures::u_image::Value{ *renderTexture->getTexture().resource }, + textures::image::Value{ *renderTexture->getTexture().resource }, }, getID()); } diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index b11c2d23b6..2c6f1127f2 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -86,12 +86,12 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { const auto allUniformValues = programInstance.computeAllUniformValues( FillProgram::LayoutUniformValues { - uniforms::u_matrix::Value( + uniforms::matrix::Value( tile.translatedMatrix(evaluated.get(), evaluated.get(), parameters.state) ), - uniforms::u_world::Value( glContext.viewport.getCurrentValue().size ), + uniforms::world::Value( glContext.viewport.getCurrentValue().size ), }, paintPropertyBinders, evaluated, @@ -219,7 +219,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { *bucket.triangleIndexBuffer, bucket.triangleSegments, FillPatternProgram::TextureBindings{ - textures::u_image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, }); if (evaluated.get() && unevaluated.get().isUndefined()) { @@ -229,7 +229,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { *bucket.lineIndexBuffer, bucket.lineSegments, FillOutlinePatternProgram::TextureBindings{ - textures::u_image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, }); } } diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index 8ec6f7707b..a8d25df818 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -106,9 +106,9 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { const auto allUniformValues = programInstance.computeAllUniformValues( HeatmapProgram::LayoutUniformValues { - uniforms::u_intensity::Value( evaluated.get() ), - uniforms::u_matrix::Value( tile.matrix ), - uniforms::heatmap::u_extrude_scale::Value( extrudeScale ) + uniforms::intensity::Value( evaluated.get() ), + uniforms::matrix::Value( tile.matrix ), + uniforms::heatmap::extrude_scale::Value( extrudeScale ) }, paintPropertyBinders, evaluated, @@ -151,9 +151,9 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { const auto allUniformValues = programInstance.computeAllUniformValues( HeatmapTextureProgram::LayoutUniformValues{ - uniforms::u_matrix::Value( viewportMat ), - uniforms::u_world::Value( size ), - uniforms::u_opacity::Value( evaluated.get() ) + uniforms::matrix::Value( viewportMat ), + uniforms::world::Value( size ), + uniforms::opacity::Value( evaluated.get() ) }, paintAttributeData, properties, @@ -179,8 +179,8 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { allUniformValues, allAttributeBindings, HeatmapTextureProgram::TextureBindings{ - textures::u_image::Value{ *renderTexture->getTexture().resource, gfx::TextureFilterType::Linear }, - textures::u_color_ramp::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *renderTexture->getTexture().resource, gfx::TextureFilterType::Linear }, + textures::color_ramp::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear }, }, getID() ); diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index ff1def3d9a..1d030f5946 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -76,12 +76,12 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src const auto allUniformValues = programInstance.computeAllUniformValues( HillshadeProgram::LayoutUniformValues { - uniforms::u_matrix::Value( matrix ), - uniforms::u_highlight::Value( evaluated.get() ), - uniforms::u_shadow::Value( evaluated.get() ), - uniforms::u_accent::Value( evaluated.get() ), - uniforms::u_light::Value( getLight(parameters) ), - uniforms::u_latrange::Value( getLatRange(id) ), + uniforms::matrix::Value( matrix ), + uniforms::highlight::Value( evaluated.get() ), + uniforms::shadow::Value( evaluated.get() ), + uniforms::accent::Value( evaluated.get() ), + uniforms::light::Value( getLight(parameters) ), + uniforms::latrange::Value( getLatRange(id) ), }, paintAttributeData, evaluated, @@ -140,10 +140,10 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src const auto allUniformValues = programInstance.computeAllUniformValues( HillshadePrepareProgram::LayoutUniformValues { - uniforms::u_matrix::Value( mat ), - uniforms::u_dimension::Value( {{stride, stride}} ), - uniforms::u_zoom::Value( float(tile.id.canonical.z) ), - uniforms::u_maxzoom::Value( float(maxzoom) ), + uniforms::matrix::Value( mat ), + uniforms::dimension::Value( {{stride, stride}} ), + uniforms::zoom::Value( float(tile.id.canonical.z) ), + uniforms::maxzoom::Value( float(maxzoom) ), }, paintAttributeData, properties, @@ -169,7 +169,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src allUniformValues, allAttributeBindings, HillshadePrepareProgram::TextureBindings{ - textures::u_image::Value{ *bucket.dem->resource }, + textures::image::Value{ *bucket.dem->resource }, }, getID() ); @@ -186,7 +186,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src bucket.segments, tile.id, HillshadeProgram::TextureBindings{ - textures::u_image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear }, }); } else { // Draw the full tile. @@ -196,7 +196,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src parameters.staticData.rasterSegments, tile.id, HillshadeProgram::TextureBindings{ - textures::u_image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *bucket.texture->resource, gfx::TextureFilterType::Linear }, }); } } diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index b52c28e6c6..60c487c205 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -147,7 +147,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) { *posA, *posB, LinePatternProgram::TextureBindings{ - textures::u_image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, }); } else if (!unevaluated.get().getValue().isUndefined()) { if (!colorRampTexture) { @@ -163,7 +163,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) { {}, {}, LineGradientProgram::TextureBindings{ - textures::u_image::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear }, + textures::image::Value{ *colorRampTexture->resource, gfx::TextureFilterType::Linear }, }); } else { draw(parameters.programs.getLineLayerPrograms().line, diff --git a/src/mbgl/renderer/layers/render_line_layer.hpp b/src/mbgl/renderer/layers/render_line_layer.hpp index 186b740234..2f76274691 100644 --- a/src/mbgl/renderer/layers/render_line_layer.hpp +++ b/src/mbgl/renderer/layers/render_line_layer.hpp @@ -10,7 +10,7 @@ namespace mbgl { -struct LineFloorwidth : style::DataDrivenPaintProperty { +struct LineFloorwidth : style::DataDrivenPaintProperty { using EvaluatorType = DataDrivenPropertyEvaluator; static float defaultValue() { return 1.0; } }; diff --git a/src/mbgl/renderer/layers/render_raster_layer.cpp b/src/mbgl/renderer/layers/render_raster_layer.cpp index c237cfe317..94c4a8dc42 100644 --- a/src/mbgl/renderer/layers/render_raster_layer.cpp +++ b/src/mbgl/renderer/layers/render_raster_layer.cpp @@ -84,17 +84,17 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source const auto allUniformValues = programInstance.computeAllUniformValues( RasterProgram::LayoutUniformValues { - uniforms::u_matrix::Value( matrix ), - uniforms::u_opacity::Value( evaluated.get() ), - uniforms::u_fade_t::Value( 1 ), - uniforms::u_brightness_low::Value( evaluated.get() ), - uniforms::u_brightness_high::Value( evaluated.get() ), - uniforms::u_saturation_factor::Value( saturationFactor(evaluated.get()) ), - uniforms::u_contrast_factor::Value( contrastFactor(evaluated.get()) ), - uniforms::u_spin_weights::Value( spinWeights(evaluated.get()) ), - uniforms::u_buffer_scale::Value( 1.0f ), - uniforms::u_scale_parent::Value( 1.0f ), - uniforms::u_tl_parent::Value( std::array {{ 0.0f, 0.0f }} ), + uniforms::matrix::Value( matrix ), + uniforms::opacity::Value( evaluated.get() ), + uniforms::fade_t::Value( 1 ), + uniforms::brightness_low::Value( evaluated.get() ), + uniforms::brightness_high::Value( evaluated.get() ), + uniforms::saturation_factor::Value( saturationFactor(evaluated.get()) ), + uniforms::contrast_factor::Value( contrastFactor(evaluated.get()) ), + uniforms::spin_weights::Value( spinWeights(evaluated.get()) ), + uniforms::buffer_scale::Value( 1.0f ), + uniforms::scale_parent::Value( 1.0f ), + uniforms::tl_parent::Value( std::array {{ 0.0f, 0.0f }} ), }, paintAttributeData, evaluated, @@ -137,8 +137,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source *bucket.indexBuffer, bucket.segments, RasterProgram::TextureBindings{ - textures::u_image0::Value{ *bucket.texture->resource, filter }, - textures::u_image1::Value{ *bucket.texture->resource, filter }, + textures::image0::Value{ *bucket.texture->resource, filter }, + textures::image1::Value{ *bucket.texture->resource, filter }, }); } } @@ -161,8 +161,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source *bucket.indexBuffer, bucket.segments, RasterProgram::TextureBindings{ - textures::u_image0::Value{ *bucket.texture->resource, filter }, - textures::u_image1::Value{ *bucket.texture->resource, filter }, + textures::image0::Value{ *bucket.texture->resource, filter }, + textures::image1::Value{ *bucket.texture->resource, filter }, }); } else { // Draw the full tile. @@ -171,8 +171,8 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source parameters.staticData.quadTriangleIndexBuffer, parameters.staticData.rasterSegments, RasterProgram::TextureBindings{ - textures::u_image0::Value{ *bucket.texture->resource, filter }, - textures::u_image1::Value{ *bucket.texture->resource, filter }, + textures::image0::Value{ *bucket.texture->resource, filter }, + textures::image1::Value{ *bucket.texture->resource, filter }, }); } } diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index fc05439010..5fbc81663c 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -279,9 +279,9 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { parameters.colorModeForRenderPass(), gfx::CullFaceMode::disabled(), CollisionBoxProgram::LayoutUniformValues { - uniforms::u_matrix::Value( tile.matrix ), - uniforms::u_extrude_scale::Value( extrudeScale ), - uniforms::u_camera_to_center_distance::Value( parameters.state.getCameraToCenterDistance() ) + uniforms::matrix::Value( tile.matrix ), + uniforms::extrude_scale::Value( extrudeScale ), + uniforms::camera_to_center_distance::Value( parameters.state.getCameraToCenterDistance() ) }, *bucket.collisionBox.vertexBuffer, *bucket.collisionBox.dynamicVertexBuffer, @@ -315,10 +315,10 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { parameters.colorModeForRenderPass(), gfx::CullFaceMode::disabled(), CollisionCircleProgram::LayoutUniformValues { - uniforms::u_matrix::Value( tile.matrix ), - uniforms::u_extrude_scale::Value( extrudeScale ), - uniforms::u_overscale_factor::Value( float(tile.tile.id.overscaleFactor()) ), - uniforms::u_camera_to_center_distance::Value( parameters.state.getCameraToCenterDistance() ) + uniforms::matrix::Value( tile.matrix ), + uniforms::extrude_scale::Value( extrudeScale ), + uniforms::overscale_factor::Value( float(tile.tile.id.overscaleFactor()) ), + uniforms::camera_to_center_distance::Value( parameters.state.getCameraToCenterDistance() ) }, *bucket.collisionCircle.vertexBuffer, *bucket.collisionCircle.dynamicVertexBuffer, diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index a014b36ece..6c2c07950d 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -432,15 +432,15 @@ PaintPropertyBinder::create(c template struct ZoomInterpolatedAttribute { - static auto name() { return Attr::name(); } + static auto attributeName() { return Attr::attributeName(); } using Type = ZoomInterpolatedAttributeType; }; template struct InterpolationUniform { using Value = float; - static auto name() { - static const std::string name = Attr::name() + std::string("_t"); + static auto uniformName() { + static const std::string name = Attr::attributeName() + std::string("_t"); return name.c_str(); } }; @@ -553,7 +553,7 @@ public: struct UniformDefines> { static void appendDefines(std::vector& defines) { util::ignore({ - (defines.push_back(std::string("#define HAS_UNIFORM_") + Us::name()), 0)... + (defines.push_back(std::string("#define HAS_UNIFORM_") + Us::uniformName()), 0)... }); } }; diff --git a/src/mbgl/renderer/render_tile.cpp b/src/mbgl/renderer/render_tile.cpp index 8490b41d37..745a577683 100644 --- a/src/mbgl/renderer/render_tile.cpp +++ b/src/mbgl/renderer/render_tile.cpp @@ -105,8 +105,8 @@ void RenderTile::finishRender(PaintParameters& parameters) { tile.debugBucket->segments, program.computeAllUniformValues( DebugProgram::LayoutUniformValues { - uniforms::u_matrix::Value( matrix ), - uniforms::u_color::Value( Color::white() ) + uniforms::matrix::Value( matrix ), + uniforms::color::Value( Color::white() ) }, paintAttributeData, properties, @@ -128,8 +128,8 @@ void RenderTile::finishRender(PaintParameters& parameters) { tile.debugBucket->segments, program.computeAllUniformValues( DebugProgram::LayoutUniformValues { - uniforms::u_matrix::Value( matrix ), - uniforms::u_color::Value( Color::black() ) + uniforms::matrix::Value( matrix ), + uniforms::color::Value( Color::black() ) }, paintAttributeData, properties, @@ -153,8 +153,8 @@ void RenderTile::finishRender(PaintParameters& parameters) { parameters.staticData.tileBorderSegments, program.computeAllUniformValues( DebugProgram::LayoutUniformValues { - uniforms::u_matrix::Value( matrix ), - uniforms::u_color::Value( Color::red() ) + uniforms::matrix::Value( matrix ), + uniforms::color::Value( Color::red() ) }, paintAttributeData, properties, diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index d12cb00de0..dee42a6128 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -466,7 +466,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { parameters.staticData.tileTriangleSegments, program.computeAllUniformValues( ClippingMaskProgram::LayoutUniformValues { - uniforms::u_matrix::Value( parameters.matrixForTile(clipID.first) ), + uniforms::matrix::Value( parameters.matrixForTile(clipID.first) ), }, paintAttributeData, properties, diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp index 5bb520be78..dee3eab750 100644 --- a/src/mbgl/renderer/sources/render_image_source.cpp +++ b/src/mbgl/renderer/sources/render_image_source.cpp @@ -73,8 +73,8 @@ void RenderImageSource::finishRender(PaintParameters& parameters) { parameters.staticData.tileBorderSegments, programInstance.computeAllUniformValues( DebugProgram::LayoutUniformValues { - uniforms::u_matrix::Value( matrix ), - uniforms::u_color::Value( Color::red() ) + uniforms::matrix::Value( matrix ), + uniforms::color::Value( Color::red() ) }, paintAttributeData, properties, diff --git a/src/mbgl/style/layers/circle_layer_properties.hpp b/src/mbgl/style/layers/circle_layer_properties.hpp index bc0c961e75..57caba9e3a 100644 --- a/src/mbgl/style/layers/circle_layer_properties.hpp +++ b/src/mbgl/style/layers/circle_layer_properties.hpp @@ -12,19 +12,19 @@ namespace mbgl { namespace style { -struct CircleRadius : DataDrivenPaintProperty { +struct CircleRadius : DataDrivenPaintProperty { static float defaultValue() { return 5; } }; -struct CircleColor : DataDrivenPaintProperty { +struct CircleColor : DataDrivenPaintProperty { static Color defaultValue() { return Color::black(); } }; -struct CircleBlur : DataDrivenPaintProperty { +struct CircleBlur : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; -struct CircleOpacity : DataDrivenPaintProperty { +struct CircleOpacity : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; @@ -44,15 +44,15 @@ struct CirclePitchAlignment : PaintProperty { static AlignmentType defaultValue() { return AlignmentType::Viewport; } }; -struct CircleStrokeWidth : DataDrivenPaintProperty { +struct CircleStrokeWidth : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; -struct CircleStrokeColor : DataDrivenPaintProperty { +struct CircleStrokeColor : DataDrivenPaintProperty { static Color defaultValue() { return Color::black(); } }; -struct CircleStrokeOpacity : DataDrivenPaintProperty { +struct CircleStrokeOpacity : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; diff --git a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp index 20cba699fe..a7799eee22 100644 --- a/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_extrusion_layer_properties.hpp @@ -16,7 +16,7 @@ struct FillExtrusionOpacity : PaintProperty { static float defaultValue() { return 1; } }; -struct FillExtrusionColor : DataDrivenPaintProperty { +struct FillExtrusionColor : DataDrivenPaintProperty { static Color defaultValue() { return Color::black(); } }; @@ -28,15 +28,15 @@ struct FillExtrusionTranslateAnchor : PaintProperty { static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; -struct FillExtrusionPattern : CrossFadedDataDrivenPaintProperty { +struct FillExtrusionPattern : CrossFadedDataDrivenPaintProperty { static std::string defaultValue() { return ""; } }; -struct FillExtrusionHeight : DataDrivenPaintProperty { +struct FillExtrusionHeight : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; -struct FillExtrusionBase : DataDrivenPaintProperty { +struct FillExtrusionBase : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; diff --git a/src/mbgl/style/layers/fill_layer_properties.hpp b/src/mbgl/style/layers/fill_layer_properties.hpp index a20089ff2e..942733f2e1 100644 --- a/src/mbgl/style/layers/fill_layer_properties.hpp +++ b/src/mbgl/style/layers/fill_layer_properties.hpp @@ -16,15 +16,15 @@ struct FillAntialias : PaintProperty { static bool defaultValue() { return true; } }; -struct FillOpacity : DataDrivenPaintProperty { +struct FillOpacity : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; -struct FillColor : DataDrivenPaintProperty { +struct FillColor : DataDrivenPaintProperty { static Color defaultValue() { return Color::black(); } }; -struct FillOutlineColor : DataDrivenPaintProperty { +struct FillOutlineColor : DataDrivenPaintProperty { static Color defaultValue() { return {}; } }; @@ -36,7 +36,7 @@ struct FillTranslateAnchor : PaintProperty { static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; -struct FillPattern : CrossFadedDataDrivenPaintProperty { +struct FillPattern : CrossFadedDataDrivenPaintProperty { static std::string defaultValue() { return ""; } }; diff --git a/src/mbgl/style/layers/heatmap_layer_properties.hpp b/src/mbgl/style/layers/heatmap_layer_properties.hpp index 4d49a52c72..ce00217b2e 100644 --- a/src/mbgl/style/layers/heatmap_layer_properties.hpp +++ b/src/mbgl/style/layers/heatmap_layer_properties.hpp @@ -12,11 +12,11 @@ namespace mbgl { namespace style { -struct HeatmapRadius : DataDrivenPaintProperty { +struct HeatmapRadius : DataDrivenPaintProperty { static float defaultValue() { return 30; } }; -struct HeatmapWeight : DataDrivenPaintProperty { +struct HeatmapWeight : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; diff --git a/src/mbgl/style/layers/line_layer_properties.hpp b/src/mbgl/style/layers/line_layer_properties.hpp index bab6e77ce5..208c2d142f 100644 --- a/src/mbgl/style/layers/line_layer_properties.hpp +++ b/src/mbgl/style/layers/line_layer_properties.hpp @@ -32,11 +32,11 @@ struct LineRoundLimit : LayoutProperty { static float defaultValue() { return 1; } }; -struct LineOpacity : DataDrivenPaintProperty { +struct LineOpacity : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; -struct LineColor : DataDrivenPaintProperty { +struct LineColor : DataDrivenPaintProperty { static Color defaultValue() { return Color::black(); } }; @@ -48,19 +48,19 @@ struct LineTranslateAnchor : PaintProperty { static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; -struct LineWidth : DataDrivenPaintProperty { +struct LineWidth : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; -struct LineGapWidth : DataDrivenPaintProperty { +struct LineGapWidth : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; -struct LineOffset : DataDrivenPaintProperty { +struct LineOffset : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; -struct LineBlur : DataDrivenPaintProperty { +struct LineBlur : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; @@ -68,7 +68,7 @@ struct LineDasharray : CrossFadedPaintProperty> { static std::vector defaultValue() { return { }; } }; -struct LinePattern : CrossFadedDataDrivenPaintProperty { +struct LinePattern : CrossFadedDataDrivenPaintProperty { static std::string defaultValue() { return ""; } }; diff --git a/src/mbgl/style/layers/symbol_layer_properties.hpp b/src/mbgl/style/layers/symbol_layer_properties.hpp index c352ab8e77..8645823cac 100644 --- a/src/mbgl/style/layers/symbol_layer_properties.hpp +++ b/src/mbgl/style/layers/symbol_layer_properties.hpp @@ -197,23 +197,23 @@ struct TextOptional : LayoutProperty { static bool defaultValue() { return false; } }; -struct IconOpacity : DataDrivenPaintProperty { +struct IconOpacity : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; -struct IconColor : DataDrivenPaintProperty { +struct IconColor : DataDrivenPaintProperty { static Color defaultValue() { return Color::black(); } }; -struct IconHaloColor : DataDrivenPaintProperty { +struct IconHaloColor : DataDrivenPaintProperty { static Color defaultValue() { return {}; } }; -struct IconHaloWidth : DataDrivenPaintProperty { +struct IconHaloWidth : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; -struct IconHaloBlur : DataDrivenPaintProperty { +struct IconHaloBlur : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; @@ -225,26 +225,26 @@ struct IconTranslateAnchor : PaintProperty { static TranslateAnchorType defaultValue() { return TranslateAnchorType::Map; } }; -struct TextOpacity : DataDrivenPaintProperty { +struct TextOpacity : DataDrivenPaintProperty { static float defaultValue() { return 1; } }; -struct TextColor : DataDrivenPaintProperty { +struct TextColor : DataDrivenPaintProperty { static Color defaultValue() { return Color::black(); } static constexpr const char *name() { return "text-color"; } static constexpr auto expressionType() { return expression::type::ColorType{}; }; template static bool hasOverride(const T& t) { return !!t.textColor; }; }; -struct TextHaloColor : DataDrivenPaintProperty { +struct TextHaloColor : DataDrivenPaintProperty { static Color defaultValue() { return {}; } }; -struct TextHaloWidth : DataDrivenPaintProperty { +struct TextHaloWidth : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; -struct TextHaloBlur : DataDrivenPaintProperty { +struct TextHaloBlur : DataDrivenPaintProperty { static float defaultValue() { return 0; } }; diff --git a/test/programs/symbol_program.test.cpp b/test/programs/symbol_program.test.cpp index 4d30e5dc3d..28d734c21a 100644 --- a/test/programs/symbol_program.test.cpp +++ b/test/programs/symbol_program.test.cpp @@ -9,9 +9,9 @@ using namespace mbgl::style::expression::dsl; TEST(SymbolProgram, SymbolSizeBinder) { auto binder = SymbolSizeBinder::create(5.0f, 12.0f, 0.0f); auto uniformValues = binder->uniformValues(5.5f); - EXPECT_EQ(uniformValues.get(), true); - EXPECT_EQ(uniformValues.get(), true); - EXPECT_EQ(uniformValues.get(), 12.0f); + EXPECT_EQ(uniformValues.get(), true); + EXPECT_EQ(uniformValues.get(), true); + EXPECT_EQ(uniformValues.get(), 12.0f); binder = SymbolSizeBinder::create(1.0f, style::PropertyExpression( interpolate( @@ -20,9 +20,9 @@ TEST(SymbolProgram, SymbolSizeBinder) { 0., literal(8.), 10., literal(18.))), 0.0f); uniformValues = binder->uniformValues(1.5f); - EXPECT_EQ(uniformValues.get(), false); - EXPECT_EQ(uniformValues.get(), true); - EXPECT_EQ(uniformValues.get(), 9.5f); + EXPECT_EQ(uniformValues.get(), false); + EXPECT_EQ(uniformValues.get(), true); + EXPECT_EQ(uniformValues.get(), 9.5f); binder = SymbolSizeBinder::create(0.0f, style::PropertyExpression( interpolate( @@ -31,9 +31,9 @@ TEST(SymbolProgram, SymbolSizeBinder) { 1., literal(8.), 11., literal(18.))), 0.0f); uniformValues = binder->uniformValues(0.5f); - EXPECT_EQ(uniformValues.get(), false); - EXPECT_EQ(uniformValues.get(), true); - EXPECT_EQ(uniformValues.get(), 8.0f); + EXPECT_EQ(uniformValues.get(), false); + EXPECT_EQ(uniformValues.get(), true); + EXPECT_EQ(uniformValues.get(), 8.0f); binder = SymbolSizeBinder::create(12.0f, style::PropertyExpression( interpolate( @@ -42,9 +42,9 @@ TEST(SymbolProgram, SymbolSizeBinder) { 1., literal(8.), 11., literal(18.))), 0.0f); uniformValues = binder->uniformValues(12.5f); - EXPECT_EQ(uniformValues.get(), false); - EXPECT_EQ(uniformValues.get(), true); - EXPECT_EQ(uniformValues.get(), 18.0f); + EXPECT_EQ(uniformValues.get(), false); + EXPECT_EQ(uniformValues.get(), true); + EXPECT_EQ(uniformValues.get(), 18.0f); binder = SymbolSizeBinder::create(0.0f, style::PropertyExpression( interpolate( @@ -53,8 +53,8 @@ TEST(SymbolProgram, SymbolSizeBinder) { 1., literal(8.), 11., literal(18.))), 0.0f); uniformValues = binder->uniformValues(12.5f); - EXPECT_EQ(uniformValues.get(), true); - EXPECT_EQ(uniformValues.get(), false); + EXPECT_EQ(uniformValues.get(), true); + EXPECT_EQ(uniformValues.get(), false); binder = SymbolSizeBinder::create(5.0f, style::PropertyExpression( interpolate( @@ -63,7 +63,7 @@ TEST(SymbolProgram, SymbolSizeBinder) { 1., interpolate(linear(), number(get("x")), 0., literal(8.), 100., literal(18.)), 11., interpolate(linear(), number(get("x")), 0., literal(12.), 100., literal(24.9)))), 0.0f); uniformValues = binder->uniformValues(5.5f); - EXPECT_EQ(uniformValues.get(), false); - EXPECT_EQ(uniformValues.get(), false); - EXPECT_EQ(uniformValues.get(), 0.45f); + EXPECT_EQ(uniformValues.get(), false); + EXPECT_EQ(uniformValues.get(), false); + EXPECT_EQ(uniformValues.get(), 0.45f); } -- cgit v1.2.1 From 53ab65d81165daf4e23ce28fa0e42861724ea687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 19 Mar 2019 14:02:10 +0100 Subject: [core] use constexpr string concatenation for uniform/attribute names --- scripts/generate-shaders.js | 5 + src/core-files.json | 1 + src/mbgl/gfx/attribute.hpp | 4 +- src/mbgl/gfx/texture.hpp | 4 +- src/mbgl/gfx/uniform.hpp | 12 +- src/mbgl/gl/attribute.hpp | 11 +- src/mbgl/gl/texture.hpp | 10 +- src/mbgl/gl/uniform.hpp | 11 +- src/mbgl/programs/attributes.hpp | 4 +- src/mbgl/programs/gl/circle.cpp | 28 +- src/mbgl/programs/gl/fill.cpp | 8 +- src/mbgl/programs/gl/fill_extrusion.cpp | 12 +- src/mbgl/programs/gl/fill_extrusion_pattern.cpp | 12 +- src/mbgl/programs/gl/fill_outline.cpp | 8 +- src/mbgl/programs/gl/fill_outline_pattern.cpp | 8 +- src/mbgl/programs/gl/fill_pattern.cpp | 8 +- src/mbgl/programs/gl/heatmap.cpp | 8 +- src/mbgl/programs/gl/line.cpp | 24 +- src/mbgl/programs/gl/line_gradient.cpp | 20 +- src/mbgl/programs/gl/line_pattern.cpp | 24 +- src/mbgl/programs/gl/line_sdf.cpp | 28 +- src/mbgl/programs/gl/shader_source.cpp | 778 ++++++++++++------------ src/mbgl/programs/gl/symbol_icon.cpp | 4 +- src/mbgl/programs/gl/symbol_sdf_icon.cpp | 20 +- src/mbgl/programs/gl/symbol_sdf_text.cpp | 20 +- src/mbgl/renderer/paint_property_binder.hpp | 15 +- src/mbgl/util/literal.hpp | 67 ++ 27 files changed, 621 insertions(+), 533 deletions(-) create mode 100644 src/mbgl/util/literal.hpp diff --git a/scripts/generate-shaders.js b/scripts/generate-shaders.js index 59544d0b34..4f58608e20 100755 --- a/scripts/generate-shaders.js +++ b/scripts/generate-shaders.js @@ -23,6 +23,11 @@ function basicMinify(src) { } for (const key in shaders) { + // Rename a_*_t uniforms to u_*_t. This is a workaround until we can use + // https://github.com/mapbox/mapbox-gl-js/pull/8055, which is blocked by + // https://github.com/mapbox/mapbox-gl-native/issues/13984 + shaders[key].vertexSource = shaders[key].vertexSource.replace(/\ba_(\w+)_t\b/mg, 'u_$1_t'); + const vertex = concatenated.length; concatenated += basicMinify(shaders[key].vertexSource); concatenated += '\n\0'; diff --git a/src/core-files.json b/src/core-files.json index 272faaf9b6..153a965567 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -744,6 +744,7 @@ "mbgl/util/i18n.hpp": "src/mbgl/util/i18n.hpp", "mbgl/util/intersection_tests.hpp": "src/mbgl/util/intersection_tests.hpp", "mbgl/util/io.hpp": "src/mbgl/util/io.hpp", + "mbgl/util/literal.hpp": "src/mbgl/util/literal.hpp", "mbgl/util/longest_common_subsequence.hpp": "src/mbgl/util/longest_common_subsequence.hpp", "mbgl/util/mapbox.hpp": "src/mbgl/util/mapbox.hpp", "mbgl/util/mat2.hpp": "src/mbgl/util/mat2.hpp", diff --git a/src/mbgl/gfx/attribute.hpp b/src/mbgl/gfx/attribute.hpp index aff27d9c1d..f5188ccfdb 100644 --- a/src/mbgl/gfx/attribute.hpp +++ b/src/mbgl/gfx/attribute.hpp @@ -14,8 +14,8 @@ #define MBGL_DEFINE_ATTRIBUTE(type_, n_, name_) \ struct name_ { \ using Type = ::mbgl::gfx::AttributeType; \ - static auto attributeName() { \ - return "a_" #name_; \ + static constexpr auto name() { \ + return #name_; \ } \ } diff --git a/src/mbgl/gfx/texture.hpp b/src/mbgl/gfx/texture.hpp index 05f98686a1..a957c4ebdf 100644 --- a/src/mbgl/gfx/texture.hpp +++ b/src/mbgl/gfx/texture.hpp @@ -10,8 +10,8 @@ #define MBGL_DEFINE_TEXTURE(name_) \ struct name_ { \ using Value = ::mbgl::gfx::TextureBinding; \ - static constexpr auto uniformName() { \ - return "u_" #name_; \ + static constexpr auto name() { \ + return #name_; \ } \ } diff --git a/src/mbgl/gfx/uniform.hpp b/src/mbgl/gfx/uniform.hpp index 44cfe35510..f6896b9138 100644 --- a/src/mbgl/gfx/uniform.hpp +++ b/src/mbgl/gfx/uniform.hpp @@ -8,24 +8,24 @@ #define MBGL_DEFINE_UNIFORM_SCALAR(type_, name_) \ struct name_ { \ using Value = type_; \ - static constexpr auto uniformName() { \ - return "u_" #name_; \ + static constexpr auto name() { \ + return #name_; \ } \ } #define MBGL_DEFINE_UNIFORM_VECTOR(type_, n_, name_) \ struct name_ { \ using Value = std::array; \ - static constexpr auto uniformName() { \ - return "u_" #name_; \ + static constexpr auto name() { \ + return #name_; \ } \ } #define MBGL_DEFINE_UNIFORM_MATRIX(type_, n_, name_) \ struct name_ { \ using Value = std::array; \ - static constexpr auto uniformName() { \ - return "u_" #name_; \ + static constexpr auto name() { \ + return #name_; \ } \ } diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index 32493d207a..62c89178cd 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -50,13 +51,15 @@ public: } }; - return Locations{ maybeBindLocation(As::attributeName())... }; + return Locations{ maybeBindLocation( + concat_literals<&string_literal<'a', '_'>::value, &As::name>::value())... }; }()) { } template AttributeLocations(const BinaryProgram& program) - : locations{ program.attributeLocation(As::attributeName())... } { + : locations{ program.attributeLocation( + concat_literals<&string_literal<'a', '_'>::value, &As::name>::value())... } { } NamedAttributeLocations getNamedLocations() const { @@ -68,7 +71,9 @@ public: } }; - util::ignore({ (maybeAddLocation(As::attributeName(), locations.template get()), 0)... }); + util::ignore({ (maybeAddLocation(concat_literals<&string_literal<'a', '_'>::value, &As::name>::value(), + locations.template get()), + 0)... }); return result; } diff --git a/src/mbgl/gl/texture.hpp b/src/mbgl/gl/texture.hpp index 2058ecd495..44b81f9a45 100644 --- a/src/mbgl/gl/texture.hpp +++ b/src/mbgl/gl/texture.hpp @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -27,16 +28,19 @@ private: public: void queryLocations(const ProgramID& id) { - state = State{ gl::uniformLocation(id, Ts::uniformName())... }; + state = State{ gl::uniformLocation(id, + concat_literals<&string_literal<'u', '_'>::value, &Ts::name>::value())... }; } template void loadNamedLocations(const BinaryProgram& program) { - state = State{ program.textureLocation(Ts::uniformName())... }; + state = State{ program.textureLocation( + concat_literals<&string_literal<'u', '_'>::value, &Ts::name>::value())... }; } NamedUniformLocations getNamedLocations() const { - return NamedUniformLocations{ { Ts::uniformName(), state.template get().location }... }; + return NamedUniformLocations{ { concat_literals<&string_literal<'u', '_'>::value, &Ts::name>::value(), + state.template get().location }... }; } void bind(gl::Context& context, const gfx::TextureBindings>& bindings) { diff --git a/src/mbgl/gl/uniform.hpp b/src/mbgl/gl/uniform.hpp index 64c83cab6b..89ef675a6b 100644 --- a/src/mbgl/gl/uniform.hpp +++ b/src/mbgl/gl/uniform.hpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -73,21 +74,21 @@ public: util::ignore( { // Some shader programs have uniforms declared, but not used, so they're not active. // Therefore, we'll only verify them when they are indeed active. - (active.find(Us::uniformName()) != active.end() - ? verifyUniform(active.at(Us::uniformName())) + (active.find(concat_literals<&string_literal<'u', '_'>::value, &Us::name>::value()) != active.end() + ? verifyUniform(active.at(concat_literals<&string_literal<'u', '_'>::value, &Us::name>::value())) : false)... }); #endif - state = State{ gl::uniformLocation(id, Us::uniformName())... }; + state = State{ gl::uniformLocation(id, concat_literals<&string_literal<'u', '_'>::value, &Us::name>::value())... }; } template void loadNamedLocations(const BinaryProgram& program) { - state = State{ UniformState(program.uniformLocation(Us::uniformName()))... }; + state = State{ UniformState(program.uniformLocation(concat_literals<&string_literal<'u', '_'>::value, &Us::name>::value()))... }; } NamedUniformLocations getNamedLocations() const { - return NamedUniformLocations{ { Us::uniformName(), state.template get().location }... }; + return NamedUniformLocations{ { concat_literals<&string_literal<'u', '_'>::value, &Us::name>::value(), state.template get().location }... }; } void bind(const gfx::UniformValues>& values) { diff --git a/src/mbgl/programs/attributes.hpp b/src/mbgl/programs/attributes.hpp index 2ee2218fcb..803a9db503 100644 --- a/src/mbgl/programs/attributes.hpp +++ b/src/mbgl/programs/attributes.hpp @@ -25,7 +25,9 @@ MBGL_DEFINE_ATTRIBUTE(float, 2, shift); template struct data { using Type = gfx::AttributeType; - static auto attributeName() { return "a_data"; } + static constexpr auto name() { + return "data"; + } }; // Paint attributes diff --git a/src/mbgl/programs/gl/circle.cpp b/src/mbgl/programs/gl/circle.cpp index 04c3f60870..ae2b65c20f 100644 --- a/src/mbgl/programs/gl/circle.cpp +++ b/src/mbgl/programs/gl/circle.cpp @@ -30,7 +30,7 @@ attribute vec2 a_pos; #ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; +uniform lowp float u_color_t; attribute highp vec4 a_color; varying highp vec4 color; #else @@ -39,7 +39,7 @@ uniform highp vec4 u_color; #ifndef HAS_UNIFORM_u_radius -uniform lowp float a_radius_t; +uniform lowp float u_radius_t; attribute mediump vec2 a_radius; varying mediump float radius; #else @@ -48,7 +48,7 @@ uniform mediump float u_radius; #ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; +uniform lowp float u_blur_t; attribute lowp vec2 a_blur; varying lowp float blur; #else @@ -57,7 +57,7 @@ uniform lowp float u_blur; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -66,7 +66,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_stroke_color -uniform lowp float a_stroke_color_t; +uniform lowp float u_stroke_color_t; attribute highp vec4 a_stroke_color; varying highp vec4 stroke_color; #else @@ -75,7 +75,7 @@ uniform highp vec4 u_stroke_color; #ifndef HAS_UNIFORM_u_stroke_width -uniform lowp float a_stroke_width_t; +uniform lowp float u_stroke_width_t; attribute mediump vec2 a_stroke_width; varying mediump float stroke_width; #else @@ -84,7 +84,7 @@ uniform mediump float u_stroke_width; #ifndef HAS_UNIFORM_u_stroke_opacity -uniform lowp float a_stroke_opacity_t; +uniform lowp float u_stroke_opacity_t; attribute lowp vec2 a_stroke_opacity; varying lowp float stroke_opacity; #else @@ -97,49 +97,49 @@ varying vec3 v_data; void main(void) { #ifndef HAS_UNIFORM_u_color - color = unpack_mix_color(a_color, a_color_t); + color = unpack_mix_color(a_color, u_color_t); #else highp vec4 color = u_color; #endif #ifndef HAS_UNIFORM_u_radius - radius = unpack_mix_vec2(a_radius, a_radius_t); + radius = unpack_mix_vec2(a_radius, u_radius_t); #else mediump float radius = u_radius; #endif #ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); + blur = unpack_mix_vec2(a_blur, u_blur_t); #else lowp float blur = u_blur; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif #ifndef HAS_UNIFORM_u_stroke_color - stroke_color = unpack_mix_color(a_stroke_color, a_stroke_color_t); + stroke_color = unpack_mix_color(a_stroke_color, u_stroke_color_t); #else highp vec4 stroke_color = u_stroke_color; #endif #ifndef HAS_UNIFORM_u_stroke_width - stroke_width = unpack_mix_vec2(a_stroke_width, a_stroke_width_t); + stroke_width = unpack_mix_vec2(a_stroke_width, u_stroke_width_t); #else mediump float stroke_width = u_stroke_width; #endif #ifndef HAS_UNIFORM_u_stroke_opacity - stroke_opacity = unpack_mix_vec2(a_stroke_opacity, a_stroke_opacity_t); + stroke_opacity = unpack_mix_vec2(a_stroke_opacity, u_stroke_opacity_t); #else lowp float stroke_opacity = u_stroke_opacity; #endif diff --git a/src/mbgl/programs/gl/fill.cpp b/src/mbgl/programs/gl/fill.cpp index c15c2774ab..44ab40949c 100644 --- a/src/mbgl/programs/gl/fill.cpp +++ b/src/mbgl/programs/gl/fill.cpp @@ -26,7 +26,7 @@ uniform mat4 u_matrix; #ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; +uniform lowp float u_color_t; attribute highp vec4 a_color; varying highp vec4 color; #else @@ -35,7 +35,7 @@ uniform highp vec4 u_color; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -46,14 +46,14 @@ uniform lowp float u_opacity; void main() { #ifndef HAS_UNIFORM_u_color - color = unpack_mix_color(a_color, a_color_t); + color = unpack_mix_color(a_color, u_color_t); #else highp vec4 color = u_color; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif diff --git a/src/mbgl/programs/gl/fill_extrusion.cpp b/src/mbgl/programs/gl/fill_extrusion.cpp index 45ebb68dd4..bd26d7afde 100644 --- a/src/mbgl/programs/gl/fill_extrusion.cpp +++ b/src/mbgl/programs/gl/fill_extrusion.cpp @@ -33,7 +33,7 @@ varying vec4 v_color; #ifndef HAS_UNIFORM_u_base -uniform lowp float a_base_t; +uniform lowp float u_base_t; attribute highp vec2 a_base; #else uniform highp float u_base; @@ -41,7 +41,7 @@ uniform highp float u_base; #ifndef HAS_UNIFORM_u_height -uniform lowp float a_height_t; +uniform lowp float u_height_t; attribute highp vec2 a_height; #else uniform highp float u_height; @@ -50,7 +50,7 @@ uniform highp float u_height; #ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; +uniform lowp float u_color_t; attribute highp vec4 a_color; #else uniform highp vec4 u_color; @@ -60,21 +60,21 @@ uniform highp vec4 u_color; void main() { #ifndef HAS_UNIFORM_u_base - highp float base = unpack_mix_vec2(a_base, a_base_t); + highp float base = unpack_mix_vec2(a_base, u_base_t); #else highp float base = u_base; #endif #ifndef HAS_UNIFORM_u_height - highp float height = unpack_mix_vec2(a_height, a_height_t); + highp float height = unpack_mix_vec2(a_height, u_height_t); #else highp float height = u_height; #endif #ifndef HAS_UNIFORM_u_color - highp vec4 color = unpack_mix_color(a_color, a_color_t); + highp vec4 color = unpack_mix_color(a_color, u_color_t); #else highp vec4 color = u_color; #endif diff --git a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp index 9c2da87b11..94a663947a 100644 --- a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp +++ b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp @@ -40,7 +40,7 @@ varying vec4 v_lighting; #ifndef HAS_UNIFORM_u_base -uniform lowp float a_base_t; +uniform lowp float u_base_t; attribute lowp vec2 a_base; varying lowp float base; #else @@ -49,7 +49,7 @@ uniform lowp float u_base; #ifndef HAS_UNIFORM_u_height -uniform lowp float a_height_t; +uniform lowp float u_height_t; attribute lowp vec2 a_height; varying lowp float height; #else @@ -58,7 +58,7 @@ uniform lowp float u_height; #ifndef HAS_UNIFORM_u_pattern_from -uniform lowp float a_pattern_from_t; +uniform lowp float u_pattern_from_t; attribute lowp vec4 a_pattern_from; varying lowp vec4 pattern_from; #else @@ -67,7 +67,7 @@ uniform lowp vec4 u_pattern_from; #ifndef HAS_UNIFORM_u_pattern_to -uniform lowp float a_pattern_to_t; +uniform lowp float u_pattern_to_t; attribute lowp vec4 a_pattern_to; varying lowp vec4 pattern_to; #else @@ -78,14 +78,14 @@ uniform lowp vec4 u_pattern_to; void main() { #ifndef HAS_UNIFORM_u_base - base = unpack_mix_vec2(a_base, a_base_t); + base = unpack_mix_vec2(a_base, u_base_t); #else lowp float base = u_base; #endif #ifndef HAS_UNIFORM_u_height - height = unpack_mix_vec2(a_height, a_height_t); + height = unpack_mix_vec2(a_height, u_height_t); #else lowp float height = u_height; #endif diff --git a/src/mbgl/programs/gl/fill_outline.cpp b/src/mbgl/programs/gl/fill_outline.cpp index 07615b2138..6186db4c9a 100644 --- a/src/mbgl/programs/gl/fill_outline.cpp +++ b/src/mbgl/programs/gl/fill_outline.cpp @@ -29,7 +29,7 @@ varying vec2 v_pos; #ifndef HAS_UNIFORM_u_outline_color -uniform lowp float a_outline_color_t; +uniform lowp float u_outline_color_t; attribute highp vec4 a_outline_color; varying highp vec4 outline_color; #else @@ -38,7 +38,7 @@ uniform highp vec4 u_outline_color; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -49,14 +49,14 @@ uniform lowp float u_opacity; void main() { #ifndef HAS_UNIFORM_u_outline_color - outline_color = unpack_mix_color(a_outline_color, a_outline_color_t); + outline_color = unpack_mix_color(a_outline_color, u_outline_color_t); #else highp vec4 outline_color = u_outline_color; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif diff --git a/src/mbgl/programs/gl/fill_outline_pattern.cpp b/src/mbgl/programs/gl/fill_outline_pattern.cpp index 7e0bf19655..9989c4076a 100644 --- a/src/mbgl/programs/gl/fill_outline_pattern.cpp +++ b/src/mbgl/programs/gl/fill_outline_pattern.cpp @@ -34,7 +34,7 @@ varying vec2 v_pos; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -43,7 +43,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_pattern_from -uniform lowp float a_pattern_from_t; +uniform lowp float u_pattern_from_t; attribute lowp vec4 a_pattern_from; varying lowp vec4 pattern_from; #else @@ -52,7 +52,7 @@ uniform lowp vec4 u_pattern_from; #ifndef HAS_UNIFORM_u_pattern_to -uniform lowp float a_pattern_to_t; +uniform lowp float u_pattern_to_t; attribute lowp vec4 a_pattern_to; varying lowp vec4 pattern_to; #else @@ -63,7 +63,7 @@ uniform lowp vec4 u_pattern_to; void main() { #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif diff --git a/src/mbgl/programs/gl/fill_pattern.cpp b/src/mbgl/programs/gl/fill_pattern.cpp index 256b1ede99..10d6c6ab85 100644 --- a/src/mbgl/programs/gl/fill_pattern.cpp +++ b/src/mbgl/programs/gl/fill_pattern.cpp @@ -32,7 +32,7 @@ varying vec2 v_pos_b; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -41,7 +41,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_pattern_from -uniform lowp float a_pattern_from_t; +uniform lowp float u_pattern_from_t; attribute lowp vec4 a_pattern_from; varying lowp vec4 pattern_from; #else @@ -50,7 +50,7 @@ uniform lowp vec4 u_pattern_from; #ifndef HAS_UNIFORM_u_pattern_to -uniform lowp float a_pattern_to_t; +uniform lowp float u_pattern_to_t; attribute lowp vec4 a_pattern_to; varying lowp vec4 pattern_to; #else @@ -61,7 +61,7 @@ uniform lowp vec4 u_pattern_to; void main() { #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif diff --git a/src/mbgl/programs/gl/heatmap.cpp b/src/mbgl/programs/gl/heatmap.cpp index 59f8ad9f69..836fd52b07 100644 --- a/src/mbgl/programs/gl/heatmap.cpp +++ b/src/mbgl/programs/gl/heatmap.cpp @@ -22,7 +22,7 @@ Context::createProgram(const ProgramParameters& programParameters) /* #ifndef HAS_UNIFORM_u_weight -uniform lowp float a_weight_t; +uniform lowp float u_weight_t; attribute highp vec2 a_weight; varying highp float weight; #else @@ -31,7 +31,7 @@ uniform highp float u_weight; #ifndef HAS_UNIFORM_u_radius -uniform lowp float a_radius_t; +uniform lowp float u_radius_t; attribute mediump vec2 a_radius; #else uniform mediump float u_radius; @@ -58,14 +58,14 @@ const highp float ZERO = 1.0 / 255.0 / 16.0; void main(void) { #ifndef HAS_UNIFORM_u_weight - weight = unpack_mix_vec2(a_weight, a_weight_t); + weight = unpack_mix_vec2(a_weight, u_weight_t); #else highp float weight = u_weight; #endif #ifndef HAS_UNIFORM_u_radius - mediump float radius = unpack_mix_vec2(a_radius, a_radius_t); + mediump float radius = unpack_mix_vec2(a_radius, u_radius_t); #else mediump float radius = u_radius; #endif diff --git a/src/mbgl/programs/gl/line.cpp b/src/mbgl/programs/gl/line.cpp index c25679ae1f..1f96b74a9c 100644 --- a/src/mbgl/programs/gl/line.cpp +++ b/src/mbgl/programs/gl/line.cpp @@ -48,7 +48,7 @@ varying highp float v_linesofar; #ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; +uniform lowp float u_color_t; attribute highp vec4 a_color; varying highp vec4 color; #else @@ -57,7 +57,7 @@ uniform highp vec4 u_color; #ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; +uniform lowp float u_blur_t; attribute lowp vec2 a_blur; varying lowp float blur; #else @@ -66,7 +66,7 @@ uniform lowp float u_blur; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -75,7 +75,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_gapwidth -uniform lowp float a_gapwidth_t; +uniform lowp float u_gapwidth_t; attribute mediump vec2 a_gapwidth; #else uniform mediump float u_gapwidth; @@ -83,7 +83,7 @@ uniform mediump float u_gapwidth; #ifndef HAS_UNIFORM_u_offset -uniform lowp float a_offset_t; +uniform lowp float u_offset_t; attribute lowp vec2 a_offset; #else uniform lowp float u_offset; @@ -91,7 +91,7 @@ uniform lowp float u_offset; #ifndef HAS_UNIFORM_u_width -uniform lowp float a_width_t; +uniform lowp float u_width_t; attribute mediump vec2 a_width; #else uniform mediump float u_width; @@ -101,42 +101,42 @@ uniform mediump float u_width; void main() { #ifndef HAS_UNIFORM_u_color - color = unpack_mix_color(a_color, a_color_t); + color = unpack_mix_color(a_color, u_color_t); #else highp vec4 color = u_color; #endif #ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); + blur = unpack_mix_vec2(a_blur, u_blur_t); #else lowp float blur = u_blur; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif #ifndef HAS_UNIFORM_u_gapwidth - mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, u_gapwidth_t); #else mediump float gapwidth = u_gapwidth; #endif #ifndef HAS_UNIFORM_u_offset - lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); + lowp float offset = unpack_mix_vec2(a_offset, u_offset_t); #else lowp float offset = u_offset; #endif #ifndef HAS_UNIFORM_u_width - mediump float width = unpack_mix_vec2(a_width, a_width_t); + mediump float width = unpack_mix_vec2(a_width, u_width_t); #else mediump float width = u_width; #endif diff --git a/src/mbgl/programs/gl/line_gradient.cpp b/src/mbgl/programs/gl/line_gradient.cpp index fae94b4596..493fc850d1 100644 --- a/src/mbgl/programs/gl/line_gradient.cpp +++ b/src/mbgl/programs/gl/line_gradient.cpp @@ -50,7 +50,7 @@ varying highp float v_lineprogress; #ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; +uniform lowp float u_blur_t; attribute lowp vec2 a_blur; varying lowp float blur; #else @@ -59,7 +59,7 @@ uniform lowp float u_blur; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -68,7 +68,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_gapwidth -uniform lowp float a_gapwidth_t; +uniform lowp float u_gapwidth_t; attribute mediump vec2 a_gapwidth; #else uniform mediump float u_gapwidth; @@ -76,7 +76,7 @@ uniform mediump float u_gapwidth; #ifndef HAS_UNIFORM_u_offset -uniform lowp float a_offset_t; +uniform lowp float u_offset_t; attribute lowp vec2 a_offset; #else uniform lowp float u_offset; @@ -84,7 +84,7 @@ uniform lowp float u_offset; #ifndef HAS_UNIFORM_u_width -uniform lowp float a_width_t; +uniform lowp float u_width_t; attribute mediump vec2 a_width; #else uniform mediump float u_width; @@ -94,35 +94,35 @@ uniform mediump float u_width; void main() { #ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); + blur = unpack_mix_vec2(a_blur, u_blur_t); #else lowp float blur = u_blur; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif #ifndef HAS_UNIFORM_u_gapwidth - mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, u_gapwidth_t); #else mediump float gapwidth = u_gapwidth; #endif #ifndef HAS_UNIFORM_u_offset - lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); + lowp float offset = unpack_mix_vec2(a_offset, u_offset_t); #else lowp float offset = u_offset; #endif #ifndef HAS_UNIFORM_u_width - mediump float width = unpack_mix_vec2(a_width, a_width_t); + mediump float width = unpack_mix_vec2(a_width, u_width_t); #else mediump float width = u_width; #endif diff --git a/src/mbgl/programs/gl/line_pattern.cpp b/src/mbgl/programs/gl/line_pattern.cpp index 2e9ebaf5ea..747b2bd197 100644 --- a/src/mbgl/programs/gl/line_pattern.cpp +++ b/src/mbgl/programs/gl/line_pattern.cpp @@ -50,7 +50,7 @@ varying float v_gamma_scale; #ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; +uniform lowp float u_blur_t; attribute lowp vec2 a_blur; varying lowp float blur; #else @@ -59,7 +59,7 @@ uniform lowp float u_blur; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -68,7 +68,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_offset -uniform lowp float a_offset_t; +uniform lowp float u_offset_t; attribute lowp vec2 a_offset; #else uniform lowp float u_offset; @@ -76,7 +76,7 @@ uniform lowp float u_offset; #ifndef HAS_UNIFORM_u_gapwidth -uniform lowp float a_gapwidth_t; +uniform lowp float u_gapwidth_t; attribute mediump vec2 a_gapwidth; #else uniform mediump float u_gapwidth; @@ -84,7 +84,7 @@ uniform mediump float u_gapwidth; #ifndef HAS_UNIFORM_u_width -uniform lowp float a_width_t; +uniform lowp float u_width_t; attribute mediump vec2 a_width; #else uniform mediump float u_width; @@ -92,7 +92,7 @@ uniform mediump float u_width; #ifndef HAS_UNIFORM_u_pattern_from -uniform lowp float a_pattern_from_t; +uniform lowp float u_pattern_from_t; attribute lowp vec4 a_pattern_from; varying lowp vec4 pattern_from; #else @@ -101,7 +101,7 @@ uniform lowp vec4 u_pattern_from; #ifndef HAS_UNIFORM_u_pattern_to -uniform lowp float a_pattern_to_t; +uniform lowp float u_pattern_to_t; attribute lowp vec4 a_pattern_to; varying lowp vec4 pattern_to; #else @@ -112,35 +112,35 @@ uniform lowp vec4 u_pattern_to; void main() { #ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); + blur = unpack_mix_vec2(a_blur, u_blur_t); #else lowp float blur = u_blur; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif #ifndef HAS_UNIFORM_u_offset - lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); + lowp float offset = unpack_mix_vec2(a_offset, u_offset_t); #else lowp float offset = u_offset; #endif #ifndef HAS_UNIFORM_u_gapwidth - mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, u_gapwidth_t); #else mediump float gapwidth = u_gapwidth; #endif #ifndef HAS_UNIFORM_u_width - mediump float width = unpack_mix_vec2(a_width, a_width_t); + mediump float width = unpack_mix_vec2(a_width, u_width_t); #else mediump float width = u_width; #endif diff --git a/src/mbgl/programs/gl/line_sdf.cpp b/src/mbgl/programs/gl/line_sdf.cpp index 0886bfcdf0..12fb5b61fd 100644 --- a/src/mbgl/programs/gl/line_sdf.cpp +++ b/src/mbgl/programs/gl/line_sdf.cpp @@ -55,7 +55,7 @@ varying float v_gamma_scale; #ifndef HAS_UNIFORM_u_color -uniform lowp float a_color_t; +uniform lowp float u_color_t; attribute highp vec4 a_color; varying highp vec4 color; #else @@ -64,7 +64,7 @@ uniform highp vec4 u_color; #ifndef HAS_UNIFORM_u_blur -uniform lowp float a_blur_t; +uniform lowp float u_blur_t; attribute lowp vec2 a_blur; varying lowp float blur; #else @@ -73,7 +73,7 @@ uniform lowp float u_blur; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -82,7 +82,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_gapwidth -uniform lowp float a_gapwidth_t; +uniform lowp float u_gapwidth_t; attribute mediump vec2 a_gapwidth; #else uniform mediump float u_gapwidth; @@ -90,7 +90,7 @@ uniform mediump float u_gapwidth; #ifndef HAS_UNIFORM_u_offset -uniform lowp float a_offset_t; +uniform lowp float u_offset_t; attribute lowp vec2 a_offset; #else uniform lowp float u_offset; @@ -98,7 +98,7 @@ uniform lowp float u_offset; #ifndef HAS_UNIFORM_u_width -uniform lowp float a_width_t; +uniform lowp float u_width_t; attribute mediump vec2 a_width; varying mediump float width; #else @@ -107,7 +107,7 @@ uniform mediump float u_width; #ifndef HAS_UNIFORM_u_floorwidth -uniform lowp float a_floorwidth_t; +uniform lowp float u_floorwidth_t; attribute lowp vec2 a_floorwidth; varying lowp float floorwidth; #else @@ -118,49 +118,49 @@ uniform lowp float u_floorwidth; void main() { #ifndef HAS_UNIFORM_u_color - color = unpack_mix_color(a_color, a_color_t); + color = unpack_mix_color(a_color, u_color_t); #else highp vec4 color = u_color; #endif #ifndef HAS_UNIFORM_u_blur - blur = unpack_mix_vec2(a_blur, a_blur_t); + blur = unpack_mix_vec2(a_blur, u_blur_t); #else lowp float blur = u_blur; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif #ifndef HAS_UNIFORM_u_gapwidth - mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, u_gapwidth_t); #else mediump float gapwidth = u_gapwidth; #endif #ifndef HAS_UNIFORM_u_offset - lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); + lowp float offset = unpack_mix_vec2(a_offset, u_offset_t); #else lowp float offset = u_offset; #endif #ifndef HAS_UNIFORM_u_width - width = unpack_mix_vec2(a_width, a_width_t); + width = unpack_mix_vec2(a_width, u_width_t); #else mediump float width = u_width; #endif #ifndef HAS_UNIFORM_u_floorwidth - floorwidth = unpack_mix_vec2(a_floorwidth, a_floorwidth_t); + floorwidth = unpack_mix_vec2(a_floorwidth, u_floorwidth_t); #else lowp float floorwidth = u_floorwidth; #endif diff --git a/src/mbgl/programs/gl/shader_source.cpp b/src/mbgl/programs/gl/shader_source.cpp index 4a986403f7..00e70f749a 100644 --- a/src/mbgl/programs/gl/shader_source.cpp +++ b/src/mbgl/programs/gl/shader_source.cpp @@ -70,395 +70,395 @@ constexpr const uint8_t compressedShaderSource[] = { 0x3a, 0x0f, 0xf2, 0x3e, 0x9e, 0xa4, 0xf3, 0x18, 0x26, 0x4d, 0x2f, 0x9d, 0xa2, 0x4e, 0xec, 0xf6, 0x47, 0x8b, 0x3c, 0x9e, 0xf6, 0x52, 0xb3, 0x64, 0x82, 0x06, 0x4f, 0xa1, 0xc5, 0xff, 0x7d, 0x72, 0xd1, 0xfd, 0xfd, 0xcb, 0xd9, 0xe7, 0xaf, 0xdf, 0x7e, 0xed, 0x52, 0xd9, 0x7f, 0xc0, 0x6a, 0x80, - 0xc5, 0x91, 0x56, 0x10, 0x93, 0xac, 0x6e, 0x2e, 0xa1, 0x23, 0x04, 0xe0, 0xe1, 0xa0, 0xd9, 0x9c, - 0x7b, 0xa5, 0x2c, 0x92, 0x41, 0x57, 0x62, 0x95, 0x76, 0x65, 0xa9, 0x92, 0x16, 0x56, 0x03, 0x61, - 0xf3, 0x18, 0xad, 0xbe, 0x0b, 0x33, 0x65, 0x24, 0x4f, 0x21, 0x8d, 0xa9, 0x01, 0xb4, 0xc5, 0x04, - 0x82, 0x53, 0xa7, 0x28, 0x09, 0x35, 0x9a, 0xa9, 0x51, 0xa8, 0xc2, 0x30, 0x02, 0xd6, 0x50, 0x99, - 0x8c, 0xaf, 0x2c, 0xbd, 0x07, 0x39, 0x0a, 0x85, 0x38, 0x97, 0x92, 0x07, 0x99, 0x9c, 0x38, 0xa9, - 0x18, 0x4e, 0xd7, 0xe8, 0x92, 0xb2, 0x49, 0x7d, 0x6b, 0x48, 0xa2, 0x1c, 0x6e, 0xa6, 0x8a, 0x66, - 0x5a, 0x09, 0xe3, 0xea, 0x42, 0x91, 0x36, 0x31, 0x73, 0xec, 0xe4, 0x49, 0x30, 0x25, 0x14, 0x2e, - 0xf2, 0x79, 0xf6, 0xef, 0xb4, 0x8c, 0xf5, 0x64, 0x08, 0x3b, 0x07, 0xca, 0x50, 0x26, 0x46, 0x54, - 0xf2, 0xcb, 0xf8, 0x51, 0x07, 0x5c, 0x4f, 0xfb, 0xcd, 0xa8, 0x9f, 0x0f, 0x4b, 0x69, 0xc7, 0x10, - 0x65, 0x2c, 0x2a, 0xc3, 0x59, 0x18, 0x55, 0x01, 0x59, 0xc3, 0xae, 0x3a, 0xec, 0xfa, 0x36, 0x94, - 0x32, 0x8a, 0x0a, 0x63, 0xe5, 0x17, 0x15, 0xcc, 0xc4, 0x36, 0x1a, 0x44, 0x19, 0xf7, 0x14, 0x41, - 0x89, 0xbb, 0x40, 0x2c, 0x90, 0x87, 0x68, 0x81, 0xec, 0xc7, 0x79, 0x2c, 0xad, 0x8f, 0xf0, 0x0b, - 0xad, 0x91, 0xa5, 0xe2, 0xad, 0x47, 0x14, 0x5d, 0xdd, 0xc4, 0xa4, 0x32, 0xcc, 0xe7, 0xa2, 0xce, - 0x65, 0xe4, 0xe9, 0xd2, 0x2c, 0xda, 0x48, 0x66, 0x91, 0x3f, 0x91, 0x6e, 0x3b, 0x33, 0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xef, 0x0d, - 0x75, 0x5a, 0xe7, 0x59, 0x1e, 0xe7, 0x69, 0x77, 0xb1, 0x9a, 0x24, 0xd9, 0xd8, 0x52, 0x90, 0x84, - 0x98, 0xd3, 0x76, 0x93, 0x14, 0x21, 0xde, 0x1b, 0xe2, 0x08, 0x8c, 0x2f, 0x60, 0xf7, 0x60, 0xcd, - 0x06, 0x1a, 0x49, 0x1d, 0xc7, 0x49, 0x8a, 0x16, 0xae, 0x71, 0x3c, 0x4d, 0x2d, 0x10, 0x03, 0xf6, - 0x7a, 0x83, 0x96, 0x2d, 0x38, 0x00, 0x44, 0xb0, 0x9e, 0x8c, 0x47, 0x80, 0x98, 0xcb, 0x93, 0x78, - 0x16, 0x5a, 0x8e, 0x5c, 0x15, 0x4d, 0xbb, 0x82, 0x61, 0xa7, 0xb0, 0xe8, 0x33, 0x79, 0x79, 0x5c, - 0xe8, 0x31, 0x91, 0x3c, 0x2b, 0xf9, 0x49, 0x13, 0xe6, 0x1d, 0x55, 0x73, 0xd9, 0x39, 0x15, 0xac, - 0x79, 0x08, 0x0f, 0x20, 0x4b, 0x84, 0x0e, 0x61, 0xa9, 0x08, 0x54, 0xe6, 0xcb, 0x45, 0x3a, 0x98, - 0x40, 0xb0, 0x41, 0xc4, 0x79, 0xe3, 0x34, 0x6a, 0x68, 0xf3, 0xfa, 0xaf, 0xce, 0x77, 0xa6, 0xa8, - 0x42, 0x9f, 0xc2, 0x02, 0xf6, 0x83, 0x65, 0xfa, 0xc2, 0x3b, 0x23, 0x3f, 0xd8, 0x67, 0x2d, 0xea, - 0x54, 0x4c, 0x05, 0x88, 0x41, 0x42, 0xd0, 0x5f, 0xad, 0xef, 0x3e, 0xfd, 0xd5, 0xfe, 0xee, 0xb3, - 0x09, 0xec, 0x06, 0x38, 0x6e, 0x71, 0x78, 0x57, 0x83, 0x3e, 0xab, 0x41, 0x8d, 0xf7, 0xab, 0x90, - 0x57, 0x56, 0x44, 0x5c, 0xd6, 0x94, 0xf5, 0x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 0x24, 0xe6, - 0xd9, 0x4c, 0x9f, 0x2f, 0xe3, 0x8c, 0xcd, 0x54, 0x72, 0x10, 0xcf, 0x74, 0x78, 0x40, 0xb1, 0x2e, - 0x8a, 0x74, 0x3a, 0x4c, 0xfc, 0xb2, 0x3a, 0xd6, 0x07, 0x59, 0xe2, 0x4a, 0x96, 0xcc, 0xac, 0xf1, - 0x34, 0x53, 0xe8, 0xd8, 0x15, 0x75, 0x1a, 0x11, 0xb4, 0x81, 0x8c, 0x84, 0x34, 0xa4, 0x32, 0xfb, - 0x61, 0xe2, 0x22, 0x21, 0x0a, 0x03, 0x87, 0xe3, 0xf7, 0x14, 0xd6, 0x74, 0x43, 0xf9, 0x4c, 0xe5, - 0xd5, 0xe5, 0x65, 0xe4, 0x60, 0x55, 0xb9, 0x81, 0xef, 0x2d, 0x50, 0xb5, 0x99, 0x2b, 0xe2, 0xd0, - 0x3f, 0xec, 0x30, 0x4e, 0x24, 0xb1, 0x00, 0xa9, 0xce, 0xe1, 0xdd, 0xe7, 0xb5, 0x9b, 0xed, 0xf7, - 0x01, 0x11, 0xce, 0x75, 0x41, 0x85, 0x5b, 0x42, 0x06, 0xa9, 0x1b, 0x6a, 0x16, 0xa3, 0x19, 0x88, - 0x05, 0x95, 0x22, 0x0b, 0xef, 0x24, 0x72, 0xf1, 0x91, 0x40, 0x93, 0xbf, 0x18, 0xbc, 0xc5, 0xcd, - 0xb8, 0xd8, 0x21, 0xa4, 0xae, 0x7e, 0x84, 0x3f, 0x3c, 0x79, 0x82, 0x2a, 0x6a, 0x0e, 0xf6, 0x55, - 0x4b, 0x87, 0x08, 0x81, 0xb4, 0x86, 0x8c, 0xc0, 0x87, 0x94, 0xba, 0x92, 0x52, 0xf1, 0xc4, 0xa0, - 0xa7, 0xae, 0x64, 0xf7, 0xf2, 0x65, 0xff, 0x1f, 0x03, 0x90, 0xfe, 0x1c + 0xc5, 0x51, 0x54, 0x00, 0x59, 0xdd, 0x5c, 0x42, 0x47, 0x08, 0xc0, 0xc3, 0x11, 0xd3, 0xf5, 0x86, + 0x71, 0xaf, 0x94, 0x45, 0x32, 0xe8, 0x4a, 0xac, 0xd2, 0xae, 0x2c, 0x55, 0xd2, 0xc2, 0x6a, 0x20, + 0x6c, 0x1e, 0xa3, 0xd5, 0x77, 0x61, 0xa6, 0x8c, 0xe4, 0x29, 0xa4, 0x31, 0x35, 0x80, 0xb6, 0x98, + 0x40, 0x70, 0xea, 0x14, 0x25, 0xa1, 0x46, 0x33, 0x35, 0x0a, 0x55, 0x18, 0x56, 0xc9, 0x1a, 0x2a, + 0x93, 0xf1, 0x95, 0xa5, 0xf7, 0x20, 0x47, 0xa1, 0x10, 0xe7, 0x52, 0xf2, 0x20, 0x93, 0x13, 0x27, + 0x15, 0xc3, 0xe9, 0x1a, 0x5d, 0x05, 0xac, 0x6b, 0x48, 0xa2, 0x1c, 0x6e, 0x2e, 0x4f, 0x33, 0xad, + 0x84, 0x71, 0x75, 0xa1, 0x48, 0x9b, 0x98, 0x39, 0x76, 0xf2, 0x24, 0x98, 0x12, 0x0a, 0x17, 0xf9, + 0x3c, 0xfb, 0x77, 0x5a, 0xc6, 0x7a, 0x32, 0x84, 0x9d, 0x03, 0x65, 0x28, 0x13, 0x23, 0x2a, 0xf9, + 0x65, 0xfc, 0xa8, 0x03, 0xae, 0xa7, 0xfd, 0x66, 0xd4, 0xcf, 0x87, 0xa5, 0xb4, 0x63, 0x88, 0x32, + 0x16, 0x95, 0xe1, 0x2c, 0x8c, 0xaa, 0x80, 0xac, 0x61, 0x57, 0x1d, 0x76, 0x7d, 0x1b, 0x4a, 0x19, + 0x45, 0x85, 0xb1, 0xf2, 0x8b, 0x0a, 0x66, 0x62, 0x1b, 0x0d, 0xa2, 0x8c, 0x7b, 0x8a, 0xa0, 0xc4, + 0x5d, 0x20, 0x16, 0xc8, 0x43, 0xb4, 0x40, 0xf6, 0xe3, 0x3c, 0x96, 0xd6, 0x47, 0xf8, 0x85, 0xd6, + 0xc8, 0x52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0x83, 0xf7, 0xe1, 0x6e, 0x10, 0xb1, 0xb3, 0x1b, 0xd8, 0xb8, 0xb9, 0xef, 0x0d, 0xa0, 0xea, + 0xcb, 0xc0, 0xb3, 0x3f, 0xd2, 0xcd, 0xee, 0x71, 0x5c, 0xce, 0xb3, 0x89, 0x19, 0x8f, 0x0c, 0x61, + 0xa4, 0x15, 0x56, 0x29, 0x19, 0x48, 0x25, 0x98, 0x5e, 0x04, 0x95, 0xb2, 0x4d, 0x44, 0xd3, 0xe1, + 0xd1, 0xe1, 0x2a, 0x10, 0x9e, 0x67, 0xe5, 0x64, 0x23, 0x43, 0x67, 0x1d, 0xd1, 0x79, 0x56, 0x42, + 0x32, 0xca, 0xac, 0x40, 0x30, 0x81, 0xaa, 0xbe, 0x5a, 0x3d, 0xd5, 0x91, 0x5c, 0x65, 0xb8, 0xe5, + 0x8f, 0x28, 0xee, 0x9a, 0x06, 0x49, 0xda, 0x8b, 0x56, 0x47, 0x31, 0xda, 0x76, 0xb0, 0xc4, 0xcf, + 0x28, 0xee, 0x16, 0x3b, 0xd9, 0x58, 0x21, 0x82, 0x35, 0x77, 0xb5, 0x7c, 0x91, 0x16, 0x2e, 0x4d, + 0x45, 0x32, 0x4d, 0x70, 0xe8, 0x44, 0x81, 0x80, 0xdb, 0x53, 0x2a, 0xc4, 0xed, 0x4d, 0xa8, 0xe3, + 0x48, 0x22, 0x51, 0x91, 0x09, 0x83, 0x92, 0x8f, 0xca, 0x53, 0x07, 0x18, 0x08, 0x9e, 0x6f, 0xd8, + 0x1f, 0x47, 0x85, 0x4c, 0x73, 0x19, 0x8a, 0xfb, 0xbc, 0x6a, 0x0e, 0x3b, 0x0b, 0x03, 0x24, 0x5c, + 0x50, 0x9f, 0x12, 0xc9, 0x61, 0xc7, 0x5b, 0xf2, 0x4c, 0x4d, 0xbf, 0x09, 0xab, 0x2d, 0xef, 0x40, + 0x2b, 0x12, 0xe6, 0xb3, 0x71, 0xbc, 0xa2, 0x37, 0x04, 0xc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, 0x5c, 0xad, 0xc8, 0x71, 0xcc, 0xb1, 0x0b, 0x1b, 0x70, + 0xf2, 0x36, 0x50, 0xe9, 0xaf, 0xb9, 0x10, 0x65, 0x88, 0x94, 0x6c, 0x47, 0x24, 0x94, 0x1b, 0x3c, + 0x70, 0x2e, 0x77, 0x00, 0x84, 0x9f, 0x12, 0x5d, 0x25, 0x75, 0xae, 0xbc, 0x97, 0xdc, 0xcd, 0xad, + 0x31, 0x2d, 0xad, 0x4b, 0x6d, 0xcb, 0x9e, 0xd5, 0xae, 0xdc, 0x4d, 0x85, 0xd1, 0x99, 0x43, 0x0c, + 0x24, 0xa4, 0x4a, 0x2c, 0x20, 0x22, 0x77, 0x59, 0x36, 0x08, 0xcb, 0xe2, 0xc8, 0xc7, 0xa8, 0xdb, + 0x70, 0x38, 0x38, 0xfd, 0x7d, 0x13, 0xe1, 0x54, 0x9c, 0xe6, 0xf3, 0x78, 0x61, 0x7a, 0xff, 0x04, + 0x5e, 0x2a, 0x59, 0xcc, 0x46, 0xd3, 0xee, 0x0d, 0x8e, 0xc2, 0xab, 0x1d, 0x29, 0x17, 0x62, 0xb9, + 0x55, 0x9c, 0x98, 0x2d, 0x12, 0x54, 0xac, 0xb5, 0x26, 0x4c, 0x6c, 0x9b, 0x80, 0xb5, 0x49, 0x34, + 0x6e, 0x82, 0xac, 0x19, 0x13, 0xd5, 0x1f, 0x55, 0x41, 0x13, 0xe6, 0x83, 0x24, 0x12, 0x3f, 0x03, + 0x06, 0x16, 0xde, 0xf1, 0x42, 0x6d, 0xbd, 0x50, 0x5b, 0x14, 0x6a, 0x8b, 0x42, 0x6d, 0x28, 0xa4, + 0xf9, 0xfb, 0x09, 0x36, 0x9f, 0x46, 0x81, 0x65, 0xa3, 0x4f, 0x1f, 0x55, 0x6a, 0x22, 0x19, 0x21, + 0x45, 0x33, 0x85, 0x2e, 0xe1, 0x78, 0x01, 0x6d, 0x08, 0x5f, 0x38, 0x9a, 0x36, 0x44, 0x32, 0x47, +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e6, 0x6b, 0xfb, 0x3d, 0x9d, + 0x69, 0x12, 0x10, 0x71, 0x34, 0x51, 0x00, 0x4f, 0xab, 0xd7, 0xfa, 0x5e, 0x04, 0xfd, 0x4d, 0xfc, + 0x41, 0x2e, 0x39, 0x77, 0xb5, 0x57, 0xf9, 0x1f, 0x5e, 0xe5, 0xb7, 0x79, 0x8a, 0x47, 0xe3, 0x71, + 0xd9, 0xc9, 0x25, 0x91, 0x6f, 0x3f, 0xbe, 0x24, 0x60, 0x4c, 0x67, 0x98, 0xa4, 0xdc, 0x32, 0xe7, + 0xbf, 0x0a, 0x56, 0xf6, 0xf2, 0x53, 0x3c, 0xce, 0xca, 0x28, 0x16, 0xf9, 0x76, 0x8a, 0x05, 0x8c, + 0x89, 0x62, 0x29, 0xb7, 0x8c, 0x62, 0x15, 0xec, 0x45, 0x1f, 0x76, 0xc2, 0x4d, 0x29, 0x39, 0x37, + 0x23, 0xf2, 0xed, 0x8f, 0xb2, 0x72, 0x10, 0xe3, 0xc3, 0xac, 0x22, 0xb7, 0xf4, 0x61, 0x2e, 0x05, + 0x6c, 0x1d, 0xc1, 0xf6, 0x73, 0x6d, 0x3c, 0xbb, 0x9c, 0x5c, 0xdb, 0x09, 0x37, 0x91, 0xb9, 0x96, + 0x58, 0x65, 0x6f, 0xe2, 0x39, 0xda, 0x82, 0x8f, 0x69, 0xb2, 0x6f, 0xea, 0x3e, 0x30, 0x99, 0xf8, + 0xd5, 0x6c, 0x56, 0x90, 0xc2, 0x8a, 0xdb, 0xf5, 0x90, 0x26, 0xb6, 0x2b, 0x59, 0xab, 0x92, 0x94, + 0x13, 0x3f, 0x4d, 0x47, 0xac, 0x44, 0xae, 0xaf, 0xca, 0x3e, 0xd3, 0x61, 0x2b, 0x19, 0xd5, 0x56, + 0xf2, 0x4b, 0xfc, 0x34, 0xd1, 0x22, 0x72, 0x7d, 0x55, 0xaa, 0x99, 0x68, 0x91, 0x51, 0x6d, 0x2e, + 0x99, 0x76, 0x7e, 0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 0xc3, 0x90, 0x29, 0xe5, 0xd2, 0xcd, 0xec, 0x90, 0x72, + 0x33, 0x64, 0x23, 0x33, 0xe2, 0x31, 0x4e, 0xdf, 0x49, 0xcc, 0xb3, 0x99, 0x3e, 0x5f, 0xc6, 0x19, + 0x9b, 0xa9, 0xe4, 0x20, 0x9e, 0xe9, 0xf0, 0x80, 0x62, 0x5d, 0x14, 0xe9, 0x74, 0x98, 0xf8, 0x65, + 0x75, 0xac, 0x0f, 0xb2, 0xc4, 0x95, 0x2c, 0x99, 0x59, 0xe3, 0x69, 0xa6, 0xd0, 0xb1, 0x2b, 0xea, + 0x34, 0x22, 0x68, 0x03, 0x19, 0x09, 0x69, 0x48, 0x65, 0xf6, 0xc3, 0xc4, 0x45, 0x42, 0x14, 0x06, + 0x0e, 0xc7, 0xef, 0x29, 0xac, 0xe9, 0x86, 0xf2, 0x99, 0xca, 0xab, 0xcb, 0xcb, 0xc8, 0xc1, 0xaa, + 0x72, 0x03, 0xdf, 0x5b, 0xa0, 0x6a, 0x33, 0x57, 0xc4, 0xa1, 0x7f, 0xd8, 0x61, 0x9c, 0x48, 0x62, + 0x01, 0x52, 0x9d, 0xc3, 0xbb, 0xcf, 0x6b, 0x37, 0xdb, 0xef, 0x03, 0x22, 0x9c, 0xeb, 0x82, 0x0a, + 0xb7, 0x84, 0x0c, 0x52, 0x37, 0xd4, 0x2c, 0x46, 0x33, 0x10, 0x0b, 0x2a, 0x45, 0x16, 0xde, 0x49, + 0xe4, 0xe2, 0x23, 0x81, 0x26, 0x7f, 0x31, 0x78, 0x8b, 0x9b, 0x71, 0xb1, 0x43, 0x48, 0x5d, 0xfd, + 0x08, 0x7f, 0x78, 0xf2, 0x04, 0x55, 0xd4, 0x1c, 0xec, 0xab, 0x96, 0x0e, 0x11, 0x02, 0x69, 0x0d, + 0x19, 0x81, 0x0f, 0x29, 0x75, 0x25, 0xa5, 0xe2, 0x89, 0x41, 0x4f, 0x5d, 0xc9, 0xee, 0xe5, 0xcb, + 0xfe, 0x3f, 0x2f, 0x9e, 0x06, 0x73 }; const char* shaderSource() { diff --git a/src/mbgl/programs/gl/symbol_icon.cpp b/src/mbgl/programs/gl/symbol_icon.cpp index 733d3b7ebd..1cf2090ba3 100644 --- a/src/mbgl/programs/gl/symbol_icon.cpp +++ b/src/mbgl/programs/gl/symbol_icon.cpp @@ -39,7 +39,7 @@ uniform float u_fade_change; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -62,7 +62,7 @@ varying float v_fade_opacity; void main() { #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif diff --git a/src/mbgl/programs/gl/symbol_sdf_icon.cpp b/src/mbgl/programs/gl/symbol_sdf_icon.cpp index ef3ecd138c..ccb213bcfd 100644 --- a/src/mbgl/programs/gl/symbol_sdf_icon.cpp +++ b/src/mbgl/programs/gl/symbol_sdf_icon.cpp @@ -41,7 +41,7 @@ uniform highp float u_size; // used when size is both zoom and feature constant #ifndef HAS_UNIFORM_u_fill_color -uniform lowp float a_fill_color_t; +uniform lowp float u_fill_color_t; attribute highp vec4 a_fill_color; varying highp vec4 fill_color; #else @@ -50,7 +50,7 @@ uniform highp vec4 u_fill_color; #ifndef HAS_UNIFORM_u_halo_color -uniform lowp float a_halo_color_t; +uniform lowp float u_halo_color_t; attribute highp vec4 a_halo_color; varying highp vec4 halo_color; #else @@ -59,7 +59,7 @@ uniform highp vec4 u_halo_color; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -68,7 +68,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_halo_width -uniform lowp float a_halo_width_t; +uniform lowp float u_halo_width_t; attribute lowp vec2 a_halo_width; varying lowp float halo_width; #else @@ -77,7 +77,7 @@ uniform lowp float u_halo_width; #ifndef HAS_UNIFORM_u_halo_blur -uniform lowp float a_halo_blur_t; +uniform lowp float u_halo_blur_t; attribute lowp vec2 a_halo_blur; varying lowp float halo_blur; #else @@ -105,35 +105,35 @@ varying vec3 v_data1; void main() { #ifndef HAS_UNIFORM_u_fill_color - fill_color = unpack_mix_color(a_fill_color, a_fill_color_t); + fill_color = unpack_mix_color(a_fill_color, u_fill_color_t); #else highp vec4 fill_color = u_fill_color; #endif #ifndef HAS_UNIFORM_u_halo_color - halo_color = unpack_mix_color(a_halo_color, a_halo_color_t); + halo_color = unpack_mix_color(a_halo_color, u_halo_color_t); #else highp vec4 halo_color = u_halo_color; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif #ifndef HAS_UNIFORM_u_halo_width - halo_width = unpack_mix_vec2(a_halo_width, a_halo_width_t); + halo_width = unpack_mix_vec2(a_halo_width, u_halo_width_t); #else lowp float halo_width = u_halo_width; #endif #ifndef HAS_UNIFORM_u_halo_blur - halo_blur = unpack_mix_vec2(a_halo_blur, a_halo_blur_t); + halo_blur = unpack_mix_vec2(a_halo_blur, u_halo_blur_t); #else lowp float halo_blur = u_halo_blur; #endif diff --git a/src/mbgl/programs/gl/symbol_sdf_text.cpp b/src/mbgl/programs/gl/symbol_sdf_text.cpp index a0d810d1ce..0d08a64dee 100644 --- a/src/mbgl/programs/gl/symbol_sdf_text.cpp +++ b/src/mbgl/programs/gl/symbol_sdf_text.cpp @@ -41,7 +41,7 @@ uniform highp float u_size; // used when size is both zoom and feature constant #ifndef HAS_UNIFORM_u_fill_color -uniform lowp float a_fill_color_t; +uniform lowp float u_fill_color_t; attribute highp vec4 a_fill_color; varying highp vec4 fill_color; #else @@ -50,7 +50,7 @@ uniform highp vec4 u_fill_color; #ifndef HAS_UNIFORM_u_halo_color -uniform lowp float a_halo_color_t; +uniform lowp float u_halo_color_t; attribute highp vec4 a_halo_color; varying highp vec4 halo_color; #else @@ -59,7 +59,7 @@ uniform highp vec4 u_halo_color; #ifndef HAS_UNIFORM_u_opacity -uniform lowp float a_opacity_t; +uniform lowp float u_opacity_t; attribute lowp vec2 a_opacity; varying lowp float opacity; #else @@ -68,7 +68,7 @@ uniform lowp float u_opacity; #ifndef HAS_UNIFORM_u_halo_width -uniform lowp float a_halo_width_t; +uniform lowp float u_halo_width_t; attribute lowp vec2 a_halo_width; varying lowp float halo_width; #else @@ -77,7 +77,7 @@ uniform lowp float u_halo_width; #ifndef HAS_UNIFORM_u_halo_blur -uniform lowp float a_halo_blur_t; +uniform lowp float u_halo_blur_t; attribute lowp vec2 a_halo_blur; varying lowp float halo_blur; #else @@ -105,35 +105,35 @@ varying vec3 v_data1; void main() { #ifndef HAS_UNIFORM_u_fill_color - fill_color = unpack_mix_color(a_fill_color, a_fill_color_t); + fill_color = unpack_mix_color(a_fill_color, u_fill_color_t); #else highp vec4 fill_color = u_fill_color; #endif #ifndef HAS_UNIFORM_u_halo_color - halo_color = unpack_mix_color(a_halo_color, a_halo_color_t); + halo_color = unpack_mix_color(a_halo_color, u_halo_color_t); #else highp vec4 halo_color = u_halo_color; #endif #ifndef HAS_UNIFORM_u_opacity - opacity = unpack_mix_vec2(a_opacity, a_opacity_t); + opacity = unpack_mix_vec2(a_opacity, u_opacity_t); #else lowp float opacity = u_opacity; #endif #ifndef HAS_UNIFORM_u_halo_width - halo_width = unpack_mix_vec2(a_halo_width, a_halo_width_t); + halo_width = unpack_mix_vec2(a_halo_width, u_halo_width_t); #else lowp float halo_width = u_halo_width; #endif #ifndef HAS_UNIFORM_u_halo_blur - halo_blur = unpack_mix_vec2(a_halo_blur, a_halo_blur_t); + halo_blur = unpack_mix_vec2(a_halo_blur, u_halo_blur_t); #else lowp float halo_blur = u_halo_blur; #endif diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index 6c2c07950d..d233e6f2e0 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -431,17 +432,15 @@ PaintPropertyBinder::create(c } template -struct ZoomInterpolatedAttribute { - static auto attributeName() { return Attr::attributeName(); } +struct ZoomInterpolatedAttribute : public Attr { using Type = ZoomInterpolatedAttributeType; }; template struct InterpolationUniform { using Value = float; - static auto uniformName() { - static const std::string name = Attr::attributeName() + std::string("_t"); - return name.c_str(); + static constexpr auto name() { + return concat_literals<&Attr::name, &string_literal<'_', 't'>::value>::value(); } }; @@ -551,9 +550,13 @@ public: template struct UniformDefines> { + static constexpr auto define() { + return "#define HAS_UNIFORM_u_"; + } + static void appendDefines(std::vector& defines) { util::ignore({ - (defines.push_back(std::string("#define HAS_UNIFORM_") + Us::uniformName()), 0)... + (defines.push_back(concat_literals<&define, &Us::name, &string_literal<'\n'>::value>::value()), 0)... }); } }; diff --git a/src/mbgl/util/literal.hpp b/src/mbgl/util/literal.hpp new file mode 100644 index 0000000000..d4fec49b35 --- /dev/null +++ b/src/mbgl/util/literal.hpp @@ -0,0 +1,67 @@ +#pragma once + +#include +#include + +namespace mbgl { + +// Using structs instead of constexpr templates because GCC 4.9 doesn't support these yet. + +template +struct string_literal { + static constexpr const char chars[] = { Cs..., 0 }; + + static constexpr const char* value() { + return chars; + } +}; + +template +constexpr const char string_literal::chars[]; + +namespace detail { + +using string_fn = const char* (*)(); + +template +string_literal to_string_literal(std::index_sequence); + +constexpr std::size_t string_length(const char* const str, std::size_t len = 0) { + return str[0] ? string_length(str + 1, len + 1) : len; +} + +template +struct concat_literals; + +template <> +struct concat_literals<> { + static constexpr auto value() { + return ""; + } +}; + +template +struct concat_literals, string_literal, Rest...> { + static constexpr auto value() { + return concat_literals, Rest...>::value(); + } +}; + +template +struct concat_literals> { + static constexpr auto value() { + return string_literal::value(); + } +}; + +} // namespace detail + +template +struct concat_literals { + static constexpr auto value() { + return detail::concat_literals( + std::make_index_sequence()))...>::value(); + } +}; + +} // namespace mbgl -- cgit v1.2.1 From 1e30fdac36233c0fd0662e2b285b0424907bc81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 19 Mar 2019 14:02:10 +0100 Subject: [core] move ProgramMap to within the gl::Program object --- scripts/generate-shaders.js | 70 ++++--- src/core-files.json | 1 - src/mbgl/gl/attribute.hpp | 31 ++++ src/mbgl/gl/context.cpp | 6 +- src/mbgl/gl/context.hpp | 2 +- src/mbgl/gl/program.hpp | 203 +++++++++++++-------- src/mbgl/programs/circle_program.hpp | 2 +- src/mbgl/programs/fill_extrusion_program.hpp | 4 +- src/mbgl/programs/fill_program.hpp | 8 +- src/mbgl/programs/gl/background.cpp | 25 ++- src/mbgl/programs/gl/background_pattern.cpp | 25 ++- src/mbgl/programs/gl/circle.cpp | 25 ++- src/mbgl/programs/gl/clipping_mask.cpp | 25 ++- src/mbgl/programs/gl/collision_box.cpp | 25 ++- src/mbgl/programs/gl/collision_circle.cpp | 25 ++- src/mbgl/programs/gl/debug.cpp | 25 ++- src/mbgl/programs/gl/extrusion_texture.cpp | 25 ++- src/mbgl/programs/gl/fill.cpp | 25 ++- src/mbgl/programs/gl/fill_extrusion.cpp | 25 ++- src/mbgl/programs/gl/fill_extrusion_pattern.cpp | 25 ++- src/mbgl/programs/gl/fill_outline.cpp | 25 ++- src/mbgl/programs/gl/fill_outline_pattern.cpp | 25 ++- src/mbgl/programs/gl/fill_pattern.cpp | 25 ++- src/mbgl/programs/gl/heatmap.cpp | 25 ++- src/mbgl/programs/gl/heatmap_texture.cpp | 25 ++- src/mbgl/programs/gl/hillshade.cpp | 25 ++- src/mbgl/programs/gl/hillshade_prepare.cpp | 25 ++- src/mbgl/programs/gl/line.cpp | 25 ++- src/mbgl/programs/gl/line_gradient.cpp | 25 ++- src/mbgl/programs/gl/line_pattern.cpp | 25 ++- src/mbgl/programs/gl/line_sdf.cpp | 25 ++- src/mbgl/programs/gl/preludes.cpp | 15 -- src/mbgl/programs/gl/preludes.hpp | 7 +- src/mbgl/programs/gl/raster.cpp | 25 ++- src/mbgl/programs/gl/shader_source.hpp | 3 + src/mbgl/programs/gl/shaders.cpp | 24 ++- src/mbgl/programs/gl/shaders.hpp | 7 +- src/mbgl/programs/gl/symbol_icon.cpp | 25 ++- src/mbgl/programs/gl/symbol_sdf_icon.cpp | 25 ++- src/mbgl/programs/gl/symbol_sdf_text.cpp | 25 ++- src/mbgl/programs/heatmap_program.hpp | 2 +- src/mbgl/programs/line_program.hpp | 8 +- src/mbgl/programs/program.hpp | 30 --- src/mbgl/programs/program_parameters.cpp | 9 - src/mbgl/programs/program_parameters.hpp | 3 - src/mbgl/programs/symbol_program.hpp | 6 +- src/mbgl/renderer/layers/render_circle_layer.cpp | 2 +- .../layers/render_fill_extrusion_layer.cpp | 4 +- src/mbgl/renderer/layers/render_fill_layer.cpp | 8 +- src/mbgl/renderer/layers/render_heatmap_layer.cpp | 2 +- src/mbgl/renderer/layers/render_line_layer.cpp | 5 +- src/mbgl/renderer/layers/render_symbol_layer.cpp | 7 +- src/mbgl/renderer/paint_property_binder.hpp | 27 --- 53 files changed, 819 insertions(+), 327 deletions(-) delete mode 100644 src/mbgl/programs/gl/preludes.cpp diff --git a/scripts/generate-shaders.js b/scripts/generate-shaders.js index 4f58608e20..fc9088fd21 100755 --- a/scripts/generate-shaders.js +++ b/scripts/generate-shaders.js @@ -5,6 +5,7 @@ require('flow-remove-types/register'); const path = require('path'); const outputPath = 'src/mbgl/programs/gl'; const zlib = require('zlib'); +const crypto = require('crypto'); var shaders = require('../mapbox-gl-js/src/shaders'); @@ -28,18 +29,23 @@ for (const key in shaders) { // https://github.com/mapbox/mapbox-gl-native/issues/13984 shaders[key].vertexSource = shaders[key].vertexSource.replace(/\ba_(\w+)_t\b/mg, 'u_$1_t'); + const hash = crypto.createHash('sha1'); + const vertex = concatenated.length; - concatenated += basicMinify(shaders[key].vertexSource); - concatenated += '\n\0'; + const vertexSource = basicMinify(shaders[key].vertexSource) + '\n\0'; + hash.update(vertexSource); + concatenated += vertexSource; const fragment = concatenated.length; - concatenated += basicMinify(shaders[key].fragmentSource); - concatenated += '\n\0'; + const fragmentSource = basicMinify(shaders[key].fragmentSource) + '\n\0'; + hash.update(fragmentSource); + concatenated += fragmentSource; offsets[key] = { vertex, fragment, originalKey: key, + hash: hash.digest('hex').substring(0, 16).match(/.{1,2}/g).map(n => `0x${n}`).join(', '), shaderName: key.replace(/[A-Z]+/g, (match) => `_${match.toLowerCase()}`), ShaderName: key.replace(/^[a-z]/g, (match) => match.toUpperCase()) }; @@ -49,6 +55,7 @@ for (const key in shaders) { offsets.symbolSDFIcon = { vertex: offsets.symbolSDF.vertex, fragment: offsets.symbolSDF.fragment, + hash: offsets.symbolSDF.hash, originalKey: 'symbolSDF', shaderName: 'symbol_sdf_icon', ShaderName: 'SymbolSDFIcon', @@ -57,6 +64,7 @@ offsets.symbolSDFIcon = { offsets.symbolSDFText = { vertex: offsets.symbolSDF.vertex, fragment: offsets.symbolSDF.fragment, + hash: offsets.symbolSDF.hash, originalKey: 'symbolSDF', shaderName: 'symbol_sdf_text', ShaderName: 'SymbolSDFText', @@ -71,10 +79,6 @@ const compressed = zlib.deflateSync(concatenated, {level: zlib.Z_BEST_COMPRESSIO .join(',\n ') .trim(); -function sourceOffset(key, type) { - return `programs::gl::shaderSource() + ${offsets[key][type]}` -} - writeIfModified(path.join(outputPath, 'shader_source.hpp'), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #pragma once @@ -85,6 +89,9 @@ namespace gl { const char* shaderSource(); +template +struct ShaderSource; + } // namespace gl } // namespace programs } // namespace mbgl @@ -119,29 +126,15 @@ writeIfModified(path.join(outputPath, 'preludes.hpp'), `// NOTE: DO NOT CHANGE T #pragma once -namespace mbgl { -namespace programs { -namespace gl { - -extern const char* vertexShaderPrelude; -extern const char* fragmentShaderPrelude; - -} // namespace gl -} // namespace programs -} // namespace mbgl -`); - -writeIfModified(path.join(outputPath, 'preludes.cpp'), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. - -#include -#include +#include namespace mbgl { namespace programs { namespace gl { -const char* vertexShaderPrelude = ${sourceOffset('prelude', 'vertex')}; -const char* fragmentShaderPrelude = ${sourceOffset('prelude', 'fragment')}; +constexpr const uint8_t preludeHash[8] = { ${offsets['prelude'].hash} }; +constexpr const auto vertexPreludeOffset = ${offsets['prelude'].vertex}; +constexpr const auto fragmentPreludeOffset = ${offsets['prelude'].fragment}; } // namespace gl } // namespace programs @@ -157,18 +150,37 @@ for (const key in offsets) { writeIfModified(path.join(outputPath, `${shaderName}.cpp`), `// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource<${ShaderName}Program> { + static constexpr const char* name = "${shaderName}"; + static constexpr const uint8_t hash[8] = { ${offsets[key].hash} }; + static constexpr const auto vertexOffset = ${offsets[key].vertex}; + static constexpr const auto fragmentOffset = ${offsets[key].fragment}; +}; + +constexpr const char* ShaderSource<${ShaderName}Program>::name; +constexpr const uint8_t ShaderSource<${ShaderName}Program>::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program<${ShaderName}Program>::createProgram( - reinterpret_cast(*this), programParameters, "${shaderName}", - ${sourceOffset(key, 'vertex')}, ${sourceOffset(key, 'fragment')}); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/core-files.json b/src/core-files.json index 153a965567..e78f6232c3 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -82,7 +82,6 @@ "src/mbgl/programs/gl/line_gradient.cpp", "src/mbgl/programs/gl/line_pattern.cpp", "src/mbgl/programs/gl/line_sdf.cpp", - "src/mbgl/programs/gl/preludes.cpp", "src/mbgl/programs/gl/raster.cpp", "src/mbgl/programs/gl/shader_source.cpp", "src/mbgl/programs/gl/shaders.cpp", diff --git a/src/mbgl/gl/attribute.hpp b/src/mbgl/gl/attribute.hpp index 62c89178cd..c7f9ba3fd4 100644 --- a/src/mbgl/gl/attribute.hpp +++ b/src/mbgl/gl/attribute.hpp @@ -95,5 +95,36 @@ public: } }; +template +class AttributeKey; + +constexpr auto attributeDefinePrefix() { + return "#define HAS_UNIFORM_u_"; +} + +template +class AttributeKey> final { +public: + static_assert(sizeof...(As) <= 32, "attribute count exceeds 32"); + + static uint32_t compute(const gfx::AttributeBindings>& bindings) { + uint32_t value = 0; + util::ignore( + { (bindings.template get() ? (void)(value |= 1 << TypeIndex::value) + : (void)0, + 0)... }); + return value; + } + + static std::string defines(const gfx::AttributeBindings>& bindings) { + std::string result; + util::ignore({ (!bindings.template get() + ? (void)(result += concat_literals<&attributeDefinePrefix, &As::name, &string_literal<'\n'>::value>::value()) + : (void)0, + 0)... }); + return result; + } +}; + } // namespace gl } // namespace mbgl diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index 1f780331c2..eff3c2160c 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -160,12 +160,10 @@ void Context::enableDebugging() { MBGL_CHECK_ERROR(debugging->debugMessageCallback(extension::Debugging::DebugCallback, nullptr)); } -UniqueShader Context::createShader(ShaderType type, const std::string& source) { +UniqueShader Context::createShader(ShaderType type, const std::initializer_list& sources) { UniqueShader result { MBGL_CHECK_ERROR(glCreateShader(static_cast(type))), { this } }; - const GLchar* sources = source.data(); - const auto lengths = static_cast(source.length()); - MBGL_CHECK_ERROR(glShaderSource(result, 1, &sources, &lengths)); + MBGL_CHECK_ERROR(glShaderSource(result, static_cast(sources.size()), sources.begin(), nullptr)); MBGL_CHECK_ERROR(glCompileShader(result)); GLint status = 0; diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 754b29c03e..8a67213628 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -46,7 +46,7 @@ public: void enableDebugging(); - UniqueShader createShader(ShaderType type, const std::string& source); + UniqueShader createShader(ShaderType type, const std::initializer_list& sources); UniqueProgram createProgram(ShaderID vertexShader, ShaderID fragmentShader); UniqueProgram createProgram(BinaryProgramFormat binaryFormat, const std::string& binaryProgram); void verifyProgramLinkage(ProgramID); diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp index 9028ffdf53..1cec7671a1 100644 --- a/src/mbgl/gl/program.hpp +++ b/src/mbgl/gl/program.hpp @@ -18,6 +18,7 @@ #include #include +#include #include #include @@ -31,93 +32,128 @@ public: using AttributeList = typename Name::AttributeList; using UniformList = typename Name::UniformList; using TextureList = typename Name::TextureList; - - Program(Context& context, const std::string& vertexSource, const std::string& fragmentSource) - : program( - context.createProgram(context.createShader(ShaderType::Vertex, vertexSource), - context.createShader(ShaderType::Fragment, fragmentSource))), - attributeLocations(context, program) { - // Re-link program after manually binding only active attributes in Attributes::queryLocations - context.linkProgram(program); - - // We have to re-initialize the uniforms state from the bindings as the uniform locations - // get shifted on some implementations - uniformStates.queryLocations(program); - - // Texture units are specified via uniforms as well, so we need query their locations - textureStates.queryLocations(program); - } - template - Program(Context& context, const BinaryProgram& binaryProgram) - : program(context.createProgram(binaryProgram.format(), binaryProgram.code())), - attributeLocations(binaryProgram) { - uniformStates.loadNamedLocations(binaryProgram); - textureStates.loadNamedLocations(binaryProgram); + Program(ProgramParameters programParameters_) + : programParameters(std::move(programParameters_)) { } - static std::unique_ptr createProgram(gl::Context& context, - const ProgramParameters& programParameters, - const char* name, - const char* vertexSource_, - const char* fragmentSource_) { - const std::string vertexSource = programs::gl::vertexSource(programParameters, vertexSource_); - const std::string fragmentSource = programs::gl::fragmentSource(programParameters, fragmentSource_); + const ProgramParameters programParameters; + + static constexpr const auto vertexOffset = programs::gl::ShaderSource::vertexOffset; + static constexpr const auto fragmentOffset = programs::gl::ShaderSource::fragmentOffset; + + class Instance { + public: + Instance(Context& context, + const std::initializer_list& vertexSource, + const std::initializer_list& fragmentSource) + : program(context.createProgram( + context.createShader(ShaderType::Vertex, vertexSource), + context.createShader(ShaderType::Fragment, fragmentSource))), + attributeLocations(context, program) { + // Re-link program after manually binding only active attributes in Attributes::queryLocations + context.linkProgram(program); + + // We have to re-initialize the uniforms state from the bindings as the uniform locations + // get shifted on some implementations + uniformStates.queryLocations(program); + + // Texture units are specified via uniforms as well, so we need query their locations + textureStates.queryLocations(program); + } + + template + Instance(Context& context, const BinaryProgram& binaryProgram) + : program(context.createProgram(binaryProgram.format(), binaryProgram.code())), + attributeLocations(binaryProgram) { + uniformStates.loadNamedLocations(binaryProgram); + textureStates.loadNamedLocations(binaryProgram); + } + + static std::unique_ptr + createInstance(gl::Context& context, + const ProgramParameters& programParameters, + const std::string& additionalDefines) { + + #if MBGL_HAS_BINARY_PROGRAMS - optional cachePath = programParameters.cachePath(name); - if (cachePath && context.supportsProgramBinaries()) { - const std::string identifier = programs::gl::programIdentifier(vertexSource, fragmentSource); - - try { - if (auto cachedBinaryProgram = util::readFile(*cachePath)) { - const BinaryProgram binaryProgram(std::move(*cachedBinaryProgram)); - if (binaryProgram.identifier() == identifier) { - return std::make_unique(context, binaryProgram); - } else { - Log::Warning(Event::OpenGL, - "Cached program %s changed. Recompilation required.", - name); + optional cachePath = + programParameters.cachePath(programs::gl::ShaderSource::name); + std::string programIdentifier; + if (cachePath && context.supportsProgramBinaries()) { + programIdentifier = programs::gl::programIdentifier( + programParameters.getDefines(), additionalDefines, programs::gl::preludeHash, + programs::gl::ShaderSource::hash); + + try { + if (auto cachedBinaryProgram = util::readFile(*cachePath)) { + const BinaryProgram binaryProgram(std::move(*cachedBinaryProgram)); + if (binaryProgram.identifier() == programIdentifier) { + return std::make_unique(context, binaryProgram); + } else { + Log::Warning(Event::OpenGL, + "Cached program %s changed. Recompilation required.", + programs::gl::ShaderSource::name); + } } + } catch (std::runtime_error& error) { + Log::Warning(Event::OpenGL, "Could not load cached program: %s", + error.what()); } - } catch (std::runtime_error& error) { - Log::Warning(Event::OpenGL, "Could not load cached program: %s", - error.what()); } +#endif // Compile the shader - auto result = std::make_unique(context, vertexSource, fragmentSource); + const std::initializer_list vertexSource = { + programParameters.getDefines().c_str(), + additionalDefines.c_str(), + (programs::gl::shaderSource() + programs::gl::vertexPreludeOffset), + (programs::gl::shaderSource() + vertexOffset) + }; + const std::initializer_list fragmentSource = { + programParameters.getDefines().c_str(), + additionalDefines.c_str(), + (programs::gl::shaderSource() + programs::gl::fragmentPreludeOffset), + (programs::gl::shaderSource() + fragmentOffset) + }; + auto result = std::make_unique(context, vertexSource, fragmentSource); - try { - if (const auto binaryProgram = - result->template get(context, identifier)) { - util::write_file(*cachePath, binaryProgram->serialize()); - Log::Warning(Event::OpenGL, "Caching program in: %s", (*cachePath).c_str()); +#if MBGL_HAS_BINARY_PROGRAMS + if (cachePath && context.supportsProgramBinaries()) { + try { + if (const auto binaryProgram = + result->template get(context, programIdentifier)) { + util::write_file(*cachePath, binaryProgram->serialize()); + Log::Warning(Event::OpenGL, "Caching program in: %s", (*cachePath).c_str()); + } + } catch (std::runtime_error& error) { + Log::Warning(Event::OpenGL, "Failed to cache program: %s", error.what()); } - } catch (std::runtime_error& error) { - Log::Warning(Event::OpenGL, "Failed to cache program: %s", error.what()); } - +#endif + return std::move(result); } -#endif - (void)name; - return std::make_unique(context, vertexSource, fragmentSource); - } - - template - optional get(Context& context, const std::string& identifier) const { - if (auto binaryProgram = context.getBinaryProgram(program)) { - return BinaryProgram{ binaryProgram->first, - std::move(binaryProgram->second), - identifier, - attributeLocations.getNamedLocations(), - uniformStates.getNamedLocations(), - textureStates.getNamedLocations() }; + template + optional get(Context& context, const std::string& identifier) const { + if (auto binaryProgram = context.getBinaryProgram(program)) { + return BinaryProgram{ binaryProgram->first, + std::move(binaryProgram->second), + identifier, + attributeLocations.getNamedLocations(), + uniformStates.getNamedLocations(), + textureStates.getNamedLocations() }; + } + return {}; } - return {}; - } + + UniqueProgram program; + gl::AttributeLocations attributeLocations; + gl::UniformStates uniformStates; + gl::TextureStates textureStates; + }; void draw(gfx::Context& genericContext, const gfx::DrawMode& drawMode, @@ -139,16 +175,29 @@ public: context.setColorMode(colorMode); context.setCullFaceMode(cullFaceMode); - context.program = program; + const uint32_t key = gl::AttributeKey::compute(attributeBindings); + auto it = instances.find(key); + if (it == instances.end()) { + it = instances + .emplace(key, + Instance::createInstance( + context, + programParameters, + gl::AttributeKey::defines(attributeBindings))) + .first; + } - uniformStates.bind(uniformValues); + auto& instance = *it->second; + context.program = instance.program; - textureStates.bind(context, textureBindings); + instance.uniformStates.bind(uniformValues); + + instance.textureStates.bind(context, textureBindings); auto& vertexArray = reinterpret_cast(*drawScope.resource).vertexArray; vertexArray.bind(context, indexBuffer, - attributeLocations.toBindingArray(attributeBindings)); + instance.attributeLocations.toBindingArray(attributeBindings)); context.draw(drawMode, indexOffset, @@ -156,11 +205,7 @@ public: } private: - UniqueProgram program; - - gl::AttributeLocations attributeLocations; - gl::UniformStates uniformStates; - gl::TextureStates textureStates; + std::map> instances; }; } // namespace gl diff --git a/src/mbgl/programs/circle_program.hpp b/src/mbgl/programs/circle_program.hpp index b108a43da3..2b218d1768 100644 --- a/src/mbgl/programs/circle_program.hpp +++ b/src/mbgl/programs/circle_program.hpp @@ -52,7 +52,7 @@ class CircleLayerPrograms final : public LayerTypePrograms { public: CircleLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : circle(context, programParameters) {} - ProgramMap circle; + CircleProgram circle; }; } // namespace mbgl diff --git a/src/mbgl/programs/fill_extrusion_program.hpp b/src/mbgl/programs/fill_extrusion_program.hpp index ca696230b4..85e2ff3caf 100644 --- a/src/mbgl/programs/fill_extrusion_program.hpp +++ b/src/mbgl/programs/fill_extrusion_program.hpp @@ -117,8 +117,8 @@ public: : fillExtrusion(context, programParameters), fillExtrusionPattern(context, programParameters), extrusionTexture(context, programParameters) {} - ProgramMap fillExtrusion; - ProgramMap fillExtrusionPattern; + FillExtrusionProgram fillExtrusion; + FillExtrusionPatternProgram fillExtrusionPattern; ExtrusionTextureProgram extrusionTexture; }; diff --git a/src/mbgl/programs/fill_program.hpp b/src/mbgl/programs/fill_program.hpp index 4684a84f54..99314c51b0 100644 --- a/src/mbgl/programs/fill_program.hpp +++ b/src/mbgl/programs/fill_program.hpp @@ -110,10 +110,10 @@ public: fillPattern(context, programParameters), fillOutline(context, programParameters), fillOutlinePattern(context, programParameters) {} - ProgramMap fill; - ProgramMap fillPattern; - ProgramMap fillOutline; - ProgramMap fillOutlinePattern; + FillProgram fill; + FillPatternProgram fillPattern; + FillOutlineProgram fillOutline; + FillOutlinePatternProgram fillOutlinePattern; }; } // namespace mbgl diff --git a/src/mbgl/programs/gl/background.cpp b/src/mbgl/programs/gl/background.cpp index da5ea25410..78074d670f 100644 --- a/src/mbgl/programs/gl/background.cpp +++ b/src/mbgl/programs/gl/background.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "background"; + static constexpr const uint8_t hash[8] = { 0x2d, 0xef, 0x97, 0xa2, 0xec, 0xb5, 0x67, 0xef }; + static constexpr const auto vertexOffset = 1429; + static constexpr const auto fragmentOffset = 1525; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "background", - programs::gl::shaderSource() + 1429, programs::gl::shaderSource() + 1525); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/background_pattern.cpp b/src/mbgl/programs/gl/background_pattern.cpp index af5d87129e..04111c7abd 100644 --- a/src/mbgl/programs/gl/background_pattern.cpp +++ b/src/mbgl/programs/gl/background_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "background_pattern"; + static constexpr const uint8_t hash[8] = { 0x70, 0x13, 0xc8, 0x7e, 0xba, 0x18, 0xf5, 0x19 }; + static constexpr const auto vertexOffset = 1675; + static constexpr const auto fragmentOffset = 2266; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "background_pattern", - programs::gl::shaderSource() + 1675, programs::gl::shaderSource() + 2266); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/circle.cpp b/src/mbgl/programs/gl/circle.cpp index ae2b65c20f..d1f1e29d33 100644 --- a/src/mbgl/programs/gl/circle.cpp +++ b/src/mbgl/programs/gl/circle.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "circle"; + static constexpr const uint8_t hash[8] = { 0xf0, 0x3e, 0x18, 0xb7, 0x75, 0xb2, 0xde, 0xa9 }; + static constexpr const auto vertexOffset = 2927; + static constexpr const auto fragmentOffset = 6093; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "circle", - programs::gl::shaderSource() + 2927, programs::gl::shaderSource() + 6093); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/clipping_mask.cpp b/src/mbgl/programs/gl/clipping_mask.cpp index 311877f065..3179ab0c13 100644 --- a/src/mbgl/programs/gl/clipping_mask.cpp +++ b/src/mbgl/programs/gl/clipping_mask.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "clipping_mask"; + static constexpr const uint8_t hash[8] = { 0x3e, 0x17, 0xc2, 0x3a, 0x1f, 0xf0, 0xa8, 0xa3 }; + static constexpr const auto vertexOffset = 7848; + static constexpr const auto fragmentOffset = 7944; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "clipping_mask", - programs::gl::shaderSource() + 7848, programs::gl::shaderSource() + 7944); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/collision_box.cpp b/src/mbgl/programs/gl/collision_box.cpp index 9af67f7981..f7ac4d4d67 100644 --- a/src/mbgl/programs/gl/collision_box.cpp +++ b/src/mbgl/programs/gl/collision_box.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "collision_box"; + static constexpr const uint8_t hash[8] = { 0xcb, 0x6a, 0x9b, 0xd1, 0x1f, 0x31, 0xf8, 0x5b }; + static constexpr const auto vertexOffset = 9956; + static constexpr const auto fragmentOffset = 10635; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "collision_box", - programs::gl::shaderSource() + 9956, programs::gl::shaderSource() + 10635); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/collision_circle.cpp b/src/mbgl/programs/gl/collision_circle.cpp index 843f9161bb..8f1b5726fe 100644 --- a/src/mbgl/programs/gl/collision_circle.cpp +++ b/src/mbgl/programs/gl/collision_circle.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "collision_circle"; + static constexpr const uint8_t hash[8] = { 0x99, 0x2e, 0xad, 0x8c, 0xd3, 0x88, 0xae, 0x82 }; + static constexpr const auto vertexOffset = 10858; + static constexpr const auto fragmentOffset = 11774; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "collision_circle", - programs::gl::shaderSource() + 10858, programs::gl::shaderSource() + 11774); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/debug.cpp b/src/mbgl/programs/gl/debug.cpp index 8b7aee5a0b..ad23f420ab 100644 --- a/src/mbgl/programs/gl/debug.cpp +++ b/src/mbgl/programs/gl/debug.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "debug"; + static constexpr const uint8_t hash[8] = { 0xa8, 0x7d, 0x87, 0x6e, 0x36, 0xa8, 0x81, 0xe3 }; + static constexpr const auto vertexOffset = 12450; + static constexpr const auto fragmentOffset = 12546; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "debug", - programs::gl::shaderSource() + 12450, programs::gl::shaderSource() + 12546); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/extrusion_texture.cpp b/src/mbgl/programs/gl/extrusion_texture.cpp index bd320d52cf..bca533a788 100644 --- a/src/mbgl/programs/gl/extrusion_texture.cpp +++ b/src/mbgl/programs/gl/extrusion_texture.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "extrusion_texture"; + static constexpr const uint8_t hash[8] = { 0xd9, 0x77, 0x11, 0xd2, 0x03, 0xc7, 0x27, 0xcb }; + static constexpr const auto vertexOffset = 27554; + static constexpr const auto fragmentOffset = 27734; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "extrusion_texture", - programs::gl::shaderSource() + 27554, programs::gl::shaderSource() + 27734); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill.cpp b/src/mbgl/programs/gl/fill.cpp index 44ab40949c..a699f82609 100644 --- a/src/mbgl/programs/gl/fill.cpp +++ b/src/mbgl/programs/gl/fill.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill"; + static constexpr const uint8_t hash[8] = { 0x87, 0xea, 0x65, 0x7f, 0x0c, 0x9b, 0x97, 0x5d }; + static constexpr const auto vertexOffset = 12610; + static constexpr const auto fragmentOffset = 13254; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill", - programs::gl::shaderSource() + 12610, programs::gl::shaderSource() + 13254); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_extrusion.cpp b/src/mbgl/programs/gl/fill_extrusion.cpp index bd26d7afde..83a8eadee6 100644 --- a/src/mbgl/programs/gl/fill_extrusion.cpp +++ b/src/mbgl/programs/gl/fill_extrusion.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_extrusion"; + static constexpr const uint8_t hash[8] = { 0x49, 0x8a, 0xa2, 0x8b, 0x21, 0x74, 0x27, 0x93 }; + static constexpr const auto vertexOffset = 21238; + static constexpr const auto fragmentOffset = 23121; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_extrusion", - programs::gl::shaderSource() + 21238, programs::gl::shaderSource() + 23121); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp index 94a663947a..45068d84b8 100644 --- a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp +++ b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_extrusion_pattern"; + static constexpr const uint8_t hash[8] = { 0x93, 0x2b, 0xd1, 0xab, 0xa3, 0xf2, 0x24, 0x63 }; + static constexpr const auto vertexOffset = 23237; + static constexpr const auto fragmentOffset = 26157; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_extrusion_pattern", - programs::gl::shaderSource() + 23237, programs::gl::shaderSource() + 26157); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_outline.cpp b/src/mbgl/programs/gl/fill_outline.cpp index 6186db4c9a..e7644468a5 100644 --- a/src/mbgl/programs/gl/fill_outline.cpp +++ b/src/mbgl/programs/gl/fill_outline.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_outline"; + static constexpr const uint8_t hash[8] = { 0x56, 0x65, 0x69, 0x4b, 0x70, 0x2d, 0x3d, 0xc4 }; + static constexpr const auto vertexOffset = 13678; + static constexpr const auto fragmentOffset = 14503; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_outline", - programs::gl::shaderSource() + 13678, programs::gl::shaderSource() + 14503); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_outline_pattern.cpp b/src/mbgl/programs/gl/fill_outline_pattern.cpp index 9989c4076a..40aa5ea2de 100644 --- a/src/mbgl/programs/gl/fill_outline_pattern.cpp +++ b/src/mbgl/programs/gl/fill_outline_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_outline_pattern"; + static constexpr const uint8_t hash[8] = { 0x56, 0x9c, 0x2f, 0x58, 0x6b, 0x31, 0xff, 0x84 }; + static constexpr const auto vertexOffset = 15092; + static constexpr const auto fragmentOffset = 16952; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_outline_pattern", - programs::gl::shaderSource() + 15092, programs::gl::shaderSource() + 16952); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_pattern.cpp b/src/mbgl/programs/gl/fill_pattern.cpp index 10d6c6ab85..fd16d8bfc9 100644 --- a/src/mbgl/programs/gl/fill_pattern.cpp +++ b/src/mbgl/programs/gl/fill_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_pattern"; + static constexpr const uint8_t hash[8] = { 0x74, 0xa9, 0x97, 0x01, 0x96, 0xbd, 0x87, 0x36 }; + static constexpr const auto vertexOffset = 18259; + static constexpr const auto fragmentOffset = 20038; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_pattern", - programs::gl::shaderSource() + 18259, programs::gl::shaderSource() + 20038); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/heatmap.cpp b/src/mbgl/programs/gl/heatmap.cpp index 836fd52b07..3b960f1bda 100644 --- a/src/mbgl/programs/gl/heatmap.cpp +++ b/src/mbgl/programs/gl/heatmap.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "heatmap"; + static constexpr const uint8_t hash[8] = { 0xab, 0x97, 0x81, 0x5c, 0xa2, 0x88, 0xaa, 0x7e }; + static constexpr const auto vertexOffset = 7983; + static constexpr const auto fragmentOffset = 9030; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "heatmap", - programs::gl::shaderSource() + 7983, programs::gl::shaderSource() + 9030); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/heatmap_texture.cpp b/src/mbgl/programs/gl/heatmap_texture.cpp index 530e9fa18b..57b033d55c 100644 --- a/src/mbgl/programs/gl/heatmap_texture.cpp +++ b/src/mbgl/programs/gl/heatmap_texture.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "heatmap_texture"; + static constexpr const uint8_t hash[8] = { 0x9f, 0xc7, 0x56, 0xb2, 0x9e, 0x8f, 0x15, 0xff }; + static constexpr const auto vertexOffset = 9491; + static constexpr const auto fragmentOffset = 9671; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "heatmap_texture", - programs::gl::shaderSource() + 9491, programs::gl::shaderSource() + 9671); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/hillshade.cpp b/src/mbgl/programs/gl/hillshade.cpp index dcf90f1149..a33ddb4326 100644 --- a/src/mbgl/programs/gl/hillshade.cpp +++ b/src/mbgl/programs/gl/hillshade.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "hillshade"; + static constexpr const uint8_t hash[8] = { 0x8a, 0x11, 0x29, 0x18, 0x52, 0x7f, 0x3b, 0xbb }; + static constexpr const auto vertexOffset = 29340; + static constexpr const auto fragmentOffset = 29511; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "hillshade", - programs::gl::shaderSource() + 29340, programs::gl::shaderSource() + 29511); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/hillshade_prepare.cpp b/src/mbgl/programs/gl/hillshade_prepare.cpp index b445713530..a302db5feb 100644 --- a/src/mbgl/programs/gl/hillshade_prepare.cpp +++ b/src/mbgl/programs/gl/hillshade_prepare.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "hillshade_prepare"; + static constexpr const uint8_t hash[8] = { 0xe6, 0x01, 0xf2, 0xbb, 0xa0, 0x77, 0x1d, 0xeb }; + static constexpr const auto vertexOffset = 27925; + static constexpr const auto fragmentOffset = 28218; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "hillshade_prepare", - programs::gl::shaderSource() + 27925, programs::gl::shaderSource() + 28218); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line.cpp b/src/mbgl/programs/gl/line.cpp index 1f96b74a9c..e59cb07cb9 100644 --- a/src/mbgl/programs/gl/line.cpp +++ b/src/mbgl/programs/gl/line.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line"; + static constexpr const uint8_t hash[8] = { 0x44, 0x46, 0x9e, 0x59, 0x02, 0xbb, 0xaa, 0xae }; + static constexpr const auto vertexOffset = 30585; + static constexpr const auto fragmentOffset = 33509; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line", - programs::gl::shaderSource() + 30585, programs::gl::shaderSource() + 33509); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line_gradient.cpp b/src/mbgl/programs/gl/line_gradient.cpp index 493fc850d1..f5325f84ba 100644 --- a/src/mbgl/programs/gl/line_gradient.cpp +++ b/src/mbgl/programs/gl/line_gradient.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line_gradient"; + static constexpr const uint8_t hash[8] = { 0xee, 0xdd, 0x10, 0x3d, 0x1a, 0x21, 0x26, 0x25 }; + static constexpr const auto vertexOffset = 34335; + static constexpr const auto fragmentOffset = 37054; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line_gradient", - programs::gl::shaderSource() + 34335, programs::gl::shaderSource() + 37054); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line_pattern.cpp b/src/mbgl/programs/gl/line_pattern.cpp index 747b2bd197..e323b16785 100644 --- a/src/mbgl/programs/gl/line_pattern.cpp +++ b/src/mbgl/programs/gl/line_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line_pattern"; + static constexpr const uint8_t hash[8] = { 0x73, 0xa0, 0x59, 0x46, 0x57, 0xa5, 0x60, 0x25 }; + static constexpr const auto vertexOffset = 37841; + static constexpr const auto fragmentOffset = 41162; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line_pattern", - programs::gl::shaderSource() + 37841, programs::gl::shaderSource() + 41162); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line_sdf.cpp b/src/mbgl/programs/gl/line_sdf.cpp index 12fb5b61fd..a7b4e7e3b7 100644 --- a/src/mbgl/programs/gl/line_sdf.cpp +++ b/src/mbgl/programs/gl/line_sdf.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line_sdf"; + static constexpr const uint8_t hash[8] = { 0x66, 0x20, 0x75, 0x4e, 0xbe, 0x02, 0x9e, 0x67 }; + static constexpr const auto vertexOffset = 43475; + static constexpr const auto fragmentOffset = 47089; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line_sdf", - programs::gl::shaderSource() + 43475, programs::gl::shaderSource() + 47089); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/preludes.cpp b/src/mbgl/programs/gl/preludes.cpp deleted file mode 100644 index 6c895c0d36..0000000000 --- a/src/mbgl/programs/gl/preludes.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. - -#include -#include - -namespace mbgl { -namespace programs { -namespace gl { - -const char* vertexShaderPrelude = programs::gl::shaderSource() + 0; -const char* fragmentShaderPrelude = programs::gl::shaderSource() + 1252; - -} // namespace gl -} // namespace programs -} // namespace mbgl diff --git a/src/mbgl/programs/gl/preludes.hpp b/src/mbgl/programs/gl/preludes.hpp index 6d86ee45c5..e796f1655b 100644 --- a/src/mbgl/programs/gl/preludes.hpp +++ b/src/mbgl/programs/gl/preludes.hpp @@ -2,12 +2,15 @@ #pragma once +#include + namespace mbgl { namespace programs { namespace gl { -extern const char* vertexShaderPrelude; -extern const char* fragmentShaderPrelude; +constexpr const uint8_t preludeHash[8] = { 0x24, 0x91, 0x82, 0x37, 0x02, 0xad, 0x98, 0x0a }; +constexpr const auto vertexPreludeOffset = 0; +constexpr const auto fragmentPreludeOffset = 1252; } // namespace gl } // namespace programs diff --git a/src/mbgl/programs/gl/raster.cpp b/src/mbgl/programs/gl/raster.cpp index 512dc81a30..1867a48f1c 100644 --- a/src/mbgl/programs/gl/raster.cpp +++ b/src/mbgl/programs/gl/raster.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "raster"; + static constexpr const uint8_t hash[8] = { 0x40, 0x3d, 0x6c, 0xf4, 0xd0, 0x41, 0x51, 0x0e }; + static constexpr const auto vertexOffset = 48592; + static constexpr const auto fragmentOffset = 48941; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "raster", - programs::gl::shaderSource() + 48592, programs::gl::shaderSource() + 48941); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/shader_source.hpp b/src/mbgl/programs/gl/shader_source.hpp index f6de8a56cc..1a5fbddae3 100644 --- a/src/mbgl/programs/gl/shader_source.hpp +++ b/src/mbgl/programs/gl/shader_source.hpp @@ -8,6 +8,9 @@ namespace gl { const char* shaderSource(); +template +struct ShaderSource; + } // namespace gl } // namespace programs } // namespace mbgl diff --git a/src/mbgl/programs/gl/shaders.cpp b/src/mbgl/programs/gl/shaders.cpp index 3cc33992de..6fb4d70db9 100644 --- a/src/mbgl/programs/gl/shaders.cpp +++ b/src/mbgl/programs/gl/shaders.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -9,20 +10,17 @@ namespace mbgl { namespace programs { namespace gl { -std::string fragmentSource(const ProgramParameters& parameters, const char* fragmentSource) { - return parameters.getDefines() + fragmentShaderPrelude + fragmentSource; -} - -std::string vertexSource(const ProgramParameters& parameters, const char* vertexSource) { - return parameters.getDefines() + vertexShaderPrelude + vertexSource; -} - -std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource) { +std::string programIdentifier(const std::string& defines1, + const std::string& defines2, + const uint8_t hash1[8], + const uint8_t hash2[8]) { std::string result; - result.reserve((sizeof(size_t) * 2) * 2 + 2); // 2 size_t hex values + "v2" - result += util::toHex(std::hash()(vertexSource)); - result += util::toHex(std::hash()(fragmentSource)); - result += "v3"; + result.reserve(8 + 8 + (sizeof(size_t) * 2) * 2 + 2); + result.append(util::toHex(std::hash()(defines1))); + result.append(util::toHex(std::hash()(defines2))); + result.append(hash1, hash2 + 8); + result.append(hash2, hash2 + 8); + result.append("v3"); return result; } diff --git a/src/mbgl/programs/gl/shaders.hpp b/src/mbgl/programs/gl/shaders.hpp index 5278ea54da..46a87f4af8 100644 --- a/src/mbgl/programs/gl/shaders.hpp +++ b/src/mbgl/programs/gl/shaders.hpp @@ -9,9 +9,10 @@ class ProgramParameters; namespace programs { namespace gl { -std::string fragmentSource(const ProgramParameters&, const char* fragmentSource); -std::string vertexSource(const ProgramParameters&, const char* vertexSource); -std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource); +std::string programIdentifier(const std::string& defines1, + const std::string& defines2, + const uint8_t hash1[8], + const uint8_t hash2[8]); } // namespace gl } // namespace programs diff --git a/src/mbgl/programs/gl/symbol_icon.cpp b/src/mbgl/programs/gl/symbol_icon.cpp index 1cf2090ba3..6cb2b88543 100644 --- a/src/mbgl/programs/gl/symbol_icon.cpp +++ b/src/mbgl/programs/gl/symbol_icon.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "symbol_icon"; + static constexpr const uint8_t hash[8] = { 0x96, 0x0c, 0xef, 0xec, 0x37, 0x23, 0xf9, 0xb1 }; + static constexpr const auto vertexOffset = 50000; + static constexpr const auto fragmentOffset = 52654; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "symbol_icon", - programs::gl::shaderSource() + 50000, programs::gl::shaderSource() + 52654); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/symbol_sdf_icon.cpp b/src/mbgl/programs/gl/symbol_sdf_icon.cpp index ccb213bcfd..d98554099f 100644 --- a/src/mbgl/programs/gl/symbol_sdf_icon.cpp +++ b/src/mbgl/programs/gl/symbol_sdf_icon.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "symbol_sdf_icon"; + static constexpr const uint8_t hash[8] = { 0x13, 0xfc, 0x05, 0x2a, 0xd1, 0x93, 0xfb, 0x7d }; + static constexpr const auto vertexOffset = 53059; + static constexpr const auto fragmentOffset = 57099; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "symbol_sdf_icon", - programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/symbol_sdf_text.cpp b/src/mbgl/programs/gl/symbol_sdf_text.cpp index 0d08a64dee..81f3729d92 100644 --- a/src/mbgl/programs/gl/symbol_sdf_text.cpp +++ b/src/mbgl/programs/gl/symbol_sdf_text.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "symbol_sdf_text"; + static constexpr const uint8_t hash[8] = { 0x13, 0xfc, 0x05, 0x2a, 0xd1, 0x93, 0xfb, 0x7d }; + static constexpr const auto vertexOffset = 53059; + static constexpr const auto fragmentOffset = 57099; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "symbol_sdf_text", - programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/heatmap_program.hpp b/src/mbgl/programs/heatmap_program.hpp index 89ba655105..537a9e9565 100644 --- a/src/mbgl/programs/heatmap_program.hpp +++ b/src/mbgl/programs/heatmap_program.hpp @@ -52,7 +52,7 @@ public: HeatmapLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : heatmap(context, programParameters), heatmapTexture(context, programParameters) {} - ProgramMap heatmap; + HeatmapProgram heatmap; HeatmapTextureProgram heatmapTexture; }; diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp index 9ec01bd3ac..26f630a5eb 100644 --- a/src/mbgl/programs/line_program.hpp +++ b/src/mbgl/programs/line_program.hpp @@ -189,10 +189,10 @@ public: lineGradient(context, programParameters), lineSDF(context, programParameters), linePattern(context, programParameters) {} - ProgramMap line; - ProgramMap lineGradient; - ProgramMap lineSDF; - ProgramMap linePattern; + LineProgram line; + LineGradientProgram lineGradient; + LineSDFProgram lineSDF; + LinePatternProgram linePattern; }; } // namespace mbgl diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index 240da22b4f..e4d2af95f8 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -109,36 +109,6 @@ public: } }; -template -class ProgramMap { -public: - using PaintProperties = typename Program::PaintProperties; - using Binders = typename Program::Binders; - using Bitset = typename Binders::Bitset; - - ProgramMap(gfx::Context& context_, ProgramParameters parameters_) - : context(context_), - parameters(std::move(parameters_)) { - } - - Program& get(const typename PaintProperties::PossiblyEvaluated& currentProperties) { - Bitset bits = Binders::constants(currentProperties); - auto it = programs.find(bits); - if (it != programs.end()) { - return it->second; - } - return programs.emplace(std::piecewise_construct, - std::forward_as_tuple(bits), - std::forward_as_tuple(context, - parameters.withAdditionalDefines(Binders::defines(currentProperties)))).first->second; - } - -private: - gfx::Context& context; - ProgramParameters parameters; - std::unordered_map programs; -}; - class LayerTypePrograms { public: virtual ~LayerTypePrograms() = default; diff --git a/src/mbgl/programs/program_parameters.cpp b/src/mbgl/programs/program_parameters.cpp index 6b6c2bb2fe..e692b74e0e 100644 --- a/src/mbgl/programs/program_parameters.cpp +++ b/src/mbgl/programs/program_parameters.cpp @@ -40,13 +40,4 @@ optional ProgramParameters::cachePath(const char* name) const { } } -ProgramParameters ProgramParameters::withAdditionalDefines(const std::vector& additionalDefines) const { - ProgramParameters result(*this); - for (const auto& define : additionalDefines) { - result.defines += define; - result.defines += "\n"; - } - return result; -} - } // namespace mbgl diff --git a/src/mbgl/programs/program_parameters.hpp b/src/mbgl/programs/program_parameters.hpp index e94e61c217..71ad454399 100644 --- a/src/mbgl/programs/program_parameters.hpp +++ b/src/mbgl/programs/program_parameters.hpp @@ -3,7 +3,6 @@ #include #include -#include namespace mbgl { @@ -14,8 +13,6 @@ public: const std::string& getDefines() const; optional cachePath(const char* name) const; - ProgramParameters withAdditionalDefines(const std::vector& defines) const; - private: std::string defines; optional cacheDir; diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 66e53647ef..9c00caef84 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -468,9 +468,9 @@ public: symbolGlyph(context, programParameters), collisionBox(context, programParameters), collisionCircle(context, programParameters) {} - ProgramMap symbolIcon; - ProgramMap symbolIconSDF; - ProgramMap symbolGlyph; + SymbolIconProgram symbolIcon; + SymbolSDFIconProgram symbolIconSDF; + SymbolSDFTextProgram symbolGlyph; CollisionBoxProgram collisionBox; CollisionCircleProgram collisionCircle; }; diff --git a/src/mbgl/renderer/layers/render_circle_layer.cpp b/src/mbgl/renderer/layers/render_circle_layer.cpp index 9b463e6a6f..1c13a6152b 100644 --- a/src/mbgl/renderer/layers/render_circle_layer.cpp +++ b/src/mbgl/renderer/layers/render_circle_layer.cpp @@ -65,7 +65,7 @@ void RenderCircleLayer::render(PaintParameters& parameters, RenderSource*) { const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID()); - auto& programInstance = parameters.programs.getCircleLayerPrograms().circle.get(evaluated); + auto& programInstance = parameters.programs.getCircleLayerPrograms().circle; const auto allUniformValues = programInstance.computeAllUniformValues( CircleProgram::LayoutUniformValues { diff --git a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp index 0d0c9034e1..13ef84f169 100644 --- a/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_extrusion_layer.cpp @@ -119,7 +119,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* FillExtrusionBucket& bucket = *bucket_; draw( - parameters.programs.getFillExtrusionLayerPrograms().fillExtrusion.get(evaluated), + parameters.programs.getFillExtrusionLayerPrograms().fillExtrusion, bucket, FillExtrusionProgram::layoutUniformValues( tile.translatedClipMatrix(evaluated.get(), @@ -146,7 +146,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource* FillExtrusionBucket& bucket = *bucket_; draw( - parameters.programs.getFillExtrusionLayerPrograms().fillExtrusionPattern.get(evaluated), + parameters.programs.getFillExtrusionLayerPrograms().fillExtrusionPattern, bucket, FillExtrusionPatternProgram::layoutUniformValues( tile.translatedClipMatrix(evaluated.get(), diff --git a/src/mbgl/renderer/layers/render_fill_layer.cpp b/src/mbgl/renderer/layers/render_fill_layer.cpp index 2c6f1127f2..205a38e380 100644 --- a/src/mbgl/renderer/layers/render_fill_layer.cpp +++ b/src/mbgl/renderer/layers/render_fill_layer.cpp @@ -74,14 +74,12 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { } FillBucket& bucket = *bucket_; - auto draw = [&] (auto& program, + auto draw = [&] (auto& programInstance, const auto& drawMode, const auto& depthMode, const auto& indexBuffer, const auto& segments, auto&& textureBindings) { - auto& programInstance = program.get(evaluated); - const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID()); const auto allUniformValues = programInstance.computeAllUniformValues( @@ -162,14 +160,12 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) { } FillBucket& bucket = *bucket_; - auto draw = [&] (auto& program, + auto draw = [&] (auto& programInstance, const auto& drawMode, const auto& depthMode, const auto& indexBuffer, const auto& segments, auto&& textureBindings) { - auto& programInstance = program.get(evaluated); - const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID()); paintPropertyBinders.setPatternParameters(patternPosA, patternPosB, crossfade); diff --git a/src/mbgl/renderer/layers/render_heatmap_layer.cpp b/src/mbgl/renderer/layers/render_heatmap_layer.cpp index a8d25df818..f8ba68965e 100644 --- a/src/mbgl/renderer/layers/render_heatmap_layer.cpp +++ b/src/mbgl/renderer/layers/render_heatmap_layer.cpp @@ -102,7 +102,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) { const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID()); - auto& programInstance = parameters.programs.getHeatmapLayerPrograms().heatmap.get(evaluated); + auto& programInstance = parameters.programs.getHeatmapLayerPrograms().heatmap; const auto allUniformValues = programInstance.computeAllUniformValues( HeatmapProgram::LayoutUniformValues { diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index 60c487c205..a023bc6254 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -65,11 +65,10 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) { } LineBucket& bucket = *bucket_; - auto draw = [&](auto& program, auto&& uniformValues, + auto draw = [&](auto& programInstance, + auto&& uniformValues, const optional& patternPositionA, const optional& patternPositionB, auto&& textureBindings) { - auto& programInstance = program.get(evaluated); - const auto& paintPropertyBinders = bucket.paintPropertyBinders.at(getID()); paintPropertyBinders.setPatternParameters(patternPositionA, patternPositionB, crossfade); diff --git a/src/mbgl/renderer/layers/render_symbol_layer.cpp b/src/mbgl/renderer/layers/render_symbol_layer.cpp index 5fbc81663c..72c641e95a 100644 --- a/src/mbgl/renderer/layers/render_symbol_layer.cpp +++ b/src/mbgl/renderer/layers/render_symbol_layer.cpp @@ -88,17 +88,14 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) { const auto& evaluated_ = bucketPaintProperties.evaluated; const auto& layout = bucket.layout; - auto draw = [&] (auto& program, + auto draw = [&] (auto& programInstance, auto&& uniformValues, const auto& buffers, const auto& symbolSizeBinder, const SymbolPropertyValues& values_, const auto& binders, const auto& paintProperties, - auto&& textureBindings) - { - auto& programInstance = program.get(paintProperties); - + auto&& textureBindings) { const auto allUniformValues = programInstance.computeAllUniformValues( std::move(uniformValues), *symbolSizeBinder, diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index d233e6f2e0..60866832c6 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -545,33 +545,6 @@ public: return result; } - template - struct UniformDefines; - - template - struct UniformDefines> { - static constexpr auto define() { - return "#define HAS_UNIFORM_u_"; - } - - static void appendDefines(std::vector& defines) { - util::ignore({ - (defines.push_back(concat_literals<&define, &Us::name, &string_literal<'\n'>::value>::value()), 0)... - }); - } - }; - - template - static std::vector defines(const EvaluatedProperties& currentProperties) { - std::vector result; - util::ignore({ - (currentProperties.template get().isConstant() - ? UniformDefines::appendDefines(result) - : (void) 0, 0)... - }); - return result; - } - private: Binders binders; }; -- cgit v1.2.1 From f86cc81680dd64f135f4f7b813c6cbb1e7e822d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 20 Mar 2019 10:34:02 +0100 Subject: [core] move cleanup to gfx::Context --- src/mbgl/gfx/context.hpp | 4 ++++ src/mbgl/gl/context.cpp | 14 ++++++++++++++ src/mbgl/gl/context.hpp | 2 +- src/mbgl/renderer/renderer_impl.cpp | 15 +-------------- 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/src/mbgl/gfx/context.hpp b/src/mbgl/gfx/context.hpp index 3653eeebe1..ff84cf34e8 100644 --- a/src/mbgl/gfx/context.hpp +++ b/src/mbgl/gfx/context.hpp @@ -33,6 +33,10 @@ public: Context& operator=(const Context& other) = delete; virtual ~Context() = default; +public: + // Called at the end of a frame. + virtual void performCleanup() = 0; + public: template VertexBuffer diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index eff3c2160c..bc703db401 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -706,6 +707,19 @@ void Context::draw(const gfx::DrawMode& drawMode, } void Context::performCleanup() { + // TODO: Find a better way to unbind VAOs after we're done with them without introducing + // unnecessary bind(0)/bind(N) sequences. + { + MBGL_DEBUG_GROUP(*this, "cleanup"); + + activeTextureUnit = 1; + texture[1] = 0; + activeTextureUnit = 0; + texture[0] = 0; + + bindVertexArray = 0; + } + for (auto id : abandonedPrograms) { if (program == id) { program.setDirty(); diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 8a67213628..338a294b47 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -110,7 +110,7 @@ public: // Actually remove the objects we marked as abandoned with the above methods. // Only call this while the OpenGL context is exclusive to this thread. - void performCleanup(); + void performCleanup() override; // Drain pools and remove abandoned objects, in preparation for destroying the store. // Only call this while the OpenGL context is exclusive to this thread. diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index dee42a6128..aa47d56b47 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -589,19 +589,6 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { } #endif - // TODO: Find a better way to unbind VAOs after we're done with them without introducing - // unnecessary bind(0)/bind(N) sequences. - { - MBGL_DEBUG_GROUP(parameters.context, "cleanup"); - - glContext.activeTextureUnit = 1; - glContext.texture[1] = 0; - glContext.activeTextureUnit = 0; - glContext.texture[0] = 0; - - glContext.bindVertexArray = 0; - } - observer->onDidFinishRenderingFrame( loaded ? RendererObserver::RenderMode::Full : RendererObserver::RenderMode::Partial, updateParameters.mode == MapMode::Continuous && hasTransitions(parameters.timePoint) @@ -615,7 +602,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { } // Cleanup only after signaling completion - glContext.performCleanup(); + parameters.context.performCleanup(); } std::vector Renderer::Impl::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { -- cgit v1.2.1 From 3122df7e5075bb05c99d7033fceb9e561e795874 Mon Sep 17 00:00:00 2001 From: "Thiago Marcos P. Santos" Date: Tue, 19 Mar 2019 15:55:06 +0200 Subject: [core] Expose a way of flushing the graphics pipeline Useful for apps before going to background that are restricted by the OS of performing any operation. --- include/mbgl/renderer/renderer.hpp | 2 ++ src/mbgl/gl/context.cpp | 4 ++++ src/mbgl/gl/context.hpp | 5 +++++ src/mbgl/renderer/renderer.cpp | 4 ++++ src/mbgl/renderer/renderer_impl.cpp | 6 ++++++ src/mbgl/renderer/renderer_impl.hpp | 2 ++ 6 files changed, 23 insertions(+) diff --git a/include/mbgl/renderer/renderer.hpp b/include/mbgl/renderer/renderer.hpp index 1d92f9c0cb..0bed4cdaa8 100644 --- a/include/mbgl/renderer/renderer.hpp +++ b/include/mbgl/renderer/renderer.hpp @@ -34,6 +34,8 @@ public: void render(const UpdateParameters&); + void flush(); + // Feature queries std::vector queryRenderedFeatures(const ScreenLineString&, const RenderedQueryOptions& options = {}) const; std::vector queryRenderedFeatures(const ScreenCoordinate& point, const RenderedQueryOptions& options = {}) const; diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp index bc703db401..5ce035f691 100644 --- a/src/mbgl/gl/context.cpp +++ b/src/mbgl/gl/context.cpp @@ -787,5 +787,9 @@ void Context::performCleanup() { } } +void Context::flush() { + MBGL_CHECK_ERROR(glFinish()); +} + } // namespace gl } // namespace mbgl diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp index 338a294b47..d9f27eacc0 100644 --- a/src/mbgl/gl/context.hpp +++ b/src/mbgl/gl/context.hpp @@ -116,6 +116,11 @@ public: // Only call this while the OpenGL context is exclusive to this thread. void reset(); + // Flush pending graphics commands. Will block until the pipeline + // is empty. Should be used only with a very good reason because + // it will have a performance impact. + void flush(); + bool empty() const { return pooledTextures.empty() && abandonedPrograms.empty() diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp index fbd9049207..4da7b78374 100644 --- a/src/mbgl/renderer/renderer.cpp +++ b/src/mbgl/renderer/renderer.cpp @@ -34,6 +34,10 @@ void Renderer::render(const UpdateParameters& updateParameters) { impl->render(updateParameters); } +void Renderer::flush() { + impl->flush(); +} + std::vector Renderer::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { return impl->queryRenderedFeatures(geometry, options); } diff --git a/src/mbgl/renderer/renderer_impl.cpp b/src/mbgl/renderer/renderer_impl.cpp index aa47d56b47..311008507b 100644 --- a/src/mbgl/renderer/renderer_impl.cpp +++ b/src/mbgl/renderer/renderer_impl.cpp @@ -605,6 +605,12 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) { parameters.context.performCleanup(); } +void Renderer::Impl::flush() { + assert(BackendScope::exists()); + + backend.getContext().flush(); +} + std::vector Renderer::Impl::queryRenderedFeatures(const ScreenLineString& geometry, const RenderedQueryOptions& options) const { std::vector layers; if (options.layerIDs) { diff --git a/src/mbgl/renderer/renderer_impl.hpp b/src/mbgl/renderer/renderer_impl.hpp index 05bf2e9b2b..a036bfc7ff 100644 --- a/src/mbgl/renderer/renderer_impl.hpp +++ b/src/mbgl/renderer/renderer_impl.hpp @@ -48,6 +48,8 @@ public: void render(const UpdateParameters&); + void flush(); + std::vector queryRenderedFeatures(const ScreenLineString&, const RenderedQueryOptions&) const; std::vector querySourceFeatures(const std::string& sourceID, const SourceQueryOptions&) const; std::vector queryShapeAnnotations(const ScreenLineString&) const; -- cgit v1.2.1 From fc77090fce72448123c4d7d53289e452a378ca7a Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Wed, 20 Mar 2019 10:49:23 -0700 Subject: [ios, macos] Fix format expression parsing. (#14168) Fixed a parsing issue when a non-constant expression was passed to MGLAttributedExpression.expression property. --- platform/darwin/src/NSExpression+MGLAdditions.mm | 18 +++++------------- platform/darwin/test/MGLExpressionTests.mm | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index f0f1d62ef7..091f1edf9d 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -1016,14 +1016,10 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { if ([constantValue isKindOfClass:[MGLAttributedExpression class]]) { MGLAttributedExpression *attributedExpression = (MGLAttributedExpression *)constantValue; id jsonObject = attributedExpression.expression.mgl_jsonExpressionObject; - NSMutableArray *attributes = [NSMutableArray array]; - if ([jsonObject isKindOfClass:[NSArray class]]) { - [attributes addObjectsFromArray:jsonObject]; - } else { - [attributes addObject:jsonObject]; - } + NSMutableDictionary *attributedDictionary = [NSMutableDictionary dictionary]; + if (attributedExpression.attributes) { - NSMutableDictionary *attributedDictionary = [NSMutableDictionary dictionaryWithDictionary:attributedExpression.attributes]; + attributedDictionary = [NSMutableDictionary dictionaryWithDictionary:attributedExpression.attributes]; if (attributedDictionary[MGLFontNamesAttribute]) { attributedDictionary[MGLFontNamesAttribute] = @[@"literal", attributedDictionary[MGLFontNamesAttribute]]; } @@ -1031,12 +1027,8 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { MGLColor *color = attributedDictionary[MGLFontColorAttribute]; attributedDictionary[MGLFontColorAttribute] = color.mgl_jsonExpressionObject; } - [attributes addObject:attributedDictionary]; - } else { - [attributes addObject:@{}]; - } - - return attributes; + } + return @[jsonObject, attributedDictionary]; } return self.constantValue; } diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index 8e99ed596e..ec51f2bf6c 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -1062,6 +1062,14 @@ using namespace std::string_literals; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } + { + MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"]] ; + NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; + + NSArray *jsonExpression = @[ @"format", @"foo", @{ } ]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); + } { MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"] attributes:@{ MGLFontSizeAttribute: @(1.2), @@ -1086,6 +1094,18 @@ using namespace std::string_literals; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } + { + MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionWithFormat:@"CAST(x, 'NSString')"] + attributes:@{ MGLFontSizeAttribute: @(1.2), + MGLFontColorAttribute: [MGLColor redColor], + MGLFontNamesAttribute: @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ] + }] ; + NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; + + NSArray *jsonExpression = @[ @"format", @[@"to-string", @[@"get", @"x"]], @{ @"font-scale": @1.2, @"text-color": @[@"rgb", @255, @0, @0] , @"text-font" : @[ @"literal", @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ]]} ]; + XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); + } { MGLAttributedExpression *attribute1 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"foo"] fontNames:nil -- cgit v1.2.1 From 8b88088316ddcadaf16d622ecd9fd37d8e8a75cc Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 20 Mar 2019 16:53:23 +0100 Subject: [android] - add offline troubleshooting link to javadoc of OfflineManager --- .../src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java index 01ac098d16..40f5e5777b 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java @@ -26,7 +26,11 @@ import java.nio.channels.FileChannel; /** * The offline manager is the main entry point for offline-related functionality. + *

* It'll help you list and create offline regions. + *

+ * + * @see Offline Maps Information/ */ public class OfflineManager { -- cgit v1.2.1 From 8ac73254c19b36fff35c50991bf79f5c98fc4421 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Mon, 18 Mar 2019 23:41:34 +0200 Subject: [darwin] [MGLOfflineStorage mbglFileSource] is now a shared_ptr --- platform/darwin/src/MGLMapSnapshotter.mm | 4 ++-- platform/darwin/src/MGLOfflinePack.mm | 11 +++++------ platform/darwin/src/MGLOfflineStorage.mm | 21 +++++++++------------ platform/darwin/src/MGLOfflineStorage_Private.h | 4 +++- platform/darwin/src/MGLRendererConfiguration.h | 8 +++----- platform/darwin/src/MGLRendererConfiguration.mm | 4 ---- platform/ios/src/MGLMapView.mm | 2 +- platform/macos/src/MGLMapView.mm | 2 +- 8 files changed, 24 insertions(+), 32 deletions(-) diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 3918008b78..169808f774 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -587,7 +587,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; _cancelled = NO; _options = options; - mbgl::DefaultFileSource *mbglFileSource = [MGLOfflineStorage sharedOfflineStorage].mbglFileSource; + auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; _mbglThreadPool = mbgl::sharedThreadPool(); std::string styleURL = std::string([options.styleURL.absoluteString UTF8String]); @@ -621,7 +621,7 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; MGLRendererConfiguration* config = [MGLRendererConfiguration currentConfiguration]; // Create the snapshotter - _mbglMapSnapshotter = std::make_unique(mbglFileSource, _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName); + _mbglMapSnapshotter = std::make_unique(mbglFileSource.get(), _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName); } @end diff --git a/platform/darwin/src/MGLOfflinePack.mm b/platform/darwin/src/MGLOfflinePack.mm index a8f807374c..913e9c2233 100644 --- a/platform/darwin/src/MGLOfflinePack.mm +++ b/platform/darwin/src/MGLOfflinePack.mm @@ -74,7 +74,7 @@ private: _mbglOfflineRegion = region; _state = MGLOfflinePackStateUnknown; - mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; + auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionObserver(*_mbglOfflineRegion, std::make_unique(self)); } return self; @@ -115,7 +115,7 @@ private: self.state = MGLOfflinePackStateActive; - mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; + auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Active); } @@ -128,7 +128,7 @@ private: _isSuspending = YES; } - mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; + auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Inactive); } @@ -137,7 +137,7 @@ private: MGLAssert(_state != MGLOfflinePackStateInvalid, @"Cannot invalidate an already invalid offline pack."); self.state = MGLOfflinePackStateInvalid; - mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; + auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; mbglFileSource->setOfflineRegionObserver(*self.mbglOfflineRegion, nullptr); self.mbglOfflineRegion = nil; } @@ -164,8 +164,7 @@ private: MGLLogInfo(@"Requesting pack progress."); MGLAssertOfflinePackIsValid(); - mbgl::DefaultFileSource *mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; - + auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; __weak MGLOfflinePack *weakSelf = self; mbglFileSource->getOfflineRegionStatus(*_mbglOfflineRegion, [&, weakSelf](mbgl::expected status) { if (status) { diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index d1c5dadde8..a118916f86 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -43,7 +43,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio @interface MGLOfflineStorage () @property (nonatomic, strong, readwrite) NSMutableArray *packs; -@property (nonatomic) mbgl::DefaultFileSource *mbglFileSource; +@property (nonatomic) std::shared_ptr mbglFileSource; @property (nonatomic, getter=isPaused) BOOL paused; @end @@ -222,7 +222,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio [[NSFileManager defaultManager] moveItemAtPath:subdirectorylessCacheURL.path toPath:cachePath error:NULL]; } - _mbglFileSource = new mbgl::DefaultFileSource(cachePath.UTF8String, [NSBundle mainBundle].resourceURL.path.UTF8String); + _mbglFileSource = std::make_shared(cachePath.UTF8String, [NSBundle mainBundle].resourceURL.path.UTF8String); // Observe for changes to the API base URL (and find out the current one). [[MGLAccountManager sharedManager] addObserver:self @@ -249,9 +249,6 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio for (MGLOfflinePack *pack in self.packs) { [pack invalidate]; } - - delete _mbglFileSource; - _mbglFileSource = nullptr; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { @@ -259,14 +256,14 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio if ([keyPath isEqualToString:@"accessToken"] && object == [MGLAccountManager sharedManager]) { NSString *accessToken = change[NSKeyValueChangeNewKey]; if (![accessToken isKindOfClass:[NSNull class]]) { - self.mbglFileSource->setAccessToken(accessToken.UTF8String); + _mbglFileSource->setAccessToken(accessToken.UTF8String); } } else if ([keyPath isEqualToString:@"apiBaseURL"] && object == [MGLAccountManager sharedManager]) { NSURL *apiBaseURL = change[NSKeyValueChangeNewKey]; if ([apiBaseURL isKindOfClass:[NSNull class]]) { - self.mbglFileSource->setAPIBaseURL(mbgl::util::API_BASE_URL); + _mbglFileSource->setAPIBaseURL(mbgl::util::API_BASE_URL); } else { - self.mbglFileSource->setAPIBaseURL(apiBaseURL.absoluteString.UTF8String); + _mbglFileSource->setAPIBaseURL(apiBaseURL.absoluteString.UTF8String); } } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; @@ -332,7 +329,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio } - (void)_addContentsOfFile:(NSString *)filePath withCompletionHandler:(void (^)(NSArray * _Nullable packs, NSError * _Nullable error))completion { - self.mbglFileSource->mergeOfflineRegions(std::string(static_cast([filePath UTF8String])), [&, completion, filePath](mbgl::expected result) { + _mbglFileSource->mergeOfflineRegions(std::string(static_cast([filePath UTF8String])), [&, completion, filePath](mbgl::expected result) { NSError *error; NSMutableArray *packs; if (!result) { @@ -393,7 +390,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio const mbgl::OfflineRegionDefinition regionDefinition = [(id )region offlineRegionDefinition]; mbgl::OfflineRegionMetadata metadata(context.length); [context getBytes:&metadata[0] length:metadata.size()]; - self.mbglFileSource->createOfflineRegion(regionDefinition, metadata, [&, completion](mbgl::expected mbglOfflineRegion) { + _mbglFileSource->createOfflineRegion(regionDefinition, metadata, [&, completion](mbgl::expected mbglOfflineRegion) { NSError *error; if (!mbglOfflineRegion) { NSString *errorDescription = @(mbgl::util::toString(mbglOfflineRegion.error()).c_str()); @@ -428,7 +425,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio return; } - self.mbglFileSource->deleteOfflineRegion(std::move(*mbglOfflineRegion), [&, completion](std::exception_ptr exception) { + _mbglFileSource->deleteOfflineRegion(std::move(*mbglOfflineRegion), [&, completion](std::exception_ptr exception) { NSError *error; if (exception) { error = [NSError errorWithDomain:MGLErrorDomain code:-1 userInfo:@{ @@ -454,7 +451,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio } - (void)getPacksWithCompletionHandler:(void (^)(NSArray *packs, NSError * _Nullable error))completion { - self.mbglFileSource->listOfflineRegions([&, completion](mbgl::expected result) { + _mbglFileSource->listOfflineRegions([&, completion](mbgl::expected result) { NSError *error; NSMutableArray *packs; if (!result) { diff --git a/platform/darwin/src/MGLOfflineStorage_Private.h b/platform/darwin/src/MGLOfflineStorage_Private.h index 7c7b80dc46..c4618684ba 100644 --- a/platform/darwin/src/MGLOfflineStorage_Private.h +++ b/platform/darwin/src/MGLOfflineStorage_Private.h @@ -4,6 +4,8 @@ #include +#include + NS_ASSUME_NONNULL_BEGIN @interface MGLOfflineStorage (Private) @@ -11,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN /** The shared file source object owned by the shared offline storage object. */ -@property (nonatomic) mbgl::DefaultFileSource *mbglFileSource; +@property (nonatomic) std::shared_ptr mbglFileSource; @end diff --git a/platform/darwin/src/MGLRendererConfiguration.h b/platform/darwin/src/MGLRendererConfiguration.h index a2ad4d6cdc..ef7122ec51 100644 --- a/platform/darwin/src/MGLRendererConfiguration.h +++ b/platform/darwin/src/MGLRendererConfiguration.h @@ -1,7 +1,8 @@ #import "MGLFoundation.h" #import -#import -#import + +#include +#include NS_ASSUME_NONNULL_BEGIN @@ -15,9 +16,6 @@ MGL_EXPORT /** Returns an instance of the current renderer configuration. */ @property (class, nonatomic, readonly) MGLRendererConfiguration *currentConfiguration; -/** The file source to use. Defaults to `mbgl::DefaultFileSource` */ -@property (nonatomic, readonly) mbgl::DefaultFileSource *fileSource; - /** The GL context mode to use. Defaults to `mbgl::GLContextMode::Unique` */ @property (nonatomic, readonly) mbgl::GLContextMode contextMode; diff --git a/platform/darwin/src/MGLRendererConfiguration.mm b/platform/darwin/src/MGLRendererConfiguration.mm index 7a2f95cfda..78201987fe 100644 --- a/platform/darwin/src/MGLRendererConfiguration.mm +++ b/platform/darwin/src/MGLRendererConfiguration.mm @@ -57,10 +57,6 @@ static NSString * const MGLCollisionBehaviorPre4_0Key = @"MGLCollisionBehaviorPr return self; } -- (mbgl::DefaultFileSource *)fileSource { - return [MGLOfflineStorage sharedOfflineStorage].mbglFileSource; -} - - (mbgl::GLContextMode)contextMode { return mbgl::GLContextMode::Unique; } diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 692da30f04..2065f92f64 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -484,7 +484,7 @@ public: .withCrossSourceCollisions(enableCrossSourceCollisions); NSAssert(!_mbglMap, @"_mbglMap should be NULL"); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *[config fileSource], *_mbglThreadPool, mapOptions); + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *[[MGLOfflineStorage sharedOfflineStorage] mbglFileSource], *_mbglThreadPool, mapOptions); // start paused if in IB if (_isTargetingInterfaceBuilder || background) { diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 320abf740c..5b2fae90ab 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -295,7 +295,7 @@ public: .withConstrainMode(mbgl::ConstrainMode::None) .withViewportMode(mbgl::ViewportMode::Default) .withCrossSourceCollisions(enableCrossSourceCollisions); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *config.fileSource, *_mbglThreadPool, mapOptions); + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *[[MGLOfflineStorage sharedOfflineStorage] mbglFileSource], *_mbglThreadPool, mapOptions); // Install the OpenGL layer. Interface Builder’s synchronous drawing means // we can’t display a map, so don’t even bother to have a map layer. -- cgit v1.2.1 From d1762d7111b39d45430bd7bb75ea60b7a5d85bd2 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 19 Mar 2019 16:52:14 +0200 Subject: [core] Cleanup Map::Impl ctor --- src/mbgl/map/map.cpp | 22 +++++----------------- src/mbgl/map/map_impl.cpp | 42 ++++++++++++++++++++---------------------- src/mbgl/map/map_impl.hpp | 20 +++++--------------- 3 files changed, 30 insertions(+), 54 deletions(-) diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index f545fc8095..e8237cca74 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -27,24 +27,14 @@ namespace mbgl { using namespace style; -Map::Map(RendererFrontend& rendererFrontend, - MapObserver& mapObserver, +Map::Map(RendererFrontend& frontend, + MapObserver& observer, const Size size, const float pixelRatio, FileSource& fileSource, Scheduler& scheduler, - const MapOptions& options) - : impl(std::make_unique(*this, - rendererFrontend, - mapObserver, - fileSource, - scheduler, - size, - pixelRatio, - options.mapMode(), - options.constrainMode(), - options.viewportMode(), - options.crossSourceCollisions())) {} + const MapOptions& mapOptions) + : impl(std::make_unique(frontend, observer, fileSource, scheduler, size, pixelRatio, mapOptions)) {} Map::~Map() = default; @@ -139,9 +129,7 @@ CameraOptions Map::getCameraOptions(const EdgeInsets& padding) const { } void Map::jumpTo(const CameraOptions& camera) { - impl->cameraMutated = true; - impl->transform.jumpTo(camera); - impl->onUpdate(); + impl->jumpTo(camera); } void Map::easeTo(const CameraOptions& camera, const AnimationOptions& animation) { diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index 84cf324722..fbceff559f 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -6,31 +6,23 @@ namespace mbgl { -Map::Impl::Impl(Map& map_, - RendererFrontend& frontend, - MapObserver& mapObserver, +Map::Impl::Impl(RendererFrontend& frontend_, + MapObserver& observer_, FileSource& fileSource_, Scheduler& scheduler_, Size size_, float pixelRatio_, - MapMode mode_, - ConstrainMode constrainMode_, - ViewportMode viewportMode_, - bool crossSourceCollisions_) - : map(map_), - observer(mapObserver), - rendererFrontend(frontend), - fileSource(fileSource_), - scheduler(scheduler_), - transform(observer, - constrainMode_, - viewportMode_), - mode(mode_), - pixelRatio(pixelRatio_), - crossSourceCollisions(crossSourceCollisions_), - style(std::make_unique(scheduler, fileSource, pixelRatio)), - annotationManager(*style) { - + const MapOptions& mapOptions) + : observer(observer_), + rendererFrontend(frontend_), + fileSource(fileSource_), + scheduler(scheduler_), + transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()), + mode(mapOptions.mapMode()), + pixelRatio(pixelRatio_), + crossSourceCollisions(mapOptions.crossSourceCollisions()), + style(std::make_unique(scheduler, fileSource, pixelRatio)), + annotationManager(*style) { style->impl->setObserver(this); rendererFrontend.setObserver(*this); transform.resize(size_); @@ -90,7 +82,7 @@ void Map::Impl::onStyleLoading() { void Map::Impl::onStyleLoaded() { if (!cameraMutated) { - map.jumpTo(style->getDefaultCamera()); + jumpTo(style->getDefaultCamera()); } if (LayerManager::annotationsEnabled) { annotationManager.onStyleLoaded(); @@ -173,4 +165,10 @@ void Map::Impl::onDidFinishRenderingMap() { } }; +void Map::Impl::jumpTo(const CameraOptions& camera) { + cameraMutated = true; + transform.jumpTo(camera); + onUpdate(); +} + } // namespace mbgl diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp index 32dc728b70..d65fe5aafc 100644 --- a/src/mbgl/map/map_impl.hpp +++ b/src/mbgl/map/map_impl.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -26,20 +27,7 @@ struct StillImageRequest { class Map::Impl : public style::Observer, public RendererObserver { public: - Impl(Map&, - RendererFrontend&, - MapObserver&, - FileSource&, - Scheduler&, - - Size size, - float pixelRatio, - - MapMode, - ConstrainMode, - ViewportMode, - bool crossSourceCollisions); - + Impl(RendererFrontend&, MapObserver&, FileSource&, Scheduler&, Size size, float pixelRatio, const MapOptions&); ~Impl() final; // StyleObserver @@ -57,7 +45,9 @@ public: void onWillStartRenderingMap() final; void onDidFinishRenderingMap() final; - Map& map; + // Map + void jumpTo(const CameraOptions&); + MapObserver& observer; RendererFrontend& rendererFrontend; FileSource& fileSource; -- cgit v1.2.1 From d5868d3da822f2bf3297229bd879e76853108a63 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Tue, 19 Mar 2019 16:57:36 +0200 Subject: [core] Remove file source from public Map ctor --- benchmark/api/query.benchmark.cpp | 8 +- benchmark/api/render.benchmark.cpp | 25 ++--- bin/render.cpp | 12 +-- include/mbgl/map/map.hpp | 11 +- include/mbgl/map/map_options.hpp | 49 +-------- include/mbgl/storage/default_file_source.hpp | 2 +- include/mbgl/storage/file_source.hpp | 12 +++ include/mbgl/storage/resource_options.hpp | 116 +++++++++++++++++++++ platform/android/src/file_source.cpp | 27 +++-- platform/android/src/file_source.hpp | 6 +- platform/android/src/map_renderer.hpp | 4 +- platform/android/src/native_map_view.cpp | 11 +- platform/android/src/native_map_view.hpp | 1 - platform/android/src/offline/offline_manager.cpp | 13 ++- platform/android/src/offline/offline_manager.hpp | 8 +- platform/android/src/offline/offline_region.cpp | 14 +-- platform/android/src/offline/offline_region.hpp | 2 +- .../android/src/snapshotter/map_snapshotter.cpp | 10 +- platform/darwin/filesource-files.json | 1 + platform/darwin/src/MGLMapSnapshotter.mm | 13 ++- platform/darwin/src/MGLOfflinePack.mm | 18 ++-- platform/darwin/src/MGLOfflinePack_Private.h | 2 +- platform/darwin/src/MGLOfflineStorage.mm | 8 +- platform/darwin/src/MGLOfflineStorage_Private.h | 5 + .../default/include/mbgl/map/map_snapshotter.hpp | 9 +- platform/default/src/mbgl/map/map_snapshotter.cpp | 44 ++++---- .../src/mbgl/storage/default_file_source.cpp | 4 +- platform/default/src/mbgl/storage/file_source.cpp | 15 +++ platform/glfw/main.cpp | 27 +++-- platform/ios/src/MGLMapView.mm | 18 ++-- platform/linux/config.cmake | 9 +- platform/linux/filesource-files.json | 10 ++ platform/macos/src/MGLMapView.mm | 19 ++-- platform/node/src/node_map.cpp | 48 ++++----- platform/node/src/node_map.hpp | 24 ++--- platform/qt/qt.cmake | 1 + platform/qt/src/qmapboxgl.cpp | 97 ++++++----------- platform/qt/src/qmapboxgl_p.hpp | 2 - src/core-files.json | 3 + src/mbgl/annotation/annotation_manager.cpp | 1 - src/mbgl/map/map.cpp | 9 +- src/mbgl/map/map_impl.cpp | 9 +- src/mbgl/map/map_impl.hpp | 10 +- src/mbgl/map/map_options.cpp | 33 ------ src/mbgl/storage/asset_file_source.hpp | 2 +- src/mbgl/storage/file_source.cpp | 37 +++++++ src/mbgl/storage/resource_options.cpp | 73 +++++++++++++ src/mbgl/style/sources/raster_dem_source.cpp | 3 - src/mbgl/tile/geometry_tile.cpp | 1 - src/mbgl/tile/raster_dem_tile.cpp | 1 - src/mbgl/tile/raster_tile.cpp | 1 - test/api/annotations.test.cpp | 7 +- test/api/api_misuse.test.cpp | 10 +- test/api/custom_geometry_source.test.cpp | 8 +- test/api/custom_layer.test.cpp | 8 +- test/api/query.test.cpp | 13 +-- test/api/recycle_map.cpp | 10 +- test/gl/context.test.cpp | 8 +- test/map/map.test.cpp | 98 ++++++++--------- test/map/prefetch.test.cpp | 11 +- test/renderer/image_manager.test.cpp | 1 - test/src/mbgl/test/map_adapter.hpp | 23 ++++ test/test-files.json | 1 + test/text/local_glyph_rasterizer.test.cpp | 13 +-- test/util/memory.test.cpp | 27 ++--- 65 files changed, 659 insertions(+), 467 deletions(-) create mode 100644 include/mbgl/storage/resource_options.hpp create mode 100644 platform/default/src/mbgl/storage/file_source.cpp create mode 100644 platform/linux/filesource-files.json create mode 100644 src/mbgl/storage/file_source.cpp create mode 100644 src/mbgl/storage/resource_options.cpp create mode 100644 test/src/mbgl/test/map_adapter.hpp diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp index 47eba7a9fe..5e273d69ac 100644 --- a/benchmark/api/query.benchmark.cpp +++ b/benchmark/api/query.benchmark.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -21,7 +20,6 @@ class QueryBenchmark { public: QueryBenchmark() { NetworkStatus::Set(NetworkStatus::Status::Offline); - fileSource.setAccessToken("foobar"); map.getStyle().loadJSON(util::read_file("benchmark/fixtures/api/style.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan @@ -32,11 +30,11 @@ public: } util::RunLoop loop; - DefaultFileSource fileSource{ "benchmark/fixtures/api/cache.db", "." }; ThreadPool threadPool{ 4 }; HeadlessFrontend frontend { { 1000, 1000 }, 1, threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - fileSource, threadPool, MapOptions().withMapMode(MapMode::Static) }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; ScreenBox box{{ 0, 0 }, { 1000, 1000 }}; }; diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index 9a91e8b3bc..0e7a3be322 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include #include @@ -22,11 +22,9 @@ class RenderBenchmark { public: RenderBenchmark() { NetworkStatus::Set(NetworkStatus::Status::Offline); - fileSource.setAccessToken("foobar"); } util::RunLoop loop; - DefaultFileSource fileSource { "benchmark/fixtures/api/cache.db", "." }; ThreadPool threadPool { 4 }; }; @@ -42,8 +40,9 @@ static void prepare(Map& map, optional json = {}) { static void API_renderStill_reuse_map(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; prepare(map); while (state.KeepRunning()) { @@ -54,8 +53,9 @@ static void API_renderStill_reuse_map(::benchmark::State& state) { static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json")); while (state.KeepRunning()) { @@ -66,8 +66,9 @@ static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; while (state.KeepRunning()) { prepare(map, { "{}" }); @@ -79,11 +80,11 @@ static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { static void API_renderStill_recreate_map(::benchmark::State& state) { RenderBenchmark bench; - + auto mapOptions = MapOptions().withMapMode(MapMode::Static); + auto resourceOptions = ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar"); while (state.KeepRunning()) { HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, - bench.fileSource, bench.threadPool, MapOptions().withMapMode(MapMode::Static) }; + Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, mapOptions, resourceOptions }; prepare(map); frontend.render(map); } diff --git a/bin/render.cpp b/bin/render.cpp index 87a1e670b9..41701913b0 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -6,7 +6,6 @@ #include #include -#include #include #include @@ -76,17 +75,12 @@ int main(int argc, char *argv[]) { using namespace mbgl; util::RunLoop loop; - DefaultFileSource fileSource(cache_file, asset_root); - - // Set access token if present - if (token.size()) { - fileSource.setAccessToken(std::string(token)); - } ThreadPool threadPool(4); HeadlessFrontend frontend({ width, height }, pixelRatio, threadPool); - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)); + Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath(cache_file).withAssetPath(asset_root).withAccessToken(std::string(token))); if (style.find("://") == std::string::npos) { style = std::string("file://") + style; diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index b4f60a19ba..be8bf45142 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -21,7 +22,6 @@ namespace mbgl { -class FileSource; class Scheduler; class RendererFrontend; @@ -36,9 +36,9 @@ public: MapObserver&, Size size, float pixelRatio, - FileSource&, Scheduler&, - const MapOptions&); + const MapOptions&, + const ResourceOptions&); ~Map(); // Register a callback that will get called (on the render thread) when all resources have @@ -137,9 +137,12 @@ public: bool isFullyLoaded() const; void dumpDebugLogs() const; -private: +protected: class Impl; const std::unique_ptr impl; + + // For testing only. + Map(std::unique_ptr); }; } // namespace mbgl diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index 13772332a8..f2297484a3 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -3,14 +3,13 @@ #include #include -#include namespace mbgl { /** * @brief Holds values for Map options. */ -class MapOptions { +class MapOptions final { public: /** * @brief Constructs a MapOptions object with default values. @@ -68,52 +67,6 @@ public: */ ViewportMode viewportMode() const; - /** - * @brief Sets the cache path. - * - * @param path Cache path. - * @return reference to MapOptions for chaining options together. - */ - MapOptions& withCachePath(std::string path); - - /** - * @brief Gets the previously set (or default) cache path. - * - * @return cache path - */ - const std::string& cachePath() const; - - /** - * @brief Sets the asset path, which is the root directory from where - * the asset:// scheme gets resolved in a style. - * - * @param path Asset path. - * @return reference to MapOptions for chaining options together. - */ - MapOptions& withAssetRoot(std::string path); - - /** - * @brief Gets the previously set (or default) asset path. - * - * @return asset path - */ - const std::string& assetRoot() const; - - /** - * @brief Sets the maximum cache size. - * - * @param size Cache maximum size in bytes. - * @return reference to MapOptions for chaining options together. - */ - MapOptions& withMaximumCacheSize(uint64_t size); - - /** - * @brief Gets the previously set (or default) maximum allowed cache size. - * - * @return maximum allowed cache database size in bytes. - */ - uint64_t maximumCacheSize() const; - /** * @brief Specify whether to enable cross-source symbol collision detection * or not. By default, it is set to true. diff --git a/include/mbgl/storage/default_file_source.hpp b/include/mbgl/storage/default_file_source.hpp index 5f6999e99f..8f88964acf 100644 --- a/include/mbgl/storage/default_file_source.hpp +++ b/include/mbgl/storage/default_file_source.hpp @@ -28,7 +28,7 @@ public: * of megabytes). */ DefaultFileSource(const std::string& cachePath, - const std::string& assetRoot, + const std::string& assetPath, uint64_t maximumCacheSize = util::DEFAULT_MAX_CACHE_SIZE); DefaultFileSource(const std::string& cachePath, std::unique_ptr&& assetFileSource, diff --git a/include/mbgl/storage/file_source.hpp b/include/mbgl/storage/file_source.hpp index 0709a1c245..868dbf7347 100644 --- a/include/mbgl/storage/file_source.hpp +++ b/include/mbgl/storage/file_source.hpp @@ -1,16 +1,21 @@ #pragma once +#include #include #include #include #include +#include #include #include namespace mbgl { +class ResourceOptions; +class ResourceTransform; + class FileSource : private util::noncopyable { public: virtual ~FileSource() = default; @@ -31,6 +36,13 @@ public: virtual bool supportsCacheOnlyRequests() const { return false; } + + // Factory for creating a platform-specific file source. + static std::shared_ptr createPlatformFileSource(const ResourceOptions&); + + // Singleton for obtaining the shared platform-specific file source. A single instance of a file source is provided + // for each unique combination of a Mapbox API base URL, access token, cache path and platform context. + static std::shared_ptr getSharedFileSource(const ResourceOptions&); }; } // namespace mbgl diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp new file mode 100644 index 0000000000..0a4669ea15 --- /dev/null +++ b/include/mbgl/storage/resource_options.hpp @@ -0,0 +1,116 @@ +#pragma once + +#include +#include + +namespace mbgl { + +/** + * @brief Holds values for resource options. + */ +class ResourceOptions final { +public: + /** + * @brief Constructs a ResourceOptions object with default values. + */ + ResourceOptions(); + ~ResourceOptions(); + + /** + * @brief Sets the Mapbox access token - see https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for details. + * + * @param token Mapbox access token. + * @return reference to ResourceOptions for chaining options together. + */ + ResourceOptions& withAccessToken(std::string token); + + /** + * @brief Gets the previously set (or default) Mapbox access token. + * + * @return const std::string& Mapbox access token. + */ + const std::string& accessToken() const; + + /** + * @brief Sets the API base URL. Default is https://api.mapbox.com for Mapbox. + * + * @param baseURL API base URL. + * @return reference to ResourceOptions for chaining options together. + */ + ResourceOptions& withBaseURL(std::string baseURL); + + /** + * @brief Gets the previously set (or default) API base URL. + * + * @return const std::string& API base URL. + */ + const std::string& baseURL() const; + + /** + * @brief Sets the cache path. + * + * @param path Cache path. + * @return reference to ResourceOptions for chaining options together. + */ + ResourceOptions& withCachePath(std::string path); + + /** + * @brief Gets the previously set (or default) cache path. + * + * @return cache path + */ + const std::string& cachePath() const; + + /** + * @brief Sets the asset path, which is the root directory from where + * the asset:// scheme gets resolved in a style. + * + * @param path Asset path. + * @return reference to ResourceOptions for chaining options together. + */ + ResourceOptions& withAssetPath(std::string path); + + /** + * @brief Gets the previously set (or default) asset path. + * + * @return asset path + */ + const std::string& assetPath() const; + + /** + * @brief Sets the maximum cache size. + * + * @param size Cache maximum size in bytes. + * @return reference to ResourceOptions for chaining options together. + */ + ResourceOptions& withMaximumCacheSize(uint64_t size); + + /** + * @brief Gets the previously set (or default) maximum allowed cache size. + * + * @return maximum allowed cache database size in bytes. + */ + uint64_t maximumCacheSize() const; + + /** + * @brief Sets the platform context. A platform context is usually an object + * that assists the creation of a file source. + * + * @param context Platform context. + * @return reference to ResourceOptions for chaining options together. + */ + ResourceOptions& withPlatformContext(void* context); + + /** + * @brief Gets the previously set (or default) platform context. + * + * @return Platform context. + */ + void* platformContext() const; + +private: + class Impl; + std::shared_ptr impl_; +}; + +} // namespace mbgl diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index 4cfb545b84..bb1f30981b 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -11,6 +12,14 @@ #include "asset_manager_file_source.hpp" namespace mbgl { + +std::shared_ptr FileSource::createPlatformFileSource(const ResourceOptions& options) { + auto* assetFileSource = reinterpret_cast(options.platformContext()); + auto fileSource = std::make_shared(options.cachePath(), std::unique_ptr(assetFileSource)); + fileSource->setAccessToken(options.accessToken()); + return fileSource; +} + namespace android { // FileSource // @@ -22,15 +31,13 @@ FileSource::FileSource(jni::JNIEnv& _env, std::string path = jni::Make(_env, _cachePath); mapbox::sqlite::setTempPath(path); - // Create a core default file source - fileSource = std::make_unique( - path + DATABASE_FILE, - std::make_unique(_env, assetManager)); + resourceOptions = mbgl::ResourceOptions() + .withAccessToken(accessToken ? jni::Make(_env, accessToken) : "") + .withCachePath(path + DATABASE_FILE) + .withPlatformContext(reinterpret_cast(new AssetManagerFileSource(_env, assetManager))); - // Set access token - if (accessToken) { - fileSource->setAccessToken(jni::Make(_env, accessToken)); - } + // Create a core default file source + fileSource = std::static_pointer_cast(mbgl::FileSource::getSharedFileSource(resourceOptions)); } FileSource::~FileSource() { @@ -110,10 +117,10 @@ FileSource* FileSource::getNativePeer(jni::JNIEnv& env, const jni::Object(jFileSource.Get(env, field)); } -mbgl::DefaultFileSource& FileSource::getDefaultFileSource(jni::JNIEnv& env, const jni::Object& jFileSource) { +mbgl::ResourceOptions FileSource::getSharedResourceOptions(jni::JNIEnv& env, const jni::Object& jFileSource) { FileSource* fileSource = FileSource::getNativePeer(env, jFileSource); assert(fileSource != nullptr); - return *fileSource->fileSource; + return fileSource->resourceOptions; } void FileSource::registerNative(jni::JNIEnv& env) { diff --git a/platform/android/src/file_source.hpp b/platform/android/src/file_source.hpp index 575702120e..3001a5e0f0 100644 --- a/platform/android/src/file_source.hpp +++ b/platform/android/src/file_source.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include "asset_manager.hpp" @@ -49,15 +50,16 @@ public: static FileSource* getNativePeer(jni::JNIEnv&, const jni::Object&); - static mbgl::DefaultFileSource& getDefaultFileSource(jni::JNIEnv&, const jni::Object&); + static mbgl::ResourceOptions getSharedResourceOptions(jni::JNIEnv&, const jni::Object&); static void registerNative(jni::JNIEnv&); private: const std::string DATABASE_FILE = "/mbgl-offline.db"; optional activationCounter; + mbgl::ResourceOptions resourceOptions; std::unique_ptr> resourceTransform; - std::unique_ptr fileSource; + std::shared_ptr fileSource; }; diff --git a/platform/android/src/map_renderer.hpp b/platform/android/src/map_renderer.hpp index 3e5b99605e..57265cebb1 100644 --- a/platform/android/src/map_renderer.hpp +++ b/platform/android/src/map_renderer.hpp @@ -1,13 +1,15 @@ #pragma once +#include #include #include +#include #include +#include #include #include -#include namespace mbgl { diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 3a4e2014ba..1eb4c56728 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -13,6 +13,7 @@ #include +#include #include #include #include @@ -74,9 +75,6 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env, return; } - // Get native peer for file source - mbgl::FileSource& fileSource = mbgl::android::FileSource::getDefaultFileSource(_env, jFileSource); - // Create a renderer frontend rendererFrontend = std::make_unique(mapRenderer); @@ -88,10 +86,9 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env, .withCrossSourceCollisions(_crossSourceCollisions); // Create the core map - map = std::make_unique(*rendererFrontend, *this, - mbgl::Size{ static_cast(width), - static_cast(height) }, pixelRatio, - fileSource, *threadPool, options); + map = std::make_unique( + *rendererFrontend, *this, mbgl::Size{ static_cast(width), static_cast(height) }, + pixelRatio, *threadPool, options, mbgl::android::FileSource::getSharedResourceOptions(_env, jFileSource)); } /** diff --git a/platform/android/src/native_map_view.hpp b/platform/android/src/native_map_view.hpp index d695a91ce0..903543e5d1 100755 --- a/platform/android/src/native_map_view.hpp +++ b/platform/android/src/native_map_view.hpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include "annotation/marker.hpp" diff --git a/platform/android/src/offline/offline_manager.cpp b/platform/android/src/offline/offline_manager.cpp index 968c33b644..54b1142845 100644 --- a/platform/android/src/offline/offline_manager.cpp +++ b/platform/android/src/offline/offline_manager.cpp @@ -10,20 +10,19 @@ namespace android { // OfflineManager // OfflineManager::OfflineManager(jni::JNIEnv& env, const jni::Object& jFileSource) - : fileSource(mbgl::android::FileSource::getDefaultFileSource(env, jFileSource)) { -} + : fileSource(std::static_pointer_cast(mbgl::FileSource::getSharedFileSource(FileSource::getSharedResourceOptions(env, jFileSource)))) {} OfflineManager::~OfflineManager() {} void OfflineManager::setOfflineMapboxTileCountLimit(jni::JNIEnv&, jni::jlong limit) { - fileSource.setOfflineMapboxTileCountLimit(limit); + fileSource->setOfflineMapboxTileCountLimit(limit); } void OfflineManager::listOfflineRegions(jni::JNIEnv& env_, const jni::Object& jFileSource_, const jni::Object& callback_) { auto globalCallback = jni::NewGlobal(env_, callback_); auto globalFilesource = jni::NewGlobal(env_, jFileSource_); - fileSource.listOfflineRegions([ + fileSource->listOfflineRegions([ //Keep a shared ptr to a global reference of the callback and file source so they are not GC'd in the meanwhile callback = std::make_shared(std::move(globalCallback)), jFileSource = std::make_shared(std::move(globalFilesource)) @@ -59,7 +58,7 @@ void OfflineManager::createOfflineRegion(jni::JNIEnv& env_, auto globalFilesource = jni::NewGlobal(env_, jFileSource_); // Create region - fileSource.createOfflineRegion(definition, metadata, [ + fileSource->createOfflineRegion(definition, metadata, [ //Keep a shared ptr to a global reference of the callback and file source so they are not GC'd in the meanwhile callback = std::make_shared(std::move(globalCallback)), jFileSource = std::make_shared(std::move(globalFilesource)) @@ -86,7 +85,7 @@ void OfflineManager::mergeOfflineRegions(jni::JNIEnv& env_, const jni::Object(env_, jFileSource_); auto path = jni::Make(env_, jString_); - fileSource.mergeOfflineRegions(path, [ + fileSource->mergeOfflineRegions(path, [ //Keep a shared ptr to a global reference of the callback and file source so they are not GC'd in the meanwhile callback = std::make_shared(std::move(globalCallback)), jFileSource = std::make_shared(std::move(globalFilesource)) @@ -226,7 +225,7 @@ void OfflineManager::putResourceWithUrl(jni::JNIEnv& env, response.expires = Timestamp(mbgl::Seconds(expires)); } - fileSource.put(resource, response); + fileSource->put(resource, response); } } // namespace android diff --git a/platform/android/src/offline/offline_manager.hpp b/platform/android/src/offline/offline_manager.hpp index f8d57b88da..d0b637b900 100644 --- a/platform/android/src/offline/offline_manager.hpp +++ b/platform/android/src/offline/offline_manager.hpp @@ -1,7 +1,5 @@ #pragma once - -#include #include #include @@ -10,8 +8,12 @@ #include "offline_region_definition.hpp" #include "../java_types.hpp" +#include namespace mbgl { + +class DefaultFileSource; + namespace android { class OfflineManager { @@ -85,7 +87,7 @@ public: private: - mbgl::DefaultFileSource& fileSource; + std::shared_ptr fileSource; }; } // namespace android diff --git a/platform/android/src/offline/offline_region.cpp b/platform/android/src/offline/offline_region.cpp index 1cd73a7c76..e0f28631b4 100644 --- a/platform/android/src/offline/offline_region.cpp +++ b/platform/android/src/offline/offline_region.cpp @@ -14,8 +14,8 @@ namespace android { // OfflineRegion // OfflineRegion::OfflineRegion(jni::JNIEnv& env, jni::jlong offlineRegionPtr, const jni::Object& jFileSource) - : region(reinterpret_cast(offlineRegionPtr)), - fileSource(mbgl::android::FileSource::getDefaultFileSource(env, jFileSource)) {} + : region(reinterpret_cast(offlineRegionPtr)) + , fileSource(std::static_pointer_cast(mbgl::FileSource::getSharedFileSource(FileSource::getSharedResourceOptions(env, jFileSource)))) {} OfflineRegion::~OfflineRegion() {} @@ -62,7 +62,7 @@ void OfflineRegion::setOfflineRegionObserver(jni::JNIEnv& env_, const jni::Objec }; // Set the observer - fileSource.setOfflineRegionObserver(*region, std::make_unique(jni::NewGlobal(env_, callback))); + fileSource->setOfflineRegionObserver(*region, std::make_unique(jni::NewGlobal(env_, callback))); } void OfflineRegion::setOfflineRegionDownloadState(jni::JNIEnv&, jni::jint jState) { @@ -80,13 +80,13 @@ void OfflineRegion::setOfflineRegionDownloadState(jni::JNIEnv&, jni::jint jState return; } - fileSource.setOfflineRegionDownloadState(*region, state); + fileSource->setOfflineRegionDownloadState(*region, state); } void OfflineRegion::getOfflineRegionStatus(jni::JNIEnv& env_, const jni::Object& callback_) { auto globalCallback = jni::NewGlobal(env_, callback_); - fileSource.getOfflineRegionStatus(*region, [ + fileSource->getOfflineRegionStatus(*region, [ //Ensure the object is not gc'd in the meanwhile callback = std::make_shared(std::move(globalCallback)) ](mbgl::expected status) mutable { @@ -104,7 +104,7 @@ void OfflineRegion::getOfflineRegionStatus(jni::JNIEnv& env_, const jni::Object< void OfflineRegion::deleteOfflineRegion(jni::JNIEnv& env_, const jni::Object& callback_) { auto globalCallback = jni::NewGlobal(env_, callback_); - fileSource.deleteOfflineRegion(std::move(*region), [ + fileSource->deleteOfflineRegion(std::move(*region), [ //Ensure the object is not gc'd in the meanwhile callback = std::make_shared(std::move(globalCallback)) ](std::exception_ptr error) mutable { @@ -123,7 +123,7 @@ void OfflineRegion::updateOfflineRegionMetadata(jni::JNIEnv& env_, const jni::Ar auto metadata = OfflineRegion::metadata(env_, jMetadata); auto globalCallback = jni::NewGlobal(env_, callback_); - fileSource.updateOfflineMetadata(region->getID(), metadata, [ + fileSource->updateOfflineMetadata(region->getID(), metadata, [ //Ensure the object is not gc'd in the meanwhile callback = std::make_shared(std::move(globalCallback)) ](mbgl::expected data) mutable { diff --git a/platform/android/src/offline/offline_region.hpp b/platform/android/src/offline/offline_region.hpp index 49fa0c8ff8..4618e1abbd 100644 --- a/platform/android/src/offline/offline_region.hpp +++ b/platform/android/src/offline/offline_region.hpp @@ -74,7 +74,7 @@ public: private: std::unique_ptr region; - mbgl::DefaultFileSource& fileSource; + std::shared_ptr fileSource; }; } // namespace android diff --git a/platform/android/src/snapshotter/map_snapshotter.cpp b/platform/android/src/snapshotter/map_snapshotter.cpp index 8eb1d02605..47a2781cb5 100644 --- a/platform/android/src/snapshotter/map_snapshotter.cpp +++ b/platform/android/src/snapshotter/map_snapshotter.cpp @@ -37,7 +37,6 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env, } jFileSource = FileSource::getNativePeer(_env, _jFileSource); - auto& fileSource = mbgl::android::FileSource::getDefaultFileSource(_env, _jFileSource); auto size = mbgl::Size { static_cast(width), static_cast(height) }; optional cameraOptions; @@ -56,11 +55,10 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env, } else { style = std::make_pair(false, jni::Make(_env, styleURL)); } - + showLogo = _showLogo; // Create the core snapshotter - snapshotter = std::make_unique(&fileSource, - threadPool, + snapshotter = std::make_unique(threadPool, style, size, pixelRatio, @@ -69,8 +67,8 @@ MapSnapshotter::MapSnapshotter(jni::JNIEnv& _env, jni::Make(_env, _programCacheDir), _localIdeographFontFamily ? jni::Make(_env, _localIdeographFontFamily) : - optional{}); - + optional{}, + mbgl::android::FileSource::getSharedResourceOptions(_env, _jFileSource)); } MapSnapshotter::~MapSnapshotter() = default; diff --git a/platform/darwin/filesource-files.json b/platform/darwin/filesource-files.json index 3ee96f9b95..b2e6fbc9b4 100644 --- a/platform/darwin/filesource-files.json +++ b/platform/darwin/filesource-files.json @@ -4,6 +4,7 @@ "platform/darwin/src/MGLLoggingConfiguration.m", "platform/darwin/src/MGLNetworkConfiguration.m", "platform/darwin/src/http_file_source.mm", + "platform/default/src/mbgl/storage/file_source.cpp", "platform/default/src/mbgl/storage/sqlite3.cpp" ], "public_headers": {}, diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 169808f774..00ec45f7ff 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -3,8 +3,10 @@ #import #import #import +#import #import #import +#import #import #import #import @@ -587,7 +589,9 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; _cancelled = NO; _options = options; + auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; + _mbglThreadPool = mbgl::sharedThreadPool(); std::string styleURL = std::string([options.styleURL.absoluteString UTF8String]); @@ -619,9 +623,14 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; // App-global configuration MGLRendererConfiguration* config = [MGLRendererConfiguration currentConfiguration]; - + + auto resourceOptions = mbgl::ResourceOptions() + .withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); + // Create the snapshotter - _mbglMapSnapshotter = std::make_unique(mbglFileSource.get(), _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName); + _mbglMapSnapshotter = std::make_unique( + _mbglThreadPool, style, size, pixelRatio, cameraOptions, coordinateBounds, config.cacheDir, config.localFontFamilyName, resourceOptions); } @end diff --git a/platform/darwin/src/MGLOfflinePack.mm b/platform/darwin/src/MGLOfflinePack.mm index 913e9c2233..0f2e8180fa 100644 --- a/platform/darwin/src/MGLOfflinePack.mm +++ b/platform/darwin/src/MGLOfflinePack.mm @@ -10,6 +10,7 @@ #import "NSValue+MGLAdditions.h" +#include #include const MGLExceptionName MGLInvalidOfflinePackException = @"MGLInvalidOfflinePackException"; @@ -58,6 +59,7 @@ private: @implementation MGLOfflinePack { BOOL _isSuspending; + std::shared_ptr _mbglFileSource; } - (instancetype)init { @@ -74,8 +76,8 @@ private: _mbglOfflineRegion = region; _state = MGLOfflinePackStateUnknown; - auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; - mbglFileSource->setOfflineRegionObserver(*_mbglOfflineRegion, std::make_unique(self)); + _mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; + _mbglFileSource->setOfflineRegionObserver(*_mbglOfflineRegion, std::make_unique(self)); } return self; } @@ -115,8 +117,7 @@ private: self.state = MGLOfflinePackStateActive; - auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; - mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Active); + _mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Active); } - (void)suspend { @@ -128,8 +129,7 @@ private: _isSuspending = YES; } - auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; - mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Inactive); + _mbglFileSource->setOfflineRegionDownloadState(*_mbglOfflineRegion, mbgl::OfflineRegionDownloadState::Inactive); } - (void)invalidate { @@ -137,8 +137,7 @@ private: MGLAssert(_state != MGLOfflinePackStateInvalid, @"Cannot invalidate an already invalid offline pack."); self.state = MGLOfflinePackStateInvalid; - auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; - mbglFileSource->setOfflineRegionObserver(*self.mbglOfflineRegion, nullptr); + _mbglFileSource->setOfflineRegionObserver(*self.mbglOfflineRegion, nullptr); self.mbglOfflineRegion = nil; } @@ -164,9 +163,8 @@ private: MGLLogInfo(@"Requesting pack progress."); MGLAssertOfflinePackIsValid(); - auto mbglFileSource = [[MGLOfflineStorage sharedOfflineStorage] mbglFileSource]; __weak MGLOfflinePack *weakSelf = self; - mbglFileSource->getOfflineRegionStatus(*_mbglOfflineRegion, [&, weakSelf](mbgl::expected status) { + _mbglFileSource->getOfflineRegionStatus(*_mbglOfflineRegion, [&, weakSelf](mbgl::expected status) { if (status) { mbgl::OfflineRegionStatus checkedStatus = *status; dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/platform/darwin/src/MGLOfflinePack_Private.h b/platform/darwin/src/MGLOfflinePack_Private.h index 8a63152dca..ea3fb2da99 100644 --- a/platform/darwin/src/MGLOfflinePack_Private.h +++ b/platform/darwin/src/MGLOfflinePack_Private.h @@ -1,6 +1,6 @@ #import "MGLOfflinePack.h" -#include +#include NS_ASSUME_NONNULL_BEGIN diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index a118916f86..5f3b2c7c20 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include #include @@ -44,6 +46,7 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio @property (nonatomic, strong, readwrite) NSMutableArray *packs; @property (nonatomic) std::shared_ptr mbglFileSource; +@property (nonatomic) std::string mbglCachePath; @property (nonatomic, getter=isPaused) BOOL paused; @end @@ -222,7 +225,10 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio [[NSFileManager defaultManager] moveItemAtPath:subdirectorylessCacheURL.path toPath:cachePath error:NULL]; } - _mbglFileSource = std::make_shared(cachePath.UTF8String, [NSBundle mainBundle].resourceURL.path.UTF8String); + _mbglCachePath = cachePath.UTF8String; + auto options = mbgl::ResourceOptions().withCachePath(_mbglCachePath) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); + _mbglFileSource = std::static_pointer_cast(mbgl::FileSource::getSharedFileSource(options)); // Observe for changes to the API base URL (and find out the current one). [[MGLAccountManager sharedManager] addObserver:self diff --git a/platform/darwin/src/MGLOfflineStorage_Private.h b/platform/darwin/src/MGLOfflineStorage_Private.h index c4618684ba..5ac64ea995 100644 --- a/platform/darwin/src/MGLOfflineStorage_Private.h +++ b/platform/darwin/src/MGLOfflineStorage_Private.h @@ -15,6 +15,11 @@ NS_ASSUME_NONNULL_BEGIN */ @property (nonatomic) std::shared_ptr mbglFileSource; +/** + The shared offline cache path. + */ +@property (nonatomic) std::string mbglCachePath; + @end NS_ASSUME_NONNULL_END diff --git a/platform/default/include/mbgl/map/map_snapshotter.hpp b/platform/default/include/mbgl/map/map_snapshotter.hpp index 2deb2b3cda..ccc3ee17f7 100644 --- a/platform/default/include/mbgl/map/map_snapshotter.hpp +++ b/platform/default/include/mbgl/map/map_snapshotter.hpp @@ -18,6 +18,7 @@ struct CameraOptions; class FileSource; class Size; class LatLngBounds; +class ResourceOptions; namespace style { class Style; @@ -25,15 +26,15 @@ class Style; class MapSnapshotter { public: - MapSnapshotter(FileSource* fileSource, - std::shared_ptr scheduler, + MapSnapshotter(std::shared_ptr scheduler, const std::pair style, const Size&, const float pixelRatio, const optional cameraOptions, const optional region, - const optional cacheDir = {}, - const optional localFontFamily = {}); + const optional cacheDir, + const optional localFontFamily, + const ResourceOptions&); ~MapSnapshotter(); diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index 415ef7befd..cd8482e4ba 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include #include @@ -14,15 +14,15 @@ namespace mbgl { class MapSnapshotter::Impl { public: - Impl(FileSource*, - std::shared_ptr, + Impl(std::shared_ptr, const std::pair style, const Size&, const float pixelRatio, const optional cameraOptions, const optional region, const optional programCacheDir, - const optional localFontFamily = {}); + const optional localFontFamily, + const ResourceOptions& resourceOptions); void setStyleURL(std::string styleURL); std::string getStyleURL() const; @@ -47,19 +47,18 @@ private: Map map; }; -MapSnapshotter::Impl::Impl(FileSource* fileSource, - std::shared_ptr scheduler_, - const std::pair style, - const Size& size, - const float pixelRatio, - const optional cameraOptions, - const optional region, - const optional programCacheDir, - const optional localFontFamily) - : scheduler(std::move(scheduler_)) - , frontend(size, pixelRatio, *scheduler, programCacheDir, GLContextMode::Unique, localFontFamily) - , map(frontend, MapObserver::nullObserver(), size, pixelRatio, *fileSource, *scheduler, MapOptions().withMapMode(MapMode::Static)) { - +MapSnapshotter::Impl::Impl(std::shared_ptr scheduler_, + const std::pair style, + const Size& size, + const float pixelRatio, + const optional cameraOptions, + const optional region, + const optional programCacheDir, + const optional localFontFamily, + const ResourceOptions& resourceOptions) + : scheduler(std::move(scheduler_)) + , frontend(size, pixelRatio, *scheduler, programCacheDir, GLContextMode::Unique, localFontFamily) + , map(frontend, MapObserver::nullObserver(), size, pixelRatio, *scheduler, MapOptions().withMapMode(MapMode::Static), resourceOptions) { if (style.first) { map.getStyle().loadJSON(style.second); } else{ @@ -164,17 +163,18 @@ LatLngBounds MapSnapshotter::Impl::getRegion() const { return map.latLngBoundsForCamera(getCameraOptions()); } -MapSnapshotter::MapSnapshotter(FileSource* fileSource, - std::shared_ptr scheduler, +MapSnapshotter::MapSnapshotter(std::shared_ptr scheduler, const std::pair style, const Size& size, const float pixelRatio, const optional cameraOptions, const optional region, const optional programCacheDir, - const optional localFontFamily) - : impl(std::make_unique>("Map Snapshotter", fileSource, std::move(scheduler), style, size, pixelRatio, cameraOptions, region, programCacheDir, localFontFamily)) { -} + const optional localFontFamily, + const ResourceOptions& resourceOptions) + : impl(std::make_unique>( + "Map Snapshotter", std::move(scheduler), style, size, pixelRatio, cameraOptions, + region, programCacheDir, localFontFamily, resourceOptions)) {} MapSnapshotter::~MapSnapshotter() = default; diff --git a/platform/default/src/mbgl/storage/default_file_source.cpp b/platform/default/src/mbgl/storage/default_file_source.cpp index 32eb8b3d58..4d812044cf 100644 --- a/platform/default/src/mbgl/storage/default_file_source.cpp +++ b/platform/default/src/mbgl/storage/default_file_source.cpp @@ -201,9 +201,9 @@ private: }; DefaultFileSource::DefaultFileSource(const std::string& cachePath, - const std::string& assetRoot, + const std::string& assetPath, uint64_t maximumCacheSize) - : DefaultFileSource(cachePath, std::make_unique(assetRoot), maximumCacheSize) { + : DefaultFileSource(cachePath, std::make_unique(assetPath), maximumCacheSize) { } DefaultFileSource::DefaultFileSource(const std::string& cachePath, diff --git a/platform/default/src/mbgl/storage/file_source.cpp b/platform/default/src/mbgl/storage/file_source.cpp new file mode 100644 index 0000000000..a7bbe82f5a --- /dev/null +++ b/platform/default/src/mbgl/storage/file_source.cpp @@ -0,0 +1,15 @@ +#include +#include + +#include + +namespace mbgl { + +std::shared_ptr FileSource::createPlatformFileSource(const ResourceOptions& options) { + auto fileSource = std::make_shared(options.cachePath(), options.assetPath()); + fileSource->setAccessToken(options.accessToken()); + fileSource->setAPIBaseURL(options.baseURL()); + return fileSource; +} + +} // namespace mbgl diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 38a41cbf18..8288a009f2 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -93,23 +93,22 @@ int main(int argc, char *argv[]) { GLFWView backend(fullscreen, benchmark); view = &backend; - mbgl::DefaultFileSource fileSource(cacheDB, "."); - if (!settings.online) { - fileSource.setOnlineStatus(false); - mbgl::Log::Warning(mbgl::Event::Setup, "Application is offline. Press `O` to toggle online status."); - } - // Set access token if present const char *token = getenv("MAPBOX_ACCESS_TOKEN"); if (token == nullptr) { mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work."); - } else { - fileSource.setAccessToken(std::string(token)); + } + + auto resourceOptions = mbgl::ResourceOptions().withCachePath(cacheDB).withAssetPath(".").withAccessToken(std::string(token)); + auto fileSource = std::static_pointer_cast(mbgl::FileSource::getSharedFileSource(resourceOptions)); + if (!settings.online) { + fileSource->setOnlineStatus(false); + mbgl::Log::Warning(mbgl::Event::Setup, "Application is offline. Press `O` to toggle online status."); } mbgl::ThreadPool threadPool(4); GLFWRendererFrontend rendererFrontend { std::make_unique(backend, view->getPixelRatio(), threadPool), backend }; - mbgl::Map map(rendererFrontend, backend, view->getSize(), view->getPixelRatio(), fileSource, threadPool, mbgl::MapOptions()); + mbgl::Map map(rendererFrontend, backend, view->getSize(), view->getPixelRatio(), threadPool, mbgl::MapOptions(), resourceOptions); backend.setMap(&map); @@ -124,9 +123,9 @@ int main(int argc, char *argv[]) { .withPitch(settings.pitch)); map.setDebug(mbgl::MapDebugOptions(settings.debug)); - view->setOnlineStatusCallback([&settings, &fileSource]() { + view->setOnlineStatusCallback([&settings, fileSource]() { settings.online = !settings.online; - fileSource.setOnlineStatus(settings.online); + fileSource->setOnlineStatus(settings.online); mbgl::Log::Info(mbgl::Event::Setup, "Application is %s. Press `O` to toggle online status.", settings.online ? "online" : "offline"); }); @@ -144,13 +143,13 @@ int main(int argc, char *argv[]) { mbgl::Log::Info(mbgl::Event::Setup, "Changed style to: %s", newStyle.name); }); - view->setPauseResumeCallback([&fileSource] () { + view->setPauseResumeCallback([fileSource] () { static bool isPaused = false; if (isPaused) { - fileSource.resume(); + fileSource->resume(); } else { - fileSource.pause(); + fileSource->pause(); } isPaused = !isPaused; diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 2065f92f64..94d56dfff9 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include #include @@ -477,14 +477,18 @@ public: BOOL enableCrossSourceCollisions = !config.perSourceCollisions; _rendererFrontend = std::make_unique(std::move(renderer), self, *_mbglView); - mbgl::MapOptions mapOptions; - mapOptions.withMapMode(mbgl::MapMode::Continuous) - .withConstrainMode(mbgl::ConstrainMode::None) - .withViewportMode(mbgl::ViewportMode::Default) - .withCrossSourceCollisions(enableCrossSourceCollisions); + auto mapOptions = mbgl::MapOptions() + .withMapMode(mbgl::MapMode::Continuous) + .withConstrainMode(mbgl::ConstrainMode::None) + .withViewportMode(mbgl::ViewportMode::Default) + .withCrossSourceCollisions(enableCrossSourceCollisions); + + auto resourceOptions = mbgl::ResourceOptions() + .withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); NSAssert(!_mbglMap, @"_mbglMap should be NULL"); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *[[MGLOfflineStorage sharedOfflineStorage] mbglFileSource], *_mbglThreadPool, mapOptions); + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); // start paused if in IB if (_isTargetingInterfaceBuilder || background) { diff --git a/platform/linux/config.cmake b/platform/linux/config.cmake index 6d4715e451..4405e0583f 100644 --- a/platform/linux/config.cmake +++ b/platform/linux/config.cmake @@ -104,13 +104,8 @@ endmacro() macro(mbgl_filesource) - target_sources(mbgl-filesource - # File source - PRIVATE platform/default/src/mbgl/storage/http_file_source.cpp - - # Database - PRIVATE platform/default/src/mbgl/storage/sqlite3.cpp - ) + # Modify platform/linux/filesource-files.json to change the source files for this target. + target_sources_from_file(mbgl-filesource PRIVATE platform/linux/filesource-files.json) # We're not referencing any cURL symbols since we're dynamically loading it. However, we want to # link the library anyway since we're definitely going to load it on startup anyway. diff --git a/platform/linux/filesource-files.json b/platform/linux/filesource-files.json new file mode 100644 index 0000000000..448f5f8613 --- /dev/null +++ b/platform/linux/filesource-files.json @@ -0,0 +1,10 @@ +{ + "//": "This file can be edited manually and is the canonical source.", + "sources": [ + "platform/default/src/mbgl/storage/file_source.cpp", + "platform/default/src/mbgl/storage/http_file_source.cpp", + "platform/default/src/mbgl/storage/sqlite3.cpp" + ], + "public_headers": {}, + "private_headers": {} +} diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 5b2fae90ab..74189c52f4 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -36,8 +36,8 @@ #import #import #import -#import #import +#import #import #import #import @@ -290,12 +290,17 @@ public: BOOL enableCrossSourceCollisions = !config.perSourceCollisions; _rendererFrontend = std::make_unique(std::move(renderer), self, *_mbglView, true); - mbgl::MapOptions mapOptions; - mapOptions.withMapMode(mbgl::MapMode::Continuous) - .withConstrainMode(mbgl::ConstrainMode::None) - .withViewportMode(mbgl::ViewportMode::Default) - .withCrossSourceCollisions(enableCrossSourceCollisions); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *[[MGLOfflineStorage sharedOfflineStorage] mbglFileSource], *_mbglThreadPool, mapOptions); + auto mapOptions = mbgl::MapOptions() + .withMapMode(mbgl::MapMode::Continuous) + .withConstrainMode(mbgl::ConstrainMode::None) + .withViewportMode(mbgl::ViewportMode::Default) + .withCrossSourceCollisions(enableCrossSourceCollisions); + + auto resourceOptions = mbgl::ResourceOptions() + .withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); + + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); // Install the OpenGL layer. Interface Builder’s synchronous drawing means // we can’t display a map, so don’t even bother to have a map layer. diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 0d69e606c1..0b27d378a7 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -20,15 +20,25 @@ #include #include +#include #include #include #include +#include #include #include #include #include +namespace mbgl { + +std::shared_ptr FileSource::createPlatformFileSource(const ResourceOptions& options) { + return std::make_shared(reinterpret_cast(options.platformContext())); +} + +} // namespace mbgl + namespace node_mbgl { struct NodeMap::RenderOptions { @@ -621,13 +631,14 @@ void NodeMap::cancel() { }); frontend = std::make_unique(mbgl::Size{ 256, 256 }, pixelRatio, threadpool); - mbgl::MapOptions options; - options.withMapMode(mode) - .withConstrainMode(mbgl::ConstrainMode::HeightOnly) - .withViewportMode(mbgl::ViewportMode::Default) - .withCrossSourceCollisions(crossSourceCollisions); + auto mapOptions = mbgl::MapOptions() + .withMapMode(mode) + .withCrossSourceCollisions(crossSourceCollisions); + + auto resourceOptions = mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this)); + map = std::make_unique(*frontend, mapObserver, frontend->getSize(), pixelRatio, - fileSource, threadpool, options); + threadpool, mapOptions, resourceOptions); // FIXME: Reload the style after recreating the map. We need to find // a better way of canceling an ongoing rendering on the core level @@ -1205,20 +1216,11 @@ NodeMap::NodeMap(v8::Local options) : true; }()) , mapObserver(NodeMapObserver()) - , fileSource(this) , frontend(std::make_unique(mbgl::Size { 256, 256 }, pixelRatio, threadpool)) - , map(std::make_unique(*frontend, - mapObserver, - frontend->getSize(), - pixelRatio, - fileSource, - threadpool, - mbgl::MapOptions().withMapMode(mode) - .withConstrainMode(mbgl::ConstrainMode::HeightOnly) - .withViewportMode(mbgl::ViewportMode::Default) - .withCrossSourceCollisions(crossSourceCollisions))), - async(new uv_async_t) { - + , map(std::make_unique(*frontend, mapObserver, frontend->getSize(), pixelRatio, threadpool, + mbgl::MapOptions().withMapMode(mode).withCrossSourceCollisions(crossSourceCollisions), + mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this)))) + , async(new uv_async_t) { async->data = this; uv_async_init(uv_default_loop(), async, [](uv_async_t* h) { reinterpret_cast(h->data)->renderFinished(); @@ -1232,8 +1234,6 @@ NodeMap::~NodeMap() { if (map) release(); } -NodeFileSource::NodeFileSource(NodeMap* nodeMap_) : nodeMap(nodeMap_) {} - std::unique_ptr NodeFileSource::request(const mbgl::Resource& resource, mbgl::FileSource::Callback callback_) { assert(nodeMap); @@ -1248,15 +1248,15 @@ std::unique_ptr NodeFileSource::request(const mbgl::Resource Nan::New(&callback_) }; - auto instance = Nan::NewInstance(Nan::New(NodeRequest::constructor), 2, argv).ToLocalChecked(); + auto instance = Nan::NewInstance(Nan::New(node_mbgl::NodeRequest::constructor), 2, argv).ToLocalChecked(); Nan::Set(instance, Nan::New("url").ToLocalChecked(), Nan::New(resource.url).ToLocalChecked()); Nan::Set(instance, Nan::New("kind").ToLocalChecked(), Nan::New(resource.kind)); - auto request = Nan::ObjectWrap::Unwrap(instance); + auto request = Nan::ObjectWrap::Unwrap(instance); request->Execute(); - return std::make_unique(request); + return std::make_unique(request); } } // namespace node_mbgl diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp index 9e3eb1ad12..65664b34bb 100644 --- a/platform/node/src/node_map.hpp +++ b/platform/node/src/node_map.hpp @@ -15,26 +15,13 @@ #pragma GCC diagnostic pop namespace mbgl { -class Map; class HeadlessFrontend; } // namespace mbgl namespace node_mbgl { -class NodeMapObserver : public mbgl::MapObserver { - void onDidFailLoadingMap(mbgl::MapLoadError, const std::string&) override; -}; - -class NodeMap; - -class NodeFileSource : public mbgl::FileSource { -public: - NodeFileSource(NodeMap*); - - std::unique_ptr request(const mbgl::Resource&, mbgl::FileSource::Callback) final; - -private: - NodeMap* nodeMap; +struct NodeMapObserver : public mbgl::MapObserver { + void onDidFailLoadingMap(mbgl::MapLoadError, const std::string&) final; }; class RenderRequest; @@ -94,7 +81,6 @@ public: bool crossSourceCollisions; NodeThreadPool threadpool; NodeMapObserver mapObserver; - NodeFileSource fileSource; std::unique_ptr frontend; std::unique_ptr map; @@ -108,4 +94,10 @@ public: bool loaded = false; }; +struct NodeFileSource : public mbgl::FileSource { + NodeFileSource(NodeMap* nodeMap_) : nodeMap(nodeMap_) {} + std::unique_ptr request(const mbgl::Resource&, mbgl::FileSource::Callback) final; + NodeMap* nodeMap; +}; + } // namespace node_mbgl diff --git a/platform/qt/qt.cmake b/platform/qt/qt.cmake index 14f09007ac..911af25bc4 100644 --- a/platform/qt/qt.cmake +++ b/platform/qt/qt.cmake @@ -50,6 +50,7 @@ set(MBGL_QT_CORE_FILES set(MBGL_QT_FILESOURCE_FILES # File source + PRIVATE platform/default/src/mbgl/storage/file_source.cpp PRIVATE platform/qt/src/http_file_source.cpp PRIVATE platform/qt/src/http_file_source.hpp PRIVATE platform/qt/src/http_request.cpp diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index b05c82a783..1feeecdd7c 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -33,7 +34,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -91,49 +94,6 @@ namespace { QThreadStorage> loop; -std::shared_ptr sharedDefaultFileSource(const QMapboxGLSettings &settings) { - static std::mutex mutex; - static std::unordered_map> fileSources; - - const std::string cachePath = settings.cacheDatabasePath().toStdString(); - const std::string accessToken = settings.accessToken().toStdString(); - const std::string apiBaseUrl = settings.apiBaseUrl().toStdString(); - - std::lock_guard lock(mutex); - - // Purge entries no longer in use. - for (auto it = fileSources.begin(); it != fileSources.end();) { - if (it->second.expired()) { - it = fileSources.erase(it); - } else { - ++it; - } - } - - const auto key = cachePath + "|" + accessToken + "|" + apiBaseUrl; - - // Return an existing FileSource if available. - auto sharedFileSource = fileSources.find(key); - if (sharedFileSource != fileSources.end()) { - auto lockedSharedFileSource = sharedFileSource->second.lock(); - if (lockedSharedFileSource) { - return lockedSharedFileSource; - } - } - - // New path, create a new FileSource. - auto newFileSource = std::make_shared( - cachePath, settings.assetPath().toStdString(), settings.cacheDatabaseMaximumSize()); - - // Setup the FileSource - newFileSource->setAccessToken(accessToken); - newFileSource->setAPIBaseURL(apiBaseUrl); - - fileSources[key] = newFileSource; - - return newFileSource; -} - // Conversion helper functions. mbgl::Size sanitizedSize(const QSize& size) { @@ -1745,22 +1705,29 @@ void QMapboxGL::connectionEstablished() \a copyrightsHtml is a string with a HTML snippet. */ +mbgl::MapOptions mapOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings) { + return mbgl::MapOptions() + .withMapMode(static_cast(settings.mapMode())) + .withConstrainMode(static_cast(settings.constrainMode())) + .withViewportMode(static_cast(settings.viewportMode())); +} + +mbgl::ResourceOptions resourceOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings) { + return mbgl::ResourceOptions() + .withAccessToken(settings.accessToken().toStdString()) + .withAssetPath(settings.assetPath().toStdString()) + .withBaseURL(settings.apiBaseUrl().toStdString()) + .withCachePath(settings.cacheDatabasePath().toStdString()) + .withMaximumCacheSize(settings.cacheDatabaseMaximumSize()); +} + QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settings, const QSize &size, qreal pixelRatio_) : QObject(q) - , m_fileSourceObj(sharedDefaultFileSource(settings)) , m_threadPool(mbgl::sharedThreadPool()) , m_mode(settings.contextMode()) , m_pixelRatio(pixelRatio_) , m_localFontFamily(settings.localFontFamily()) { - if (settings.resourceTransform()) { - m_resourceTransform = std::make_unique>(*mbgl::Scheduler::GetCurrent(), - [callback = settings.resourceTransform()] (mbgl::Resource::Kind, const std::string &&url_) -> std::string { - return callback(std::move(url_)); - }); - m_fileSourceObj->setResourceTransform(m_resourceTransform->self()); - } - // Setup MapObserver m_mapObserver = std::make_unique(this); @@ -1770,18 +1737,20 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin connect(m_mapObserver.get(), SIGNAL(mapLoadingFailed(QMapboxGL::MapLoadingFailure,QString)), q, SIGNAL(mapLoadingFailed(QMapboxGL::MapLoadingFailure,QString))); connect(m_mapObserver.get(), SIGNAL(copyrightsChanged(QString)), q, SIGNAL(copyrightsChanged(QString))); - mbgl::MapOptions options; - options.withMapMode(static_cast(settings.mapMode())) - .withConstrainMode(static_cast(settings.constrainMode())) - .withViewportMode(static_cast(settings.viewportMode())); - - // Setup the Map object - mapObj = std::make_unique( - *this, // RendererFrontend - *m_mapObserver, - sanitizedSize(size), - m_pixelRatio, *m_fileSourceObj, *m_threadPool, - options); + auto resourceOptions = resourceOptionsFromQMapboxGLSettings(settings); + + // Setup the Map object. + mapObj = std::make_unique(*this, *m_mapObserver, sanitizedSize(size), m_pixelRatio, *m_threadPool, + mapOptionsFromQMapboxGLSettings(settings), resourceOptions); + + if (settings.resourceTransform()) { + m_resourceTransform = std::make_unique>(*mbgl::Scheduler::GetCurrent(), + [callback = settings.resourceTransform()] (mbgl::Resource::Kind, const std::string &&url_) -> std::string { + return callback(std::move(url_)); + }); + auto fs = mbgl::FileSource::getSharedFileSource(resourceOptions); + std::static_pointer_cast(fs)->setResourceTransform(m_resourceTransform->self()); + } // Needs to be Queued to give time to discard redundant draw calls via the `renderQueued` flag. connect(this, SIGNAL(needsRendering()), q, SIGNAL(needsRendering()), Qt::QueuedConnection); diff --git a/platform/qt/src/qmapboxgl_p.hpp b/platform/qt/src/qmapboxgl_p.hpp index 7157df0aba..6a5b5ce04f 100644 --- a/platform/qt/src/qmapboxgl_p.hpp +++ b/platform/qt/src/qmapboxgl_p.hpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include #include @@ -57,7 +56,6 @@ private: std::shared_ptr m_updateParameters; std::unique_ptr m_mapObserver; - std::shared_ptr m_fileSourceObj; std::shared_ptr m_threadPool; std::unique_ptr m_mapRenderer; std::unique_ptr> m_resourceTransform; diff --git a/src/core-files.json b/src/core-files.json index e78f6232c3..139b93e368 100644 --- a/src/core-files.json +++ b/src/core-files.json @@ -143,8 +143,10 @@ "src/mbgl/sprite/sprite_loader.cpp", "src/mbgl/sprite/sprite_loader_worker.cpp", "src/mbgl/sprite/sprite_parser.cpp", + "src/mbgl/storage/file_source.cpp", "src/mbgl/storage/network_status.cpp", "src/mbgl/storage/resource.cpp", + "src/mbgl/storage/resource_options.cpp", "src/mbgl/storage/resource_transform.cpp", "src/mbgl/storage/response.cpp", "src/mbgl/style/conversion/color_ramp_property_value.cpp", @@ -358,6 +360,7 @@ "mbgl/storage/offline.hpp": "include/mbgl/storage/offline.hpp", "mbgl/storage/online_file_source.hpp": "include/mbgl/storage/online_file_source.hpp", "mbgl/storage/resource.hpp": "include/mbgl/storage/resource.hpp", + "mbgl/storage/resource_options.hpp": "include/mbgl/storage/resource_options.hpp", "mbgl/storage/resource_transform.hpp": "include/mbgl/storage/resource_transform.hpp", "mbgl/storage/response.hpp": "include/mbgl/storage/response.hpp", "mbgl/style/color_ramp_property_value.hpp": "include/mbgl/style/color_ramp_property_value.hpp", diff --git a/src/mbgl/annotation/annotation_manager.cpp b/src/mbgl/annotation/annotation_manager.cpp index ab22404c15..345171b96e 100644 --- a/src/mbgl/annotation/annotation_manager.cpp +++ b/src/mbgl/annotation/annotation_manager.cpp @@ -10,7 +10,6 @@ #include #include #include -#include #include diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index e8237cca74..24b2435923 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -31,10 +31,13 @@ Map::Map(RendererFrontend& frontend, MapObserver& observer, const Size size, const float pixelRatio, - FileSource& fileSource, Scheduler& scheduler, - const MapOptions& mapOptions) - : impl(std::make_unique(frontend, observer, fileSource, scheduler, size, pixelRatio, mapOptions)) {} + const MapOptions& mapOptions, + const ResourceOptions& resourceOptions) + : impl(std::make_unique(frontend, observer, scheduler, size, pixelRatio, + FileSource::getSharedFileSource(resourceOptions), mapOptions)) {} + +Map::Map(std::unique_ptr impl_) : impl(std::move(impl_)) {} Map::~Map() = default; diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index fbceff559f..348e26700f 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include @@ -8,20 +9,20 @@ namespace mbgl { Map::Impl::Impl(RendererFrontend& frontend_, MapObserver& observer_, - FileSource& fileSource_, Scheduler& scheduler_, Size size_, float pixelRatio_, + std::shared_ptr fileSource_, const MapOptions& mapOptions) : observer(observer_), rendererFrontend(frontend_), - fileSource(fileSource_), scheduler(scheduler_), transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()), mode(mapOptions.mapMode()), pixelRatio(pixelRatio_), crossSourceCollisions(mapOptions.crossSourceCollisions()), - style(std::make_unique(scheduler, fileSource, pixelRatio)), + fileSource(std::move(fileSource_)), + style(std::make_unique(scheduler, *fileSource, pixelRatio)), annotationManager(*style) { style->impl->setObserver(this); rendererFrontend.setObserver(*this); @@ -65,7 +66,7 @@ void Map::Impl::onUpdate() { style->impl->getSourceImpls(), style->impl->getLayerImpls(), annotationManager, - fileSource, + *fileSource, prefetchZoomDelta, bool(stillImageRequest), crossSourceCollisions diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp index d65fe5aafc..13ffdc02ae 100644 --- a/src/mbgl/map/map_impl.hpp +++ b/src/mbgl/map/map_impl.hpp @@ -1,5 +1,6 @@ #pragma once +#include #include #include #include @@ -9,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -17,6 +17,9 @@ namespace mbgl { +class FileSource; +class ResourceTransform; + struct StillImageRequest { StillImageRequest(Map::StillImageCallback&& callback_) : callback(std::move(callback_)) { @@ -27,7 +30,7 @@ struct StillImageRequest { class Map::Impl : public style::Observer, public RendererObserver { public: - Impl(RendererFrontend&, MapObserver&, FileSource&, Scheduler&, Size size, float pixelRatio, const MapOptions&); + Impl(RendererFrontend&, MapObserver&, Scheduler&, Size size, float pixelRatio, std::shared_ptr, const MapOptions&); ~Impl() final; // StyleObserver @@ -50,7 +53,6 @@ public: MapObserver& observer; RendererFrontend& rendererFrontend; - FileSource& fileSource; Scheduler& scheduler; Transform transform; @@ -61,6 +63,8 @@ public: MapDebugOptions debugOptions { MapDebugOptions::NoDebug }; + std::shared_ptr fileSource; + std::unique_ptr style; AnnotationManager annotationManager; diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index 118fcaf3df..ddb3f8e3be 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -1,7 +1,4 @@ #include -#include - -#include namespace mbgl { @@ -10,9 +7,6 @@ public: MapMode mapMode = MapMode::Continuous; ConstrainMode constrainMode = ConstrainMode::HeightOnly; ViewportMode viewportMode = ViewportMode::Default; - std::string cachePath; - std::string assetRoot; - uint64_t maximumSize{mbgl::util::DEFAULT_MAX_CACHE_SIZE}; bool crossSourceCollisions = true; }; @@ -46,33 +40,6 @@ ViewportMode MapOptions::viewportMode() const { return impl_->viewportMode; } -MapOptions& MapOptions::withCachePath(std::string path) { - impl_->cachePath = std::move(path); - return *this; -} - -const std::string& MapOptions::cachePath() const { - return impl_->cachePath; -} - -MapOptions& MapOptions::withAssetRoot(std::string path) { - impl_->assetRoot = std::move(path); - return *this; -} - -const std::string& MapOptions::assetRoot() const { - return impl_->assetRoot; -} - -MapOptions& MapOptions::withMaximumCacheSize(uint64_t size) { - impl_->maximumSize = size; - return *this; -} - -uint64_t MapOptions::maximumCacheSize() const { - return impl_->maximumSize; -} - MapOptions& MapOptions::withCrossSourceCollisions(bool enableCollisions) { impl_->crossSourceCollisions = enableCollisions; return *this; diff --git a/src/mbgl/storage/asset_file_source.hpp b/src/mbgl/storage/asset_file_source.hpp index 5d98b4e69e..cc15dbb60b 100644 --- a/src/mbgl/storage/asset_file_source.hpp +++ b/src/mbgl/storage/asset_file_source.hpp @@ -10,7 +10,7 @@ template class Thread; class AssetFileSource : public FileSource { public: - AssetFileSource(const std::string& assetRoot); + AssetFileSource(const std::string& assetPath); ~AssetFileSource() override; std::unique_ptr request(const Resource&, Callback) override; diff --git a/src/mbgl/storage/file_source.cpp b/src/mbgl/storage/file_source.cpp new file mode 100644 index 0000000000..5854682771 --- /dev/null +++ b/src/mbgl/storage/file_source.cpp @@ -0,0 +1,37 @@ +#include +#include +#include + +#include +#include + +namespace mbgl { + +std::shared_ptr FileSource::getSharedFileSource(const ResourceOptions& options) { + static std::mutex mutex; + static std::map> fileSources; + + std::lock_guard lock(mutex); + + // Purge entries no longer in use. + for (auto it = fileSources.begin(); it != fileSources.end();) { + it = it->second.expired() ? fileSources.erase(it) : ++it; + } + + const uint64_t context = reinterpret_cast(options.platformContext()); + const std::string key = options.baseURL() + '|' + options.accessToken() + '|' + options.cachePath() + '|' + util::toString(context); + + std::shared_ptr fileSource; + auto tuple = fileSources.find(key); + if (tuple != fileSources.end()) { + fileSource = tuple->second.lock(); + } + + if (!fileSource) { + fileSources[key] = fileSource = createPlatformFileSource(options); + } + + return fileSource; +} + +} // namespace mbgl diff --git a/src/mbgl/storage/resource_options.cpp b/src/mbgl/storage/resource_options.cpp new file mode 100644 index 0000000000..ce82b51a14 --- /dev/null +++ b/src/mbgl/storage/resource_options.cpp @@ -0,0 +1,73 @@ +#include +#include + +namespace mbgl { + +class ResourceOptions::Impl { +public: + std::string accessToken; + std::string baseURL = mbgl::util::API_BASE_URL; + std::string cachePath = ":memory:"; + std::string assetPath = "."; + uint64_t maximumSize = mbgl::util::DEFAULT_MAX_CACHE_SIZE; + void* platformContext = nullptr; +}; + +ResourceOptions::ResourceOptions() : impl_(std::make_shared()) {} +ResourceOptions::~ResourceOptions() = default; + +ResourceOptions& ResourceOptions::withAccessToken(std::string token) { + impl_->accessToken = std::move(token); + return *this; +} + +const std::string& ResourceOptions::accessToken() const { + return impl_->accessToken; +} + +ResourceOptions& ResourceOptions::withBaseURL(std::string url) { + impl_->baseURL = std::move(url); + return *this; +} + +const std::string& ResourceOptions::baseURL() const { + return impl_->baseURL; +} + +ResourceOptions& ResourceOptions::withCachePath(std::string path) { + impl_->cachePath = std::move(path); + return *this; +} + +const std::string& ResourceOptions::cachePath() const { + return impl_->cachePath; +} + +ResourceOptions& ResourceOptions::withAssetPath(std::string path) { + impl_->assetPath = std::move(path); + return *this; +} + +const std::string& ResourceOptions::assetPath() const { + return impl_->assetPath; +} + +ResourceOptions& ResourceOptions::withMaximumCacheSize(uint64_t size) { + impl_->maximumSize = size; + return *this; +} + +uint64_t ResourceOptions::maximumCacheSize() const { + return impl_->maximumSize; +} + +ResourceOptions& ResourceOptions::withPlatformContext(void* context) { + impl_->platformContext = context; + return *this; +} + +void* ResourceOptions::platformContext() const { + return impl_->platformContext; +} + +} // namespace mbgl diff --git a/src/mbgl/style/sources/raster_dem_source.cpp b/src/mbgl/style/sources/raster_dem_source.cpp index dc9feb8eeb..bb745561b1 100644 --- a/src/mbgl/style/sources/raster_dem_source.cpp +++ b/src/mbgl/style/sources/raster_dem_source.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include namespace mbgl { @@ -13,7 +12,5 @@ RasterDEMSource::RasterDEMSource(std::string id, variant u : RasterSource(std::move(id), urlOrTileset_, tileSize, SourceType::RasterDEM){ } - - } // namespace style } // namespace mbgl diff --git a/src/mbgl/tile/geometry_tile.cpp b/src/mbgl/tile/geometry_tile.cpp index c8498976b8..d0b55a17d4 100644 --- a/src/mbgl/tile/geometry_tile.cpp +++ b/src/mbgl/tile/geometry_tile.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include diff --git a/src/mbgl/tile/raster_dem_tile.cpp b/src/mbgl/tile/raster_dem_tile.cpp index ba961853d0..224c5c9062 100644 --- a/src/mbgl/tile/raster_dem_tile.cpp +++ b/src/mbgl/tile/raster_dem_tile.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/src/mbgl/tile/raster_tile.cpp b/src/mbgl/tile/raster_tile.cpp index 22561ec11d..ff02301021 100644 --- a/src/mbgl/tile/raster_tile.cpp +++ b/src/mbgl/tile/raster_tile.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include #include #include diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index aad85f8d57..2a9737e10b 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -1,11 +1,11 @@ #include #include +#include #include #include #include #include -#include #include #include #include @@ -28,13 +28,12 @@ std::unique_ptr namedMarker(const std::string& name) { class AnnotationTest { public: util::RunLoop loop; - StubFileSource fileSource; ThreadPool threadPool { 4 }; float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, std::make_shared(), + threadPool, MapOptions().withMapMode(MapMode::Static)}; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/annotations/") + name, diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp index 2ccfb0a7ff..6fc04ab26f 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -1,12 +1,11 @@ #include #include #include +#include -#include #include #include #include -#include #include #include #include @@ -22,14 +21,13 @@ TEST(API, RenderWithoutCallback) { util::RunLoop loop; - StubFileSource fileSource; ThreadPool threadPool(4); float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), - pixelRatio, fileSource, threadPool, - MapOptions().withMapMode(MapMode::Static)); + auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), + pixelRatio, std::make_shared(), threadPool, + MapOptions().withMapMode(MapMode::Static)); map->renderStill(nullptr); // Force Map thread to join. diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp index 6959a36f15..58af09c1ac 100644 --- a/test/api/custom_geometry_source.test.cpp +++ b/test/api/custom_geometry_source.test.cpp @@ -3,8 +3,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -20,12 +20,12 @@ using namespace mbgl::style; TEST(CustomGeometrySource, Grid) { util::RunLoop loop; - DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); auto threadPool = sharedThreadPool(); float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, *threadPool }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - *threadPool, MapOptions().withMapMode(MapMode::Static)); + Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, *threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index 18c6dc1692..e16d2852ec 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -4,9 +4,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -90,12 +90,12 @@ public: TEST(CustomLayer, Basic) { util::RunLoop loop; - DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); ThreadPool threadPool(4); float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)); + Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); map.getStyle().addLayer(std::make_unique( diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index 5567eabc73..b4297bfe82 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -1,4 +1,5 @@ -#include +#include + #include #include #include @@ -33,16 +34,16 @@ public: } util::RunLoop loop; - StubFileSource fileSource; + std::shared_ptr fileSource = std::make_shared(); ThreadPool threadPool { 4 }; float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, + threadPool, MapOptions().withMapMode(MapMode::Static)}; }; std::vector getTopClusterFeature(QueryTest& test) { - test.fileSource.sourceResponse = [&] (const Resource& resource) { + test.fileSource->sourceResponse = [&] (const Resource& resource) { EXPECT_EQ("http://url"s, resource.url); Response response; response.data = std::make_unique(util::read_file("test/fixtures/supercluster/places.json"s)); @@ -54,7 +55,7 @@ std::vector getTopClusterFeature(QueryTest& test) { options.cluster = true; auto source = std::make_unique("cluster_source"s, options); source->setURL("http://url"s); - source->loadDescription(test.fileSource); + source->loadDescription(*test.fileSource); auto clusterLayer = std::make_unique("cluster_layer"s, "cluster_source"s); clusterLayer->setIconImage("test-icon"s); diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index db576b4cf6..7d14bd14de 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -1,11 +1,10 @@ #include #include +#include #include -#include #include #include -#include #include #include #include @@ -24,14 +23,13 @@ using namespace mbgl::style; TEST(API, RecycleMapUpdateImages) { util::RunLoop loop; - StubFileSource fileSource; ThreadPool threadPool(4); float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), - pixelRatio, fileSource, threadPool, - MapOptions().withMapMode(MapMode::Static)); + auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), + pixelRatio, std::make_shared(), threadPool, + MapOptions().withMapMode(MapMode::Static)); EXPECT_TRUE(map); diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp index 3c055c2ce0..ff9b2ecac2 100644 --- a/test/gl/context.test.cpp +++ b/test/gl/context.test.cpp @@ -5,9 +5,9 @@ #include #include #include -#include #include #include +#include #include #include #include @@ -86,14 +86,14 @@ struct Buffer { TEST(GLContextMode, Shared) { util::RunLoop loop; - DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); ThreadPool threadPool(4); float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool, {}, GLContextMode::Shared }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(MapMode::Static)); + Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Static), + ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index 410a7e76af..c06fa53744 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -3,12 +3,13 @@ #include #include #include +#include -#include #include #include #include #include +#include #include #include #include @@ -31,27 +32,26 @@ template class MapTest { public: util::RunLoop runLoop; - FileSource fileSource; + std::shared_ptr fileSource; ThreadPool threadPool { 4 }; StubMapObserver observer; HeadlessFrontend frontend; - Map map; + MapAdapter map; MapTest(float pixelRatio = 1, MapMode mode = MapMode::Static) - : frontend(pixelRatio, threadPool) + : fileSource(std::make_shared()) + , frontend(pixelRatio, threadPool) , map(frontend, observer, frontend.getSize(), pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(mode)) { - } + fileSource, threadPool, MapOptions().withMapMode(mode)) {} template - MapTest(const std::string& cachePath, const std::string& assetRoot, + MapTest(const std::string& cachePath, const std::string& assetPath, float pixelRatio = 1, MapMode mode = MapMode::Static, typename std::enable_if::value>::type* = 0) - : fileSource { cachePath, assetRoot } + : fileSource(std::make_shared(cachePath, assetPath)) , frontend(pixelRatio, threadPool) , map(frontend, observer, frontend.getSize(), pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(mode)) { - } + fileSource, threadPool, MapOptions().withMapMode(mode)) {} }; TEST(Map, RendererState) { @@ -235,12 +235,12 @@ TEST(Map, Offline) { }; const std::string prefix = "http://127.0.0.1:3000/"; - test.fileSource.put(Resource::style(prefix + "style.json"), expiredItem("style.json")); - test.fileSource.put(Resource::source(prefix + "streets.json"), expiredItem("streets.json")); - test.fileSource.put(Resource::spriteJSON(prefix + "sprite", 1.0), expiredItem("sprite.json")); - test.fileSource.put(Resource::spriteImage(prefix + "sprite", 1.0), expiredItem("sprite.png")); - test.fileSource.put(Resource::tile(prefix + "{z}-{x}-{y}.vector.pbf", 1.0, 0, 0, 0, Tileset::Scheme::XYZ), expiredItem("0-0-0.vector.pbf")); - test.fileSource.put(Resource::glyphs(prefix + "{fontstack}/{range}.pbf", {{"Helvetica"}}, {0, 255}), expiredItem("glyph.pbf")); + test.fileSource->put(Resource::style(prefix + "style.json"), expiredItem("style.json")); + test.fileSource->put(Resource::source(prefix + "streets.json"), expiredItem("streets.json")); + test.fileSource->put(Resource::spriteJSON(prefix + "sprite", 1.0), expiredItem("sprite.json")); + test.fileSource->put(Resource::spriteImage(prefix + "sprite", 1.0), expiredItem("sprite.png")); + test.fileSource->put(Resource::tile(prefix + "{z}-{x}-{y}.vector.pbf", 1.0, 0, 0, 0, Tileset::Scheme::XYZ), expiredItem("0-0-0.vector.pbf")); + test.fileSource->put(Resource::glyphs(prefix + "{fontstack}/{range}.pbf", {{"Helvetica"}}, {0, 255}), expiredItem("glyph.pbf")); NetworkStatus::Set(NetworkStatus::Status::Offline); test.map.getStyle().loadURL(prefix + "style.json"); @@ -334,7 +334,7 @@ TEST(Map, SetStyleInvalidJSON) { TEST(Map, SetStyleInvalidURL) { MapTest<> test; - test.fileSource.styleResponse = [] (const Resource&) { + test.fileSource->styleResponse = [] (const Resource&) { Response response; response.error = std::make_unique( Response::Error::Reason::Other, @@ -364,14 +364,14 @@ TEST(Map, StyleFresh) { MapTest test; test.map.getStyle().loadURL("mapbox://styles/test"); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/empty.json")); response.expires = Timestamp::max(); - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); } TEST(Map, StyleExpired) { @@ -382,31 +382,31 @@ TEST(Map, StyleExpired) { MapTest test; test.map.getStyle().loadURL("mapbox://styles/test"); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/empty.json")); response.expires = util::now() - 1h; - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); // Mutate layer. From now on, sending a response to the style won't overwrite it anymore, but // we should continue to wait for a fresh response. test.map.getStyle().addLayer(std::make_unique("bg")); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); // Send another expired response, and confirm that we didn't overwrite the style, but continue // to wait for a fresh response. - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); EXPECT_NE(nullptr, test.map.getStyle().getLayer("bg")); // Send a fresh response, and confirm that we didn't overwrite the style, but continue to wait // for a fresh response. response.expires = util::now() + 1h; - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); EXPECT_NE(nullptr, test.map.getStyle().getLayer("bg")); } @@ -418,20 +418,20 @@ TEST(Map, StyleExpiredWithAnnotations) { MapTest test; test.map.getStyle().loadURL("mapbox://styles/test"); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/empty.json")); response.expires = util::now() - 1h; - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); test.map.addAnnotation(LineAnnotation { LineString {{ { 0, 0 }, { 10, 10 } }} }); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); } TEST(Map, StyleExpiredWithRender) { @@ -442,20 +442,20 @@ TEST(Map, StyleExpiredWithRender) { MapTest test; test.map.getStyle().loadURL("mapbox://styles/test"); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/empty.json")); response.expires = util::now() - 1h; - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); test.frontend.render(test.map); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); - test.fileSource.respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + test.fileSource->respond(Resource::Style, response); + EXPECT_EQ(1u, test.fileSource->requests.size()); } TEST(Map, StyleEarlyMutation) { @@ -468,9 +468,9 @@ TEST(Map, StyleEarlyMutation) { Response response; response.data = std::make_shared(util::read_file("test/fixtures/api/water.json")); - test.fileSource.respond(Resource::Style, response); + test.fileSource->respond(Resource::Style, response); - EXPECT_EQ(1u, test.fileSource.requests.size()); + EXPECT_EQ(1u, test.fileSource->requests.size()); EXPECT_NE(nullptr, test.map.getStyle().getLayer("water")); } @@ -592,7 +592,7 @@ TEST(Map, DisabledSources) { MapTest<> test; // Always load the same image tile for raster layers. - test.fileSource.response = [] (const Resource& res) -> optional { + test.fileSource->response = [] (const Resource& res) -> optional { if (res.url == "asset://tile.png") { Response response; response.data = std::make_shared( @@ -668,7 +668,7 @@ TEST(Map, DontLoadUnneededTiles) { using Tiles = std::unordered_set; Tiles tiles; - test.fileSource.tileResponse = [&](const Resource& rsc) { + test.fileSource->tileResponse = [&](const Resource& rsc) { tiles.emplace(rsc.url); Response res; res.noContent = true; @@ -698,7 +698,6 @@ TEST(Map, DontLoadUnneededTiles) { TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { util::RunLoop runLoop; ThreadPool threadPool { 4 }; - DefaultFileSource fileSource(":memory:", "test/fixtures/api/assets"); float pixelRatio { 1 }; using namespace std::chrono_literals; @@ -723,8 +722,9 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { }); }; - Map map(frontend, observer, frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Continuous)); + Map map(frontend, observer, frontend.getSize(), pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Continuous), + ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); runLoop.run(); @@ -739,7 +739,7 @@ TEST(Map, NoContentTiles) { Response response; response.noContent = true; response.expires = util::now() + 1h; - test.fileSource.put(Resource::tile("http://example.com/{z}-{x}-{y}.vector.pbf", 1.0, 0, 0, 0, + test.fileSource->put(Resource::tile("http://example.com/{z}-{x}-{y}.vector.pbf", 1.0, 0, 0, 0, Tileset::Scheme::XYZ), response); @@ -776,7 +776,7 @@ TEST(Map, NoContentTiles) { TEST(Map, Issue12432) { MapTest<> test { 1, MapMode::Continuous }; - test.fileSource.tileResponse = [&](const Resource&) { + test.fileSource->tileResponse = [&](const Resource&) { Response result; result.data = std::make_shared(util::read_file("test/fixtures/map/issue12432/0-0-0.mvt")); return result; diff --git a/test/map/prefetch.test.cpp b/test/map/prefetch.test.cpp index dfde3a779b..2830045983 100644 --- a/test/map/prefetch.test.cpp +++ b/test/map/prefetch.test.cpp @@ -1,11 +1,10 @@ #include #include #include +#include -#include #include #include -#include #include #include #include @@ -24,7 +23,7 @@ using namespace std::chrono_literals; TEST(Map, PrefetchTiles) { util::RunLoop runLoop; ThreadPool threadPool(4); - StubFileSource fileSource; + std::shared_ptr fileSource = std::make_shared(); util::Timer emergencyShutoff; emergencyShutoff.start(10s, 0s, [&] { @@ -38,12 +37,12 @@ TEST(Map, PrefetchTiles) { }; HeadlessFrontend frontend { { 512, 512 }, 1, threadPool }; - Map map(frontend, observer, frontend.getSize(), 1, fileSource, threadPool, - MapOptions().withMapMode(MapMode::Continuous)); + MapAdapter map(frontend, observer, frontend.getSize(), 1, fileSource, threadPool, + MapOptions().withMapMode(MapMode::Continuous)); std::vector tiles; - fileSource.response = [&] (const Resource& res) -> optional { + fileSource->response = [&] (const Resource& res) -> optional { static std::string tile = util::read_file("test/fixtures/map/prefetch/tile.png"); auto zoom = std::stoi(res.url); diff --git a/test/renderer/image_manager.test.cpp b/test/renderer/image_manager.test.cpp index 4a838d0f9c..20451827ce 100644 --- a/test/renderer/image_manager.test.cpp +++ b/test/renderer/image_manager.test.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include diff --git a/test/src/mbgl/test/map_adapter.hpp b/test/src/mbgl/test/map_adapter.hpp new file mode 100644 index 0000000000..e0fc449f48 --- /dev/null +++ b/test/src/mbgl/test/map_adapter.hpp @@ -0,0 +1,23 @@ +#pragma once + +#include +#include + +namespace mbgl { + +class FileSource; + +// Non-public version of mbgl::Map that accepts a file source as parameter. +class MapAdapter : public Map { +public: + explicit MapAdapter(RendererFrontend& frontend, + MapObserver& observer, + Size size, + float ratio, + std::shared_ptr fileSource, + Scheduler& scheduler, + const MapOptions& options) + : Map(std::make_unique(frontend, observer, scheduler, size, ratio, std::move(fileSource), options)) {} +}; + +} // namespace mbgl diff --git a/test/test-files.json b/test/test-files.json index 498237e072..58970689be 100644 --- a/test/test-files.json +++ b/test/test-files.json @@ -114,6 +114,7 @@ "mbgl/test/fake_file_source.hpp": "test/src/mbgl/test/fake_file_source.hpp", "mbgl/test/fixture_log_observer.hpp": "test/src/mbgl/test/fixture_log_observer.hpp", "mbgl/test/getrss.hpp": "test/src/mbgl/test/getrss.hpp", + "mbgl/test/map_adapter.hpp": "test/src/mbgl/test/map_adapter.hpp", "mbgl/test/mock.hpp": "test/src/mbgl/test/mock.hpp", "mbgl/test/sqlite3_test_fs.hpp": "test/src/mbgl/test/sqlite3_test_fs.hpp", "mbgl/test/stub_file_source.hpp": "test/src/mbgl/test/stub_file_source.hpp", diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp index d0fdb5ee57..a266021f25 100644 --- a/test/text/local_glyph_rasterizer.test.cpp +++ b/test/text/local_glyph_rasterizer.test.cpp @@ -1,6 +1,7 @@ #include #include -#include +#include + #include #include #include @@ -38,12 +39,12 @@ public: } util::RunLoop loop; - StubFileSource fileSource; + std::shared_ptr fileSource = std::make_shared(); ThreadPool threadPool { 4 }; float pixelRatio { 1 }; HeadlessFrontend frontend; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, + threadPool, MapOptions().withMapMode(MapMode::Static)}; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/local_glyphs/") + name, @@ -59,7 +60,7 @@ public: TEST(LocalGlyphRasterizer, PingFang) { LocalGlyphRasterizerTest test(std::string("PingFang")); - test.fileSource.glyphsResponse = [&] (const Resource& resource) { + test.fileSource->glyphsResponse = [&] (const Resource& resource) { EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); Response response; response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); @@ -80,7 +81,7 @@ TEST(LocalGlyphRasterizer, NoLocal) { // the output should just contain basic latin characters. LocalGlyphRasterizerTest test({}); - test.fileSource.glyphsResponse = [&] (const Resource& resource) { + test.fileSource->glyphsResponse = [&] (const Resource& resource) { EXPECT_EQ(Resource::Kind::Glyphs, resource.kind); Response response; response.data = std::make_shared(util::read_file("test/fixtures/resources/glyphs.pbf")); diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp index 36bed57ab5..c1ae597986 100644 --- a/test/util/memory.test.cpp +++ b/test/util/memory.test.cpp @@ -1,8 +1,8 @@ #include #include #include +#include -#include #include #include #include @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -26,16 +27,16 @@ using namespace std::literals::string_literals; class MemoryTest { public: MemoryTest() { - fileSource.styleResponse = [&](const Resource& res) { return response("style_" + getType(res) + ".json");}; - fileSource.tileResponse = [&](const Resource& res) { return response(getType(res) + ".tile"); }; - fileSource.sourceResponse = [&](const Resource& res) { return response("source_" + getType(res) + ".json"); }; - fileSource.glyphsResponse = [&](const Resource&) { return response("glyphs.pbf"); }; - fileSource.spriteJSONResponse = [&](const Resource&) { return response("sprite.json"); }; - fileSource.spriteImageResponse = [&](const Resource&) { return response("sprite.png"); }; + fileSource->styleResponse = [&](const Resource& res) { return response("style_" + getType(res) + ".json");}; + fileSource->tileResponse = [&](const Resource& res) { return response(getType(res) + ".tile"); }; + fileSource->sourceResponse = [&](const Resource& res) { return response("source_" + getType(res) + ".json"); }; + fileSource->glyphsResponse = [&](const Resource&) { return response("glyphs.pbf"); }; + fileSource->spriteJSONResponse = [&](const Resource&) { return response("sprite.json"); }; + fileSource->spriteImageResponse = [&](const Resource&) { return response("sprite.png"); }; } util::RunLoop runLoop; - StubFileSource fileSource; + std::shared_ptr fileSource = std::make_shared(); ThreadPool threadPool { 4 }; private: @@ -72,8 +73,8 @@ TEST(Memory, Vector) { float ratio { 2 }; HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, - test.threadPool, MapOptions().withMapMode(MapMode::Static)); + MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, + test.threadPool, MapOptions().withMapMode(MapMode::Static)); map.jumpTo(CameraOptions().withZoom(16)); map.getStyle().loadURL("mapbox://streets"); @@ -85,8 +86,8 @@ TEST(Memory, Raster) { float ratio { 2 }; HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, - test.threadPool, MapOptions().withMapMode(MapMode::Static)); + MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, + test.threadPool, MapOptions().withMapMode(MapMode::Static)); map.getStyle().loadURL("mapbox://satellite"); frontend.render(map); @@ -131,7 +132,7 @@ TEST(Memory, Footprint) { } HeadlessFrontend frontend; - Map map; + MapAdapter map; }; // Warm up buffers and cache. -- cgit v1.2.1 From db275e58888d10bfeb96529286d1d400fea504d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Wed, 20 Mar 2019 16:07:47 +0100 Subject: [android] clear the style object when the map is destroyed --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 5 ++++- .../src/main/java/com/mapbox/mapboxsdk/maps/Style.java | 7 ++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index f0155bda58..ebfac5a021 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -174,6 +174,9 @@ public final class MapboxMap { */ void onDestroy() { locationComponent.onDestroy(); + if (style != null) { + style.clear(); + } } /** @@ -813,7 +816,7 @@ public final class MapboxMap { public void setStyle(Style.Builder builder, final Style.OnStyleLoaded callback) { locationComponent.onStartLoadingMap(); if (style != null) { - style.onWillStartLoadingMap(); + style.clear(); } if (callback != null) { diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java index f14e034816..ff93e2b099 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java @@ -437,10 +437,11 @@ public class Style { // /** - * Called when the underlying map will start loading a new style. This method will clean up this style - * by setting the java sources and layers in a detached state and removing them from core. + * Called when the underlying map will start loading a new style or the map is destroyed. + * This method will clean up this style by setting the java sources and layers + * in a detached state and removing them from core. */ - void onWillStartLoadingMap() { + void clear() { fullyLoaded = false; for (Source source : sources.values()) { if (source != null) { -- cgit v1.2.1 From 140eddf868299a18fa54bdf2d255135a35f852b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Wed, 20 Mar 2019 19:02:16 +0100 Subject: [android] cache source/layer only when successfully added --- .../src/main/java/com/mapbox/mapboxsdk/maps/Style.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java index ff93e2b099..5c28b55de8 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/Style.java @@ -100,8 +100,8 @@ public class Style { */ public void addSource(@NonNull Source source) { validateState("addSource"); - sources.put(source.getId(), source); nativeMap.addSource(source); + sources.put(source.getId(), source); } /** @@ -172,8 +172,8 @@ public class Style { */ public void addLayer(@NonNull Layer layer) { validateState("addLayer"); - layers.put(layer.getId(), layer); nativeMap.addLayer(layer); + layers.put(layer.getId(), layer); } /** @@ -184,8 +184,8 @@ public class Style { */ public void addLayerBelow(@NonNull Layer layer, @NonNull String below) { validateState("addLayerBelow"); - layers.put(layer.getId(), layer); nativeMap.addLayerBelow(layer, below); + layers.put(layer.getId(), layer); } /** @@ -196,8 +196,8 @@ public class Style { */ public void addLayerAbove(@NonNull Layer layer, @NonNull String above) { validateState("addLayerAbove"); - layers.put(layer.getId(), layer); nativeMap.addLayerAbove(layer, above); + layers.put(layer.getId(), layer); } /** @@ -209,8 +209,8 @@ public class Style { */ public void addLayerAt(@NonNull Layer layer, @IntRange(from = 0) int index) { validateState("addLayerAbove"); - layers.put(layer.getId(), layer); nativeMap.addLayerAt(layer, index); + layers.put(layer.getId(), layer); } /** -- cgit v1.2.1 From 2d371a38600dea580dc46485615c3c8e47fde3ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Wed, 20 Mar 2019 11:40:13 +0100 Subject: [build] correct the code_coverage time to follow ISO 8601 --- scripts/code-coverage.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/code-coverage.sh b/scripts/code-coverage.sh index c58501605d..cb99bd9646 100755 --- a/scripts/code-coverage.sh +++ b/scripts/code-coverage.sh @@ -4,7 +4,7 @@ set -e set -o pipefail # -# This script takes three values: $1 should be a decimal value reflecting the +# This script takes three values: $1 should be a decimal value reflecting the # percentage of lines covered, with a maximum value of 100.0, $2 is # the platform the percentage pertains to (iOS or Android), and $3 is the # test scheme being run (on iOS, this is currently CI). @@ -21,19 +21,18 @@ circle_sha="" if [[ $CIRCLE_SHA1 ]]; then circle_sha="$CIRCLE_SHA1" fi -# Create a formatted JSON file that contains the current coverage. +# Create a formatted JSON file that contains the current coverage. -current_date=$(TZ=UTC date +"%F-%T") +current_date=$(TZ=UTC date +"%FT%T%z") file_name=$2_coverage.json cat < $file_name - {"code_coverage":$1,"platform":"$2","sdk":"Maps","scheme":"$3","created_at":"$current_date","sha":"$circle_sha"} +{"code_coverage":$1,"platform":"$2","sdk":"Maps","scheme":"$3","created_at":"$current_date","sha":"$circle_sha"} EOF gzip -f $file_name -if [ -z `which aws` ]; then - brew install awscli +if [ -z `which aws` ]; then + brew install awscli fi aws s3 cp $file_name.gz s3://mapbox-loading-dock/raw/mobile.codecoverage/$current_date/ echo $ - -- cgit v1.2.1 From 8c87ca252201d8f7df120c928f008d18cfd956af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Wed, 20 Mar 2019 20:52:54 +0100 Subject: [android] changelog for 7.3.0-beta.1 --- platform/android/CHANGELOG.md | 14 ++++++++++++++ .../java/com/mapbox/mapboxsdk/offline/OfflineManager.java | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 7a117f4b2a..00ee46198f 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -4,6 +4,20 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to ## master +## 7.3.0-beta.1 - March 20, 2019 + +### Features +Expose "text-color" option for formatted sections [#14128](https://github.com/mapbox/mapbox-gl-native/pull/14128) +Expose LocationComponent's layer IDs [#14155](https://github.com/mapbox/mapbox-gl-native/pull/14155) + +### Bugs +Cache location layer IDs in a set instead of a list [#14141](https://github.com/mapbox/mapbox-gl-native/pull/14141) +Clear the style object when the map is destroyed [#14171](https://github.com/mapbox/mapbox-gl-native/pull/14171) +Cache source/layer only when successfully added [#14171](https://github.com/mapbox/mapbox-gl-native/pull/14171) + +### Build +Bump telemetry version to 4.3.0 [#14140](https://github.com/mapbox/mapbox-gl-native/pull/14140) + ## 7.3.0-alpha.2 - March 13, 2019 ### Features diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java index 40f5e5777b..8684d7c6f1 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/offline/OfflineManager.java @@ -29,7 +29,7 @@ import java.nio.channels.FileChannel; *

* It'll help you list and create offline regions. *

- * + * * @see Offline Maps Information/ */ public class OfflineManager { -- cgit v1.2.1 From 0945165353afde4403ffee44b01abd51bff763ce Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Thu, 21 Mar 2019 14:04:19 -0400 Subject: [core] Change definition of "complete" so offline packs created before #11055 can complete. (#14188) --- include/mbgl/storage/offline.hpp | 2 +- platform/ios/CHANGELOG.md | 1 + platform/macos/CHANGELOG.md | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/mbgl/storage/offline.hpp b/include/mbgl/storage/offline.hpp index b3d258a7e3..f884c8b465 100644 --- a/include/mbgl/storage/offline.hpp +++ b/include/mbgl/storage/offline.hpp @@ -153,7 +153,7 @@ public: bool requiredResourceCountIsPrecise = false; bool complete() const { - return completedResourceCount == requiredResourceCount; + return completedResourceCount >= requiredResourceCount; } }; diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index a1ab7c949a..7d5818d311 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -9,6 +9,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed an issue that caused `MGL_FUNCTION` to ignore multiple formatting parameters when passed a `format` function as parameter. ([#14064](https://github.com/mapbox/mapbox-gl-native/pull/14064)) * Added a Galician localization. ([#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095)) * Added `mgl_attributed:` expression operator, which concatenate `MGLAttributedExpression` objects for specifying rich text in the `MGLSymbolStyleLayer.text` property. ([#14094](https://github.com/mapbox/mapbox-gl-native/pull/14094)) +* Fixed a bug that caused offline packs created prior to v4.0.0 (introduced in [#11055](https://github.com/mapbox/mapbox-gl-native/pull/11055)) to be marked as `MGLOfflinePackStateInactive`. ([#14188](https://github.com/mapbox/mapbox-gl-native/pull/14188)) ### User interaction diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 2542f57d95..0c6fd89b56 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -11,6 +11,10 @@ * Fixed an issue that caused `MGL_FUNCTION` to ignore multiple formatting parameters when passed a `format` function as parameter. ([#14064](https://github.com/mapbox/mapbox-gl-native/pull/14064)) * Added `mgl_attributed:` expression operator, which concatenate `MGLAttributedExpression` objects for specifying rich text in the `MGLSymbolStyleLayer.text` property. ([#14094](https://github.com/mapbox/mapbox-gl-native/pull/14094)) +### Offline + +* Fixed a bug that caused offline packs created prior to v0.7.0 (introduced in [#11055](https://github.com/mapbox/mapbox-gl-native/pull/11055)) to be marked as `MGLOfflinePackStateInactive`. ([#14188](https://github.com/mapbox/mapbox-gl-native/pull/14188)) + ### Annotations * Fixed a bug with `MGLMapView.visibleAnnotations` that resulted in incorrect results and performance degradation. ([#13745](https://github.com/mapbox/mapbox-gl-native/pull/13745)) -- cgit v1.2.1 From 1388f3a502220b32b7eb00ad57e6c048e99b9fcd Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Thu, 21 Mar 2019 12:36:39 -0700 Subject: [ios, macos] Fix conditional expression parsing error. (#14181) Fixed an error that caused conditional expressions to crash when a conditional parameter was also a conditional expression. --- platform/darwin/src/NSExpression+MGLAdditions.mm | 23 +++-------------------- platform/darwin/test/MGLExpressionTests.mm | 5 +---- platform/ios/CHANGELOG.md | 1 + platform/macos/CHANGELOG.md | 1 + 4 files changed, 6 insertions(+), 24 deletions(-) diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index 091f1edf9d..b509c12172 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -1230,27 +1230,10 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { } case NSConditionalExpressionType: { - NSMutableArray *arguments = [NSMutableArray arrayWithObjects:self.predicate.mgl_jsonExpressionObject, nil]; + NSMutableArray *arguments = [NSMutableArray arrayWithObjects:@"case", self.predicate.mgl_jsonExpressionObject, nil]; + [arguments addObject:self.trueExpression.mgl_jsonExpressionObject]; + [arguments addObject:self.falseExpression.mgl_jsonExpressionObject]; - if (self.trueExpression.expressionType == NSConditionalExpressionType) { - // Fold nested conditionals into a single case expression. - NSArray *trueArguments = self.trueExpression.mgl_jsonExpressionObject; - trueArguments = [trueArguments subarrayWithRange:NSMakeRange(1, trueArguments.count - 1)]; - [arguments addObjectsFromArray:trueArguments]; - } else { - [arguments addObject:self.trueExpression.mgl_jsonExpressionObject]; - } - - if (self.falseExpression.expressionType == NSConditionalExpressionType) { - // Fold nested conditionals into a single case expression. - NSArray *falseArguments = self.falseExpression.mgl_jsonExpressionObject; - falseArguments = [falseArguments subarrayWithRange:NSMakeRange(1, falseArguments.count - 1)]; - [arguments addObjectsFromArray:falseArguments]; - } else { - [arguments addObject:self.falseExpression.mgl_jsonExpressionObject]; - } - - [arguments insertObject:@"case" atIndex:0]; return arguments; } diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index ec51f2bf6c..2a4d40b4c5 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -846,12 +846,9 @@ using namespace std::string_literals; } { NSExpression *expression = [NSExpression expressionWithFormat:@"TERNARY(0 = 1, TRUE, TERNARY(1 = 2, TRUE, FALSE))"]; - NSArray *jsonExpression = @[@"case", @[@"==", @0, @1], @YES, @[@"==", @1, @2], @YES, @NO]; + NSArray *jsonExpression = @[@"case", @[@"==", @0, @1], @YES, @[@"case", @[@"==", @1, @2], @YES, @NO]]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); XCTAssertEqualObjects([expression expressionValueWithObject:nil context:nil], @NO); - expression = [NSExpression expressionWithFormat:@"MGL_IF(%@, TRUE, %@, TRUE, FALSE)", - MGLConstantExpression([NSPredicate predicateWithFormat:@"0 = 1"]), - MGLConstantExpression([NSPredicate predicateWithFormat:@"1 = 2"])]; XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } { diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 7d5818d311..b0a1f9e215 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -10,6 +10,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Added a Galician localization. ([#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095)) * Added `mgl_attributed:` expression operator, which concatenate `MGLAttributedExpression` objects for specifying rich text in the `MGLSymbolStyleLayer.text` property. ([#14094](https://github.com/mapbox/mapbox-gl-native/pull/14094)) * Fixed a bug that caused offline packs created prior to v4.0.0 (introduced in [#11055](https://github.com/mapbox/mapbox-gl-native/pull/11055)) to be marked as `MGLOfflinePackStateInactive`. ([#14188](https://github.com/mapbox/mapbox-gl-native/pull/14188)) +* Fixed an issue that caused conditional expressions to crash when passed nested conditional expressions as parameters. ([#14181](https://github.com/mapbox/mapbox-gl-native/pull/14181)) ### User interaction diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 0c6fd89b56..36668dfe22 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -10,6 +10,7 @@ * Added `MGLNetworkConfiguration` class to customize the SDK's `NSURLSessionConfiguration` object. ([#11447](https://github.com/mapbox/mapbox-gl-native/pull/13886)) * Fixed an issue that caused `MGL_FUNCTION` to ignore multiple formatting parameters when passed a `format` function as parameter. ([#14064](https://github.com/mapbox/mapbox-gl-native/pull/14064)) * Added `mgl_attributed:` expression operator, which concatenate `MGLAttributedExpression` objects for specifying rich text in the `MGLSymbolStyleLayer.text` property. ([#14094](https://github.com/mapbox/mapbox-gl-native/pull/14094)) +* Fixed an issue that caused conditional expressions to crash when passed nested conditional expressions as parameters. ([#14181](https://github.com/mapbox/mapbox-gl-native/pull/14181)) ### Offline -- cgit v1.2.1 From 1229b80a8c271e10795c07347d10f512d2abdb9a Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 13 Mar 2019 09:31:26 +0100 Subject: [android] - introduce Pixel dimension instrumentation test --- .../src/androidTest/assets/streets.json | 5331 ++++++++++++++++++++ .../com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt | 76 +- .../mapbox/mapboxsdk/testapp/style/ImageTest.java | 44 - .../mapbox/mapboxsdk/testapp/style/ImageTest.kt | 75 + .../src/main/AndroidManifest.xml | 3 + .../testapp/activity/espresso/PixelTestActivity.kt | 66 + .../src/main/res/layout/activity_pixel_test.xml | 16 + 7 files changed, 5535 insertions(+), 76 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_pixel_test.xml diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json new file mode 100644 index 0000000000..5ab289344a --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/assets/streets.json @@ -0,0 +1,5331 @@ +{ + "version": 8, + "name": "mapbox-gl-native-test-style", + "metadata": { + "mapbox:autocomposite": true, + "mapbox:type": "default", + "mapbox:origin": "streets-v10", + "mapbox:groups": { + "1444934828655.3389": {"name": "Aeroways", "collapsed": true}, + "1444933322393.2852": { + "name": "POI labels (scalerank 1)", + "collapsed": true + }, + "1444855786460.0557": {"name": "Roads", "collapsed": true}, + "1444933575858.6992": { + "name": "Highway shields", + "collapsed": true + }, + "1444934295202.7542": { + "name": "Admin boundaries", + "collapsed": true + }, + "1444856151690.9143": {"name": "State labels", "collapsed": true}, + "1444933721429.3076": {"name": "Road labels", "collapsed": true}, + "1444933358918.2366": { + "name": "POI labels (scalerank 2)", + "collapsed": true + }, + "1444933808272.805": {"name": "Water labels", "collapsed": true}, + "1444933372896.5967": { + "name": "POI labels (scalerank 3)", + "collapsed": true + }, + "1444855799204.86": {"name": "Bridges", "collapsed": true}, + "1444856087950.3635": {"name": "Marine labels", "collapsed": true}, + "1456969573402.7817": {"name": "Hillshading", "collapsed": true}, + "1444862510685.128": {"name": "City labels", "collapsed": true}, + "1444855769305.6016": {"name": "Tunnels", "collapsed": true}, + "1456970288113.8113": {"name": "Landcover", "collapsed": true}, + "1444856144497.7825": {"name": "Country labels", "collapsed": true}, + "1444933456003.5437": { + "name": "POI labels (scalerank 4)", + "collapsed": true + } + }, + "mapbox:sdk-support": { + "js": "0.49.0", + "android": "6.5.0", + "ios": "4.4.0" + } + }, + "center": [0.0, 0.0], + "zoom": 0, + "bearing": 0, + "pitch": 0, + "sources": { + "composite": { + "url": "mapbox://mapbox.mapbox-terrain-v2,mapbox.mapbox-streets-v7", + "type": "vector" + } + }, + "sprite": "mapbox://sprites/lukaspaczos/cjnkdt02b0b2p2ss40skwpvs1", + "glyphs": "mapbox://fonts/lukaspaczos/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "background", + "type": "background", + "layout": {}, + "paint": { + "background-color": { + "base": 1, + "stops": [ + [11, "hsl(35, 32%, 91%)"], + [13, "hsl(35, 12%, 89%)"] + ] + } + } + }, + { + "id": "landcover_snow", + "type": "fill", + "metadata": {"mapbox:group": "1456970288113.8113"}, + "source": "composite", + "source-layer": "landcover", + "filter": ["==", "class", "snow"], + "layout": {}, + "paint": { + "fill-color": "hsl(0, 0%, 100%)", + "fill-opacity": 0.2, + "fill-antialias": false + } + }, + { + "id": "landcover_wood", + "type": "fill", + "metadata": {"mapbox:group": "1456970288113.8113"}, + "source": "composite", + "source-layer": "landcover", + "maxzoom": 14, + "filter": ["==", "class", "wood"], + "layout": {}, + "paint": { + "fill-color": "hsl(75, 62%, 81%)", + "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]}, + "fill-antialias": false + } + }, + { + "id": "landcover_scrub", + "type": "fill", + "metadata": {"mapbox:group": "1456970288113.8113"}, + "source": "composite", + "source-layer": "landcover", + "maxzoom": 14, + "filter": ["==", "class", "scrub"], + "layout": {}, + "paint": { + "fill-color": "hsl(75, 62%, 81%)", + "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]}, + "fill-antialias": false + } + }, + { + "id": "landcover_grass", + "type": "fill", + "metadata": {"mapbox:group": "1456970288113.8113"}, + "source": "composite", + "source-layer": "landcover", + "maxzoom": 14, + "filter": ["==", "class", "grass"], + "layout": {}, + "paint": { + "fill-color": "hsl(75, 62%, 81%)", + "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]}, + "fill-antialias": false + } + }, + { + "id": "landcover_crop", + "type": "fill", + "metadata": {"mapbox:group": "1456970288113.8113"}, + "source": "composite", + "source-layer": "landcover", + "maxzoom": 14, + "filter": ["==", "class", "crop"], + "layout": {}, + "paint": { + "fill-color": "hsl(75, 62%, 81%)", + "fill-opacity": {"base": 1.5, "stops": [[2, 0.3], [7, 0]]}, + "fill-antialias": false + } + }, + { + "id": "national_park", + "type": "fill", + "source": "composite", + "source-layer": "landuse_overlay", + "filter": ["==", "class", "national_park"], + "layout": {}, + "paint": { + "fill-color": "hsl(100, 58%, 76%)", + "fill-opacity": {"base": 1, "stops": [[5, 0], [6, 0.5]]} + } + }, + { + "id": "hospital", + "type": "fill", + "source": "composite", + "source-layer": "landuse", + "filter": ["==", "class", "hospital"], + "layout": {}, + "paint": { + "fill-color": { + "base": 1, + "stops": [ + [15.5, "hsl(340, 37%, 87%)"], + [16, "hsl(340, 63%, 89%)"] + ] + } + } + }, + { + "id": "school", + "type": "fill", + "source": "composite", + "source-layer": "landuse", + "filter": ["==", "class", "school"], + "layout": {}, + "paint": { + "fill-color": { + "base": 1, + "stops": [ + [15.5, "hsl(50, 47%, 81%)"], + [16, "hsl(50, 63%, 84%)"] + ] + } + } + }, + { + "id": "park", + "type": "fill", + "source": "composite", + "source-layer": "landuse", + "filter": ["==", "class", "park"], + "layout": {}, + "paint": { + "fill-color": "hsl(100, 58%, 76%)", + "fill-opacity": {"base": 1, "stops": [[5, 0], [6, 1]]} + } + }, + { + "id": "pitch", + "type": "fill", + "source": "composite", + "source-layer": "landuse", + "filter": ["==", "class", "pitch"], + "layout": {}, + "paint": {"fill-color": "hsl(100, 57%, 72%)"} + }, + { + "id": "pitch-line", + "type": "line", + "source": "composite", + "source-layer": "landuse", + "minzoom": 15, + "filter": ["==", "class", "pitch"], + "layout": {"line-join": "miter"}, + "paint": {"line-color": "hsl(75, 57%, 84%)"} + }, + { + "id": "cemetery", + "type": "fill", + "source": "composite", + "source-layer": "landuse", + "filter": ["==", "class", "cemetery"], + "layout": {}, + "paint": {"fill-color": "hsl(75, 37%, 81%)"} + }, + { + "id": "industrial", + "type": "fill", + "source": "composite", + "source-layer": "landuse", + "filter": ["==", "class", "industrial"], + "layout": {}, + "paint": { + "fill-color": { + "base": 1, + "stops": [ + [15.5, "hsl(230, 15%, 86%)"], + [16, "hsl(230, 29%, 89%)"] + ] + } + } + }, + { + "id": "sand", + "type": "fill", + "source": "composite", + "source-layer": "landuse", + "filter": ["==", "class", "sand"], + "layout": {}, + "paint": {"fill-color": "hsl(60, 46%, 87%)"} + }, + { + "id": "hillshade_highlight_bright", + "type": "fill", + "metadata": {"mapbox:group": "1456969573402.7817"}, + "source": "composite", + "source-layer": "hillshade", + "maxzoom": 16, + "filter": ["==", "level", 94], + "layout": {}, + "paint": { + "fill-color": "hsl(0, 0%, 100%)", + "fill-opacity": {"stops": [[14, 0.12], [16, 0]]}, + "fill-antialias": false + } + }, + { + "id": "hillshade_highlight_med", + "type": "fill", + "metadata": {"mapbox:group": "1456969573402.7817"}, + "source": "composite", + "source-layer": "hillshade", + "maxzoom": 16, + "filter": ["==", "level", 90], + "layout": {}, + "paint": { + "fill-color": "hsl(0, 0%, 100%)", + "fill-opacity": {"stops": [[14, 0.12], [16, 0]]}, + "fill-antialias": false + } + }, + { + "id": "hillshade_shadow_faint", + "type": "fill", + "metadata": {"mapbox:group": "1456969573402.7817"}, + "source": "composite", + "source-layer": "hillshade", + "maxzoom": 16, + "filter": ["==", "level", 89], + "layout": {}, + "paint": { + "fill-color": "hsl(56, 59%, 22%)", + "fill-opacity": {"stops": [[14, 0.05], [16, 0]]}, + "fill-antialias": false + } + }, + { + "id": "hillshade_shadow_med", + "type": "fill", + "metadata": {"mapbox:group": "1456969573402.7817"}, + "source": "composite", + "source-layer": "hillshade", + "maxzoom": 16, + "filter": ["==", "level", 78], + "layout": {}, + "paint": { + "fill-color": "hsl(56, 59%, 22%)", + "fill-opacity": {"stops": [[14, 0.05], [16, 0]]}, + "fill-antialias": false + } + }, + { + "id": "hillshade_shadow_dark", + "type": "fill", + "metadata": {"mapbox:group": "1456969573402.7817"}, + "source": "composite", + "source-layer": "hillshade", + "maxzoom": 16, + "filter": ["==", "level", 67], + "layout": {}, + "paint": { + "fill-color": "hsl(56, 59%, 22%)", + "fill-opacity": {"stops": [[14, 0.06], [16, 0]]}, + "fill-antialias": false + } + }, + { + "id": "hillshade_shadow_extreme", + "type": "fill", + "metadata": {"mapbox:group": "1456969573402.7817"}, + "source": "composite", + "source-layer": "hillshade", + "maxzoom": 16, + "filter": ["==", "level", 56], + "layout": {}, + "paint": { + "fill-color": "hsl(56, 59%, 22%)", + "fill-opacity": {"stops": [[14, 0.06], [16, 0]]}, + "fill-antialias": false + } + }, + { + "id": "waterway-river-canal", + "type": "line", + "source": "composite", + "source-layer": "waterway", + "minzoom": 8, + "filter": ["in", "class", "canal", "river"], + "layout": { + "line-cap": {"base": 1, "stops": [[0, "butt"], [11, "round"]]}, + "line-join": "round" + }, + "paint": { + "line-color": "hsl(205, 87%, 76%)", + "line-width": {"base": 1.3, "stops": [[8.5, 0.1], [20, 8]]}, + "line-opacity": {"base": 1, "stops": [[8, 0], [8.5, 1]]} + } + }, + { + "id": "waterway-small", + "type": "line", + "source": "composite", + "source-layer": "waterway", + "minzoom": 13, + "filter": ["!in", "class", "canal", "river"], + "layout": {"line-join": "round", "line-cap": "round"}, + "paint": { + "line-color": "hsl(205, 87%, 76%)", + "line-width": {"base": 1.35, "stops": [[13.5, 0.1], [20, 3]]}, + "line-opacity": {"base": 1, "stops": [[13, 0], [13.5, 1]]} + } + }, + { + "id": "water-shadow", + "type": "fill", + "source": "composite", + "source-layer": "water", + "layout": {}, + "paint": { + "fill-color": "hsl(215, 84%, 69%)", + "fill-translate": { + "base": 1.2, + "stops": [[7, [0, 0]], [16, [-1, -1]]] + }, + "fill-translate-anchor": "viewport", + "fill-opacity": 1 + } + }, + { + "id": "water", + "type": "fill", + "source": "composite", + "source-layer": "water", + "layout": {}, + "paint": {"fill-color": "hsl(196, 80%, 70%)"} + }, + { + "id": "barrier_line-land-polygon", + "type": "fill", + "source": "composite", + "source-layer": "barrier_line", + "filter": [ + "all", + ["==", "$type", "Polygon"], + ["==", "class", "land"] + ], + "layout": {}, + "paint": {"fill-color": "hsl(35, 12%, 89%)"} + }, + { + "id": "barrier_line-land-line", + "type": "line", + "source": "composite", + "source-layer": "barrier_line", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["==", "class", "land"] + ], + "layout": {"line-cap": "round"}, + "paint": { + "line-width": {"base": 1.99, "stops": [[14, 0.75], [20, 40]]}, + "line-color": "hsl(35, 12%, 89%)" + } + }, + { + "id": "aeroway-polygon", + "type": "fill", + "metadata": {"mapbox:group": "1444934828655.3389"}, + "source": "composite", + "source-layer": "aeroway", + "minzoom": 11, + "filter": [ + "all", + ["!=", "type", "apron"], + ["==", "$type", "Polygon"] + ], + "layout": {}, + "paint": { + "fill-color": { + "base": 1, + "stops": [ + [15, "hsl(230, 23%, 82%)"], + [16, "hsl(230, 37%, 84%)"] + ] + }, + "fill-opacity": {"base": 1, "stops": [[11, 0], [11.5, 1]]} + } + }, + { + "id": "aeroway-runway", + "type": "line", + "metadata": {"mapbox:group": "1444934828655.3389"}, + "source": "composite", + "source-layer": "aeroway", + "minzoom": 9, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["==", "type", "runway"] + ], + "layout": {}, + "paint": { + "line-color": { + "base": 1, + "stops": [ + [15, "hsl(230, 23%, 82%)"], + [16, "hsl(230, 37%, 84%)"] + ] + }, + "line-width": {"base": 1.5, "stops": [[9, 1], [18, 80]]} + } + }, + { + "id": "aeroway-taxiway", + "type": "line", + "metadata": {"mapbox:group": "1444934828655.3389"}, + "source": "composite", + "source-layer": "aeroway", + "minzoom": 9, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["==", "type", "taxiway"] + ], + "layout": {}, + "paint": { + "line-color": { + "base": 1, + "stops": [ + [15, "hsl(230, 23%, 82%)"], + [16, "hsl(230, 37%, 84%)"] + ] + }, + "line-width": {"base": 1.5, "stops": [[10, 0.5], [18, 20]]} + } + }, + { + "id": "building-line", + "type": "line", + "source": "composite", + "source-layer": "building", + "minzoom": 15, + "filter": [ + "all", + ["!=", "type", "building:part"], + ["==", "underground", "false"] + ], + "layout": {}, + "paint": { + "line-color": "hsl(35, 6%, 79%)", + "line-width": {"base": 1.5, "stops": [[15, 0.75], [20, 3]]}, + "line-opacity": {"base": 1, "stops": [[15.5, 0], [16, 1]]} + } + }, + { + "id": "building", + "type": "fill", + "source": "composite", + "source-layer": "building", + "minzoom": 15, + "filter": [ + "all", + ["!=", "type", "building:part"], + ["==", "underground", "false"] + ], + "layout": {}, + "paint": { + "fill-color": { + "base": 1, + "stops": [ + [15, "hsl(35, 11%, 88%)"], + [16, "hsl(35, 8%, 85%)"] + ] + }, + "fill-opacity": {"base": 1, "stops": [[15.5, 0], [16, 1]]}, + "fill-outline-color": "hsl(35, 6%, 79%)" + } + }, + { + "id": "tunnel-street-low", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": { + "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]] + } + } + }, + { + "id": "tunnel-street_limited-low", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": { + "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]] + } + } + }, + { + "id": "tunnel-service-link-track-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["==", "structure", "tunnel"], + ["in", "class", "link", "service", "track"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 19%, 75%)", + "line-gap-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}, + "line-dasharray": [3, 3] + } + }, + { + "id": "tunnel-street_limited-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 19%, 75%)", + "line-gap-width": { + "base": 1.5, + "stops": [[13, 0], [14, 2], [18, 18]] + }, + "line-dasharray": [3, 3], + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "tunnel-street-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 19%, 75%)", + "line-gap-width": { + "base": 1.5, + "stops": [[13, 0], [14, 2], [18, 18]] + }, + "line-dasharray": [3, 3], + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "tunnel-secondary-tertiary-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "tunnel"], + ["in", "class", "secondary", "tertiary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.2, "stops": [[10, 0.75], [18, 2]]}, + "line-dasharray": [3, 3], + "line-gap-width": { + "base": 1.5, + "stops": [[8.5, 0.5], [10, 0.75], [18, 26]] + }, + "line-color": "hsl(230, 19%, 75%)" + } + }, + { + "id": "tunnel-primary-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "primary"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-dasharray": [3, 3], + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(230, 19%, 75%)" + } + }, + { + "id": "tunnel-trunk_link-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "tunnel"], + ["==", "type", "trunk_link"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-dasharray": [3, 3] + } + }, + { + "id": "tunnel-motorway_link-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway_link"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-dasharray": [3, 3] + } + }, + { + "id": "tunnel-trunk-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "structure", "tunnel"], ["==", "type", "trunk"]] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-opacity": 1, + "line-dasharray": [3, 3] + } + }, + { + "id": "tunnel-motorway-case", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-opacity": 1, + "line-dasharray": [3, 3] + } + }, + { + "id": "tunnel-construction", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "construction"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-join": "miter"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(230, 24%, 87%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}, + "line-dasharray": { + "base": 1, + "stops": [ + [14, [0.4, 0.8]], + [15, [0.3, 0.6]], + [16, [0.2, 0.3]], + [17, [0.2, 0.25]], + [18, [0.15, 0.15]] + ] + } + } + }, + { + "id": "tunnel-path", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "steps"], + ["==", "class", "path"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]}, + "line-dasharray": { + "base": 1, + "stops": [ + [14, [1, 0]], + [15, [1.75, 1]], + [16, [1, 0.75]], + [17, [1, 0.5]] + ] + }, + "line-color": "hsl(35, 26%, 95%)", + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]} + } + }, + { + "id": "tunnel-steps", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "structure", "tunnel"], ["==", "type", "steps"]] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[15, 1], [16, 1.6], [18, 6]] + }, + "line-color": "hsl(35, 26%, 95%)", + "line-dasharray": { + "base": 1, + "stops": [ + [14, [1, 0]], + [15, [1.75, 1]], + [16, [1, 0.75]], + [17, [0.3, 0.3]] + ] + }, + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]} + } + }, + { + "id": "tunnel-trunk_link", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "tunnel"], + ["==", "type", "trunk_link"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(46, 77%, 78%)", + "line-opacity": 1, + "line-dasharray": [1, 0] + } + }, + { + "id": "tunnel-motorway_link", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway_link"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(26, 100%, 78%)", + "line-opacity": 1, + "line-dasharray": [1, 0] + } + }, + { + "id": "tunnel-pedestrian", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "pedestrian"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": 1, + "line-dasharray": { + "base": 1, + "stops": [[14, [1, 0]], [15, [1.5, 0.4]], [16, [1, 0.2]]] + } + } + }, + { + "id": "tunnel-service-link-track", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["==", "structure", "tunnel"], + ["in", "class", "link", "service", "track"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-dasharray": [1, 0] + } + }, + { + "id": "tunnel-street_limited", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(35, 14%, 93%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "tunnel-street", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "tunnel-secondary-tertiary", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "tunnel"], + ["in", "class", "secondary", "tertiary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[8.5, 0.5], [10, 0.75], [18, 26]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": 1, + "line-dasharray": [1, 0], + "line-blur": 0 + } + }, + { + "id": "tunnel-primary", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "primary"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": 1, + "line-dasharray": [1, 0], + "line-blur": 0 + } + }, + { + "id": "tunnel-oneway-arrows-blue-minor", + "type": "symbol", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["==", "oneway", "true"], + ["==", "structure", "tunnel"], + [ + "in", + "class", + "link", + "path", + "pedestrian", + "service", + "track" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [[17, "oneway-small"], [18, "oneway-large"]] + }, + "symbol-spacing": 200, + "icon-padding": 2 + }, + "paint": {} + }, + { + "id": "tunnel-oneway-arrows-blue-major", + "type": "symbol", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 15, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["==", "oneway", "true"], + ["==", "structure", "tunnel"], + [ + "in", + "class", + "primary", + "secondary", + "street", + "street_limited", + "tertiary" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [[16, "oneway-small"], [17, "oneway-large"]] + }, + "symbol-spacing": 200, + "icon-padding": 2 + }, + "paint": {} + }, + { + "id": "tunnel-trunk", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "class", "trunk"], ["==", "structure", "tunnel"]] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(46, 77%, 78%)" + } + }, + { + "id": "tunnel-motorway", + "type": "line", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway"], + ["==", "structure", "tunnel"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-dasharray": [1, 0], + "line-opacity": 1, + "line-color": "hsl(26, 100%, 78%)", + "line-blur": 0 + } + }, + { + "id": "tunnel-oneway-arrows-white", + "type": "symbol", + "metadata": {"mapbox:group": "1444855769305.6016"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + [ + "!in", + "type", + "primary_link", + "secondary_link", + "tertiary_link" + ], + ["==", "oneway", "true"], + ["==", "structure", "tunnel"], + [ + "in", + "class", + "link", + "motorway", + "motorway_link", + "trunk" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [ + [16, "oneway-white-small"], + [17, "oneway-white-large"] + ] + }, + "symbol-spacing": 200, + "icon-padding": 2 + }, + "paint": {} + }, + { + "id": "ferry", + "type": "line", + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["==", "type", "ferry"] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-color": { + "base": 1, + "stops": [ + [15, "hsl(205, 73%, 63%)"], + [17, "hsl(230, 73%, 63%)"] + ] + }, + "line-opacity": 1, + "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]}, + "line-dasharray": { + "base": 1, + "stops": [[12, [1, 0]], [13, [12, 4]]] + } + } + }, + { + "id": "ferry_auto", + "type": "line", + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["==", "type", "ferry_auto"] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-color": { + "base": 1, + "stops": [ + [15, "hsl(205, 73%, 63%)"], + [17, "hsl(230, 73%, 63%)"] + ] + }, + "line-opacity": 1, + "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]} + } + }, + { + "id": "road-path-bg", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["!in", "type", "crossing", "sidewalk", "steps"], + ["==", "class", "path"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[15, 2], [18, 7]]}, + "line-dasharray": [1, 0], + "line-color": "hsl(230, 17%, 82%)", + "line-blur": 0, + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 0.75]]} + } + }, + { + "id": "road-steps-bg", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "type", "steps"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[15, 2], [17, 4.6], [18, 7]] + }, + "line-color": "hsl(230, 17%, 82%)", + "line-dasharray": [1, 0], + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 0.75]]} + } + }, + { + "id": "road-sidewalk-bg", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["in", "type", "crossing", "sidewalk"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[15, 2], [18, 7]]}, + "line-dasharray": [1, 0], + "line-color": "hsl(230, 17%, 82%)", + "line-blur": 0, + "line-opacity": {"base": 1, "stops": [[16, 0], [16.25, 0.75]]} + } + }, + { + "id": "turning-features-outline", + "type": "symbol", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 15, + "filter": [ + "all", + ["==", "$type", "Point"], + ["in", "class", "turning_circle", "turning_loop"] + ], + "layout": { + "icon-image": "turning-circle-outline", + "icon-size": { + "base": 1.5, + "stops": [[14, 0.122], [18, 0.969], [20, 1]] + }, + "icon-allow-overlap": true, + "icon-ignore-placement": true, + "icon-padding": 0, + "icon-rotation-alignment": "map" + }, + "paint": {} + }, + { + "id": "road-pedestrian-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 12, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "pedestrian"], + ["==", "structure", "none"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 2], [18, 14.5]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": 0, + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "road-street-low", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "class", "street"], ["==", "structure", "none"]] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": { + "stops": [[11, 0], [11.25, 1], [14, 1], [14.01, 0]] + } + } + }, + { + "id": "road-street_limited-low", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "none"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": { + "stops": [[11, 0], [11.25, 1], [14, 1], [14.01, 0]] + } + } + }, + { + "id": "road-service-link-track-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["!in", "structure", "bridge", "tunnel"], + ["in", "class", "link", "service", "track"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]} + } + }, + { + "id": "road-street_limited-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "none"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": { + "base": 1.5, + "stops": [[13, 0], [14, 2], [18, 18]] + }, + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "road-street-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "class", "street"], ["==", "structure", "none"]] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": { + "base": 1.5, + "stops": [[13, 0], [14, 2], [18, 18]] + }, + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "road-secondary-tertiary-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["in", "class", "secondary", "tertiary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.2, "stops": [[10, 0.75], [18, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": { + "base": 1.5, + "stops": [[8.5, 0.5], [10, 0.75], [18, 26]] + }, + "line-opacity": {"base": 1, "stops": [[9.99, 0], [10, 1]]} + } + }, + { + "id": "road-primary-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "primary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-opacity": {"base": 1, "stops": [[9.99, 0], [10, 1]]} + } + }, + { + "id": "road-motorway_link-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 10, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "motorway_link"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]} + } + }, + { + "id": "road-trunk_link-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "type", "trunk_link"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]} + } + }, + { + "id": "road-trunk-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "trunk"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-opacity": {"base": 1, "stops": [[6, 0], [6.1, 1]]} + } + }, + { + "id": "road-motorway-case", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "motorway"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]} + } + }, + { + "id": "road-construction", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "construction"], + ["==", "structure", "none"] + ] + ], + "layout": {"line-join": "miter"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(230, 24%, 87%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}, + "line-dasharray": { + "base": 1, + "stops": [ + [14, [0.4, 0.8]], + [15, [0.3, 0.6]], + [16, [0.2, 0.3]], + [17, [0.2, 0.25]], + [18, [0.15, 0.15]] + ] + } + } + }, + { + "id": "road-sidewalks", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["in", "type", "crossing", "sidewalk"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-dasharray": { + "base": 1, + "stops": [ + [14, [1, 0]], + [15, [1.75, 1]], + [16, [1, 0.75]], + [17, [1, 0.5]] + ] + }, + "line-opacity": {"base": 1, "stops": [[16, 0], [16.25, 1]]} + } + }, + { + "id": "road-path", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["!in", "type", "crossing", "sidewalk", "steps"], + ["==", "class", "path"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-dasharray": { + "base": 1, + "stops": [ + [14, [1, 0]], + [15, [1.75, 1]], + [16, [1, 0.75]], + [17, [1, 0.5]] + ] + }, + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]} + } + }, + { + "id": "road-steps", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "type", "steps"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[15, 1], [16, 1.6], [18, 6]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-dasharray": { + "base": 1, + "stops": [ + [14, [1, 0]], + [15, [1.75, 1]], + [16, [1, 0.75]], + [17, [0.3, 0.3]] + ] + }, + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]} + } + }, + { + "id": "road-trunk_link", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "type", "trunk_link"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(46, 85%, 67%)", + "line-opacity": 1 + } + }, + { + "id": "road-motorway_link", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 10, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "motorway_link"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(26, 100%, 68%)", + "line-opacity": 1 + } + }, + { + "id": "road-pedestrian", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 12, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "pedestrian"], + ["==", "structure", "none"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": 1, + "line-dasharray": { + "base": 1, + "stops": [[14, [1, 0]], [15, [1.5, 0.4]], [16, [1, 0.2]]] + } + } + }, + { + "id": "road-pedestrian-polygon-fill", + "type": "fill", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 12, + "filter": [ + "all", + ["==", "$type", "Polygon"], + [ + "all", + ["==", "structure", "none"], + ["in", "class", "path", "pedestrian"] + ] + ], + "layout": {}, + "paint": { + "fill-color": { + "base": 1, + "stops": [ + [16, "hsl(230, 16%, 94%)"], + [16.25, "hsl(230, 50%, 98%)"] + ] + }, + "fill-outline-color": "hsl(230, 26%, 88%)", + "fill-opacity": 1 + } + }, + { + "id": "road-pedestrian-polygon-pattern", + "type": "fill", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 12, + "filter": [ + "all", + ["==", "$type", "Polygon"], + [ + "all", + ["==", "structure", "none"], + ["in", "class", "path", "pedestrian"] + ] + ], + "layout": {}, + "paint": { + "fill-color": "hsl(0, 0%, 100%)", + "fill-outline-color": "hsl(35, 10%, 83%)", + "fill-pattern": "pedestrian-polygon", + "fill-opacity": {"base": 1, "stops": [[16, 0], [16.25, 1]]} + } + }, + { + "id": "road-polygon", + "type": "fill", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 12, + "filter": [ + "all", + ["==", "$type", "Polygon"], + [ + "all", + ["!in", "class", "motorway", "path", "pedestrian", "trunk"], + ["!in", "structure", "bridge", "tunnel"] + ] + ], + "layout": {}, + "paint": { + "fill-color": "hsl(0, 0%, 100%)", + "fill-outline-color": "#d6d9e6" + } + }, + { + "id": "road-service-link-track", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["!in", "structure", "bridge", "tunnel"], + ["in", "class", "link", "service", "track"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}, + "line-color": "hsl(0, 0%, 100%)" + } + }, + { + "id": "road-street_limited", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "none"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(35, 14%, 93%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "road-street", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "class", "street"], ["==", "structure", "none"]] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "road-secondary-tertiary", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["in", "class", "secondary", "tertiary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[8.5, 0.5], [10, 0.75], [18, 26]] + }, + "line-color": { + "base": 1, + "stops": [[5, "hsl(35, 32%, 91%)"], [8, "hsl(0, 0%, 100%)"]] + }, + "line-opacity": {"base": 1.2, "stops": [[5, 0], [5.5, 1]]} + } + }, + { + "id": "road-primary", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "primary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": { + "base": 1, + "stops": [[5, "hsl(35, 32%, 91%)"], [7, "hsl(0, 0%, 100%)"]] + }, + "line-opacity": 1 + } + }, + { + "id": "road-oneway-arrows-blue-minor", + "type": "symbol", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["!in", "structure", "bridge", "tunnel"], + ["==", "oneway", "true"], + [ + "in", + "class", + "link", + "path", + "pedestrian", + "service", + "track" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [[17, "oneway-small"], [18, "oneway-large"]] + }, + "icon-rotation-alignment": "map", + "icon-padding": 2, + "symbol-spacing": 200 + }, + "paint": {} + }, + { + "id": "road-oneway-arrows-blue-major", + "type": "symbol", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 15, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["!in", "structure", "bridge", "tunnel"], + ["==", "oneway", "true"], + [ + "in", + "class", + "primary", + "secondary", + "street", + "street_limited", + "tertiary" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [[16, "oneway-small"], [17, "oneway-large"]] + }, + "icon-rotation-alignment": "map", + "icon-padding": 2, + "symbol-spacing": 200 + }, + "paint": {} + }, + { + "id": "road-trunk", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "trunk"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": { + "base": 1, + "stops": [ + [6, "hsl(0, 0%, 100%)"], + [6.1, "hsl(46, 80%, 60%)"], + [9, "hsl(46, 85%, 67%)"] + ] + } + } + }, + { + "id": "road-motorway", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["==", "class", "motorway"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": { + "base": 1, + "stops": [ + [8, "hsl(26, 87%, 62%)"], + [9, "hsl(26, 100%, 68%)"] + ] + } + } + }, + { + "id": "road-rail", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["in", "class", "major_rail", "minor_rail"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-color": { + "stops": [ + [13, "hsl(50, 17%, 82%)"], + [16, "hsl(230, 10%, 74%)"] + ] + }, + "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]} + } + }, + { + "id": "road-rail-tracks", + "type": "line", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + ["in", "class", "major_rail", "minor_rail"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-color": { + "stops": [ + [13, "hsl(50, 17%, 82%)"], + [16, "hsl(230, 10%, 74%)"] + ] + }, + "line-width": {"base": 1.5, "stops": [[14, 4], [20, 8]]}, + "line-dasharray": [0.1, 15], + "line-opacity": {"base": 1, "stops": [[13.75, 0], [14, 1]]} + } + }, + { + "id": "level-crossings", + "type": "symbol", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "Point"], + ["==", "class", "level_crossing"] + ], + "layout": { + "icon-size": 1, + "icon-image": "level-crossing", + "icon-allow-overlap": true + }, + "paint": {} + }, + { + "id": "road-oneway-arrows-white", + "type": "symbol", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "structure", "bridge", "tunnel"], + [ + "!in", + "type", + "primary_link", + "secondary_link", + "tertiary_link" + ], + ["==", "oneway", "true"], + [ + "in", + "class", + "link", + "motorway", + "motorway_link", + "trunk" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [ + [16, "oneway-white-small"], + [17, "oneway-white-large"] + ] + }, + "icon-padding": 2, + "symbol-spacing": 200 + }, + "paint": {} + }, + { + "id": "turning-features", + "type": "symbol", + "metadata": {"mapbox:group": "1444855786460.0557"}, + "source": "composite", + "source-layer": "road", + "minzoom": 15, + "filter": [ + "all", + ["==", "$type", "Point"], + ["in", "class", "turning_circle", "turning_loop"] + ], + "layout": { + "icon-image": "turning-circle", + "icon-size": {"base": 1.5, "stops": [[14, 0.095], [18, 1]]}, + "icon-allow-overlap": true, + "icon-ignore-placement": true, + "icon-padding": 0, + "icon-rotation-alignment": "map" + }, + "paint": {} + }, + { + "id": "bridge-path-bg", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "steps"], + ["==", "class", "path"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[15, 2], [18, 7]]}, + "line-dasharray": [1, 0], + "line-color": "hsl(230, 17%, 82%)", + "line-blur": 0, + "line-opacity": {"base": 1, "stops": [[15, 0], [15.25, 1]]} + } + }, + { + "id": "bridge-steps-bg", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "structure", "bridge"], ["==", "type", "steps"]] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[15, 2], [17, 4.6], [18, 7]] + }, + "line-color": "hsl(230, 17%, 82%)", + "line-dasharray": [1, 0], + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 0.75]]} + } + }, + { + "id": "bridge-pedestrian-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "pedestrian"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 2], [18, 14.5]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": 0, + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "bridge-street-low", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": { + "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]] + } + } + }, + { + "id": "bridge-street_limited-low", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": { + "stops": [[11.5, 0], [12, 1], [14, 1], [14.01, 0]] + } + } + }, + { + "id": "bridge-service-link-track-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["==", "structure", "bridge"], + ["in", "class", "link", "service", "track"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]} + } + }, + { + "id": "bridge-street_limited-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": { + "base": 1.5, + "stops": [[13, 0], [14, 2], [18, 18]] + } + } + }, + { + "id": "bridge-street-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}, + "line-gap-width": { + "base": 1.5, + "stops": [[13, 0], [14, 2], [18, 18]] + } + } + }, + { + "id": "bridge-secondary-tertiary-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "bridge"], + ["in", "class", "secondary", "tertiary"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.2, "stops": [[10, 0.75], [18, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": { + "base": 1.5, + "stops": [[8.5, 0.5], [10, 0.75], [18, 26]] + }, + "line-translate": [0, 0] + } + }, + { + "id": "bridge-primary-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "primary"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(230, 24%, 87%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-translate": [0, 0] + } + }, + { + "id": "bridge-trunk_link-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "structure", "bridge"], + ["==", "type", "trunk_link"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]} + } + }, + { + "id": "bridge-motorway_link-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "class", "motorway_link"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-opacity": 1 + } + }, + { + "id": "bridge-trunk-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "class", "trunk"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]} + } + }, + { + "id": "bridge-motorway-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "class", "motorway"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]} + } + }, + { + "id": "bridge-construction", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "construction"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "miter"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(230, 24%, 87%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}, + "line-dasharray": { + "base": 1, + "stops": [ + [14, [0.4, 0.8]], + [15, [0.3, 0.6]], + [16, [0.2, 0.3]], + [17, [0.2, 0.25]], + [18, [0.15, 0.15]] + ] + } + } + }, + { + "id": "bridge-path", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "steps"], + ["==", "class", "path"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[15, 1], [18, 4]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-dasharray": { + "base": 1, + "stops": [ + [14, [1, 0]], + [15, [1.75, 1]], + [16, [1, 0.75]], + [17, [1, 0.5]] + ] + }, + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]} + } + }, + { + "id": "bridge-steps", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + ["all", ["==", "structure", "bridge"], ["==", "type", "steps"]] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[15, 1], [16, 1.6], [18, 6]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-dasharray": { + "base": 1, + "stops": [ + [14, [1, 0]], + [15, [1.75, 1]], + [16, [1, 0.75]], + [17, [0.3, 0.3]] + ] + }, + "line-opacity": {"base": 1, "stops": [[14, 0], [14.25, 1]]} + } + }, + { + "id": "bridge-trunk_link", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "structure", "bridge"], + ["==", "type", "trunk_link"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(46, 85%, 67%)" + } + }, + { + "id": "bridge-motorway_link", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "class", "motorway_link"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(26, 100%, 68%)" + } + }, + { + "id": "bridge-pedestrian", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "pedestrian"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": 1, + "line-dasharray": { + "base": 1, + "stops": [[14, [1, 0]], [15, [1.5, 0.4]], [16, [1, 0.2]]] + } + } + }, + { + "id": "bridge-service-link-track", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 14, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!=", "type", "trunk_link"], + ["==", "structure", "bridge"], + ["in", "class", "link", "service", "track"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[14, 0.5], [18, 12]]}, + "line-color": "hsl(0, 0%, 100%)" + } + }, + { + "id": "bridge-street_limited", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street_limited"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(35, 14%, 93%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "bridge-street", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "street"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12.5, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]} + } + }, + { + "id": "bridge-secondary-tertiary", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "bridge"], + ["in", "type", "secondary", "tertiary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[8.5, 0.5], [10, 0.75], [18, 26]] + }, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": {"base": 1.2, "stops": [[5, 0], [5.5, 1]]} + } + }, + { + "id": "bridge-primary", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "bridge"], + ["==", "type", "primary"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-opacity": 1 + } + }, + { + "id": "bridge-oneway-arrows-blue-minor", + "type": "symbol", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "oneway", "true"], + ["==", "structure", "bridge"], + [ + "in", + "class", + "link", + "path", + "pedestrian", + "service", + "track" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [[17, "oneway-small"], [18, "oneway-large"]] + }, + "symbol-spacing": 200, + "icon-rotation-alignment": "map", + "icon-padding": 2 + }, + "paint": {} + }, + { + "id": "bridge-oneway-arrows-blue-major", + "type": "symbol", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 15, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "oneway", "true"], + ["==", "structure", "bridge"], + [ + "in", + "class", + "primary", + "secondary", + "street", + "street_limited", + "tertiary" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [[16, "oneway-small"], [17, "oneway-large"]] + }, + "symbol-spacing": 200, + "icon-rotation-alignment": "map", + "icon-padding": 2 + }, + "paint": {} + }, + { + "id": "bridge-trunk", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "class", "trunk"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(46, 85%, 67%)" + } + }, + { + "id": "bridge-motorway", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["!in", "layer", 2, 3, 4, 5], + ["==", "class", "motorway"], + ["==", "structure", "bridge"] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(26, 100%, 68%)" + } + }, + { + "id": "bridge-rail", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "bridge"], + ["in", "class", "major_rail", "minor_rail"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-color": { + "stops": [ + [13, "hsl(50, 17%, 82%)"], + [16, "hsl(230, 10%, 74%)"] + ] + }, + "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]} + } + }, + { + "id": "bridge-rail-tracks", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "bridge"], + ["in", "class", "major_rail", "minor_rail"] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-color": { + "stops": [ + [13, "hsl(50, 17%, 82%)"], + [16, "hsl(230, 10%, 74%)"] + ] + }, + "line-width": {"base": 1.5, "stops": [[14, 4], [20, 8]]}, + "line-dasharray": [0.1, 15], + "line-opacity": {"base": 1, "stops": [[13.75, 0], [20, 1]]} + } + }, + { + "id": "bridge-trunk_link-2-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "bridge"], + ["==", "type", "trunk_link"], + [">=", "layer", 2] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-opacity": {"base": 1, "stops": [[10.99, 0], [11, 1]]} + } + }, + { + "id": "bridge-motorway_link-2-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway_link"], + ["==", "structure", "bridge"], + [">=", "layer", 2] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[12, 0.75], [20, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-opacity": 1 + } + }, + { + "id": "bridge-trunk-2-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "trunk"], + ["==", "structure", "bridge"], + [">=", "layer", 2] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]} + } + }, + { + "id": "bridge-motorway-2-case", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway"], + ["==", "structure", "bridge"], + [">=", "layer", 2] + ] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[10, 1], [16, 2]]}, + "line-color": "hsl(0, 0%, 100%)", + "line-gap-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]} + } + }, + { + "id": "bridge-trunk_link-2", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "structure", "bridge"], + ["==", "type", "trunk_link"], + [">=", "layer", 2] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(46, 85%, 67%)" + } + }, + { + "id": "bridge-motorway_link-2", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway_link"], + ["==", "structure", "bridge"], + [">=", "layer", 2] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": { + "base": 1.5, + "stops": [[12, 0.5], [14, 2], [18, 18]] + }, + "line-color": "hsl(26, 100%, 68%)" + } + }, + { + "id": "bridge-trunk-2", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "trunk"], + ["==", "structure", "bridge"], + [">=", "layer", 2] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(46, 85%, 67%)" + } + }, + { + "id": "bridge-motorway-2", + "type": "line", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + ["==", "class", "motorway"], + ["==", "structure", "bridge"], + [">=", "layer", 2] + ] + ], + "layout": {"line-cap": "round", "line-join": "round"}, + "paint": { + "line-width": {"base": 1.5, "stops": [[5, 0.75], [18, 32]]}, + "line-color": "hsl(26, 100%, 68%)" + } + }, + { + "id": "bridge-oneway-arrows-white", + "type": "symbol", + "metadata": {"mapbox:group": "1444855799204.86"}, + "source": "composite", + "source-layer": "road", + "minzoom": 16, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "all", + [ + "!in", + "type", + "primary_link", + "secondary_link", + "tertiary_link" + ], + ["==", "oneway", "true"], + ["==", "structure", "bridge"], + [ + "in", + "class", + "link", + "motorway", + "motorway_link", + "trunk" + ] + ] + ], + "layout": { + "symbol-placement": "line", + "icon-image": { + "base": 1, + "stops": [ + [16, "oneway-white-small"], + [17, "oneway-white-large"] + ] + }, + "symbol-spacing": 200, + "icon-padding": 2 + }, + "paint": {} + }, + { + "id": "aerialway", + "type": "line", + "source": "composite", + "source-layer": "road", + "minzoom": 13, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["==", "class", "aerialway"] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-color": "hsl(230, 10%, 74%)", + "line-width": {"base": 1.5, "stops": [[14, 0.5], [20, 1]]} + } + }, + { + "id": "admin-3-4-boundaries-bg", + "type": "line", + "metadata": {"mapbox:group": "1444934295202.7542"}, + "source": "composite", + "source-layer": "admin", + "filter": ["all", ["==", "maritime", 0], [">=", "admin_level", 3]], + "layout": {"line-join": "bevel"}, + "paint": { + "line-color": { + "base": 1, + "stops": [ + [8, "hsl(35, 12%, 89%)"], + [16, "hsl(230, 49%, 90%)"] + ] + }, + "line-width": {"base": 1, "stops": [[7, 3.75], [12, 5.5]]}, + "line-opacity": {"base": 1, "stops": [[7, 0], [8, 0.75]]}, + "line-dasharray": [1, 0], + "line-translate": [0, 0], + "line-blur": {"base": 1, "stops": [[3, 0], [8, 3]]} + } + }, + { + "id": "admin-2-boundaries-bg", + "type": "line", + "metadata": {"mapbox:group": "1444934295202.7542"}, + "source": "composite", + "source-layer": "admin", + "minzoom": 1, + "filter": ["all", ["==", "admin_level", 2], ["==", "maritime", 0]], + "layout": {"line-join": "miter"}, + "paint": { + "line-width": {"base": 1, "stops": [[3, 3.5], [10, 8]]}, + "line-color": { + "base": 1, + "stops": [ + [6, "hsl(35, 12%, 89%)"], + [8, "hsl(230, 49%, 90%)"] + ] + }, + "line-opacity": {"base": 1, "stops": [[3, 0], [4, 0.5]]}, + "line-translate": [0, 0], + "line-blur": {"base": 1, "stops": [[3, 0], [10, 2]]} + } + }, + { + "id": "admin-3-4-boundaries", + "type": "line", + "metadata": {"mapbox:group": "1444934295202.7542"}, + "source": "composite", + "source-layer": "admin", + "filter": ["all", ["==", "maritime", 0], [">=", "admin_level", 3]], + "layout": {"line-join": "round", "line-cap": "round"}, + "paint": { + "line-dasharray": { + "base": 1, + "stops": [[6, [2, 0]], [7, [2, 2, 6, 2]]] + }, + "line-width": {"base": 1, "stops": [[7, 0.75], [12, 1.5]]}, + "line-opacity": {"base": 1, "stops": [[2, 0], [3, 1]]}, + "line-color": { + "base": 1, + "stops": [ + [3, "hsl(230, 14%, 77%)"], + [7, "hsl(230, 8%, 62%)"] + ] + } + } + }, + { + "id": "admin-2-boundaries", + "type": "line", + "metadata": {"mapbox:group": "1444934295202.7542"}, + "source": "composite", + "source-layer": "admin", + "minzoom": 1, + "filter": [ + "all", + ["==", "admin_level", 2], + ["==", "disputed", 0], + ["==", "maritime", 0] + ], + "layout": {"line-join": "round", "line-cap": "round"}, + "paint": { + "line-color": "hsl(230, 8%, 51%)", + "line-width": {"base": 1, "stops": [[3, 0.5], [10, 2]]} + } + }, + { + "id": "admin-2-boundaries-dispute", + "type": "line", + "metadata": {"mapbox:group": "1444934295202.7542"}, + "source": "composite", + "source-layer": "admin", + "minzoom": 1, + "filter": [ + "all", + ["==", "admin_level", 2], + ["==", "disputed", 1], + ["==", "maritime", 0] + ], + "layout": {"line-join": "round"}, + "paint": { + "line-dasharray": [1.5, 1.5], + "line-color": "hsl(230, 8%, 51%)", + "line-width": {"base": 1, "stops": [[3, 0.5], [10, 2]]} + } + }, + { + "id": "housenum-label", + "type": "symbol", + "source": "composite", + "source-layer": "housenum_label", + "minzoom": 17, + "layout": { + "text-field": "{house_num}", + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "text-padding": 4, + "text-max-width": 7, + "text-size": 9.5 + }, + "paint": { + "text-color": "hsl(35, 2%, 69%)", + "text-halo-color": "hsl(35, 8%, 85%)", + "text-halo-width": 0.5, + "text-halo-blur": 0 + } + }, + { + "id": "waterway-label", + "type": "symbol", + "source": "composite", + "source-layer": "waterway_label", + "minzoom": 12, + "filter": ["in", "class", "canal", "river"], + "layout": { + "text-field": "{name_en}", + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-pitch-alignment": "viewport", + "text-max-angle": 30, + "text-size": {"base": 1, "stops": [[13, 12], [18, 16]]} + }, + "paint": { + "text-halo-width": 0.5, + "text-halo-color": "hsl(196, 80%, 70%)", + "text-color": "hsl(230, 48%, 44%)", + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-scalerank4-l15", + "type": "symbol", + "metadata": {"mapbox:group": "1444933456003.5437"}, + "source": "composite", + "source-layer": "poi_label", + "minzoom": 17, + "filter": [ + "all", + [ + "!in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ], + ["==", "scalerank", 4], + [">=", "localrank", 15] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]}, + "icon-image": "{maki}-11", + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(26, 25%, 32%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-scalerank4-l1", + "type": "symbol", + "metadata": {"mapbox:group": "1444933456003.5437"}, + "source": "composite", + "source-layer": "poi_label", + "minzoom": 15, + "filter": [ + "all", + [ + "!in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ], + ["<=", "localrank", 14], + ["==", "scalerank", 4] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]}, + "icon-image": "{maki}-11", + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 1, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(26, 25%, 32%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-parks_scalerank4", + "type": "symbol", + "metadata": {"mapbox:group": "1444933456003.5437"}, + "source": "composite", + "source-layer": "poi_label", + "minzoom": 15, + "filter": [ + "all", + ["==", "scalerank", 4], + [ + "in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]}, + "icon-image": "{maki}-11", + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 1, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(100, 100%, 20%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-scalerank3", + "type": "symbol", + "metadata": {"mapbox:group": "1444933372896.5967"}, + "source": "composite", + "source-layer": "poi_label", + "filter": [ + "all", + [ + "!in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ], + ["==", "scalerank", 3] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]}, + "icon-image": "{maki}-11", + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 1, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(26, 25%, 32%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-parks-scalerank3", + "type": "symbol", + "metadata": {"mapbox:group": "1444933372896.5967"}, + "source": "composite", + "source-layer": "poi_label", + "filter": [ + "all", + ["==", "scalerank", 3], + [ + "in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]}, + "icon-image": "{maki}-11", + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(100, 100%, 20%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "road-label-small", + "type": "symbol", + "metadata": {"mapbox:group": "1444933721429.3076"}, + "source": "composite", + "source-layer": "road_label", + "minzoom": 15, + "filter": [ + "all", + [ + "!in", + "class", + "golf", + "link", + "motorway", + "pedestrian", + "primary", + "secondary", + "street", + "street_limited", + "tertiary", + "trunk" + ], + ["==", "$type", "LineString"] + ], + "layout": { + "text-size": {"base": 1, "stops": [[15, 10], [20, 13]]}, + "text-max-angle": 30, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-padding": 1, + "text-rotation-alignment": "map", + "text-pitch-alignment": "viewport", + "text-field": "{name_en}", + "text-letter-spacing": 0.01 + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1.25, + "text-halo-blur": 1 + } + }, + { + "id": "road-label-medium", + "type": "symbol", + "metadata": {"mapbox:group": "1444933721429.3076"}, + "source": "composite", + "source-layer": "road_label", + "minzoom": 11, + "filter": [ + "all", + ["==", "$type", "LineString"], + [ + "in", + "class", + "link", + "pedestrian", + "street", + "street_limited" + ] + ], + "layout": { + "text-size": {"base": 1, "stops": [[11, 10], [20, 14]]}, + "text-max-angle": 30, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-padding": 1, + "text-rotation-alignment": "map", + "text-pitch-alignment": "viewport", + "text-field": "{name_en}", + "text-letter-spacing": 0.01 + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1 + } + }, + { + "id": "road-label-large", + "type": "symbol", + "metadata": {"mapbox:group": "1444933721429.3076"}, + "source": "composite", + "source-layer": "road_label", + "filter": [ + "in", + "class", + "motorway", + "primary", + "secondary", + "tertiary", + "trunk" + ], + "layout": { + "text-size": {"base": 1, "stops": [[9, 10], [20, 16]]}, + "text-max-angle": 30, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-padding": 1, + "text-rotation-alignment": "map", + "text-pitch-alignment": "viewport", + "text-field": "{name_en}", + "text-letter-spacing": 0.01 + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsla(0, 0%, 100%, 0.75)", + "text-halo-width": 1, + "text-halo-blur": 1 + } + }, + { + "id": "road-shields-black", + "type": "symbol", + "metadata": {"mapbox:group": "1444933575858.6992"}, + "source": "composite", + "source-layer": "road_label", + "filter": [ + "all", + [ + "!in", + "shield", + "at-expressway", + "at-motorway", + "at-state-b", + "bg-motorway", + "bg-national", + "ch-main", + "ch-motorway", + "cz-motorway", + "cz-road", + "de-motorway", + "e-road", + "fi-main", + "gr-motorway", + "gr-national", + "hr-motorway", + "hr-state", + "hu-main", + "hu-motorway", + "nz-state", + "pl-expressway", + "pl-motorway", + "pl-national", + "ro-county", + "ro-motorway", + "ro-national", + "rs-motorway", + "rs-state-1b", + "se-main", + "si-expressway", + "si-motorway", + "sk-highway", + "sk-road", + "us-interstate", + "us-interstate-business", + "us-interstate-duplex", + "us-interstate-truck", + "za-metropolitan", + "za-national", + "za-provincial", + "za-regional" + ], + ["<=", "reflen", 6] + ], + "layout": { + "text-size": 9, + "icon-image": "{shield}-{reflen}", + "icon-rotation-alignment": "viewport", + "text-max-angle": 38, + "symbol-spacing": {"base": 1, "stops": [[11, 150], [14, 200]]}, + "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"], + "symbol-placement": { + "base": 1, + "stops": [[10, "point"], [11, "line"]] + }, + "text-padding": 2, + "text-rotation-alignment": "viewport", + "text-field": "{ref}", + "text-letter-spacing": 0.05, + "icon-padding": 2 + }, + "paint": { + "text-color": "hsl(0, 0%, 7%)", + "icon-halo-color": "rgba(0, 0, 0, 1)", + "icon-halo-width": 1, + "text-opacity": 1, + "icon-color": "white", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0 + } + }, + { + "id": "road-shields-white", + "type": "symbol", + "metadata": {"mapbox:group": "1444933575858.6992"}, + "source": "composite", + "source-layer": "road_label", + "filter": [ + "all", + ["<=", "reflen", 6], + [ + "in", + "shield", + "at-expressway", + "at-motorway", + "at-state-b", + "bg-motorway", + "bg-national", + "ch-main", + "ch-motorway", + "cz-motorway", + "cz-road", + "de-motorway", + "e-road", + "fi-main", + "gr-motorway", + "gr-national", + "hr-motorway", + "hr-state", + "hu-main", + "hu-motorway", + "nz-state", + "pl-expressway", + "pl-motorway", + "pl-national", + "ro-county", + "ro-motorway", + "ro-national", + "rs-motorway", + "rs-state-1b", + "se-main", + "si-expressway", + "si-motorway", + "sk-highway", + "sk-road", + "us-interstate", + "us-interstate-business", + "us-interstate-duplex", + "us-interstate-truck", + "za-metropolitan", + "za-national", + "za-provincial", + "za-regional" + ] + ], + "layout": { + "text-size": 9, + "icon-image": "{shield}-{reflen}", + "icon-rotation-alignment": "viewport", + "text-max-angle": 38, + "symbol-spacing": {"base": 1, "stops": [[11, 150], [14, 200]]}, + "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"], + "symbol-placement": { + "base": 1, + "stops": [[10, "point"], [11, "line"]] + }, + "text-padding": 2, + "text-rotation-alignment": "viewport", + "text-field": "{ref}", + "text-letter-spacing": 0.05, + "icon-padding": 2 + }, + "paint": { + "text-color": "hsl(0, 0%, 100%)", + "icon-halo-color": "rgba(0, 0, 0, 1)", + "icon-halo-width": 1, + "text-opacity": 1, + "icon-color": "white", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0 + } + }, + { + "id": "motorway-junction", + "type": "symbol", + "metadata": {"mapbox:group": "1444933575858.6992"}, + "source": "composite", + "source-layer": "motorway_junction", + "minzoom": 14, + "filter": ["all", ["<=", "reflen", 9], [">", "reflen", 0]], + "layout": { + "text-field": "{ref}", + "text-size": 9, + "icon-image": "motorway-exit-{reflen}", + "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"] + }, + "paint": { + "text-color": "hsl(0, 0%, 100%)", + "text-translate": [0, 0] + } + }, + { + "id": "poi-scalerank2", + "type": "symbol", + "metadata": {"mapbox:group": "1444933358918.2366"}, + "source": "composite", + "source-layer": "poi_label", + "filter": [ + "all", + [ + "!in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ], + ["==", "scalerank", 2] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[14, 11], [20, 14]]}, + "icon-image": {"stops": [[14, "{maki}-11"], [15, "{maki}-15"]]}, + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(26, 25%, 32%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-parks-scalerank2", + "type": "symbol", + "metadata": {"mapbox:group": "1444933358918.2366"}, + "source": "composite", + "source-layer": "poi_label", + "filter": [ + "all", + ["==", "scalerank", 2], + [ + "in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[14, 11], [20, 14]]}, + "icon-image": {"stops": [[14, "{maki}-11"], [15, "{maki}-15"]]}, + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(100, 100%, 20%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "rail-label", + "type": "symbol", + "source": "composite", + "source-layer": "rail_station_label", + "minzoom": 12, + "filter": ["!=", "maki", "entrance"], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[16, 11], [20, 13]]}, + "icon-image": "{network}", + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-offset": [0, 0.85], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": { + "base": 1, + "stops": [[0, ""], [13, "{name_en}"]] + }, + "text-letter-spacing": 0.01, + "icon-padding": 0, + "text-max-width": 7 + }, + "paint": { + "text-color": "hsl(230, 48%, 44%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "icon-halo-width": 4, + "icon-halo-color": "#fff", + "text-opacity": {"base": 1, "stops": [[13.99, 0], [14, 1]]}, + "text-halo-blur": 0.5 + } + }, + { + "id": "water-label-sm", + "type": "symbol", + "metadata": {"mapbox:group": "1444933808272.805"}, + "source": "composite", + "source-layer": "water_label", + "minzoom": 15, + "filter": ["<=", "area", 10000], + "layout": { + "text-field": "{name_en}", + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "text-max-width": 7, + "text-size": {"base": 1, "stops": [[16, 13], [20, 16]]} + }, + "paint": {"text-color": "hsl(230, 48%, 44%)"} + }, + { + "id": "water-label", + "type": "symbol", + "metadata": {"mapbox:group": "1444933808272.805"}, + "source": "composite", + "source-layer": "water_label", + "minzoom": 5, + "filter": [">", "area", 10000], + "layout": { + "text-field": "{name_en}", + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "text-max-width": 7, + "text-size": {"base": 1, "stops": [[13, 13], [18, 18]]} + }, + "paint": {"text-color": "hsl(230, 48%, 44%)"} + }, + { + "id": "place-residential", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "maxzoom": 18, + "filter": [ + "all", + ["all", ["<=", "localrank", 10], ["==", "type", "residential"]], + ["in", "$type", "LineString", "Point", "Polygon"] + ], + "layout": { + "text-line-height": 1.2, + "text-size": {"base": 1, "stops": [[10, 11], [18, 14]]}, + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0], + "text-rotation-alignment": "viewport", + "text-field": "{name_en}", + "text-max-width": 7 + }, + "paint": { + "text-color": "hsl(26, 25%, 32%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1, + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-parks-scalerank1", + "type": "symbol", + "metadata": {"mapbox:group": "1444933322393.2852"}, + "source": "composite", + "source-layer": "poi_label", + "filter": [ + "all", + ["<=", "scalerank", 1], + [ + "in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[10, 11], [18, 14]]}, + "icon-image": {"stops": [[13, "{maki}-11"], [14, "{maki}-15"]]}, + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(100, 100%, 20%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "poi-scalerank1", + "type": "symbol", + "metadata": {"mapbox:group": "1444933322393.2852"}, + "source": "composite", + "source-layer": "poi_label", + "filter": [ + "all", + [ + "!in", + "maki", + "campsite", + "cemetery", + "dog-park", + "garden", + "golf", + "park", + "picnic-site", + "playground", + "zoo" + ], + ["<=", "scalerank", 1] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[10, 11], [18, 14]]}, + "icon-image": {"stops": [[13, "{maki}-11"], [14, "{maki}-15"]]}, + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0.65], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(26, 25%, 32%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "airport-label", + "type": "symbol", + "source": "composite", + "source-layer": "airport_label", + "minzoom": 9, + "filter": ["<=", "scalerank", 2], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[10, 12], [18, 18]]}, + "icon-image": {"stops": [[12, "{maki}-11"], [13, "{maki}-15"]]}, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0.75], + "text-rotation-alignment": "viewport", + "text-anchor": "top", + "text-field": {"stops": [[11, "{ref}"], [12, "{name_en}"]]}, + "text-letter-spacing": 0.01, + "text-max-width": 9 + }, + "paint": { + "text-color": "hsl(230, 48%, 44%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 0.5, + "text-halo-blur": 0.5 + } + }, + { + "id": "place-islet-archipelago-aboriginal", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "maxzoom": 16, + "filter": [ + "in", + "type", + "aboriginal_lands", + "archipelago", + "islet" + ], + "layout": { + "text-line-height": 1.2, + "text-size": {"base": 1, "stops": [[10, 11], [18, 16]]}, + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0], + "text-rotation-alignment": "viewport", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 8 + }, + "paint": { + "text-color": "hsl(230, 29%, 35%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1 + } + }, + { + "id": "place-neighbourhood", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "minzoom": 10, + "maxzoom": 16, + "filter": ["==", "type", "neighbourhood"], + "layout": { + "text-field": "{name_en}", + "text-transform": "uppercase", + "text-letter-spacing": 0.1, + "text-max-width": 7, + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "text-padding": 3, + "text-size": {"base": 1, "stops": [[12, 11], [16, 16]]} + }, + "paint": { + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1, + "text-color": "hsl(230, 29%, 35%)", + "text-halo-blur": 0.5 + } + }, + { + "id": "place-suburb", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "minzoom": 10, + "maxzoom": 16, + "filter": ["==", "type", "suburb"], + "layout": { + "text-field": "{name_en}", + "text-transform": "uppercase", + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "text-letter-spacing": 0.15, + "text-max-width": 7, + "text-padding": 3, + "text-size": {"base": 1, "stops": [[11, 11], [15, 18]]} + }, + "paint": { + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1, + "text-color": "hsl(230, 29%, 35%)", + "text-halo-blur": 0.5 + } + }, + { + "id": "place-hamlet", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "minzoom": 10, + "maxzoom": 16, + "filter": ["==", "type", "hamlet"], + "layout": { + "text-field": "{name_en}", + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 1, "stops": [[12, 11.5], [15, 16]]} + }, + "paint": { + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1.25, + "text-color": "hsl(0, 0%, 0%)" + } + }, + { + "id": "place-village", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "minzoom": 8, + "maxzoom": 15, + "filter": ["==", "type", "village"], + "layout": { + "text-field": "{name_en}", + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "text-max-width": 7, + "text-size": {"base": 1, "stops": [[10, 11.5], [16, 18]]} + }, + "paint": { + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1.25, + "text-color": "hsl(0, 0%, 0%)" + } + }, + { + "id": "place-town", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "minzoom": 6, + "maxzoom": 15, + "filter": ["==", "type", "town"], + "layout": { + "icon-image": "dot-9", + "text-font": { + "base": 1, + "stops": [ + [ + 11, + ["DIN Offc Pro Regular", "Arial Unicode MS Regular"] + ], + [ + 12, + ["DIN Offc Pro Medium", "Arial Unicode MS Regular"] + ] + ] + }, + "text-offset": { + "base": 1, + "stops": [[7, [0, -0.15]], [8, [0, 0]]] + }, + "text-anchor": { + "base": 1, + "stops": [[7, "bottom"], [8, "center"]] + }, + "text-field": "{name_en}", + "text-max-width": 7, + "text-size": {"base": 1, "stops": [[7, 11.5], [15, 20]]} + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1.25, + "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]} + } + }, + { + "id": "place-island", + "type": "symbol", + "source": "composite", + "source-layer": "place_label", + "maxzoom": 16, + "filter": ["==", "type", "island"], + "layout": { + "text-line-height": 1.2, + "text-size": {"base": 1, "stops": [[10, 11], [18, 16]]}, + "text-max-angle": 38, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Regular", + "Arial Unicode MS Regular" + ], + "text-padding": 2, + "text-offset": [0, 0], + "text-rotation-alignment": "viewport", + "text-field": "{name_en}", + "text-letter-spacing": 0.01, + "text-max-width": 7 + }, + "paint": { + "text-color": "hsl(230, 29%, 35%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1 + } + }, + { + "id": "place-city-sm", + "type": "symbol", + "metadata": {"mapbox:group": "1444862510685.128"}, + "source": "composite", + "source-layer": "place_label", + "maxzoom": 14, + "filter": [ + "all", + ["!in", "scalerank", 0, 1, 2, 3, 4, 5], + ["==", "type", "city"] + ], + "layout": { + "text-size": {"base": 1, "stops": [[6, 12], [14, 22]]}, + "icon-image": "dot-9", + "text-font": { + "base": 1, + "stops": [ + [ + 7, + ["DIN Offc Pro Regular", "Arial Unicode MS Regular"] + ], + [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]] + ] + }, + "text-offset": { + "base": 1, + "stops": [[7.99, [0, -0.2]], [8, [0, 0]]] + }, + "text-anchor": { + "base": 1, + "stops": [[7, "bottom"], [8, "center"]] + }, + "text-field": "{name_en}", + "text-max-width": 7 + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1.25, + "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]} + } + }, + { + "id": "place-city-md-s", + "type": "symbol", + "metadata": {"mapbox:group": "1444862510685.128"}, + "source": "composite", + "source-layer": "place_label", + "maxzoom": 14, + "filter": [ + "all", + ["==", "type", "city"], + ["in", "ldir", "E", "S", "SE", "SW"], + ["in", "scalerank", 3, 4, 5] + ], + "layout": { + "text-field": "{name_en}", + "icon-image": "dot-10", + "text-anchor": { + "base": 1, + "stops": [[7, "top"], [8, "center"]] + }, + "text-offset": { + "base": 1, + "stops": [[7.99, [0, 0.1]], [8, [0, 0]]] + }, + "text-font": { + "base": 1, + "stops": [ + [ + 7, + ["DIN Offc Pro Regular", "Arial Unicode MS Regular"] + ], + [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]] + ] + }, + "text-size": {"base": 0.9, "stops": [[5, 12], [12, 22]]} + }, + "paint": { + "text-halo-width": 1, + "text-halo-color": "hsl(0, 0%, 100%)", + "text-color": "hsl(0, 0%, 0%)", + "text-halo-blur": 1, + "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]} + } + }, + { + "id": "place-city-md-n", + "type": "symbol", + "metadata": {"mapbox:group": "1444862510685.128"}, + "source": "composite", + "source-layer": "place_label", + "maxzoom": 14, + "filter": [ + "all", + ["==", "type", "city"], + ["in", "ldir", "N", "NE", "NW", "W"], + ["in", "scalerank", 3, 4, 5] + ], + "layout": { + "icon-image": "dot-10", + "text-font": { + "base": 1, + "stops": [ + [ + 7, + ["DIN Offc Pro Regular", "Arial Unicode MS Regular"] + ], + [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]] + ] + }, + "text-offset": { + "base": 1, + "stops": [[7.99, [0, -0.25]], [8, [0, 0]]] + }, + "text-anchor": { + "base": 1, + "stops": [[7, "bottom"], [8, "center"]] + }, + "text-field": "{name_en}", + "text-max-width": 7, + "text-size": {"base": 0.9, "stops": [[5, 12], [12, 22]]} + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1, + "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]}, + "text-halo-blur": 1 + } + }, + { + "id": "place-city-lg-s", + "type": "symbol", + "metadata": {"mapbox:group": "1444862510685.128"}, + "source": "composite", + "source-layer": "place_label", + "minzoom": 1, + "maxzoom": 14, + "filter": [ + "all", + ["<=", "scalerank", 2], + ["==", "type", "city"], + ["in", "ldir", "E", "S", "SE", "SW"] + ], + "layout": { + "icon-image": "dot-11", + "text-font": { + "base": 1, + "stops": [ + [ + 7, + ["DIN Offc Pro Regular", "Arial Unicode MS Regular"] + ], + [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]] + ] + }, + "text-offset": { + "base": 1, + "stops": [[7.99, [0, 0.15]], [8, [0, 0]]] + }, + "text-anchor": { + "base": 1, + "stops": [[7, "top"], [8, "center"]] + }, + "text-field": "{name_en}", + "text-max-width": 7, + "text-size": {"base": 0.9, "stops": [[4, 12], [10, 22]]} + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1, + "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]}, + "text-halo-blur": 1 + } + }, + { + "id": "place-city-lg-n", + "type": "symbol", + "metadata": {"mapbox:group": "1444862510685.128"}, + "source": "composite", + "source-layer": "place_label", + "minzoom": 1, + "maxzoom": 14, + "filter": [ + "all", + ["<=", "scalerank", 2], + ["==", "type", "city"], + ["in", "ldir", "N", "NE", "NW", "W"] + ], + "layout": { + "icon-image": "dot-11", + "text-font": { + "base": 1, + "stops": [ + [ + 7, + ["DIN Offc Pro Regular", "Arial Unicode MS Regular"] + ], + [8, ["DIN Offc Pro Medium", "Arial Unicode MS Regular"]] + ] + }, + "text-offset": { + "base": 1, + "stops": [[7.99, [0, -0.25]], [8, [0, 0]]] + }, + "text-anchor": { + "base": 1, + "stops": [[7, "bottom"], [8, "center"]] + }, + "text-field": "{name_en}", + "text-max-width": 7, + "text-size": {"base": 0.9, "stops": [[4, 12], [10, 22]]} + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-opacity": 1, + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1, + "icon-opacity": {"base": 1, "stops": [[7.99, 1], [8, 0]]}, + "text-halo-blur": 1 + } + }, + { + "id": "marine-label-sm-ln", + "type": "symbol", + "metadata": {"mapbox:group": "1444856087950.3635"}, + "source": "composite", + "source-layer": "marine_label", + "minzoom": 3, + "maxzoom": 10, + "filter": [ + "all", + ["==", "$type", "LineString"], + [">=", "labelrank", 4] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1, "stops": [[3, 12], [6, 16]]}, + "symbol-spacing": {"base": 1, "stops": [[4, 100], [6, 400]]}, + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-pitch-alignment": "viewport", + "text-field": "{name_en}", + "text-letter-spacing": 0.1, + "text-max-width": 5 + }, + "paint": {"text-color": "hsl(205, 83%, 88%)"} + }, + { + "id": "marine-label-sm-pt", + "type": "symbol", + "metadata": {"mapbox:group": "1444856087950.3635"}, + "source": "composite", + "source-layer": "marine_label", + "minzoom": 3, + "maxzoom": 10, + "filter": ["all", ["==", "$type", "Point"], [">=", "labelrank", 4]], + "layout": { + "text-field": "{name_en}", + "text-max-width": 5, + "text-letter-spacing": 0.1, + "text-line-height": 1.5, + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 1, "stops": [[3, 12], [6, 16]]} + }, + "paint": {"text-color": "hsl(205, 83%, 88%)"} + }, + { + "id": "marine-label-md-ln", + "type": "symbol", + "metadata": {"mapbox:group": "1444856087950.3635"}, + "source": "composite", + "source-layer": "marine_label", + "minzoom": 2, + "maxzoom": 8, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["in", "labelrank", 2, 3] + ], + "layout": { + "text-line-height": 1.1, + "text-size": {"base": 1.1, "stops": [[2, 12], [5, 20]]}, + "symbol-spacing": 250, + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "symbol-placement": "line", + "text-pitch-alignment": "viewport", + "text-field": "{name_en}", + "text-letter-spacing": 0.15, + "text-max-width": 5 + }, + "paint": {"text-color": "hsl(205, 83%, 88%)"} + }, + { + "id": "marine-label-md-pt", + "type": "symbol", + "metadata": {"mapbox:group": "1444856087950.3635"}, + "source": "composite", + "source-layer": "marine_label", + "minzoom": 2, + "maxzoom": 8, + "filter": [ + "all", + ["==", "$type", "Point"], + ["in", "labelrank", 2, 3] + ], + "layout": { + "text-field": "{name_en}", + "text-max-width": 5, + "text-letter-spacing": 0.15, + "text-line-height": 1.5, + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 1.1, "stops": [[2, 14], [5, 20]]} + }, + "paint": {"text-color": "hsl(205, 83%, 88%)"} + }, + { + "id": "marine-label-lg-ln", + "type": "symbol", + "metadata": {"mapbox:group": "1444856087950.3635"}, + "source": "composite", + "source-layer": "marine_label", + "minzoom": 1, + "maxzoom": 4, + "filter": [ + "all", + ["==", "$type", "LineString"], + ["==", "labelrank", 1] + ], + "layout": { + "text-field": "{name_en}", + "text-max-width": 4, + "text-letter-spacing": 0.25, + "text-line-height": 1.1, + "symbol-placement": "line", + "text-pitch-alignment": "viewport", + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 1, "stops": [[1, 14], [4, 30]]} + }, + "paint": {"text-color": "hsl(205, 83%, 88%)"} + }, + { + "id": "marine-label-lg-pt", + "type": "symbol", + "metadata": {"mapbox:group": "1444856087950.3635"}, + "source": "composite", + "source-layer": "marine_label", + "minzoom": 1, + "maxzoom": 4, + "filter": ["all", ["==", "$type", "Point"], ["==", "labelrank", 1]], + "layout": { + "text-field": "{name_en}", + "text-max-width": 4, + "text-letter-spacing": 0.25, + "text-line-height": 1.5, + "text-font": [ + "DIN Offc Pro Italic", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 1, "stops": [[1, 14], [4, 30]]} + }, + "paint": {"text-color": "hsl(205, 83%, 88%)"} + }, + { + "id": "state-label-sm", + "type": "symbol", + "metadata": {"mapbox:group": "1444856151690.9143"}, + "source": "composite", + "source-layer": "state_label", + "minzoom": 3, + "maxzoom": 9, + "filter": ["<", "area", 20000], + "layout": { + "text-size": {"base": 1, "stops": [[6, 10], [9, 14]]}, + "text-transform": "uppercase", + "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"], + "text-field": { + "base": 1, + "stops": [[0, "{abbr}"], [6, "{name_en}"]] + }, + "text-letter-spacing": 0.15, + "text-max-width": 5 + }, + "paint": { + "text-opacity": 1, + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1 + } + }, + { + "id": "state-label-md", + "type": "symbol", + "metadata": {"mapbox:group": "1444856151690.9143"}, + "source": "composite", + "source-layer": "state_label", + "minzoom": 3, + "maxzoom": 8, + "filter": ["all", ["<", "area", 80000], [">=", "area", 20000]], + "layout": { + "text-size": {"base": 1, "stops": [[5, 10], [8, 16]]}, + "text-transform": "uppercase", + "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"], + "text-field": { + "base": 1, + "stops": [[0, "{abbr}"], [5, "{name_en}"]] + }, + "text-letter-spacing": 0.15, + "text-max-width": 6 + }, + "paint": { + "text-opacity": 1, + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1 + } + }, + { + "id": "state-label-lg", + "type": "symbol", + "metadata": {"mapbox:group": "1444856151690.9143"}, + "source": "composite", + "source-layer": "state_label", + "minzoom": 3, + "maxzoom": 7, + "filter": [">=", "area", 80000], + "layout": { + "text-size": {"base": 1, "stops": [[4, 10], [7, 18]]}, + "text-transform": "uppercase", + "text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"], + "text-padding": 1, + "text-field": { + "base": 1, + "stops": [[0, "{abbr}"], [4, "{name_en}"]] + }, + "text-letter-spacing": 0.15, + "text-max-width": 6 + }, + "paint": { + "text-opacity": 1, + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": "hsl(0, 0%, 100%)", + "text-halo-width": 1 + } + }, + { + "id": "country-label-sm", + "type": "symbol", + "metadata": {"mapbox:group": "1444856144497.7825"}, + "source": "composite", + "source-layer": "country_label", + "minzoom": 1, + "maxzoom": 10, + "filter": [">=", "scalerank", 5], + "layout": { + "text-field": "{name_en}", + "text-max-width": 6, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 0.9, "stops": [[5, 14], [9, 22]]} + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": { + "base": 1, + "stops": [ + [2, "rgba(255,255,255,0.75)"], + [3, "hsl(0, 0%, 100%)"] + ] + }, + "text-halo-width": 1.25 + } + }, + { + "id": "country-label-md", + "type": "symbol", + "metadata": {"mapbox:group": "1444856144497.7825"}, + "source": "composite", + "source-layer": "country_label", + "minzoom": 1, + "maxzoom": 8, + "filter": ["in", "scalerank", 3, 4], + "layout": { + "text-field": { + "base": 1, + "stops": [[0, "{code}"], [2, "{name_en}"]] + }, + "text-max-width": 6, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 1, "stops": [[3, 10], [8, 24]]} + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": { + "base": 1, + "stops": [ + [2, "rgba(255,255,255,0.75)"], + [3, "hsl(0, 0%, 100%)"] + ] + }, + "text-halo-width": 1.25 + } + }, + { + "id": "country-label-lg", + "type": "symbol", + "metadata": {"mapbox:group": "1444856144497.7825"}, + "source": "composite", + "source-layer": "country_label", + "minzoom": 1, + "maxzoom": 7, + "filter": ["in", "scalerank", 1, 2], + "layout": { + "text-field": "{name_en}", + "text-max-width": {"base": 1, "stops": [[0, 5], [3, 6]]}, + "text-font": [ + "DIN Offc Pro Medium", + "Arial Unicode MS Regular" + ], + "text-size": {"base": 1, "stops": [[1, 10], [6, 24]]} + }, + "paint": { + "text-color": "hsl(0, 0%, 0%)", + "text-halo-color": { + "base": 1, + "stops": [ + [2, "rgba(255,255,255,0.75)"], + [3, "hsl(0, 0%, 100%)"] + ] + }, + "text-halo-width": 1.25 + } + } + ], + "created": "2018-10-22T14:13:43.210Z", + "id": "cjnkdt02b0b2p2ss40skwpvs1", + "modified": "2018-10-22T14:14:35.211Z", + "owner": "lukaspaczos", + "visibility": "public", + "draft": false +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt index 2e8cb27292..139695461d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/VisibleRegionTest.kt @@ -5,12 +5,24 @@ import android.support.test.espresso.UiController import com.mapbox.mapboxsdk.camera.CameraUpdateFactory import com.mapbox.mapboxsdk.geometry.LatLng import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction.invoke -import com.mapbox.mapboxsdk.testapp.activity.EspressoTest + +import com.mapbox.mapboxsdk.testapp.activity.BaseTest +import com.mapbox.mapboxsdk.testapp.activity.espresso.PixelTestActivity import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test -class VisibleRegionTest : EspressoTest() { +class VisibleRegionTest : BaseTest() { + + override fun getActivityClass(): Class<*> { + return PixelTestActivity::class.java + } + + override + fun beforeTest() { + super.beforeTest() + mapView = (rule.activity as PixelTestActivity).mapView + } @Test fun visibleRegionTest() { @@ -253,9 +265,9 @@ class VisibleRegionTest : EspressoTest() { @Test fun paddedTopVisibleRegionOverDatelineTest() { validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> + invoke(mapboxMap) { ui: UiController, mapboxMap: MapboxMap -> mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - + ui.loopMainThreadForAtLeast(5000) val latLngs = listOf( mapboxMap.getLatLngFromScreenCoords(0f, 0f), mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), @@ -289,7 +301,7 @@ class VisibleRegionTest : EspressoTest() { mapboxMap.getLatLngFromScreenCoords(0f, 0f), mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, 0f), mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), 0f) - .also { it.longitude += 360 }, + .also { it.longitude += 360 }, mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height / 2f) .also { it.longitude += 360 }, mapboxMap.getLatLngFromScreenCoords(mapView.width.toFloat(), mapView.height.toFloat()) @@ -345,11 +357,11 @@ class VisibleRegionTest : EspressoTest() { mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 0.0), 8.0)) val d = Math.min(mapboxMap.width, mapboxMap.height) / 4; val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f) + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f), + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f), + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f), + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f), + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f) ) @@ -361,29 +373,29 @@ class VisibleRegionTest : EspressoTest() { } } - @Test - fun visibleRotatedRegionOverDatelineTest() { - validateTestSetup() - invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> - mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) - val d = Math.min(mapboxMap.width, mapboxMap.height) / 4; - val latLngs = listOf( - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f) - .also { it.longitude += 360 }, - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f), - mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f) - ) - - - for (bearing in 45 until 360 step 45) { - mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble())); - val visibleRegion = mapboxMap.projection.visibleRegion - assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) }) - } - } + @Test + fun visibleRotatedRegionOverDatelineTest() { + validateTestSetup() + invoke(mapboxMap) { _: UiController, mapboxMap: MapboxMap -> + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(LatLng(0.0, 180.0), 8.0)) + val d = Math.min(mapboxMap.width, mapboxMap.height) / 4; + val latLngs = listOf( + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f), + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f - d / 2f, mapView.height / 2f), + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f + d / 2f, mapView.height / 2f) + .also { it.longitude += 360 }, + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f - d / 2f), + mapboxMap.getLatLngFromScreenCoords(mapView.width / 2f, mapView.height / 2f + d / 2f) + ) + + + for (bearing in 45 until 360 step 45) { + mapboxMap.moveCamera(CameraUpdateFactory.bearingTo(bearing.toDouble())); + val visibleRegion = mapboxMap.projection.visibleRegion + assertTrue(latLngs.all { visibleRegion.latLngBounds.contains(it) }) + } } + } private fun MapboxMap.getLatLngFromScreenCoords(x: Float, y: Float): LatLng { return this.projection.fromScreenLocation(PointF(x, y)) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java deleted file mode 100644 index 1c49801e05..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.java +++ /dev/null @@ -1,44 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.style; - -import android.graphics.Bitmap; -import android.graphics.drawable.BitmapDrawable; -import android.graphics.drawable.Drawable; -import android.support.test.runner.AndroidJUnit4; -import com.mapbox.mapboxsdk.testapp.R; -import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction; -import com.mapbox.mapboxsdk.testapp.activity.EspressoTest; -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -/** - * CRUD tests around Image - */ -@RunWith(AndroidJUnit4.class) -public class ImageTest extends EspressoTest { - - private static final String IMAGE_ID = "test.image"; - - @Test - public void testAddGetImage() { - validateTestSetup(); - MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> { - Drawable drawable = rule.getActivity().getResources().getDrawable(R.drawable.ic_launcher_round); - assertTrue(drawable instanceof BitmapDrawable); - - Bitmap bitmapSet = ((BitmapDrawable) drawable).getBitmap(); - mapboxMap.getStyle().addImage(IMAGE_ID, bitmapSet); - - // adding an image requires converting the image with an asynctask - uiController.loopMainThreadForAtLeast(200); - - Bitmap bitmapGet = mapboxMap.getStyle().getImage(IMAGE_ID); - assertTrue(bitmapGet.sameAs(bitmapSet)); - - mapboxMap.getStyle().removeImage(IMAGE_ID); - assertNull(mapboxMap.getStyle().getImage(IMAGE_ID)); - }); - } -} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt new file mode 100644 index 0000000000..9cef677e7c --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/ImageTest.kt @@ -0,0 +1,75 @@ +package com.mapbox.mapboxsdk.testapp.style + +import android.graphics.Bitmap +import android.graphics.drawable.BitmapDrawable +import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.testapp.R +import com.mapbox.mapboxsdk.testapp.action.MapboxMapAction +import com.mapbox.mapboxsdk.testapp.activity.EspressoTest +import org.junit.Assert.assertNull +import org.junit.Assert.assertTrue +import org.junit.Test +import org.junit.runner.RunWith +import java.util.* + +/** + * CRUD tests around Image + */ +@RunWith(AndroidJUnit4::class) +class ImageTest : EspressoTest() { + + companion object { + private const val IMAGE_ID = "test.image" + } + + @Test + fun testAddGetImage() { + validateTestSetup() + MapboxMapAction.invoke(mapboxMap) { uiController, mapboxMap -> + val drawable = rule.activity.resources.getDrawable(R.drawable.ic_launcher_round) + assertTrue(drawable is BitmapDrawable) + + val bitmapSet = (drawable as BitmapDrawable).bitmap + mapboxMap.style!!.addImage(IMAGE_ID, bitmapSet) + + // adding an image requires converting the image with an asynctask + uiController.loopMainThreadForAtLeast(200) + + val bitmapGet = mapboxMap.style!!.getImage(IMAGE_ID) + assertTrue(bitmapGet!!.similarTo(bitmapSet)) + + mapboxMap.style!!.removeImage(IMAGE_ID) + assertNull(mapboxMap.style!!.getImage(IMAGE_ID)) + } + } +} + +/** + * Alternative implementation of Bitmap.sameAs #14060 + */ +fun Bitmap.similarTo(other: Bitmap): Boolean { + if (invalidConfig(other)) { + return false + } + + // Allocate arrays + val argb = IntArray(width * height) + val argbOther = IntArray(other.width * other.height) + getPixels(argb, 0, width, 0, 0, width, height) + other.getPixels(argbOther, 0, width, 0, 0, width, height) + + // Alpha channel special check + if (config == Bitmap.Config.ALPHA_8) { + // in this case we have to manually compare the alpha channel as the rest is garbage. + val length = width * height + for (i in 0 until length) { + if (argb[i] and -0x1000000 != argbOther[i] and -0x1000000) { + return false + } + } + return true + } + return Arrays.equals(argb, argbOther) +} + +fun Bitmap.invalidConfig(other: Bitmap): Boolean = this.config != other.config || this.width != other.width || this.height != other.height \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 2fa26f822a..d8eb81a972 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -923,6 +923,9 @@ + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt new file mode 100644 index 0000000000..b69d1ee5ed --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/espresso/PixelTestActivity.kt @@ -0,0 +1,66 @@ +package com.mapbox.mapboxsdk.testapp.activity.espresso + +import android.os.Bundle +import android.support.v7.app.AppCompatActivity +import com.mapbox.mapboxsdk.maps.MapView +import com.mapbox.mapboxsdk.maps.MapboxMap +import com.mapbox.mapboxsdk.maps.OnMapReadyCallback +import com.mapbox.mapboxsdk.maps.Style +import com.mapbox.mapboxsdk.testapp.R + +/** + * Test activity used for instrumentation tests that require a specific device size. + */ +class PixelTestActivity : AppCompatActivity(), OnMapReadyCallback { + + lateinit var mapView: MapView + lateinit var mapboxMap: MapboxMap + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_pixel_test) + mapView = findViewById(R.id.mapView) + mapView.onCreate(savedInstanceState) + mapView.getMapAsync(this) + } + + override fun onMapReady(map: MapboxMap) { + mapboxMap = map + mapboxMap.setStyle(Style.MAPBOX_STREETS) + } + + public override fun onResume() { + super.onResume() + mapView.onResume() + } + + override fun onStart() { + super.onStart() + mapView.onStart() + } + + public override fun onPause() { + super.onPause() + mapView.onPause() + } + + override fun onStop() { + super.onStop() + mapView.onStop() + } + + override fun onSaveInstanceState(outState: Bundle) { + super.onSaveInstanceState(outState) + mapView.onSaveInstanceState(outState) + } + + override fun onDestroy() { + super.onDestroy() + mapView.onDestroy() + } + + override fun onLowMemory() { + super.onLowMemory() + mapView.onLowMemory() + } +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_pixel_test.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_pixel_test.xml new file mode 100644 index 0000000000..4c88a87703 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_pixel_test.xml @@ -0,0 +1,16 @@ + + + + + + -- cgit v1.2.1 From 9045d2450d6e5a253b3bb423525be39ad53f3a5f Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 20 Mar 2019 19:29:26 +0100 Subject: [android] - call getMapAsync when restoring map fragment from saved instance state --- .../testapp/activity/fragment/MapFragmentActivity.java | 14 +++++++++----- .../activity/fragment/SupportMapFragmentActivity.java | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java index 472b9b7d57..c7f530b123 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/MapFragmentActivity.java @@ -3,16 +3,15 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapFragment; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.testapp.R; /** @@ -24,6 +23,7 @@ import com.mapbox.mapboxsdk.testapp.R; public class MapFragmentActivity extends AppCompatActivity implements MapFragment.OnMapViewReadyCallback, OnMapReadyCallback, MapView.OnDidFinishRenderingFrameListener { + private static final String TAG = "com.mapbox.map"; private MapboxMap mapboxMap; private MapView mapView; private boolean initialCameraAnimation = true; @@ -32,14 +32,18 @@ public class MapFragmentActivity extends AppCompatActivity implements MapFragmen protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map_fragment); + + MapFragment mapFragment; if (savedInstanceState == null) { - MapFragment mapFragment = MapFragment.newInstance(createFragmentOptions()); + mapFragment = MapFragment.newInstance(createFragmentOptions()); getFragmentManager() .beginTransaction() - .add(R.id.fragment_container, mapFragment, "com.mapbox.map") + .add(R.id.fragment_container, mapFragment, TAG) .commit(); - mapFragment.getMapAsync(this); + } else { + mapFragment = (MapFragment) getFragmentManager().findFragmentByTag(TAG); } + mapFragment.getMapAsync(this); } private MapboxMapOptions createFragmentOptions() { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java index 4baf40d51b..7fd84bcd25 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/SupportMapFragmentActivity.java @@ -3,16 +3,15 @@ package com.mapbox.mapboxsdk.testapp.activity.fragment; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; - import com.mapbox.mapboxsdk.camera.CameraPosition; import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; -import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.geometry.LatLng; import com.mapbox.mapboxsdk.maps.MapFragment; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; import com.mapbox.mapboxsdk.maps.MapboxMapOptions; import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; +import com.mapbox.mapboxsdk.maps.Style; import com.mapbox.mapboxsdk.maps.SupportMapFragment; import com.mapbox.mapboxsdk.testapp.R; @@ -25,6 +24,7 @@ import com.mapbox.mapboxsdk.testapp.R; public class SupportMapFragmentActivity extends AppCompatActivity implements MapFragment.OnMapViewReadyCallback, OnMapReadyCallback, MapView.OnDidFinishRenderingFrameListener { + private static final String TAG = "com.mapbox.map"; private MapboxMap mapboxMap; private MapView mapView; private boolean initialCameraAnimation = true; @@ -33,14 +33,18 @@ public class SupportMapFragmentActivity extends AppCompatActivity implements Map protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_map_fragment); + SupportMapFragment mapFragment; if (savedInstanceState == null) { - SupportMapFragment mapFragment = SupportMapFragment.newInstance(createFragmentOptions()); + mapFragment = SupportMapFragment.newInstance(createFragmentOptions()); getSupportFragmentManager() .beginTransaction() - .add(R.id.fragment_container, mapFragment, "com.mapbox.map") + .add(R.id.fragment_container, mapFragment, TAG) .commit(); - mapFragment.getMapAsync(this); + } else { + mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentByTag(TAG); } + mapFragment.getMapAsync(this); + } private MapboxMapOptions createFragmentOptions() { -- cgit v1.2.1 From 1ee067dc989b15b96ab92fd591e1952395f8aa9b Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 21 Mar 2019 13:44:42 -0700 Subject: [ios] Copy-edit changelog for 4.10.0-beta.1 --- platform/ios/CHANGELOG.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index b0a1f9e215..325cfe47e2 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -4,17 +4,25 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ## 4.10.0 +### Styles and rendering + * Client-side text rendering of CJK ideographs is now enabled by default. ([#13988](https://github.com/mapbox/mapbox-gl-native/pull/13988)) -* Added an MGLMapView.prefetchesTiles property that you can disable if you don’t want to prefetch simplified tiles as a performance optimization. ([#14031](https://github.com/mapbox/mapbox-gl-native/pull/14031)) * Fixed an issue that caused `MGL_FUNCTION` to ignore multiple formatting parameters when passed a `format` function as parameter. ([#14064](https://github.com/mapbox/mapbox-gl-native/pull/14064)) -* Added a Galician localization. ([#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095)) -* Added `mgl_attributed:` expression operator, which concatenate `MGLAttributedExpression` objects for specifying rich text in the `MGLSymbolStyleLayer.text` property. ([#14094](https://github.com/mapbox/mapbox-gl-native/pull/14094)) -* Fixed a bug that caused offline packs created prior to v4.0.0 (introduced in [#11055](https://github.com/mapbox/mapbox-gl-native/pull/11055)) to be marked as `MGLOfflinePackStateInactive`. ([#14188](https://github.com/mapbox/mapbox-gl-native/pull/14188)) +* Added `mgl_attributed:` expression operator, which concatenates `MGLAttributedExpression` objects for specifying rich text in the `MGLSymbolStyleLayer.text` property. ([#14094](https://github.com/mapbox/mapbox-gl-native/pull/14094)) * Fixed an issue that caused conditional expressions to crash when passed nested conditional expressions as parameters. ([#14181](https://github.com/mapbox/mapbox-gl-native/pull/14181)) -### User interaction +### Packaging + +* Added a Galician localization. ([#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095)) + +### Offline maps + +* Fixed a bug that caused offline packs created prior to v4.0.0 to be marked as `MGLOfflinePackStateInactive`. ([#14188](https://github.com/mapbox/mapbox-gl-native/pull/14188)) + +### Other changes -* Added `MGLOrnamentPosition` enum and margins methods to customize MGLMapView's scale bar, compass, logo and attribution position. ([#13911](https://github.com/mapbox/mapbox-gl-native/pull/13911)) +* Added `MGLOrnamentPosition` enum and margin properties to customize scale bar, compass, logo, and attribution position within the map view. ([#13911](https://github.com/mapbox/mapbox-gl-native/pull/13911)) +* Added an `MGLMapView.prefetchesTiles` property to configure lower-resolution tile prefetching behavior. ([#14031](https://github.com/mapbox/mapbox-gl-native/pull/14031)) ## 4.9.0 - February 27, 2019 -- cgit v1.2.1 From 07845b1208030b5920e73d04afeb5ecf7da903d6 Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Thu, 21 Mar 2019 13:48:43 -0700 Subject: [ios] Nitpicky style edits of recent changes --- platform/ios/src/MGLMapView.h | 27 ++++++++++++++------------- platform/ios/src/MGLMapView.mm | 6 ++++-- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h index 1ef64a587b..589b7b547b 100644 --- a/platform/ios/src/MGLMapView.h +++ b/platform/ios/src/MGLMapView.h @@ -414,12 +414,12 @@ MGL_EXPORT IB_DESIGNABLE /** A Boolean value indicating whether the map should prefetch tiles. - When this property is set to YES, the map view prefetches loads tiles designed for a - low zoom level and displays them until receiving more detailed tiles for the current - zoom level. The prefetched tiles typically contain simplified versions of each shape, - improving the map view’s perceived performance. + When this property is set to `YES`, the map view prefetches tiles designed for + a low zoom level and displays them until receiving more detailed tiles for the + current zoom level. The prefetched tiles typically contain simplified versions + of each shape, improving the map view’s perceived performance. - The default value of this property is YES. + The default value of this property is `YES`. */ @property (nonatomic, assign) BOOL prefetchesTiles; @@ -434,17 +434,18 @@ MGL_EXPORT IB_DESIGNABLE #pragma mark Displaying the User’s Location /** - The object that this map view uses to start and stop the delivery of location-related - updates. + The object that this map view uses to start and stop the delivery of + location-related updates. - To receive the current user location, implement the `-[MGLMapViewDelegate mapView:didUpdateUserLocation:]` - and `-[MGLMapViewDelegate mapView:didFailToLocateUserWithError:]` methods. + To receive the current user location, implement the + `-[MGLMapViewDelegate mapView:didUpdateUserLocation:]` and + `-[MGLMapViewDelegate mapView:didFailToLocateUserWithError:]` methods. - If setting this property to `nil` or if no custom manager is provided this property - is set to the default location manager. + If setting this property to `nil` or if no custom manager is provided this + property is set to the default location manager. - `MGLMapView` uses a default location manager. If you want to substitute your own - location manager, you should do so by setting this property before setting + `MGLMapView` uses a default location manager. If you want to substitute your + own location manager, you should do so by setting this property before setting `showsUserLocation` to `YES`. To restore the default location manager, set this property to `nil`. */ diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 94d56dfff9..793d95fffe 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2564,11 +2564,13 @@ public: } } -- (void)setPrefetchesTiles:(BOOL)prefetchesTiles{ +- (void)setPrefetchesTiles:(BOOL)prefetchesTiles +{ _mbglMap->setPrefetchZoomDelta(prefetchesTiles ? mbgl::util::DEFAULT_PREFETCH_ZOOM_DELTA : 0); } -- (BOOL)prefetchesTiles{ +- (BOOL)prefetchesTiles +{ return _mbglMap->getPrefetchZoomDelta() > 0 ? YES : NO; } -- cgit v1.2.1 From d8712e880af483d1fe681cd36f32c0969d7dfc33 Mon Sep 17 00:00:00 2001 From: Jordan Kiley Date: Thu, 21 Mar 2019 16:46:18 -0700 Subject: [ios] Bumped podspecs for v4.10.0-beta.1 (#14197) --- platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec | 2 +- platform/ios/Mapbox-iOS-SDK-stripped.podspec | 2 +- platform/ios/Mapbox-iOS-SDK.podspec | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec b/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec index bff5531290..3a3a2a2fab 100644 --- a/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec +++ b/platform/ios/Mapbox-iOS-SDK-snapshot-dynamic.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '4.10.0-alpha.2' + version = '4.10.0-beta.1' m.name = 'Mapbox-iOS-SDK-snapshot-dynamic' m.version = "#{version}-snapshot" diff --git a/platform/ios/Mapbox-iOS-SDK-stripped.podspec b/platform/ios/Mapbox-iOS-SDK-stripped.podspec index 9a32524ef0..6976d05d3a 100644 --- a/platform/ios/Mapbox-iOS-SDK-stripped.podspec +++ b/platform/ios/Mapbox-iOS-SDK-stripped.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '4.10.0-alpha.2' + version = '4.10.0-beta.1' m.name = 'Mapbox-iOS-SDK-stripped' m.version = "#{version}-stripped" diff --git a/platform/ios/Mapbox-iOS-SDK.podspec b/platform/ios/Mapbox-iOS-SDK.podspec index 1cbd82c5e4..5431a37b8c 100644 --- a/platform/ios/Mapbox-iOS-SDK.podspec +++ b/platform/ios/Mapbox-iOS-SDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |m| - version = '4.10.0-alpha.2' + version = '4.10.0-beta.1' m.name = 'Mapbox-iOS-SDK' m.version = version -- cgit v1.2.1 From a33aaceaa9f8a3ff7415af7046eedaf040326d3f Mon Sep 17 00:00:00 2001 From: Alf Watt Date: Thu, 21 Mar 2019 17:20:43 -0700 Subject: Update to `mapbox-events-ios` release `v0.9.1` (#14194) MMENSDateWrapper -> MMEDate Add SKIP_DOCS flag to build pipeline for iOS --- Makefile | 4 +++- platform/ios/ios.xcodeproj/project.pbxproj | 20 ++++++++++---------- platform/ios/scripts/package.sh | 7 +++++-- platform/ios/sdk-files.json | 4 ++-- platform/ios/vendor/mapbox-events-ios | 2 +- 5 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index a6aa414068..afbcd70d0f 100644 --- a/Makefile +++ b/Makefile @@ -56,6 +56,8 @@ default: test BUILD_DEPS += Makefile BUILD_DEPS += CMakeLists.txt +BUILD_DOCS ?= true + #### macOS targets ############################################################## ifeq ($(HOST_PLATFORM), macos) @@ -273,7 +275,7 @@ ipackage%: .PHONY: iframework iframework: $(IOS_PROJ_PATH) - FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) \ + FORMAT=$(FORMAT) BUILD_DEVICE=$(BUILD_DEVICE) SYMBOLS=$(SYMBOLS) BUILD_DOCS=$(BUILD_DOCS) \ ./platform/ios/scripts/package.sh .PHONY: ideploy diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 73f2e04167..535f83728f 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -219,7 +219,6 @@ 40834BEE1FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB21FE05D6D00C1BD0D /* MMEEventsConfiguration.m */; }; 40834BEF1FE05E1800C1BD0D /* MMEEventsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BA41FE05D6B00C1BD0D /* MMEEventsManager.m */; }; 40834BF01FE05E1800C1BD0D /* MMELocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB81FE05D6D00C1BD0D /* MMELocationManager.m */; }; - 40834BF11FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */; }; 40834BF21FE05E1800C1BD0D /* MMENSURLSessionWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */; }; 40834BF31FE05E1800C1BD0D /* MMETimerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB91FE05D6E00C1BD0D /* MMETimerManager.m */; }; 40834BF51FE05E1800C1BD0D /* MMETypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBD1FE05D6E00C1BD0D /* MMETypes.m */; }; @@ -238,7 +237,7 @@ 40834C021FE05E1800C1BD0D /* MMEEventsConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB21FE05D6D00C1BD0D /* MMEEventsConfiguration.m */; }; 40834C031FE05E1800C1BD0D /* MMEEventsManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BA41FE05D6B00C1BD0D /* MMEEventsManager.m */; }; 40834C041FE05E1800C1BD0D /* MMELocationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB81FE05D6D00C1BD0D /* MMELocationManager.m */; }; - 40834C051FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */; }; + 40834C051FE05E1800C1BD0D /* MMEDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBC1FE05D6E00C1BD0D /* MMEDate.m */; }; 40834C061FE05E1800C1BD0D /* MMENSURLSessionWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */; }; 40834C071FE05E1800C1BD0D /* MMETimerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BB91FE05D6E00C1BD0D /* MMETimerManager.m */; }; 40834C091FE05E1800C1BD0D /* MMETypes.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBD1FE05D6E00C1BD0D /* MMETypes.m */; }; @@ -336,7 +335,6 @@ 55E5666221C2A2080008B8B5 /* MMELocationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 40834BB31FE05D6D00C1BD0D /* MMELocationManager.h */; }; 55E5666321C2A2080008B8B5 /* MMEMetrics.h in Headers */ = {isa = PBXBuildFile; fileRef = ACD024552187EAAF00D8C8A7 /* MMEMetrics.h */; }; 55E5666421C2A2080008B8B5 /* MMEMetricsManager.h in Headers */ = {isa = PBXBuildFile; fileRef = ACD024562187EAAF00D8C8A7 /* MMEMetricsManager.h */; }; - 55E5666521C2A2080008B8B5 /* MMENSDateWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 40834BC51FE05D6F00C1BD0D /* MMENSDateWrapper.h */; }; 55E5666621C2A2080008B8B5 /* MMENSURLSessionWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = 40834BAA1FE05D6C00C1BD0D /* MMENSURLSessionWrapper.h */; }; 55E5666721C2A2080008B8B5 /* MMETimerManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 40834BC91FE05D7000C1BD0D /* MMETimerManager.h */; }; 55E5666821C2A2080008B8B5 /* MMETypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 40834BB61FE05D6D00C1BD0D /* MMETypes.h */; }; @@ -459,6 +457,8 @@ 96E5170420005A6B00A02306 /* SMCalloutView.h in Headers */ = {isa = PBXBuildFile; fileRef = DA8848891CBB037E00AB86E3 /* SMCalloutView.h */; }; 96ED34DE22374C0900E9FCA9 /* MGLMapViewDirectionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 96ED34DD22374C0900E9FCA9 /* MGLMapViewDirectionTests.mm */; }; 96F3F73C1F57124B003E2D2C /* MGLUserLocationHeadingIndicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 96F3F73B1F5711F1003E2D2C /* MGLUserLocationHeadingIndicator.h */; }; + 9C188C4F2242C95A0022FA55 /* MMEDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 40834BBC1FE05D6E00C1BD0D /* MMEDate.m */; }; + 9C188C502242C96F0022FA55 /* MMEDate.h in Headers */ = {isa = PBXBuildFile; fileRef = 40834BC51FE05D6F00C1BD0D /* MMEDate.h */; }; AC1B0916221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = AC1B0914221CA14500DB56C8 /* CLLocationManager+MMEMobileEvents.h */; }; AC1B0917221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.h in Headers */ = {isa = PBXBuildFile; fileRef = AC1B0914221CA14500DB56C8 /* CLLocationManager+MMEMobileEvents.h */; }; AC1B0918221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.m in Sources */ = {isa = PBXBuildFile; fileRef = AC1B0915221CA14C00DB56C8 /* CLLocationManager+MMEMobileEvents.m */; }; @@ -1004,7 +1004,7 @@ 40834BB91FE05D6E00C1BD0D /* MMETimerManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMETimerManager.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETimerManager.m"; sourceTree = SOURCE_ROOT; }; 40834BBA1FE05D6E00C1BD0D /* MMEEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEEvent.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEvent.h"; sourceTree = SOURCE_ROOT; }; 40834BBB1FE05D6E00C1BD0D /* MMEEventsConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEEventsConfiguration.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventsConfiguration.h"; sourceTree = SOURCE_ROOT; }; - 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMENSDateWrapper.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENSDateWrapper.m"; sourceTree = SOURCE_ROOT; }; + 40834BBC1FE05D6E00C1BD0D /* MMEDate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEDate.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEDate.m"; sourceTree = SOURCE_ROOT; }; 40834BBD1FE05D6E00C1BD0D /* MMETypes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMETypes.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMETypes.m"; sourceTree = SOURCE_ROOT; }; 40834BBE1FE05D6E00C1BD0D /* MMEUIApplicationWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEUIApplicationWrapper.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUIApplicationWrapper.h"; sourceTree = SOURCE_ROOT; }; 40834BBF1FE05D6E00C1BD0D /* MMEUniqueIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEUniqueIdentifier.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEUniqueIdentifier.h"; sourceTree = SOURCE_ROOT; }; @@ -1012,7 +1012,7 @@ 40834BC21FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "CLLocation+MMEMobileEvents.h"; path = "vendor/mapbox-events-ios/MapboxMobileEvents/CLLocation+MMEMobileEvents.h"; sourceTree = SOURCE_ROOT; }; 40834BC31FE05D6F00C1BD0D /* CLLocation+MMEMobileEvents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "CLLocation+MMEMobileEvents.m"; path = "vendor/mapbox-events-ios/MapboxMobileEvents/CLLocation+MMEMobileEvents.m"; sourceTree = SOURCE_ROOT; }; 40834BC41FE05D6F00C1BD0D /* MMECategoryLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMECategoryLoader.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMECategoryLoader.m"; sourceTree = SOURCE_ROOT; }; - 40834BC51FE05D6F00C1BD0D /* MMENSDateWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMENSDateWrapper.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENSDateWrapper.h"; sourceTree = SOURCE_ROOT; }; + 40834BC51FE05D6F00C1BD0D /* MMEDate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMEDate.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEDate.h"; sourceTree = SOURCE_ROOT; }; 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMENSURLSessionWrapper.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENSURLSessionWrapper.m"; sourceTree = SOURCE_ROOT; }; 40834BC71FE05D7000C1BD0D /* MMEEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MMEEvent.m; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMEEvent.m"; sourceTree = SOURCE_ROOT; }; 40834BC81FE05D7000C1BD0D /* MMENamespacedDependencies.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MMENamespacedDependencies.h; path = "vendor/mapbox-events-ios/MapboxMobileEvents/MMENamespacedDependencies.h"; sourceTree = SOURCE_ROOT; }; @@ -1766,8 +1766,8 @@ ACD024572187EAAF00D8C8A7 /* MMEMetrics.m */, ACD024562187EAAF00D8C8A7 /* MMEMetricsManager.h */, ACD024542187EAAF00D8C8A7 /* MMEMetricsManager.m */, - 40834BC51FE05D6F00C1BD0D /* MMENSDateWrapper.h */, - 40834BBC1FE05D6E00C1BD0D /* MMENSDateWrapper.m */, + 40834BC51FE05D6F00C1BD0D /* MMEDate.h */, + 40834BBC1FE05D6E00C1BD0D /* MMEDate.m */, 40834BAA1FE05D6C00C1BD0D /* MMENSURLSessionWrapper.h */, 40834BC61FE05D7000C1BD0D /* MMENSURLSessionWrapper.m */, 40834BC91FE05D7000C1BD0D /* MMETimerManager.h */, @@ -2450,6 +2450,7 @@ DD0902AB1DB192A800C5BDCE /* MGLNetworkConfiguration.h in Headers */, 35D3A1E61E9BE7EB002B38EE /* MGLScaleBar.h in Headers */, 0778DD431F67556700A73B34 /* MGLComputedShapeSource.h in Headers */, + 9C188C502242C96F0022FA55 /* MMEDate.h in Headers */, 1F6A82A221360F9D00BA5B41 /* MGLLoggingConfiguration.h in Headers */, AC1B0916221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.h in Headers */, DA8848311CBAFA6200AB86E3 /* NSString+MGLAdditions.h in Headers */, @@ -2568,7 +2569,6 @@ 55E5666221C2A2080008B8B5 /* MMELocationManager.h in Headers */, 55E5666321C2A2080008B8B5 /* MMEMetrics.h in Headers */, 55E5666421C2A2080008B8B5 /* MMEMetricsManager.h in Headers */, - 55E5666521C2A2080008B8B5 /* MMENSDateWrapper.h in Headers */, 55E5666621C2A2080008B8B5 /* MMENSURLSessionWrapper.h in Headers */, 55E5666721C2A2080008B8B5 /* MMETimerManager.h in Headers */, 55E5666821C2A2080008B8B5 /* MMETypes.h in Headers */, @@ -3175,6 +3175,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 9C188C4F2242C95A0022FA55 /* MMEDate.m in Sources */, 35136D391D42271A00C20EFD /* MGLBackgroundStyleLayer.mm in Sources */, 3510FFEC1D6D9C7A00F413B2 /* NSComparisonPredicate+MGLAdditions.mm in Sources */, 40834C431FE05F7500C1BD0D /* TSKSPKIHashCache.m in Sources */, @@ -3210,7 +3211,6 @@ 40834BF31FE05E1800C1BD0D /* MMETimerManager.m in Sources */, 35136D421D42274500C20EFD /* MGLRasterStyleLayer.mm in Sources */, 3538AA1F1D542239008EC33D /* MGLForegroundStyleLayer.mm in Sources */, - 40834BF11FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */, AC1B0918221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.m in Sources */, 40834C461FE05F7500C1BD0D /* TSKPinFailureReport.m in Sources */, 406E99B91FFEFF1B00D9FFCC /* MMEEventLogReportViewController.m in Sources */, @@ -3346,7 +3346,7 @@ ACA65F5A2140697200537748 /* MMEDispatchManager.m in Sources */, 3538AA201D542239008EC33D /* MGLForegroundStyleLayer.mm in Sources */, DA00FC911D5EEB0D009AABC8 /* MGLAttributionInfo.mm in Sources */, - 40834C051FE05E1800C1BD0D /* MMENSDateWrapper.m in Sources */, + 40834C051FE05E1800C1BD0D /* MMEDate.m in Sources */, 40834C531FE05F7600C1BD0D /* TSKPinFailureReport.m in Sources */, AC1B0919221CA14D00DB56C8 /* CLLocationManager+MMEMobileEvents.m in Sources */, 40834BFA1FE05E1800C1BD0D /* CLLocation+MMEMobileEvents.m in Sources */, diff --git a/platform/ios/scripts/package.sh b/platform/ios/scripts/package.sh index 45aab45f3f..a37b3c7fda 100755 --- a/platform/ios/scripts/package.sh +++ b/platform/ios/scripts/package.sh @@ -11,6 +11,7 @@ PRODUCTS=${DERIVED_DATA} LOG_PATH=build/xcodebuild-$(date +"%Y-%m-%d_%H%M%S").log BUILD_FOR_DEVICE=${BUILD_DEVICE:-true} +BUILD_DOCS=${BUILD_DOCS:-true} SYMBOLS=${SYMBOLS:-YES} BUILDTYPE=${BUILDTYPE:-Debug} @@ -270,5 +271,7 @@ sed -i '' \ "${README}" cp ${README} "${OUTPUT}" -step "Generating API documentation…" -make idocument OUTPUT="${OUTPUT}/documentation" +if [ ${BUILD_DOCS} == true ]; then + step "Generating API documentation for ${BUILDTYPE} Build…" + make idocument OUTPUT="${OUTPUT}/documentation" +fi diff --git a/platform/ios/sdk-files.json b/platform/ios/sdk-files.json index af295c4266..94f928b77e 100644 --- a/platform/ios/sdk-files.json +++ b/platform/ios/sdk-files.json @@ -1,6 +1,7 @@ { "//": "This file is generated. Do not edit. Regenerate it with scripts/generate-file-lists.js", "sources": [ + "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEDate.m", "platform/darwin/src/MGLBackgroundStyleLayer.mm", "platform/darwin/src/NSComparisonPredicate+MGLAdditions.mm", "platform/ios/vendor/mapbox-events-ios/vendor/TrustKit/Pinning/TSKSPKIHashCache.m", @@ -36,7 +37,6 @@ "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMETimerManager.m", "platform/darwin/src/MGLRasterStyleLayer.mm", "platform/darwin/src/MGLForegroundStyleLayer.mm", - "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMENSDateWrapper.m", "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/CLLocationManager+MMEMobileEvents.m", "platform/ios/vendor/mapbox-events-ios/vendor/TrustKit/Reporting/TSKPinFailureReport.m", "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEEventLogReportViewController.m", @@ -242,6 +242,7 @@ "NSComparisonPredicate+MGLAdditions.h": "platform/darwin/src/NSComparisonPredicate+MGLAdditions.h", "MGLMapAccessibilityElement.h": "platform/ios/src/MGLMapAccessibilityElement.h", "MGLScaleBar.h": "platform/ios/src/MGLScaleBar.h", + "MMEDate.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEDate.h", "CLLocationManager+MMEMobileEvents.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/CLLocationManager+MMEMobileEvents.h", "NSString+MGLAdditions.h": "platform/darwin/src/NSString+MGLAdditions.h", "UIDevice+MGLAdditions.h": "platform/ios/src/UIDevice+MGLAdditions.h", @@ -321,7 +322,6 @@ "MMELocationManager.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMELocationManager.h", "MMEMetrics.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEMetrics.h", "MMEMetricsManager.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMEMetricsManager.h", - "MMENSDateWrapper.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMENSDateWrapper.h", "MMENSURLSessionWrapper.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMENSURLSessionWrapper.h", "MMETimerManager.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMETimerManager.h", "MMETypes.h": "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/MMETypes.h", diff --git a/platform/ios/vendor/mapbox-events-ios b/platform/ios/vendor/mapbox-events-ios index d79e62581d..a75545ca01 160000 --- a/platform/ios/vendor/mapbox-events-ios +++ b/platform/ios/vendor/mapbox-events-ios @@ -1 +1 @@ -Subproject commit d79e62581df5f51a0064dd2f78972c489c71d418 +Subproject commit a75545ca01b3e567a989cd950b74f7865d3518ce -- cgit v1.2.1 From db56d8f03e9ec368f20805255da633e770895604 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 20 Mar 2019 19:13:04 +0100 Subject: [android] - improve reliability of UiAutomator tests --- .../mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt | 17 ++++++++--------- .../com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt | 11 ++--------- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt index 98b251027f..708b633db4 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt @@ -2,15 +2,18 @@ package com.mapbox.mapboxsdk.maps import android.content.Intent import android.support.test.InstrumentationRegistry +import android.support.test.InstrumentationRegistry.getTargetContext import android.support.test.filters.SdkSuppress import android.support.test.runner.AndroidJUnit4 -import android.support.test.uiautomator.* +import android.support.test.uiautomator.By +import android.support.test.uiautomator.UiDevice +import android.support.test.uiautomator.UiSelector +import android.support.test.uiautomator.Until import org.hamcrest.CoreMatchers.notNullValue import org.hamcrest.MatcherAssert.assertThat import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import java.lang.Thread.sleep private const val BASIC_SAMPLE_PACKAGE = "com.mapbox.mapboxsdk.testapp" private const val LAUNCH_TIMEOUT = 5000L @@ -57,17 +60,13 @@ class GLSurfaceViewReopenTest { @Test fun reopenSimpleMapActivity() { - // return to home screen - device.pressHome() - - // press recents apps button + // press recent apps button to pause the app device.pressRecentApps() - // click to reopen app - device.findObject(UiSelector().description("Mapbox Android SDK TestApp")).click() + // return to app + device.findObject(UiSelector().text(getTargetContext().getString(getTargetContext().applicationInfo.labelRes))).click() // wait for idle device.waitForIdle(LAUNCH_TIMEOUT) - sleep(LAUNCH_TIMEOUT) } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt index cd139ccc40..490f279b29 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt @@ -10,9 +10,6 @@ import org.hamcrest.MatcherAssert.assertThat import org.junit.Before import org.junit.Test import org.junit.runner.RunWith -import java.lang.Thread.sleep -import android.support.test.uiautomator.UiSelector -import android.support.test.uiautomator.UiScrollable private const val BASIC_SAMPLE_PACKAGE = "com.mapbox.mapboxsdk.testapp" private const val LAUNCH_TIMEOUT = 5000L @@ -61,17 +58,13 @@ class TextureViewReopenTest { @Test fun reopenTextureViewDebugActivity() { - // return to home screen - device.pressHome() - // press recent apps button device.pressRecentApps() - // click to reopen app - device.findObject(UiSelector().description("Mapbox Android SDK TestApp")).click() + // return to app + device.findObject(UiSelector().text(InstrumentationRegistry.getTargetContext().getString(InstrumentationRegistry.getTargetContext().applicationInfo.labelRes))).click() // wait for idle device.waitForIdle(LAUNCH_TIMEOUT) - sleep(LAUNCH_TIMEOUT) } } \ No newline at end of file -- cgit v1.2.1 From 14703a8f84fd7a3cdb4ce7f5749d2dafb02f4178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Thu, 21 Mar 2019 11:06:37 +0100 Subject: [android] fix formatting of the 7.3.0-beta.1 changelog --- platform/android/CHANGELOG.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 00ee46198f..4f50a2f038 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -7,16 +7,16 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to ## 7.3.0-beta.1 - March 20, 2019 ### Features -Expose "text-color" option for formatted sections [#14128](https://github.com/mapbox/mapbox-gl-native/pull/14128) -Expose LocationComponent's layer IDs [#14155](https://github.com/mapbox/mapbox-gl-native/pull/14155) + - Expose "text-color" option for formatted sections [#14128](https://github.com/mapbox/mapbox-gl-native/pull/14128) + - Expose LocationComponent's layer IDs [#14155](https://github.com/mapbox/mapbox-gl-native/pull/14155) ### Bugs -Cache location layer IDs in a set instead of a list [#14141](https://github.com/mapbox/mapbox-gl-native/pull/14141) -Clear the style object when the map is destroyed [#14171](https://github.com/mapbox/mapbox-gl-native/pull/14171) -Cache source/layer only when successfully added [#14171](https://github.com/mapbox/mapbox-gl-native/pull/14171) + - Cache location layer IDs in a set instead of a list [#14141](https://github.com/mapbox/mapbox-gl-native/pull/14141) + - Clear the style object when the map is destroyed [#14171](https://github.com/mapbox/mapbox-gl-native/pull/14171) + - Cache source/layer only when successfully added [#14171](https://github.com/mapbox/mapbox-gl-native/pull/14171) ### Build -Bump telemetry version to 4.3.0 [#14140](https://github.com/mapbox/mapbox-gl-native/pull/14140) + - Bump telemetry version to 4.3.0 [#14140](https://github.com/mapbox/mapbox-gl-native/pull/14140) ## 7.3.0-alpha.2 - March 13, 2019 -- cgit v1.2.1 From 2de2b0b068520a55170d23c86f349232b3e28ae7 Mon Sep 17 00:00:00 2001 From: tobrun Date: Fri, 22 Mar 2019 11:17:15 +0100 Subject: [android] - bump snapshot version to 7.4.0 --- platform/android/MapboxGLAndroidSDK/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/gradle.properties b/platform/android/MapboxGLAndroidSDK/gradle.properties index be4246a903..5f3ea808fa 100644 --- a/platform/android/MapboxGLAndroidSDK/gradle.properties +++ b/platform/android/MapboxGLAndroidSDK/gradle.properties @@ -1,4 +1,4 @@ -VERSION_NAME=7.3.0-SNAPSHOT +VERSION_NAME=7.4.0-SNAPSHOT # Only build native dependencies for the current ABI # See https://code.google.com/p/android/issues/detail?id=221098#c20 -- cgit v1.2.1 From 03db58cdc1f1f31034863020f205f5c5696bfa8b Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 21 Mar 2019 18:36:43 +0200 Subject: [core] Replace shared_ptr with unique_ptr in {Map,Resource}Options --- benchmark/api/render.benchmark.cpp | 43 +++++++++++++++++-------------- include/mbgl/map/map_options.hpp | 21 ++++++++------- include/mbgl/storage/resource_options.hpp | 25 ++++++++++-------- platform/android/src/file_source.cpp | 4 +-- platform/glfw/main.cpp | 8 +++--- platform/node/src/node_map.cpp | 11 +++----- src/mbgl/map/map_options.cpp | 21 ++++++++------- src/mbgl/storage/resource_options.cpp | 29 +++++++++++---------- 8 files changed, 87 insertions(+), 75 deletions(-) diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index 0e7a3be322..b66c3f228c 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -18,6 +18,10 @@ using namespace mbgl; namespace { +static std::string cachePath { "benchmark/fixtures/api/cache.db" }; +constexpr double pixelRatio { 1.0 }; +constexpr Size size { 1000, 1000 }; + class RenderBenchmark { public: RenderBenchmark() { @@ -27,22 +31,23 @@ public: util::RunLoop loop; ThreadPool threadPool { 4 }; }; - + static void prepare(Map& map, optional json = {}) { map.getStyle().loadJSON(json ? *json : util::read_file("benchmark/fixtures/api/style.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 40.726989, -73.992857 }).withZoom(15.0)); // Manhattan - map.getStyle().addImage(std::make_unique("test-icon", - decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")), 1.0)); + + auto image = decodeImage(util::read_file("benchmark/fixtures/api/default_marker.png")); + map.getStyle().addImage(std::make_unique("test-icon", std::move(image), 1.0)); } - + } // end namespace static void API_renderStill_reuse_map(::benchmark::State& state) { RenderBenchmark bench; - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, + HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; + Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, MapOptions().withMapMode(MapMode::Static), - ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; + ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map); while (state.KeepRunning()) { @@ -52,10 +57,9 @@ static void API_renderStill_reuse_map(::benchmark::State& state) { static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state) { RenderBenchmark bench; - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, - MapOptions().withMapMode(MapMode::Static), - ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; + HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; + Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, + MapOptions().withMapMode(MapMode::Static), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json")); while (state.KeepRunning()) { @@ -65,11 +69,10 @@ static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { RenderBenchmark bench; - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, - MapOptions().withMapMode(MapMode::Static), - ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; - + HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; + Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, + MapOptions().withMapMode(MapMode::Static), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; + while (state.KeepRunning()) { prepare(map, { "{}" }); frontend.render(map); @@ -80,11 +83,11 @@ static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { static void API_renderStill_recreate_map(::benchmark::State& state) { RenderBenchmark bench; - auto mapOptions = MapOptions().withMapMode(MapMode::Static); - auto resourceOptions = ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar"); + while (state.KeepRunning()) { - HeadlessFrontend frontend { { 1000, 1000 }, 1, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, bench.threadPool, mapOptions, resourceOptions }; + HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; + Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, + MapOptions().withMapMode(MapMode::Static), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map); frontend.render(map); } diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index f2297484a3..384b113dba 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -17,15 +17,18 @@ public: MapOptions(); ~MapOptions(); + MapOptions(MapOptions&&); + explicit MapOptions(const MapOptions&); + /** * @brief Sets the map rendering mode. By default, it is set to Continuous * so the map will render as data arrives from the network and react * immediately to state changes. * * @param mode Map rendering mode. - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withMapMode(MapMode mode); + MapOptions withMapMode(MapMode mode); /** * @brief Gets the previously set (or default) map mode. @@ -40,9 +43,9 @@ public: * HeightOnly. * * @param mode Map constrain mode. - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withConstrainMode(ConstrainMode mode); + MapOptions withConstrainMode(ConstrainMode mode); /** * @brief Gets the previously set (or default) constrain mode. @@ -56,9 +59,9 @@ public: * orientation of the map as some devices may use inverted orientation. * * @param mode Viewport mode. - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withViewportMode(ViewportMode mode); + MapOptions withViewportMode(ViewportMode mode); /** * @brief Gets the previously set (or default) viewport mode. @@ -72,9 +75,9 @@ public: * or not. By default, it is set to true. * * @param enableCollisions true to enable, false to disable - * @return reference to MapOptions for chaining options together. + * @return MapOptions for chaining options together. */ - MapOptions& withCrossSourceCollisions(bool enableCollisions); + MapOptions withCrossSourceCollisions(bool enableCollisions); /** * @brief Gets the previously set (or default) crossSourceCollisions value. @@ -86,7 +89,7 @@ public: private: class Impl; - std::shared_ptr impl_; + std::unique_ptr impl_; }; } // namespace mbgl diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp index 0a4669ea15..958392175c 100644 --- a/include/mbgl/storage/resource_options.hpp +++ b/include/mbgl/storage/resource_options.hpp @@ -16,13 +16,16 @@ public: ResourceOptions(); ~ResourceOptions(); + ResourceOptions(ResourceOptions&&); + explicit ResourceOptions(const ResourceOptions&); + /** * @brief Sets the Mapbox access token - see https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for details. * * @param token Mapbox access token. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withAccessToken(std::string token); + ResourceOptions withAccessToken(std::string token); /** * @brief Gets the previously set (or default) Mapbox access token. @@ -35,9 +38,9 @@ public: * @brief Sets the API base URL. Default is https://api.mapbox.com for Mapbox. * * @param baseURL API base URL. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withBaseURL(std::string baseURL); + ResourceOptions withBaseURL(std::string baseURL); /** * @brief Gets the previously set (or default) API base URL. @@ -50,9 +53,9 @@ public: * @brief Sets the cache path. * * @param path Cache path. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withCachePath(std::string path); + ResourceOptions withCachePath(std::string path); /** * @brief Gets the previously set (or default) cache path. @@ -66,9 +69,9 @@ public: * the asset:// scheme gets resolved in a style. * * @param path Asset path. - * @return reference to ResourceOptions for chaining options together. + * @return ResourceOptions for chaining options together. */ - ResourceOptions& withAssetPath(std::string path); + ResourceOptions withAssetPath(std::string path); /** * @brief Gets the previously set (or default) asset path. @@ -83,7 +86,7 @@ public: * @param size Cache maximum size in bytes. * @return reference to ResourceOptions for chaining options together. */ - ResourceOptions& withMaximumCacheSize(uint64_t size); + ResourceOptions withMaximumCacheSize(uint64_t size); /** * @brief Gets the previously set (or default) maximum allowed cache size. @@ -99,7 +102,7 @@ public: * @param context Platform context. * @return reference to ResourceOptions for chaining options together. */ - ResourceOptions& withPlatformContext(void* context); + ResourceOptions withPlatformContext(void* context); /** * @brief Gets the previously set (or default) platform context. @@ -110,7 +113,7 @@ public: private: class Impl; - std::shared_ptr impl_; + std::unique_ptr impl_; }; } // namespace mbgl diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index bb1f30981b..94db563efc 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -31,7 +31,7 @@ FileSource::FileSource(jni::JNIEnv& _env, std::string path = jni::Make(_env, _cachePath); mapbox::sqlite::setTempPath(path); - resourceOptions = mbgl::ResourceOptions() + resourceOptions .withAccessToken(accessToken ? jni::Make(_env, accessToken) : "") .withCachePath(path + DATABASE_FILE) .withPlatformContext(reinterpret_cast(new AssetManagerFileSource(_env, assetManager))); @@ -120,7 +120,7 @@ FileSource* FileSource::getNativePeer(jni::JNIEnv& env, const jni::Object& jFileSource) { FileSource* fileSource = FileSource::getNativePeer(env, jFileSource); assert(fileSource != nullptr); - return fileSource->resourceOptions; + return mbgl::ResourceOptions(fileSource->resourceOptions); } void FileSource::registerNative(jni::JNIEnv& env) { diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 8288a009f2..77585718e1 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -94,12 +94,14 @@ int main(int argc, char *argv[]) { view = &backend; // Set access token if present - const char *token = getenv("MAPBOX_ACCESS_TOKEN"); - if (token == nullptr) { + std::string token(getenv("MAPBOX_ACCESS_TOKEN") ?: ""); + if (token.empty()) { mbgl::Log::Warning(mbgl::Event::Setup, "no access token set. mapbox.com tiles won't work."); } - auto resourceOptions = mbgl::ResourceOptions().withCachePath(cacheDB).withAssetPath(".").withAccessToken(std::string(token)); + mbgl::ResourceOptions resourceOptions; + resourceOptions.withCachePath(cacheDB).withAccessToken(token); + auto fileSource = std::static_pointer_cast(mbgl::FileSource::getSharedFileSource(resourceOptions)); if (!settings.online) { fileSource->setOnlineStatus(false); diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 0b27d378a7..7ad9c362bf 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -631,14 +631,9 @@ void NodeMap::cancel() { }); frontend = std::make_unique(mbgl::Size{ 256, 256 }, pixelRatio, threadpool); - auto mapOptions = mbgl::MapOptions() - .withMapMode(mode) - .withCrossSourceCollisions(crossSourceCollisions); - - auto resourceOptions = mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this)); - - map = std::make_unique(*frontend, mapObserver, frontend->getSize(), pixelRatio, - threadpool, mapOptions, resourceOptions); + map = std::make_unique(*frontend, mapObserver, frontend->getSize(), pixelRatio, threadpool, + mbgl::MapOptions().withMapMode(mode).withCrossSourceCollisions(crossSourceCollisions), + mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this))); // FIXME: Reload the style after recreating the map. We need to find // a better way of canceling an ongoing rendering on the core level diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index ddb3f8e3be..c1146ab0bc 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -10,39 +10,42 @@ public: bool crossSourceCollisions = true; }; -MapOptions::MapOptions() : impl_(std::make_shared()) {} +// These requires the complete type of Impl. +MapOptions::MapOptions() : impl_(std::make_unique()) {} MapOptions::~MapOptions() = default; +MapOptions::MapOptions(MapOptions&&) = default; +MapOptions::MapOptions(const MapOptions& other) : impl_(std::make_unique(*other.impl_)) {} -MapOptions& MapOptions::withMapMode(MapMode mode) { +MapOptions MapOptions::withMapMode(MapMode mode) { impl_->mapMode = mode; - return *this; + return std::move(*this); } MapMode MapOptions::mapMode() const { return impl_->mapMode; } -MapOptions& MapOptions::withConstrainMode(ConstrainMode mode) { +MapOptions MapOptions::withConstrainMode(ConstrainMode mode) { impl_->constrainMode = mode; - return *this; + return std::move(*this); } ConstrainMode MapOptions::constrainMode() const { return impl_->constrainMode; } -MapOptions& MapOptions::withViewportMode(ViewportMode mode) { +MapOptions MapOptions::withViewportMode(ViewportMode mode) { impl_->viewportMode = mode; - return *this; + return std::move(*this); } ViewportMode MapOptions::viewportMode() const { return impl_->viewportMode; } -MapOptions& MapOptions::withCrossSourceCollisions(bool enableCollisions) { +MapOptions MapOptions::withCrossSourceCollisions(bool enableCollisions) { impl_->crossSourceCollisions = enableCollisions; - return *this; + return std::move(*this); } bool MapOptions::crossSourceCollisions() const { diff --git a/src/mbgl/storage/resource_options.cpp b/src/mbgl/storage/resource_options.cpp index ce82b51a14..dcd7f84f7e 100644 --- a/src/mbgl/storage/resource_options.cpp +++ b/src/mbgl/storage/resource_options.cpp @@ -13,57 +13,60 @@ public: void* platformContext = nullptr; }; -ResourceOptions::ResourceOptions() : impl_(std::make_shared()) {} +// These requires the complete type of Impl. +ResourceOptions::ResourceOptions() : impl_(std::make_unique()) {} ResourceOptions::~ResourceOptions() = default; +ResourceOptions::ResourceOptions(ResourceOptions&&) = default; +ResourceOptions::ResourceOptions(const ResourceOptions& other) : impl_(std::make_unique(*other.impl_)) {} -ResourceOptions& ResourceOptions::withAccessToken(std::string token) { +ResourceOptions ResourceOptions::withAccessToken(std::string token) { impl_->accessToken = std::move(token); - return *this; + return std::move(*this); } const std::string& ResourceOptions::accessToken() const { return impl_->accessToken; } -ResourceOptions& ResourceOptions::withBaseURL(std::string url) { +ResourceOptions ResourceOptions::withBaseURL(std::string url) { impl_->baseURL = std::move(url); - return *this; + return std::move(*this); } const std::string& ResourceOptions::baseURL() const { return impl_->baseURL; } -ResourceOptions& ResourceOptions::withCachePath(std::string path) { +ResourceOptions ResourceOptions::withCachePath(std::string path) { impl_->cachePath = std::move(path); - return *this; + return std::move(*this); } const std::string& ResourceOptions::cachePath() const { return impl_->cachePath; } -ResourceOptions& ResourceOptions::withAssetPath(std::string path) { +ResourceOptions ResourceOptions::withAssetPath(std::string path) { impl_->assetPath = std::move(path); - return *this; + return std::move(*this); } const std::string& ResourceOptions::assetPath() const { return impl_->assetPath; } -ResourceOptions& ResourceOptions::withMaximumCacheSize(uint64_t size) { +ResourceOptions ResourceOptions::withMaximumCacheSize(uint64_t size) { impl_->maximumSize = size; - return *this; + return std::move(*this); } uint64_t ResourceOptions::maximumCacheSize() const { return impl_->maximumSize; } -ResourceOptions& ResourceOptions::withPlatformContext(void* context) { +ResourceOptions ResourceOptions::withPlatformContext(void* context) { impl_->platformContext = context; - return *this; + return std::move(*this); } void* ResourceOptions::platformContext() const { -- cgit v1.2.1 From 5ea450b14bb84950f80bda3eeb9873fdbd736fc7 Mon Sep 17 00:00:00 2001 From: tobrun Date: Fri, 15 Mar 2019 11:25:03 +0100 Subject: [android] - add GLSurfaceView RecylerView example to test for regressions --- .../src/main/AndroidManifest.xml | 19 ++- .../maplayout/GLSurfaceRecyclerViewActivity.kt | 155 +++++++++++++++++++++ .../activity/maplayout/RecyclerViewActivity.kt | 151 -------------------- .../maplayout/TextureRecyclerViewActivity.kt | 15 ++ .../src/main/res/layout/item_map.xml | 11 -- .../src/main/res/layout/item_map_gl.xml | 10 ++ .../src/main/res/layout/item_map_texture.xml | 11 ++ .../src/main/res/values/descriptions.xml | 3 +- .../src/main/res/values/titles.xml | 3 +- 9 files changed, 210 insertions(+), 168 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/GLSurfaceRecyclerViewActivity.kt delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_gl.xml create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_texture.xml diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index d8eb81a972..fbba6a4927 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -895,9 +895,20 @@ android:value=".activity.FeatureOverviewActivity" /> + android:name=".activity.maplayout.TextureRecyclerViewActivity" + android:description="@string/description_recyclerview_textureview" + android:label="@string/activity_recyclerview_textureview"> + + + + @@ -907,7 +918,7 @@ + * It requires calling the correct lifecycle methods when detaching and attaching the View to + * the RecyclerView with onViewAttachedToWindow and onViewDetachedFromWindow. + *

+ */ +@SuppressLint("ClickableViewAccessibility") +open class GLSurfaceRecyclerViewActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_recyclerview) + recyclerView.layoutManager = LinearLayoutManager(this) + recyclerView.adapter = ItemAdapter(this, LayoutInflater.from(this), savedInstanceState) + } + + override fun onSaveInstanceState(outState: Bundle?) { + super.onSaveInstanceState(outState) + // to save state, we need to call MapView#onSaveInstanceState + (recyclerView.adapter as ItemAdapter).onSaveInstanceState(outState) + } + + override fun onLowMemory() { + super.onLowMemory() + // to release memory, we need to call MapView#onLowMemory + (recyclerView.adapter as ItemAdapter).onLowMemory() + } + + override fun onDestroy() { + super.onDestroy() + // to perform cleanup, we need to call MapView#onDestroy + (recyclerView.adapter as ItemAdapter).onDestroy() + } + + open fun getMapItemLayoutId(): Int { + return R.layout.item_map_gl + } + + class ItemAdapter(private val activity: GLSurfaceRecyclerViewActivity, private val inflater: LayoutInflater, val savedInstanceState: Bundle?) : RecyclerView.Adapter() { + + private val items = listOf( + "one", "two", "three", MapItem(), "four", "five", "six", "seven", "eight", "nine", "ten", + "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", + "nineteen", "twenty", "twenty-one" + ) + + private var mapHolder: MapHolder? = null + + companion object { + const val TYPE_MAP = 0 + const val TYPE_TEXT = 1 + } + + override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { + return if (viewType == TYPE_MAP) { + val mapView = inflater.inflate(activity.getMapItemLayoutId(), parent, false) as MapView + mapView.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS) } + mapHolder = MapHolder(mapView, savedInstanceState) + return mapHolder as MapHolder + } else { + TextHolder(inflater.inflate(android.R.layout.simple_list_item_1, parent, false) as TextView) + } + } + + override fun onViewAttachedToWindow(holder: RecyclerView.ViewHolder) { + super.onViewAttachedToWindow(holder) + if (holder is MapHolder) { + val mapView = holder.mapView + mapView.onStart() + mapView.onResume() + } + } + + override fun onViewDetachedFromWindow(holder: RecyclerView.ViewHolder) { + super.onViewDetachedFromWindow(holder) + if (holder is MapHolder) { + val mapView = holder.mapView + mapView.onPause() + mapView.onStop() + } + } + + override fun getItemCount(): Int { + return items.count() + } + + override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { + if (holder.itemViewType == TYPE_TEXT) { + val textHolder = holder as TextHolder + textHolder.bind(items[position] as String) + } + } + + override fun getItemViewType(position: Int): Int { + return if (items[position] is MapItem) { + TYPE_MAP + } else { + TYPE_TEXT + } + } + + fun onSaveInstanceState(savedInstanceState: Bundle?) { + savedInstanceState?.let { + mapHolder?.mapView?.onSaveInstanceState(it) + } + } + + fun onLowMemory() { + mapHolder?.mapView?.onLowMemory() + } + + fun onDestroy() { + mapHolder?.mapView?.let { + it.onPause() + it.onStop() + it.onDestroy() + } + } + + class MapItem + class MapHolder(val mapView: MapView, bundle: Bundle?) : RecyclerView.ViewHolder(mapView) { + init { + mapView.onCreate(bundle) + mapView.setOnTouchListener { view, motionEvent -> + // Disallow the touch request for recyclerView scroll + view.parent.requestDisallowInterceptTouchEvent(true) + mapView.onTouchEvent(motionEvent) + true + } + } + } + + class TextHolder(val textView: TextView) : RecyclerView.ViewHolder(textView) { + fun bind(item: String) { + textView.text = item + } + } + } +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt deleted file mode 100644 index 9989d1b137..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/RecyclerViewActivity.kt +++ /dev/null @@ -1,151 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.activity.maplayout - -import android.annotation.SuppressLint -import android.os.Bundle -import android.support.v7.app.AppCompatActivity -import android.support.v7.widget.LinearLayoutManager -import android.support.v7.widget.RecyclerView -import android.view.LayoutInflater -import android.view.ViewGroup -import android.widget.TextView -import com.mapbox.mapboxsdk.maps.MapView -import com.mapbox.mapboxsdk.maps.OnMapReadyCallback -import com.mapbox.mapboxsdk.maps.Style -import com.mapbox.mapboxsdk.testapp.R -import kotlinx.android.synthetic.main.activity_recyclerview.* - -/** - * TestActivity showcasing how to integrate a MapView in a RecyclerView. - *

- * It requires calling the correct lifecycle methods when detaching and attaching the View to - * the RecyclerView with onViewAttachedToWindow and onViewDetachedFromWindow. - *

- */ -@SuppressLint("ClickableViewAccessibility") -class RecyclerViewActivity : AppCompatActivity() { - - override fun onCreate(savedInstanceState: Bundle?) { - super.onCreate(savedInstanceState) - setContentView(R.layout.activity_recyclerview) - recyclerView.layoutManager = LinearLayoutManager(this) - recyclerView.adapter = ItemAdapter(LayoutInflater.from(this), savedInstanceState) - } - - override fun onSaveInstanceState(outState: Bundle?) { - super.onSaveInstanceState(outState) - // to save state, we need to call MapView#onSaveInstanceState - (recyclerView.adapter as ItemAdapter).onSaveInstanceState(outState) - } - - override fun onLowMemory() { - super.onLowMemory() - // to release memory, we need to call MapView#onLowMemory - (recyclerView.adapter as ItemAdapter).onLowMemory() - } - - override fun onDestroy() { - super.onDestroy() - // to perform cleanup, we need to call MapView#onDestroy - (recyclerView.adapter as ItemAdapter).onDestroy() - } - - class ItemAdapter(private val inflater: LayoutInflater, val savedInstanceState: Bundle?) : RecyclerView.Adapter() { - - private val items = listOf( - "one", "two", "three", MapItem(), "four", "five", "six", "seven", "eight", "nine", "ten", - "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", - "nineteen", "twenty", "twenty-one" - ) - - private var mapHolder: MapHolder? = null - - companion object { - const val TYPE_MAP = 0 - const val TYPE_TEXT = 1 - } - - override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { - return if (viewType == TYPE_MAP) { - val mapView = inflater.inflate(R.layout.item_map, parent, false) as MapView - mapView.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS) } - mapHolder = MapHolder(mapView, savedInstanceState) - return mapHolder as MapHolder - } else { - TextHolder(inflater.inflate(android.R.layout.simple_list_item_1, parent, false) as TextView) - } - } - - override fun onViewAttachedToWindow(holder: RecyclerView.ViewHolder) { - super.onViewAttachedToWindow(holder) - if (holder is MapHolder) { - val mapView = holder.mapView - mapView.onStart() - mapView.onResume() - } - } - - override fun onViewDetachedFromWindow(holder: RecyclerView.ViewHolder) { - super.onViewDetachedFromWindow(holder) - if (holder is MapHolder) { - val mapView = holder.mapView - mapView.onPause() - mapView.onStop() - } - } - - override fun getItemCount(): Int { - return items.count() - } - - override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { - if (holder.itemViewType == TYPE_TEXT) { - val textHolder = holder as TextHolder - textHolder.bind(items[position] as String) - } - } - - override fun getItemViewType(position: Int): Int { - return if (items[position] is MapItem) { - TYPE_MAP - } else { - TYPE_TEXT - } - } - - fun onSaveInstanceState(savedInstanceState: Bundle?){ - savedInstanceState?.let { - mapHolder?.mapView?.onSaveInstanceState(it) - } - } - - fun onLowMemory() { - mapHolder?.mapView?.onLowMemory() - } - - fun onDestroy() { - mapHolder?.mapView?.let { - it.onPause() - it.onStop() - it.onDestroy() - } - } - - class MapItem - class MapHolder(val mapView: MapView, bundle: Bundle?) : RecyclerView.ViewHolder(mapView) { - init { - mapView.onCreate(bundle) - mapView.setOnTouchListener { view, motionEvent -> - // Disallow the touch request for recyclerView scroll - view.parent.requestDisallowInterceptTouchEvent(true) - mapView.onTouchEvent(motionEvent) - true - } - } - } - class TextHolder(val textView: TextView) : RecyclerView.ViewHolder(textView) { - fun bind(item: String) { - textView.text = item - } - } - } -} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt new file mode 100644 index 0000000000..895389bc1e --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/TextureRecyclerViewActivity.kt @@ -0,0 +1,15 @@ +package com.mapbox.mapboxsdk.testapp.activity.maplayout + +import android.annotation.SuppressLint +import com.mapbox.mapboxsdk.testapp.R + +/** + * TestActivity showcasing how to integrate a TexureView MapView in a RecyclerView. + */ +@SuppressLint("ClickableViewAccessibility") +class TextureRecyclerViewActivity : GLSurfaceRecyclerViewActivity() { + + override fun getMapItemLayoutId() : Int{ + return R.layout.item_map_texture + } +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml deleted file mode 100644 index 3224b73477..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map.xml +++ /dev/null @@ -1,11 +0,0 @@ - - diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_gl.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_gl.xml new file mode 100644 index 0000000000..850399e355 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_gl.xml @@ -0,0 +1,10 @@ + + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_texture.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_texture.xml new file mode 100644 index 0000000000..3224b73477 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/item_map_texture.xml @@ -0,0 +1,11 @@ + + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml index 21ebeaabd5..cd4130c44a 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/descriptions.xml @@ -78,6 +78,7 @@ Uses LocationComponent in a Fragment Force location updates and don\'t rely on the engine Use LocationComponentActivationOptions to set options - Show a MapView as a recyclerView item + Show a TextureView MapView as a recyclerView item + Show a GLSurfaceView MapView as a recyclerView item Show a MapView inside a viewpager inside a recyclerView diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml index 26f56f29b1..07ba2b7afd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/titles.xml @@ -78,6 +78,7 @@ Location Fragment Manual Location updates Build Location Activation - RecyclerView + RecyclerView TextureView + RecyclerView GLSurfaceView Nested ViewPager \ No newline at end of file -- cgit v1.2.1 From 76df7d9cee6968e7e620f2f915254084f82d94ec Mon Sep 17 00:00:00 2001 From: tobrun Date: Fri, 15 Mar 2019 13:40:28 +0100 Subject: [android] - add integration test suite --- .../mapboxsdk/integration/BaseIntegrationTest.kt | 60 +++++++++++ .../mapboxsdk/integration/FragmentBackStackTest.kt | 59 +++++++++++ .../integration/GLSurfaceViewReopenTest.kt | 27 +++++ .../integration/GLSurfaceViewReuseTest.kt | 30 ++++++ .../mapboxsdk/integration/OrientationChangeTest.kt | 29 +++++ .../mapboxsdk/integration/TextureViewReopenTest.kt | 29 +++++ .../mapboxsdk/integration/TextureViewReuseTest.kt | 29 +++++ .../mapboxsdk/integration/ViewPagerScrollTest.kt | 37 +++++++ .../mapboxsdk/maps/GLSurfaceViewReopenTest.kt | 72 ------------- .../com/mapbox/mapboxsdk/maps/OrientationTest.java | 41 -------- .../mapbox/mapboxsdk/maps/TextureViewReopenTest.kt | 70 ------------ .../src/main/AndroidManifest.xml | 10 +- .../activity/fragment/ViewPagerActivity.java | 117 --------------------- .../testapp/activity/fragment/ViewPagerActivity.kt | 71 +++++++++++++ .../src/main/res/layout/activity_viewpager.xml | 2 +- .../src/main/res/values/categories.xml | 1 + 16 files changed, 378 insertions(+), 306 deletions(-) create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt delete mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java create mode 100644 platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt new file mode 100644 index 0000000000..4d39b55a25 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt @@ -0,0 +1,60 @@ +package com.mapbox.mapboxsdk.integration + +import android.content.Intent +import android.support.test.InstrumentationRegistry +import android.support.test.uiautomator.* +import org.hamcrest.CoreMatchers +import org.hamcrest.MatcherAssert +import org.junit.Before + +const val LAUNCH_TIMEOUT = 2500L +private const val TEST_APP_PACKAGE = "com.mapbox.mapboxsdk.testapp" + +abstract class BaseIntegrationTest { + + protected lateinit var device: UiDevice + + @Before + open fun beforeTest() { + // Initialize UiDevice instance + device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) + + // Start from the home screen + device.pressHome() + + // Wait for launcher + val launcherPackage: String = device.launcherPackageName + MatcherAssert.assertThat(launcherPackage, CoreMatchers.notNullValue()) + device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT) + + // Launch the app + val context = InstrumentationRegistry.getInstrumentation().context + val intent = context.packageManager.getLaunchIntentForPackage(TEST_APP_PACKAGE).apply { + // Clear out any previous instances + addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) + } + context.startActivity(intent) + + // Wait for the app to appear + device.wait( + Until.hasObject(By.pkg(TEST_APP_PACKAGE).depth(0)), + LAUNCH_TIMEOUT + ) + } + + fun openFeature(featureName: String) { + scrollRecyclerViewTo(featureName) + device.findObject(UiSelector().text(featureName)).clickAndWaitForNewWindow() + device.waitForIdle(LAUNCH_TIMEOUT) + } + + fun scrollRecyclerViewTo(recycleItem: String) { + val appView = UiScrollable(UiSelector().scrollable(true)) + appView.scrollIntoView(UiSelector().text(recycleItem)) + } + + fun pressHomeReturnWithRecentApps(){ + device.pressRecentApps() + device.findObject(UiSelector().text(InstrumentationRegistry.getTargetContext().getString(InstrumentationRegistry.getTargetContext().applicationInfo.labelRes))).click() + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt new file mode 100644 index 0000000000..f46ec153c3 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt @@ -0,0 +1,59 @@ +package com.mapbox.mapboxsdk.integration + +import android.support.test.filters.LargeTest +import android.support.test.runner.AndroidJUnit4 +import android.support.test.uiautomator.UiSelector +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Regression test that validates MapFragment integration on the backstack + */ +@RunWith(AndroidJUnit4::class) +class FragmentBackStackTest : BaseIntegrationTest() { + + @Before + override fun beforeTest() { + super.beforeTest() + openFeature("Backstack Map Fragment") + } + + @Test + @LargeTest + fun backPressedOnBackStack() { + device.waitForIdle() + clickReplaceFragmentButton() + device.waitForIdle() + backPressBackStack() + } + + @Test + @LargeTest + fun backPressedOnBackStackResumed(){ + device.waitForIdle() + clickReplaceFragmentButton() + device.waitForIdle() + pressHomeReturnWithRecentApps() + device.waitForIdle() + backPressBackStack() + } + + @Test + @LargeTest + fun finishOnBackStack() { + device.waitForIdle() + clickReplaceFragmentButton() + device.waitForIdle() + device.findObject(UiSelector().description("Navigate up")).click() + } + + private fun clickReplaceFragmentButton(){ + device.findObject(UiSelector().text("REPLACE WITH EMPTY FRAGMENT")).click() + } + + private fun backPressBackStack(){ + device.pressBack() // pops fragment, showing map + device.pressBack() // finish activity + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt new file mode 100644 index 0000000000..07fea012eb --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt @@ -0,0 +1,27 @@ +package com.mapbox.mapboxsdk.integration + +import android.support.test.filters.LargeTest +import android.support.test.runner.AndroidJUnit4 +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Regression test that validates reopening an Activity with a GLSurfaceView + */ +@RunWith(AndroidJUnit4::class) +class GLSurfaceViewReopenTest : BaseIntegrationTest() { + + @Before + override fun beforeTest() { + super.beforeTest() + openFeature("Simple Map") + } + + @Test + @LargeTest + fun reopenSimpleMapActivity() { + pressHomeReturnWithRecentApps() + device.waitForIdle() + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt new file mode 100644 index 0000000000..95f05566c3 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt @@ -0,0 +1,30 @@ +package com.mapbox.mapboxsdk.integration + +import android.support.test.filters.LargeTest +import android.support.test.runner.AndroidJUnit4 +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Regression test that validates if a GLSurfaceView surface can be recreated without crashing. + */ +@RunWith(AndroidJUnit4::class) +class GLSurfaceViewReuseTest : BaseIntegrationTest() { + + @Before + override fun beforeTest() { + super.beforeTest() + openFeature("RecyclerView GLSurfaceView") + } + + @Test + @LargeTest + fun scrollRecylerView() { + device.waitForIdle() + scrollRecyclerViewTo("Twenty-one") + device.waitForIdle() + scrollRecyclerViewTo("One") + device.waitForIdle() + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt new file mode 100644 index 0000000000..b79303a1a8 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt @@ -0,0 +1,29 @@ +package com.mapbox.mapboxsdk.integration + +import android.support.test.filters.LargeTest +import android.support.test.runner.AndroidJUnit4 +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(AndroidJUnit4::class) +class OrientationChangeTest : BaseIntegrationTest() { + + @Before + override fun beforeTest() { + super.beforeTest() + openFeature("Simple Map") + } + + @Test + @LargeTest + fun rotateSimpleMap() { + device.setOrientationLeft() + device.waitForIdle() + device.setOrientationNatural() + device.waitForIdle() + device.setOrientationRight() + device.waitForIdle() + device.setOrientationNatural() + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt new file mode 100644 index 0000000000..3de8ece8c3 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt @@ -0,0 +1,29 @@ +package com.mapbox.mapboxsdk.integration + +import android.support.test.filters.LargeTest +import android.support.test.runner.AndroidJUnit4 +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith +import java.lang.Thread.sleep + +/** + * Regression test that validates reopening an Activity with a TextureView + */ +@RunWith(AndroidJUnit4::class) +class TextureViewReopenTest : BaseIntegrationTest() { + + @Before + override fun beforeTest() { + super.beforeTest() + openFeature("TextureView debug") + } + + @Test + @LargeTest + fun reopenTextureViewDebugActivity() { + pressHomeReturnWithRecentApps() + device.waitForIdle() + sleep(LAUNCH_TIMEOUT) + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt new file mode 100644 index 0000000000..6053e696d6 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt @@ -0,0 +1,29 @@ +package com.mapbox.mapboxsdk.integration + +import android.support.test.filters.LargeTest +import android.support.test.runner.AndroidJUnit4 +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Regression test that validates if a GLSurfaceView surface can be recreated without crashing. + */ +@RunWith(AndroidJUnit4::class) +class TextureViewReuseTest : BaseIntegrationTest() { + + @Before + override fun beforeTest() { + super.beforeTest() + openFeature("RecyclerView TextureView") + } + + @Test + @LargeTest + fun scrollRecylerView() { + scrollRecyclerViewTo("Twenty-one") + device.waitForIdle() + scrollRecyclerViewTo("One") + device.waitForIdle() + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt new file mode 100644 index 0000000000..9f4b7591b6 --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt @@ -0,0 +1,37 @@ +package com.mapbox.mapboxsdk.integration + +import android.support.test.filters.LargeTest +import android.support.test.runner.AndroidJUnit4 +import android.support.test.uiautomator.UiSelector +import org.junit.Before +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Regression test that validates MapFragment integration with a ViewPager + */ +@RunWith(AndroidJUnit4::class) +class ViewPagerScrollTest : BaseIntegrationTest() { + + @Before + override fun beforeTest() { + super.beforeTest() + openFeature("ViewPager") + } + + @Test + @LargeTest + fun scrollViewPager() { + for (i in 1..5) { + clickTab(i) + } + + for (i in 4 downTo 0) { + clickTab(i) + } + } + + private fun clickTab(index: Int) { + device.findObject(UiSelector().text("Page $index")).click() + } +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt deleted file mode 100644 index 708b633db4..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/GLSurfaceViewReopenTest.kt +++ /dev/null @@ -1,72 +0,0 @@ -package com.mapbox.mapboxsdk.maps - -import android.content.Intent -import android.support.test.InstrumentationRegistry -import android.support.test.InstrumentationRegistry.getTargetContext -import android.support.test.filters.SdkSuppress -import android.support.test.runner.AndroidJUnit4 -import android.support.test.uiautomator.By -import android.support.test.uiautomator.UiDevice -import android.support.test.uiautomator.UiSelector -import android.support.test.uiautomator.Until -import org.hamcrest.CoreMatchers.notNullValue -import org.hamcrest.MatcherAssert.assertThat -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith - -private const val BASIC_SAMPLE_PACKAGE = "com.mapbox.mapboxsdk.testapp" -private const val LAUNCH_TIMEOUT = 5000L - -@RunWith(AndroidJUnit4::class) -@SdkSuppress(minSdkVersion = 18) -class GLSurfaceViewReopenTest { - - private lateinit var device: UiDevice - - @Before - fun startSimpleMapActivityFromHomeScreen() { - // Initialize UiDevice instance - device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) - - // Start from the home screen - device.pressHome() - - // Wait for launcher - val launcherPackage: String = device.launcherPackageName - assertThat(launcherPackage, notNullValue()) - device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT) - - // Launch the app - val context = InstrumentationRegistry.getInstrumentation().context - val intent = context.packageManager.getLaunchIntentForPackage(BASIC_SAMPLE_PACKAGE).apply { - // Clear out any previous instances - addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) - } - context.startActivity(intent) - - // Wait for the app to appear - device.wait( - Until.hasObject(By.pkg(BASIC_SAMPLE_PACKAGE).depth(0)), - LAUNCH_TIMEOUT - ) - - // open SimpleMapActivity - device.findObject(UiSelector().text("Simple Map")).clickAndWaitForNewWindow() - - // wait for idle - device.waitForIdle(LAUNCH_TIMEOUT) - } - - @Test - fun reopenSimpleMapActivity() { - // press recent apps button to pause the app - device.pressRecentApps() - - // return to app - device.findObject(UiSelector().text(getTargetContext().getString(getTargetContext().applicationInfo.labelRes))).click() - - // wait for idle - device.waitForIdle(LAUNCH_TIMEOUT) - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java deleted file mode 100644 index 536f452493..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/OrientationTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.mapbox.mapboxsdk.maps; - -import com.mapbox.mapboxsdk.testapp.action.OrientationAction; -import com.mapbox.mapboxsdk.testapp.action.WaitAction; -import com.mapbox.mapboxsdk.testapp.activity.BaseTest; -import com.mapbox.mapboxsdk.testapp.activity.camera.CameraAnimationTypeActivity; -import org.junit.Test; - -import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationLandscape; -import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationLandscapeReverse; -import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationPortrait; -import static com.mapbox.mapboxsdk.testapp.action.OrientationAction.orientationPortraitReverse; - -public class OrientationTest extends BaseTest { - - @Test - public void testChangeDeviceOrientation() { - OrientationAction.invoke(orientationLandscape()); - WaitAction.invoke(2200); - OrientationAction.invoke(orientationPortrait()); - WaitAction.invoke(2500); - OrientationAction.invoke(orientationLandscapeReverse()); - WaitAction.invoke(500); - OrientationAction.invoke(orientationPortraitReverse()); - WaitAction.invoke(1250); - OrientationAction.invoke(orientationLandscape()); - WaitAction.invoke(750); - OrientationAction.invoke(orientationPortrait()); - WaitAction.invoke(950); - OrientationAction.invoke(orientationLandscapeReverse()); - OrientationAction.invoke(orientationPortraitReverse()); - OrientationAction.invoke(orientationLandscape()); - OrientationAction.invoke(orientationPortrait()); - } - - @Override - protected Class getActivityClass() { - return CameraAnimationTypeActivity.class; - } - -} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt deleted file mode 100644 index 490f279b29..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/TextureViewReopenTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -package com.mapbox.mapboxsdk.maps - -import android.content.Intent -import android.support.test.InstrumentationRegistry -import android.support.test.filters.SdkSuppress -import android.support.test.runner.AndroidJUnit4 -import android.support.test.uiautomator.* -import org.hamcrest.CoreMatchers.notNullValue -import org.hamcrest.MatcherAssert.assertThat -import org.junit.Before -import org.junit.Test -import org.junit.runner.RunWith - -private const val BASIC_SAMPLE_PACKAGE = "com.mapbox.mapboxsdk.testapp" -private const val LAUNCH_TIMEOUT = 5000L - -@RunWith(AndroidJUnit4::class) -@SdkSuppress(minSdkVersion = 18) -class TextureViewReopenTest { - - private lateinit var device: UiDevice - - @Before - fun startSimpleMapActivityFromHomeScreen() { - // Initialize UiDevice instance - device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) - - // Start from the home screen - device.pressHome() - - // Wait for launcher - val launcherPackage: String = device.launcherPackageName - assertThat(launcherPackage, notNullValue()) - device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT) - - // Launch the app - val context = InstrumentationRegistry.getInstrumentation().context - val intent = context.packageManager.getLaunchIntentForPackage(BASIC_SAMPLE_PACKAGE).apply { - // Clear out any previous instances - addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) - } - context.startActivity(intent) - - // Wait for the app to appear - device.wait( - Until.hasObject(By.pkg(BASIC_SAMPLE_PACKAGE).depth(0)), - LAUNCH_TIMEOUT - ) - - // open TextureView debug activity - val appView = UiScrollable(UiSelector().scrollable(true)) - appView.scrollIntoView(UiSelector().text("TextureView debug")) - device.findObject(UiSelector().text("TextureView debug")).clickAndWaitForNewWindow() - - // wait for idle - device.waitForIdle(LAUNCH_TIMEOUT) - } - - @Test - fun reopenTextureViewDebugActivity() { - // press recent apps button - device.pressRecentApps() - - // return to app - device.findObject(UiSelector().text(InstrumentationRegistry.getTargetContext().getString(InstrumentationRegistry.getTargetContext().applicationInfo.labelRes))).click() - - // wait for idle - device.waitForIdle(LAUNCH_TIMEOUT) - } -} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index fbba6a4927..cec5bd879b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -176,7 +176,7 @@ android:label="@string/activity_map_fragment_backstack"> + android:value="@string/category_integration" /> @@ -399,7 +399,7 @@ android:label="@string/activity_viewpager"> + android:value="@string/category_integration" /> @@ -900,7 +900,7 @@ android:label="@string/activity_recyclerview_textureview"> + android:value="@string/category_integration" /> @@ -911,7 +911,7 @@ android:label="@string/activity_recyclerview_glsurfaceview"> + android:value="@string/category_integration" /> @@ -922,7 +922,7 @@ android:label="@string/activity_nested_viewpager"> + android:value="@string/category_integration" /> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java deleted file mode 100644 index c494842b14..0000000000 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.java +++ /dev/null @@ -1,117 +0,0 @@ -package com.mapbox.mapboxsdk.testapp.activity.fragment; - -import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentManager; -import android.support.v4.app.FragmentStatePagerAdapter; -import android.support.v4.view.ViewPager; -import android.support.v7.app.AppCompatActivity; - -import com.mapbox.mapboxsdk.camera.CameraPosition; -import com.mapbox.mapboxsdk.geometry.LatLng; -import com.mapbox.mapboxsdk.maps.MapboxMapOptions; -import com.mapbox.mapboxsdk.maps.Style; -import com.mapbox.mapboxsdk.maps.SupportMapFragment; -import com.mapbox.mapboxsdk.testapp.R; - -/** - * Test activity showcasing using the Android SDK ViewPager API to show MapFragments. - */ -public class ViewPagerActivity extends AppCompatActivity { - - private ViewPager viewPager; - private MapFragmentAdapter adapter; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_viewpager); - - viewPager = (ViewPager) findViewById(R.id.viewpager); - if (viewPager != null) { - adapter = new MapFragmentAdapter(getSupportFragmentManager()); - viewPager.setAdapter(adapter); - } - } - - @Override - protected void onRestoreInstanceState(Bundle savedInstanceState) { - super.onRestoreInstanceState(savedInstanceState); - - int currentPosition = viewPager.getCurrentItem(); - SupportMapFragment mapFragment; - - if (Math.abs(0 - currentPosition) <= 1) { - mapFragment = (SupportMapFragment) adapter.instantiateItem(viewPager, 0); - mapFragment.getMapAsync(mapboxMap -> { - mapboxMap.setStyle(Style.MAPBOX_STREETS); - }); - } - - if (Math.abs(1 - currentPosition) <= 1) { - mapFragment = (SupportMapFragment) adapter.instantiateItem(viewPager, 1); - mapFragment.getMapAsync(mapboxMap -> { - mapboxMap.setStyle(Style.DARK); - }); - } - - if (Math.abs(2 - currentPosition) <= 1) { - mapFragment = (SupportMapFragment) adapter.instantiateItem(viewPager, 2); - mapFragment.getMapAsync(mapboxMap -> { - mapboxMap.setStyle(Style.SATELLITE); - }); - } - } - - static class MapFragmentAdapter extends FragmentStatePagerAdapter { - - private static int NUM_ITEMS = 3; - - MapFragmentAdapter(FragmentManager fragmentManager) { - super(fragmentManager); - } - - @Override - public int getCount() { - return NUM_ITEMS; - } - - @Override - public Fragment getItem(int position) { - SupportMapFragment fragment = null; - MapboxMapOptions options = new MapboxMapOptions(); - options.textureMode(true); - - switch (position) { - case 0: - options.camera(new CameraPosition.Builder().target(new LatLng(34.920526, 102.634774)).zoom(3).build()); - fragment = SupportMapFragment.newInstance(options); - fragment.getMapAsync(mapboxMap -> { - mapboxMap.setStyle(Style.MAPBOX_STREETS); - }); - break; - case 1: - options.camera(new CameraPosition.Builder().target(new LatLng(62.326440, 92.764913)).zoom(3).build()); - fragment = SupportMapFragment.newInstance(options); - fragment.getMapAsync(mapboxMap -> { - mapboxMap.setStyle(Style.DARK); - }); - break; - case 2: - options.camera(new CameraPosition.Builder().target(new LatLng(-25.007786, 133.623852)).zoom(3).build()); - fragment = SupportMapFragment.newInstance(options); - fragment.getMapAsync(mapboxMap -> { - mapboxMap.setStyle(Style.SATELLITE); - }); - break; - } - return fragment; - } - - @Override - public CharSequence getPageTitle(int position) { - return "Page " + position; - } - } -} - diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt new file mode 100644 index 0000000000..8312661ebd --- /dev/null +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt @@ -0,0 +1,71 @@ +package com.mapbox.mapboxsdk.testapp.activity.fragment + +import android.os.Bundle +import android.support.v4.app.Fragment +import android.support.v4.app.FragmentManager +import android.support.v4.app.FragmentStatePagerAdapter +import android.support.v7.app.AppCompatActivity +import com.mapbox.mapboxsdk.camera.CameraPosition +import com.mapbox.mapboxsdk.geometry.LatLng +import com.mapbox.mapboxsdk.maps.MapboxMapOptions +import com.mapbox.mapboxsdk.maps.Style +import com.mapbox.mapboxsdk.maps.SupportMapFragment +import com.mapbox.mapboxsdk.testapp.R +import kotlinx.android.synthetic.main.activity_viewpager.* + +/** + * Test activity showcasing using the Android SDK ViewPager API to show MapFragments. + */ +class ViewPagerActivity : AppCompatActivity() { + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + setContentView(R.layout.activity_viewpager) + viewPager.adapter = MapFragmentAdapter(supportFragmentManager) + } + + override fun onRestoreInstanceState(savedInstanceState: Bundle) { + super.onRestoreInstanceState(savedInstanceState) + val currentPosition = viewPager!!.currentItem + for (i in 0 until FRAGMENT_COUNT) { + if (Math.abs(i - currentPosition) <= 1) { + viewPager.adapter?.instantiateItem(viewPager, 0) + break + } + } + } + + internal class MapFragmentAdapter(fragmentManager: FragmentManager) : FragmentStatePagerAdapter(fragmentManager) { + + override fun getCount(): Int { + return FRAGMENT_COUNT + } + + override fun getItem(position: Int): Fragment { + return when (position) { + 0 -> createFragment(Style.MAPBOX_STREETS, LatLng(34.920526, 102.634774)) + 1 -> createFragment(Style.DARK, LatLng(62.326440, 92.764913)) + 2 -> createFragment(Style.SATELLITE, LatLng(-25.007786, 133.623852)) + 3 -> createFragment(Style.LIGHT, LatLng(-19.922070, -43.939676)) + 4 -> createFragment(Style.OUTDOORS, LatLng(46.881020, 9.098098)) + else -> createFragment(Style.TRAFFIC_DAY, LatLng(40.722517, -74.000029)) + } + } + + private fun createFragment(@Style.StyleUrl style: String, latLng: LatLng): Fragment { + val options = MapboxMapOptions().camera(CameraPosition.Builder().target(latLng).zoom(3.0).build()) + val fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(style) } + return fragment + } + + override fun getPageTitle(position: Int): CharSequence? { + return "Page $position" + } + } + + companion object { + const val FRAGMENT_COUNT = 6 + } +} + diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml index 3edaff6985..516bf60b6b 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_viewpager.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent"> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/categories.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/categories.xml index a4403a34f7..918fd4cc3f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/categories.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/values/categories.xml @@ -15,4 +15,5 @@ Storage Texture View Location + _Integration \ No newline at end of file -- cgit v1.2.1 From ab5f935b57db7255d1ca939c296f2d869a56a3cc Mon Sep 17 00:00:00 2001 From: tobrun Date: Fri, 15 Mar 2019 14:06:59 +0100 Subject: [android] - hook GLSurfaceViewMapRenderer into surfaceCreated callback, don't destroy map renderer when surface is destroyed as it can be recreated later --- .../renderer/glsurfaceview/GLSurfaceViewMapRenderer.java | 13 +++++-------- .../maps/renderer/textureview/TextureViewRenderThread.java | 1 - 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java index 9d9a7bd2d4..6eeb148283 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java @@ -2,10 +2,8 @@ package com.mapbox.mapboxsdk.maps.renderer.glsurfaceview; import android.content.Context; import android.opengl.GLSurfaceView; - import android.support.annotation.NonNull; import android.view.SurfaceHolder; - import com.mapbox.mapboxsdk.maps.renderer.MapRenderer; import com.mapbox.mapboxsdk.maps.renderer.egl.EGLConfigChooser; @@ -25,8 +23,6 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi @NonNull private final GLSurfaceView glSurfaceView; - private boolean requestDestroy; - public GLSurfaceViewMapRenderer(Context context, GLSurfaceView glSurfaceView, String localIdeographFontFamily) { @@ -42,9 +38,13 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi @Override public void surfaceDestroyed(SurfaceHolder holder) { - requestDestroy = true; + onSurfaceDestroyed(); } + @Override + public void surfaceCreated(SurfaceHolder holder) { + onSurfaceCreated(null, null); + } }); } @@ -60,9 +60,6 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi @Override public void onDestroy() { - if (requestDestroy) { - onSurfaceDestroyed(); - } super.onDestroy(); } diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java index 96d5e9e943..165b15a512 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/textureview/TextureViewRenderThread.java @@ -197,7 +197,6 @@ class TextureViewRenderThread extends Thread implements TextureView.SurfaceTextu if (destroySurface) { eglHolder.destroySurface(); destroySurface = false; - mapRenderer.onSurfaceDestroyed(); break; } -- cgit v1.2.1 From 1e8622378db0e03561bd7528b37918079020eede Mon Sep 17 00:00:00 2001 From: tobrun Date: Fri, 15 Mar 2019 15:04:18 +0100 Subject: [android] - make a singular FragmentBackStack test --- .../mapboxsdk/integration/FragmentBackStackTest.kt | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt index f46ec153c3..9eb03bd1c5 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt @@ -19,15 +19,6 @@ class FragmentBackStackTest : BaseIntegrationTest() { openFeature("Backstack Map Fragment") } - @Test - @LargeTest - fun backPressedOnBackStack() { - device.waitForIdle() - clickReplaceFragmentButton() - device.waitForIdle() - backPressBackStack() - } - @Test @LargeTest fun backPressedOnBackStackResumed(){ @@ -39,15 +30,6 @@ class FragmentBackStackTest : BaseIntegrationTest() { backPressBackStack() } - @Test - @LargeTest - fun finishOnBackStack() { - device.waitForIdle() - clickReplaceFragmentButton() - device.waitForIdle() - device.findObject(UiSelector().description("Navigate up")).click() - } - private fun clickReplaceFragmentButton(){ device.findObject(UiSelector().text("REPLACE WITH EMPTY FRAGMENT")).click() } -- cgit v1.2.1 From dcd6efd5b5c806c524095500ae1d832765816f47 Mon Sep 17 00:00:00 2001 From: tobrun Date: Fri, 22 Mar 2019 09:37:21 +0100 Subject: [android] - revert onDismiss workaround, refactor tests, adress review comments --- circle.yml | 4 +- .../mapboxsdk/integration/BaseIntegrationTest.kt | 59 ++++----------- .../mapboxsdk/integration/FragmentBackStackTest.kt | 16 ++-- .../integration/GLSurfaceViewReopenTest.kt | 18 +++-- .../integration/GLSurfaceViewReuseTest.kt | 17 +++-- .../mapboxsdk/integration/OrientationChangeTest.kt | 15 ++-- .../mapboxsdk/integration/TextureViewReopenTest.kt | 17 +++-- .../mapboxsdk/integration/TextureViewReuseTest.kt | 18 +++-- .../mapboxsdk/integration/ViewPagerScrollTest.kt | 15 ++-- .../testapp/fragment/MapDialogFragmentTest.kt | 4 +- .../testapp/activity/fragment/ViewPagerActivity.kt | 88 ++++++++++++++++------ .../activity/maplayout/MapInDialogActivity.java | 34 +-------- platform/android/scripts/exclude-activity-gen.json | 3 +- 13 files changed, 155 insertions(+), 153 deletions(-) diff --git a/circle.yml b/circle.yml index 87de7109ac..b47281cf26 100644 --- a/circle.yml +++ b/circle.yml @@ -15,8 +15,8 @@ workflows: - android-arm-template: name: android-gnustl-arm-v7 stl: gnustl_shared - firebase_device_id: "m0" - firebase_device_os: "18" + firebase_device_id: "cheryl" + firebase_device_os: "25" image: android-ndk-r17c:1d5db0eb34 abi: arm-v7 - android-release: diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt index 4d39b55a25..be57fb3e2d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt @@ -1,60 +1,31 @@ package com.mapbox.mapboxsdk.integration +import android.content.Context import android.content.Intent +import android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP import android.support.test.InstrumentationRegistry import android.support.test.uiautomator.* -import org.hamcrest.CoreMatchers -import org.hamcrest.MatcherAssert import org.junit.Before -const val LAUNCH_TIMEOUT = 2500L -private const val TEST_APP_PACKAGE = "com.mapbox.mapboxsdk.testapp" - abstract class BaseIntegrationTest { protected lateinit var device: UiDevice @Before open fun beforeTest() { - // Initialize UiDevice instance device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()) - - // Start from the home screen - device.pressHome() - - // Wait for launcher - val launcherPackage: String = device.launcherPackageName - MatcherAssert.assertThat(launcherPackage, CoreMatchers.notNullValue()) - device.wait(Until.hasObject(By.pkg(launcherPackage).depth(0)), LAUNCH_TIMEOUT) - - // Launch the app - val context = InstrumentationRegistry.getInstrumentation().context - val intent = context.packageManager.getLaunchIntentForPackage(TEST_APP_PACKAGE).apply { - // Clear out any previous instances - addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) - } - context.startActivity(intent) - - // Wait for the app to appear - device.wait( - Until.hasObject(By.pkg(TEST_APP_PACKAGE).depth(0)), - LAUNCH_TIMEOUT - ) - } - - fun openFeature(featureName: String) { - scrollRecyclerViewTo(featureName) - device.findObject(UiSelector().text(featureName)).clickAndWaitForNewWindow() - device.waitForIdle(LAUNCH_TIMEOUT) - } - - fun scrollRecyclerViewTo(recycleItem: String) { - val appView = UiScrollable(UiSelector().scrollable(true)) - appView.scrollIntoView(UiSelector().text(recycleItem)) - } - - fun pressHomeReturnWithRecentApps(){ - device.pressRecentApps() - device.findObject(UiSelector().text(InstrumentationRegistry.getTargetContext().getString(InstrumentationRegistry.getTargetContext().applicationInfo.labelRes))).click() } +} + +fun UiDevice.launchActivity(context: Context, clazz: Class<*>) { + val applicationPackage = InstrumentationRegistry.getTargetContext().packageName + val intent = Intent(context, clazz) + intent.addFlags(FLAG_ACTIVITY_SINGLE_TOP) + InstrumentationRegistry.getContext().startActivity(intent) + wait(Until.hasObject(By.pkg(applicationPackage).depth(0)), 5000) +} + +fun UiDevice.scrollRecyclerViewTo(recycleItem: String) { + val appView = UiScrollable(UiSelector().scrollable(true)) + appView.scrollIntoView(UiSelector().text(recycleItem)) } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt index 9eb03bd1c5..e57e1d1abd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt @@ -1,9 +1,13 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 import android.support.test.uiautomator.UiSelector +import com.mapbox.mapboxsdk.testapp.activity.fragment.FragmentBackStackActivity +import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -13,21 +17,19 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class FragmentBackStackTest : BaseIntegrationTest() { - @Before - override fun beforeTest() { - super.beforeTest() - openFeature("Backstack Map Fragment") - } + @get:Rule + var activityRule: ActivityTestRule = ActivityTestRule(FragmentBackStackActivity::class.java) @Test @LargeTest fun backPressedOnBackStackResumed(){ device.waitForIdle() clickReplaceFragmentButton() + device.pressHome() device.waitForIdle() - pressHomeReturnWithRecentApps() - device.waitForIdle() + device.launchActivity(activityRule.activity.applicationContext, FragmentBackStackActivity::class.java) backPressBackStack() + device.waitForIdle() } private fun clickReplaceFragmentButton(){ diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt index 07fea012eb..755c5fc560 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt @@ -1,27 +1,29 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 -import org.junit.Before +import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith + /** * Regression test that validates reopening an Activity with a GLSurfaceView */ @RunWith(AndroidJUnit4::class) class GLSurfaceViewReopenTest : BaseIntegrationTest() { - @Before - override fun beforeTest() { - super.beforeTest() - openFeature("Simple Map") - } + @get:Rule + var activityRule: ActivityTestRule = ActivityTestRule(SimpleMapActivity::class.java) @Test @LargeTest fun reopenSimpleMapActivity() { - pressHomeReturnWithRecentApps() device.waitForIdle() + device.pressHome() + device.waitForIdle() + device.launchActivity(activityRule.activity.applicationContext, SimpleMapActivity::class.java) } -} \ No newline at end of file +} diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt index 95f05566c3..945fac677e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReuseTest.kt @@ -1,8 +1,12 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity +import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -12,19 +16,16 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class GLSurfaceViewReuseTest : BaseIntegrationTest() { - @Before - override fun beforeTest() { - super.beforeTest() - openFeature("RecyclerView GLSurfaceView") - } + @get:Rule + var activityRule: ActivityTestRule = ActivityTestRule(GLSurfaceRecyclerViewActivity::class.java) @Test @LargeTest - fun scrollRecylerView() { + fun scrollRecyclerView() { device.waitForIdle() - scrollRecyclerViewTo("Twenty-one") + device.scrollRecyclerViewTo("Twenty-one") device.waitForIdle() - scrollRecyclerViewTo("One") + device.scrollRecyclerViewTo("One") device.waitForIdle() } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt index b79303a1a8..941b7ea8dc 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/OrientationChangeTest.kt @@ -1,19 +1,20 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity +import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class OrientationChangeTest : BaseIntegrationTest() { - @Before - override fun beforeTest() { - super.beforeTest() - openFeature("Simple Map") - } + @get:Rule + var activityRule: ActivityTestRule = ActivityTestRule(SimpleMapActivity::class.java) @Test @LargeTest @@ -25,5 +26,9 @@ class OrientationChangeTest : BaseIntegrationTest() { device.setOrientationRight() device.waitForIdle() device.setOrientationNatural() + device.setOrientationLeft() + device.setOrientationNatural() + device.setOrientationRight() + device.setOrientationNatural() } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt index 3de8ece8c3..cc171ca905 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt @@ -1,8 +1,13 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity +import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity +import com.mapbox.mapboxsdk.testapp.activity.textureview.TextureViewDebugModeActivity import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import java.lang.Thread.sleep @@ -13,17 +18,15 @@ import java.lang.Thread.sleep @RunWith(AndroidJUnit4::class) class TextureViewReopenTest : BaseIntegrationTest() { - @Before - override fun beforeTest() { - super.beforeTest() - openFeature("TextureView debug") - } + @get:Rule + var activityRule: ActivityTestRule = ActivityTestRule(TextureViewDebugModeActivity::class.java) @Test @LargeTest fun reopenTextureViewDebugActivity() { - pressHomeReturnWithRecentApps() device.waitForIdle() - sleep(LAUNCH_TIMEOUT) + device.pressHome() + device.waitForIdle() + device.launchActivity(activityRule.activity.applicationContext, TextureViewDebugModeActivity::class.java) } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt index 6053e696d6..5c3d66c462 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReuseTest.kt @@ -1,8 +1,12 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity +import com.mapbox.mapboxsdk.testapp.activity.maplayout.TextureRecyclerViewActivity import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -12,18 +16,16 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class TextureViewReuseTest : BaseIntegrationTest() { - @Before - override fun beforeTest() { - super.beforeTest() - openFeature("RecyclerView TextureView") - } + @get:Rule + var activityRule: ActivityTestRule = ActivityTestRule(TextureRecyclerViewActivity::class.java) @Test @LargeTest - fun scrollRecylerView() { - scrollRecyclerViewTo("Twenty-one") + fun scrollRecyclerView() { + device.waitForIdle() + device.scrollRecyclerViewTo("Twenty-one") device.waitForIdle() - scrollRecyclerViewTo("One") + device.scrollRecyclerViewTo("One") device.waitForIdle() } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt index 9f4b7591b6..b918801296 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/ViewPagerScrollTest.kt @@ -1,9 +1,13 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest +import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 import android.support.test.uiautomator.UiSelector +import com.mapbox.mapboxsdk.testapp.activity.fragment.ViewPagerActivity +import com.mapbox.mapboxsdk.testapp.activity.maplayout.GLSurfaceRecyclerViewActivity import org.junit.Before +import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -13,20 +17,17 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class ViewPagerScrollTest : BaseIntegrationTest() { - @Before - override fun beforeTest() { - super.beforeTest() - openFeature("ViewPager") - } + @get:Rule + var activityRule: ActivityTestRule = ActivityTestRule(ViewPagerActivity::class.java) @Test @LargeTest fun scrollViewPager() { - for (i in 1..5) { + for (i in 1..4) { clickTab(i) } - for (i in 4 downTo 0) { + for (i in 3 downTo 0) { clickTab(i) } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt index 418191e91a..2731b20db7 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/fragment/MapDialogFragmentTest.kt @@ -10,6 +10,7 @@ import android.support.test.runner.AndroidJUnit4 import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.action.WaitAction import com.mapbox.mapboxsdk.testapp.activity.maplayout.MapInDialogActivity +import org.junit.Ignore import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith @@ -25,9 +26,10 @@ class MapDialogFragmentTest { var activityRule: ActivityTestRule = ActivityTestRule(MapInDialogActivity::class.java) @Test + @Ignore fun openCloseDialog() { onView(withId(R.id.button_open_dialog)).perform(click()) - onView(withId(R.id.mapView)).perform(WaitAction(2500)) + Thread.sleep(2500) Espresso.pressBack() } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt index 8312661ebd..77e2e1370d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/fragment/ViewPagerActivity.kt @@ -26,46 +26,84 @@ class ViewPagerActivity : AppCompatActivity() { override fun onRestoreInstanceState(savedInstanceState: Bundle) { super.onRestoreInstanceState(savedInstanceState) - val currentPosition = viewPager!!.currentItem - for (i in 0 until FRAGMENT_COUNT) { - if (Math.abs(i - currentPosition) <= 1) { - viewPager.adapter?.instantiateItem(viewPager, 0) - break - } + + val currentPosition = viewPager.currentItem + var mapFragment: SupportMapFragment + + if (Math.abs(0 - currentPosition) <= 1) { + mapFragment = viewPager.adapter?.instantiateItem(viewPager, 0) as SupportMapFragment + mapFragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS) } + } + + if (Math.abs(1 - currentPosition) <= 1) { + mapFragment = viewPager.adapter?.instantiateItem(viewPager, 1) as SupportMapFragment + mapFragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.DARK) } + } + + if (Math.abs(2 - currentPosition) <= 1) { + mapFragment = viewPager.adapter?.instantiateItem(viewPager, 2) as SupportMapFragment + mapFragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) } + } + + if (Math.abs(3 - currentPosition) <= 1) { + mapFragment = viewPager.adapter?.instantiateItem(viewPager, 3) as SupportMapFragment + mapFragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) } + } + + if (Math.abs(4 - currentPosition) <= 1) { + mapFragment = viewPager.adapter?.instantiateItem(viewPager, 4) as SupportMapFragment + mapFragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) } } } internal class MapFragmentAdapter(fragmentManager: FragmentManager) : FragmentStatePagerAdapter(fragmentManager) { override fun getCount(): Int { - return FRAGMENT_COUNT + return NUM_ITEMS } - override fun getItem(position: Int): Fragment { - return when (position) { - 0 -> createFragment(Style.MAPBOX_STREETS, LatLng(34.920526, 102.634774)) - 1 -> createFragment(Style.DARK, LatLng(62.326440, 92.764913)) - 2 -> createFragment(Style.SATELLITE, LatLng(-25.007786, 133.623852)) - 3 -> createFragment(Style.LIGHT, LatLng(-19.922070, -43.939676)) - 4 -> createFragment(Style.OUTDOORS, LatLng(46.881020, 9.098098)) - else -> createFragment(Style.TRAFFIC_DAY, LatLng(40.722517, -74.000029)) - } - } + override fun getItem(position: Int): Fragment? { + var fragment: SupportMapFragment? = null + val options = MapboxMapOptions() + options.textureMode(true) - private fun createFragment(@Style.StyleUrl style: String, latLng: LatLng): Fragment { - val options = MapboxMapOptions().camera(CameraPosition.Builder().target(latLng).zoom(3.0).build()) - val fragment = SupportMapFragment.newInstance(options) - fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(style) } + when (position) { + 0 -> { + options.camera(CameraPosition.Builder().target(LatLng(34.920526, 102.634774)).zoom(3.0).build()) + fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.MAPBOX_STREETS) } + } + 1 -> { + options.camera(CameraPosition.Builder().target(LatLng(62.326440, 92.764913)).zoom(3.0).build()) + fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.DARK) } + } + 2 -> { + options.camera(CameraPosition.Builder().target(LatLng(-25.007786, 133.623852)).zoom(3.0).build()) + fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.SATELLITE) } + } + 3 -> { + options.camera(CameraPosition.Builder().target(LatLng(62.326440, 92.764913)).zoom(3.0).build()) + fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.LIGHT) } + } + 4 -> { + options.camera(CameraPosition.Builder().target(LatLng(34.920526, 102.634774)).zoom(3.0).build()) + fragment = SupportMapFragment.newInstance(options) + fragment.getMapAsync { mapboxMap -> mapboxMap.setStyle(Style.TRAFFIC_NIGHT) } + } + } return fragment } override fun getPageTitle(position: Int): CharSequence? { return "Page $position" } - } - companion object { - const val FRAGMENT_COUNT = 6 + companion object { + + private val NUM_ITEMS = 5 + } } } - diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java index c9a9377885..18092ce372 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/MapInDialogActivity.java @@ -1,6 +1,5 @@ package com.mapbox.mapboxsdk.testapp.activity.maplayout; -import android.app.Dialog; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; @@ -17,9 +16,6 @@ import com.mapbox.mapboxsdk.testapp.R; /** * Test activity showcasing showing a Map inside of a DialogFragment. - *

- * Uses the deprecated TextureView API to workaround the issue of seeing a grey background before the gl surface. - *

*/ public class MapInDialogActivity extends AppCompatActivity { @@ -64,23 +60,6 @@ public class MapInDialogActivity extends AppCompatActivity { mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(Style.OUTDOORS)); } - @NonNull - @Override - public Dialog onCreateDialog(Bundle savedInstanceState) { - return new Dialog(getActivity(), getTheme()) { - @Override - public void dismiss() { - if (mapView != null && !mapView.isDestroyed()) { - mapView.onPause(); - mapView.onStop(); - mapView.onDestroy(); - mapView = null; - } - super.dismiss(); - } - }; - } - @Override public void onStart() { super.onStart(); @@ -96,25 +75,20 @@ public class MapInDialogActivity extends AppCompatActivity { @Override public void onPause() { super.onPause(); - if (mapView != null) { - mapView.onPause(); - } + mapView.onPause(); } @Override public void onStop() { super.onStop(); - if (mapView != null) { - mapView.onStop(); - } + mapView.onStop(); } @Override public void onDestroyView() { super.onDestroyView(); - if (mapView != null) { - mapView.onDestroy(); - } + mapView.onDestroy(); + mapView = null; } @Override diff --git a/platform/android/scripts/exclude-activity-gen.json b/platform/android/scripts/exclude-activity-gen.json index 9e0a1d154f..47c437bd23 100644 --- a/platform/android/scripts/exclude-activity-gen.json +++ b/platform/android/scripts/exclude-activity-gen.json @@ -48,5 +48,6 @@ "EspressoTestActivity", "ChangeResourcesCachePathActivity", "EspressoTestActivity", - "FragmentBackStackActivity" + "FragmentBackStackActivity", + "ChildFragmentMapInDialogActivity" ] -- cgit v1.2.1 From c78b60bf356ad36fc36bce24a184e046cc8066bb Mon Sep 17 00:00:00 2001 From: Zack Mully Date: Fri, 22 Mar 2019 16:00:31 -0400 Subject: remove unneeded permissions (#14208) --- ci.template | 112 ------------------------------------------------------------ 1 file changed, 112 deletions(-) diff --git a/ci.template b/ci.template index f29d8d1608..85e741d5f4 100644 --- a/ci.template +++ b/ci.template @@ -1,4 +1,3 @@ - { "AWSTemplateFormatVersion": "2010-09-09", "Description": "mapbox-gl-native travis resources", @@ -84,35 +83,6 @@ ] } }, - { - "PolicyName": "android", - "PolicyDocument": { - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "ec2:DescribeInstances", - "ec2:RunInstances", - "ec2:CreateTags", - "ec2:GetConsoleOutput" - ], - "Resource": [ - "*" - ] - }, - { - "Effect": "Allow", - "Action": "iam:PassRole", - "Resource": { - "Fn::GetAtt": [ - "AndroidRole", - "Arn" - ] - } - } - ] - } - }, { "PolicyName": "cloudwatch-metrics", "PolicyDocument": { @@ -231,72 +201,6 @@ "Ref": "BuildUser" } } - }, - "AndroidRole": { - "Type": "AWS::IAM::Role", - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Effect": "Allow", - "Principal": { - "Service": [ - "ec2.amazonaws.com" - ] - }, - "Action": [ - "sts:AssumeRole" - ] - } - ] - }, - "Policies": [ - { - "PolicyName": "android-testing", - "PolicyDocument": { - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:PutObject" - ], - "Resource": [ - "arn:aws:s3:::mapbox-gl-testing/android/*" - ] - } - ] - } - }, - { - "PolicyName": "android", - "PolicyDocument": { - "Statement": [ - { - "Effect": "Allow", - "Action": [ - "s3:PutObject" - ], - "Resource": [ - "arn:aws:s3:::mapbox/mapbox-gl-native/android/build/*" - ] - } - ] - } - } - ], - "Path": "/android-gl-build/travis/role/" - } - }, - "AndroidInstanceProfile": { - "Type": "AWS::IAM::InstanceProfile", - "Properties": { - "Roles": [ - { - "Ref": "AndroidRole" - } - ], - "Path": "/android-gl-build/travis/instance-profile/" - } } }, "Outputs": { @@ -312,22 +216,6 @@ "SecretAccessKey" ] } - }, - "AndroidInstanceProfile": { - "Value": { - "Fn::GetAtt": [ - "AndroidInstanceProfile", - "Arn" - ] - } - }, - "AndroidRole": { - "Value": { - "Fn::GetAtt": [ - "AndroidRole", - "Arn" - ] - } } } } -- cgit v1.2.1 From 1d7b243a06c6c3d2def4d1989e93e90250e87cad Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Fri, 22 Mar 2019 13:45:39 -0700 Subject: [ios, macos] Support expressions in formatting parameters. (#14198) Modified MGLAttributedExpression object to support NSExpressions as formatting attributes only. This aligns with GL and Android implementation and specification. Modified the documentation accordingly, and changed MGLFontSizeAttribute to MGLFontScaleAttribute to clarify the true function of the formatting parameter. --- .../darwin/docs/guides/For Style Authors.md.ejs | 2 +- .../docs/guides/Predicates and Expressions.md | 6 +-- platform/darwin/src/MGLAttributedExpression.h | 40 ++++++++++------- platform/darwin/src/MGLAttributedExpression.m | 14 +++--- platform/darwin/src/NSExpression+MGLAdditions.mm | 27 +++-------- .../darwin/test/MGLDocumentationExampleTests.swift | 8 ++-- platform/darwin/test/MGLExpressionTests.mm | 52 ++++++++++++---------- platform/ios/docs/guides/For Style Authors.md | 2 +- platform/macos/docs/guides/For Style Authors.md | 2 +- 9 files changed, 75 insertions(+), 78 deletions(-) diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs index cff6e2f41c..8df541d0f7 100644 --- a/platform/darwin/docs/guides/For Style Authors.md.ejs +++ b/platform/darwin/docs/guides/For Style Authors.md.ejs @@ -439,7 +439,7 @@ can use to update the formatting of `MGLSymbolStyleLayer.text` property. In style JSON | In Objective-C | In Swift --------------|-----------------------|--------- `text-font` | `MGLFontNamesAttribute` | `.fontNamesAttribute` -`font-scale` | `MGLFontSizeAttribute` | `.fontSizeAttribute` +`font-scale` | `MGLFontScaleAttribute` | `.fontScaleAttribute` `text-color` | `MGLFontColorAttribute` | `.fontColorAttribute` See the “[Predicates and Expressions](predicates-and-expressions.html)” guide for diff --git a/platform/darwin/docs/guides/Predicates and Expressions.md b/platform/darwin/docs/guides/Predicates and Expressions.md index 51617c8508..b2e01b94db 100644 --- a/platform/darwin/docs/guides/Predicates and Expressions.md +++ b/platform/darwin/docs/guides/Predicates and Expressions.md @@ -550,9 +550,9 @@ with the `MGLSymbolStyleLayer.text` property. Key | Value Type --- | --- - `MGLFontNamesAttribute` | `NSArray*` - `MGLFontSizeAttribute` | `NSNumber` - `MGLFontColorAttribute` | `UIColor` or `NSColor` on macos + `MGLFontNamesAttribute` | An `NSExpression` evaluating to an `NSString` array. + `MGLFontScaleAttribute` | An `NSExpression` evaluating to an `NSNumber` value. + `MGLFontColorAttribute` | An `NSExpression` evaluating to an `UIColor` (iOS) or `NSColor` (macOS). This function corresponds to the [`format`](https://www.mapbox.com/mapbox-gl-js/style-spec/#expressions-types-format) diff --git a/platform/darwin/src/MGLAttributedExpression.h b/platform/darwin/src/MGLAttributedExpression.h index 32f1a96dae..ea298c7a44 100644 --- a/platform/darwin/src/MGLAttributedExpression.h +++ b/platform/darwin/src/MGLAttributedExpression.h @@ -2,10 +2,16 @@ NS_ASSUME_NONNULL_BEGIN -typedef NSString * MGLAttributedExpressionKey NS_EXTENSIBLE_STRING_ENUM; +/** Options for `MGLAttributedExpression.attributes`. */ +typedef NSString * MGLAttributedExpressionKey NS_TYPED_ENUM; +/** The font name string array expression used to format the text. */ FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontNamesAttribute; -FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontSizeAttribute; + +/** The font scale number expression relative to `MGLSymbolStyleLayer.textFontSize` used to format the text. */ +FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontScaleAttribute; + +/** The font color expression used to format the text. */ FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontColorAttribute; /** @@ -16,10 +22,10 @@ FOUNDATION_EXTERN MGL_EXPORT MGLAttributedExpressionKey const MGLFontColorAttrib ```swift let redColor = UIColor.red let expression = NSExpression(forConstantValue: "Foo") - let attributes: Dictionary = [.fontNamesAttribute : ["DIN Offc Pro Italic", - "Arial Unicode MS Regular"], - .fontSizeAttribute: 1.2, - .fontColorAttribute: redColor] + let attributes: [MGLAttributedExpressionKey: NSExpression] = [.fontNamesAttribute : NSExpression(forConstantValue: ["DIN Offc Pro Italic", + "Arial Unicode MS Regular"]), + .fontScaleAttribute: NSExpression(forConstantValue: 1.2), + .fontColorAttribute: NSExpression(forConstantValue: redColor)] let attributedExpression = MGLAttributedExpression(expression, attributes:attributes) ``` @@ -37,22 +43,22 @@ MGL_EXPORT The formatting attributes dictionary. Key | Value Type --- | --- - `MGLFontNamesAttribute` | `NSArray*` - `MGLFontSizeAttribute` | `NSNumber` - `MGLFontColorAttribute` | `UIColor` + `MGLFontNamesAttribute` | An `NSExpression` evaluating to an `NSString` array. + `MGLFontScaleAttribute` | An `NSExpression` evaluating to an `NSNumber` value. + `MGLFontColorAttribute` | An `NSExpression` evaluating to an `UIColor`. */ -@property (strong, nonatomic, readonly) NSDictionary *attributes; +@property (strong, nonatomic, readonly) NSDictionary *attributes; #else /** The formatting attributes dictionary. Key | Value Type --- | --- - `MGLFontNamesAttribute` | `NSArray*` - `MGLFontSizeAttribute` | `NSNumber` - `MGLFontColorAttribute` | `NSColor` + `MGLFontNamesAttribute` | An `NSExpression` evaluating to an `NSString` array. + `MGLFontScaleAttribute` | An `NSExpression` evaluating to an `NSNumber` value. + `MGLFontColorAttribute` | An `NSExpression` evaluating to an `NSColor` on macos. */ -@property (strong, nonatomic, readonly) NSDictionary *attributes; +@property (strong, nonatomic, readonly) NSDictionary *attributes; #endif @@ -64,17 +70,17 @@ MGL_EXPORT /** Returns an `MGLAttributedExpression` object initialized with an expression and text format attributes. */ -- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs; +- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs; /** Creates an `MGLAttributedExpression` object initialized with an expression and the format attributes for font names and font size. */ -+ (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray *)fontNames fontSize:(nullable NSNumber *)fontSize; ++ (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray *)fontNames fontScale:(nullable NSNumber *)fontScale; /** Creates an `MGLAttributedExpression` object initialized with an expression and the format attributes dictionary. */ -+ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs; ++ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs; @end diff --git a/platform/darwin/src/MGLAttributedExpression.m b/platform/darwin/src/MGLAttributedExpression.m index 000701f7cf..a34480a957 100644 --- a/platform/darwin/src/MGLAttributedExpression.m +++ b/platform/darwin/src/MGLAttributedExpression.m @@ -2,7 +2,7 @@ #import "MGLLoggingConfiguration_Private.h" const MGLAttributedExpressionKey MGLFontNamesAttribute = @"text-font"; -const MGLAttributedExpressionKey MGLFontSizeAttribute = @"font-scale"; +const MGLAttributedExpressionKey MGLFontScaleAttribute = @"font-scale"; const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color"; @implementation MGLAttributedExpression @@ -12,24 +12,24 @@ const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color"; return self; } -+ (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray *)fontNames fontSize:(nullable NSNumber *)fontSize { ++ (instancetype)attributedExpression:(NSExpression *)expression fontNames:(nullable NSArray *)fontNames fontScale:(nullable NSNumber *)fontScale { MGLAttributedExpression *attributedExpression; NSMutableDictionary *attrs = [NSMutableDictionary dictionary]; if (fontNames && fontNames.count > 0) { - attrs[MGLFontNamesAttribute] = fontNames; + attrs[MGLFontNamesAttribute] = [NSExpression expressionForConstantValue:fontNames]; } - if (fontSize) { - attrs[MGLFontSizeAttribute] = fontSize; + if (fontScale) { + attrs[MGLFontScaleAttribute] = [NSExpression expressionForConstantValue:fontScale]; } attributedExpression = [[self alloc] initWithExpression:expression attributes:attrs]; return attributedExpression; } -+ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs { ++ (instancetype)attributedExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs { MGLAttributedExpression *attributedExpression; attributedExpression = [[self alloc] initWithExpression:expression attributes:attrs]; @@ -37,7 +37,7 @@ const MGLAttributedExpressionKey MGLFontColorAttribute = @"text-color"; return attributedExpression; } -- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs { +- (instancetype)initWithExpression:(NSExpression *)expression attributes:(nonnull NSDictionary *)attrs { if (self = [super init]) { MGLLogInfo(@"Starting %@ initialization.", NSStringFromClass([self class])); diff --git a/platform/darwin/src/NSExpression+MGLAdditions.mm b/platform/darwin/src/NSExpression+MGLAdditions.mm index b509c12172..4b1fdb818e 100644 --- a/platform/darwin/src/NSExpression+MGLAdditions.mm +++ b/platform/darwin/src/NSExpression+MGLAdditions.mm @@ -882,19 +882,8 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { attrs = [NSMutableDictionary dictionaryWithDictionary:argumentObjects[index + 1]]; } - if (attrs.count) { - if (NSArray *fontNames = MGL_OBJC_DYNAMIC_CAST(attrs[MGLFontNamesAttribute], NSArray)) { - attrs[MGLFontNamesAttribute] = fontNames[1]; - } - if (NSArray *colorArray = MGL_OBJC_DYNAMIC_CAST(attrs[MGLFontColorAttribute], NSArray)) { - if ([colorArray[0] isEqualToString:@"rgb"] || [colorArray[0] isEqualToString:@"rgba"]) { - NSArray *colorArguments = [colorArray subarrayWithRange:NSMakeRange(1, colorArray.count - 1)]; - NSArray *subexpressions = MGLSubexpressionsWithJSONObjects(colorArguments); - MGLColor *color = [NSExpression mgl_colorWithRGBComponents:subexpressions]; - - attrs[MGLFontColorAttribute] = color; - } - } + for (NSString *key in attrs.allKeys) { + attrs[key] = [NSExpression expressionWithMGLJSONObject:attrs[key]]; } MGLAttributedExpression *attributedExpression = [[MGLAttributedExpression alloc] initWithExpression:expression attributes:attrs]; @@ -1016,17 +1005,15 @@ NSArray *MGLSubexpressionsWithJSONObjects(NSArray *objects) { if ([constantValue isKindOfClass:[MGLAttributedExpression class]]) { MGLAttributedExpression *attributedExpression = (MGLAttributedExpression *)constantValue; id jsonObject = attributedExpression.expression.mgl_jsonExpressionObject; - NSMutableDictionary *attributedDictionary = [NSMutableDictionary dictionary]; + NSMutableDictionary *attributedDictionary = [NSMutableDictionary dictionary]; if (attributedExpression.attributes) { attributedDictionary = [NSMutableDictionary dictionaryWithDictionary:attributedExpression.attributes]; - if (attributedDictionary[MGLFontNamesAttribute]) { - attributedDictionary[MGLFontNamesAttribute] = @[@"literal", attributedDictionary[MGLFontNamesAttribute]]; - } - if (attributedDictionary[MGLFontColorAttribute] && [attributedDictionary[MGLFontColorAttribute] isKindOfClass:[MGLColor class]]) { - MGLColor *color = attributedDictionary[MGLFontColorAttribute]; - attributedDictionary[MGLFontColorAttribute] = color.mgl_jsonExpressionObject; + + for (NSString *key in attributedExpression.attributes.allKeys) { + attributedDictionary[key] = attributedExpression.attributes[key].mgl_jsonExpressionObject; } + } return @[jsonObject, attributedDictionary]; } diff --git a/platform/darwin/test/MGLDocumentationExampleTests.swift b/platform/darwin/test/MGLDocumentationExampleTests.swift index 45efe4c591..2a64fbc601 100644 --- a/platform/darwin/test/MGLDocumentationExampleTests.swift +++ b/platform/darwin/test/MGLDocumentationExampleTests.swift @@ -550,10 +550,10 @@ class MGLDocumentationExampleTests: XCTestCase, MGLMapViewDelegate { let redColor = UIColor.red #endif let expression = NSExpression(forConstantValue: "Foo") - let attributes: Dictionary = [.fontNamesAttribute : ["DIN Offc Pro Italic", - "Arial Unicode MS Regular"], - .fontSizeAttribute: 1.2, - .fontColorAttribute: redColor] + let attributes: [MGLAttributedExpressionKey: NSExpression] = [.fontNamesAttribute : NSExpression(forConstantValue: ["DIN Offc Pro Italic", + "Arial Unicode MS Regular"]), + .fontScaleAttribute: NSExpression(forConstantValue: 1.2), + .fontColorAttribute: NSExpression(forConstantValue: redColor)] let attributedExpression = MGLAttributedExpression(expression, attributes:attributes) //#-end-example-code diff --git a/platform/darwin/test/MGLExpressionTests.mm b/platform/darwin/test/MGLExpressionTests.mm index 2a4d40b4c5..68806e38f6 100644 --- a/platform/darwin/test/MGLExpressionTests.mm +++ b/platform/darwin/test/MGLExpressionTests.mm @@ -992,16 +992,16 @@ using namespace std::string_literals; { MGLAttributedExpression *attribute1 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"foo"] fontNames:nil - fontSize:@(1.2)]; + fontScale:@(1.2)]; MGLAttributedExpression *attribute2 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"biz"] fontNames:nil - fontSize:@(1.0)]; + fontScale:@(1.0)]; MGLAttributedExpression *attribute3 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"bar"] fontNames:nil - fontSize:@(0.8)]; + fontScale:@(0.8)]; MGLAttributedExpression *attribute4 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"\r"] fontNames:@[] - fontSize:nil]; + fontScale:nil]; NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@, %@, %@, %@)", MGLConstantExpression(attribute1), MGLConstantExpression(attribute4), @@ -1014,16 +1014,16 @@ using namespace std::string_literals; { MGLAttributedExpression *attribute1 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"foo"] fontNames:nil - fontSize:@(1.2)]; + fontScale:@(1.2)]; MGLAttributedExpression *attribute2 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"biz"] fontNames:nil - fontSize:@(1.0)]; + fontScale:@(1.0)]; MGLAttributedExpression *attribute3 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"bar"] fontNames:nil - fontSize:@(0.8)]; + fontScale:@(0.8)]; MGLAttributedExpression *attribute4 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"\n"] fontNames:@[] - fontSize:nil]; + fontScale:nil]; NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@, %@, %@, %@)", MGLConstantExpression(attribute1), MGLConstantExpression(attribute4), @@ -1036,7 +1036,7 @@ using namespace std::string_literals; { MGLAttributedExpression *attribute1 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"foo"] fontNames:nil - fontSize:@(1.2)]; + fontScale:@(1.2)]; NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; NSExpression *compatibilityExpression = [NSExpression expressionForFunction:@"mgl_attributed:" arguments:@[MGLConstantExpression(attribute1)]]; @@ -1048,8 +1048,8 @@ using namespace std::string_literals; } { MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"] - attributes:@{ MGLFontSizeAttribute: @(1.2), - MGLFontColorAttribute: @"yellow"}] ; + attributes:@{ MGLFontScaleAttribute: MGLConstantExpression(@(1.2)), + MGLFontColorAttribute: MGLConstantExpression(@"yellow") }] ; NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; NSExpression *compatibilityExpression = [NSExpression expressionForFunction:@"mgl_attributed:" arguments:@[MGLConstantExpression(attribute1)]]; @@ -1068,22 +1068,25 @@ using namespace std::string_literals; XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } { + NSExpression *fontNames = [NSExpression expressionForAggregate:@[ MGLConstantExpression(@"DIN Offc Pro Bold"), MGLConstantExpression(@"Arial Unicode MS Bold") ]]; MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"] - attributes:@{ MGLFontSizeAttribute: @(1.2), - MGLFontColorAttribute: @"yellow", - MGLFontNamesAttribute: @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ] + attributes:@{ MGLFontScaleAttribute: MGLConstantExpression(@(1.2)), + MGLFontColorAttribute: MGLConstantExpression(@"yellow"), + MGLFontNamesAttribute: fontNames }] ; NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; NSArray *jsonExpression = @[ @"format", @"foo", @{ @"font-scale": @1.2, @"text-color": @"yellow" , @"text-font" : @[ @"literal", @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ]]} ]; XCTAssertEqualObjects(expression.mgl_jsonExpressionObject, jsonExpression); + NSExpression *exp = [NSExpression expressionWithMGLJSONObject:jsonExpression]; XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } { + NSExpression *fontNames = [NSExpression expressionForAggregate:@[ MGLConstantExpression(@"DIN Offc Pro Bold"), MGLConstantExpression(@"Arial Unicode MS Bold") ]]; MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionForConstantValue:@"foo"] - attributes:@{ MGLFontSizeAttribute: @(1.2), - MGLFontColorAttribute: [MGLColor redColor], - MGLFontNamesAttribute: @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ] + attributes:@{ MGLFontScaleAttribute: MGLConstantExpression(@(1.2)), + MGLFontColorAttribute: MGLConstantExpression([MGLColor redColor]), + MGLFontNamesAttribute: fontNames }] ; NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; @@ -1092,10 +1095,11 @@ using namespace std::string_literals; XCTAssertEqualObjects([NSExpression expressionWithMGLJSONObject:jsonExpression], expression); } { + NSExpression *fontNames = [NSExpression expressionForAggregate:@[ MGLConstantExpression(@"DIN Offc Pro Bold"), MGLConstantExpression(@"Arial Unicode MS Bold") ]]; MGLAttributedExpression *attribute1 = [[MGLAttributedExpression alloc] initWithExpression:[NSExpression expressionWithFormat:@"CAST(x, 'NSString')"] - attributes:@{ MGLFontSizeAttribute: @(1.2), - MGLFontColorAttribute: [MGLColor redColor], - MGLFontNamesAttribute: @[ @"DIN Offc Pro Bold", @"Arial Unicode MS Bold" ] + attributes:@{ MGLFontScaleAttribute: MGLConstantExpression(@(1.2)), + MGLFontColorAttribute: MGLConstantExpression([MGLColor redColor]), + MGLFontNamesAttribute: fontNames }] ; NSExpression *expression = [NSExpression expressionWithFormat:@"mgl_attributed:(%@)", MGLConstantExpression(attribute1)]; @@ -1106,16 +1110,16 @@ using namespace std::string_literals; { MGLAttributedExpression *attribute1 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"foo"] fontNames:nil - fontSize:@(1.2)]; + fontScale:@(1.2)]; MGLAttributedExpression *attribute2 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"biz"] fontNames:nil - fontSize:@(1.0)]; + fontScale:@(1.0)]; MGLAttributedExpression *attribute3 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"bar"] fontNames:nil - fontSize:@(0.8)]; + fontScale:@(0.8)]; MGLAttributedExpression *attribute4 = [MGLAttributedExpression attributedExpression:[NSExpression expressionForConstantValue:@"\n"] fontNames:@[] - fontSize:nil]; + fontScale:nil]; NSExpression *expression = [NSExpression mgl_expressionForAttributedExpressions:@[MGLConstantExpression(attribute1), MGLConstantExpression(attribute4), MGLConstantExpression(attribute2), diff --git a/platform/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md index 44d5e47262..1acf587cda 100644 --- a/platform/ios/docs/guides/For Style Authors.md +++ b/platform/ios/docs/guides/For Style Authors.md @@ -426,7 +426,7 @@ can use to update the formatting of `MGLSymbolStyleLayer.text` property. In style JSON | In Objective-C | In Swift --------------|-----------------------|--------- `text-font` | `MGLFontNamesAttribute` | `.fontNamesAttribute` -`font-scale` | `MGLFontSizeAttribute` | `.fontSizeAttribute` +`font-scale` | `MGLFontScaleAttribute` | `.fontScaleAttribute` `text-color` | `MGLFontColorAttribute` | `.fontColorAttribute` See the “[Predicates and Expressions](predicates-and-expressions.html)” guide for diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md index 220ce3d50e..5a81eb3593 100644 --- a/platform/macos/docs/guides/For Style Authors.md +++ b/platform/macos/docs/guides/For Style Authors.md @@ -419,7 +419,7 @@ can use to update the formatting of `MGLSymbolStyleLayer.text` property. In style JSON | In Objective-C | In Swift --------------|-----------------------|--------- `text-font` | `MGLFontNamesAttribute` | `.fontNamesAttribute` -`font-scale` | `MGLFontSizeAttribute` | `.fontSizeAttribute` +`font-scale` | `MGLFontScaleAttribute` | `.fontScaleAttribute` `text-color` | `MGLFontColorAttribute` | `.fontColorAttribute` See the “[Predicates and Expressions](predicates-and-expressions.html)” guide for -- cgit v1.2.1 From ac6855a4734be099319e4003eff4951074e7fd57 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Fri, 22 Mar 2019 21:15:00 +0200 Subject: [core] Fix signature of fluent interface setters --- include/mbgl/map/map_options.hpp | 8 ++++---- include/mbgl/storage/resource_options.hpp | 12 ++++++------ platform/darwin/src/MGLMapSnapshotter.mm | 6 +++--- platform/darwin/src/MGLOfflineStorage.mm | 5 +++-- platform/ios/src/MGLMapView.mm | 18 +++++++++--------- platform/macos/src/MGLMapView.mm | 18 +++++++++--------- platform/qt/src/qmapboxgl.cpp | 8 ++++---- src/mbgl/map/map_options.cpp | 16 ++++++++-------- src/mbgl/storage/resource_options.cpp | 24 ++++++++++++------------ 9 files changed, 58 insertions(+), 57 deletions(-) diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index 384b113dba..b5dc2930c9 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -28,7 +28,7 @@ public: * @param mode Map rendering mode. * @return MapOptions for chaining options together. */ - MapOptions withMapMode(MapMode mode); + MapOptions& withMapMode(MapMode mode); /** * @brief Gets the previously set (or default) map mode. @@ -45,7 +45,7 @@ public: * @param mode Map constrain mode. * @return MapOptions for chaining options together. */ - MapOptions withConstrainMode(ConstrainMode mode); + MapOptions& withConstrainMode(ConstrainMode mode); /** * @brief Gets the previously set (or default) constrain mode. @@ -61,7 +61,7 @@ public: * @param mode Viewport mode. * @return MapOptions for chaining options together. */ - MapOptions withViewportMode(ViewportMode mode); + MapOptions& withViewportMode(ViewportMode mode); /** * @brief Gets the previously set (or default) viewport mode. @@ -77,7 +77,7 @@ public: * @param enableCollisions true to enable, false to disable * @return MapOptions for chaining options together. */ - MapOptions withCrossSourceCollisions(bool enableCollisions); + MapOptions& withCrossSourceCollisions(bool enableCollisions); /** * @brief Gets the previously set (or default) crossSourceCollisions value. diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp index 958392175c..e8a56920e0 100644 --- a/include/mbgl/storage/resource_options.hpp +++ b/include/mbgl/storage/resource_options.hpp @@ -25,7 +25,7 @@ public: * @param token Mapbox access token. * @return ResourceOptions for chaining options together. */ - ResourceOptions withAccessToken(std::string token); + ResourceOptions& withAccessToken(std::string token); /** * @brief Gets the previously set (or default) Mapbox access token. @@ -40,7 +40,7 @@ public: * @param baseURL API base URL. * @return ResourceOptions for chaining options together. */ - ResourceOptions withBaseURL(std::string baseURL); + ResourceOptions& withBaseURL(std::string baseURL); /** * @brief Gets the previously set (or default) API base URL. @@ -55,7 +55,7 @@ public: * @param path Cache path. * @return ResourceOptions for chaining options together. */ - ResourceOptions withCachePath(std::string path); + ResourceOptions& withCachePath(std::string path); /** * @brief Gets the previously set (or default) cache path. @@ -71,7 +71,7 @@ public: * @param path Asset path. * @return ResourceOptions for chaining options together. */ - ResourceOptions withAssetPath(std::string path); + ResourceOptions& withAssetPath(std::string path); /** * @brief Gets the previously set (or default) asset path. @@ -86,7 +86,7 @@ public: * @param size Cache maximum size in bytes. * @return reference to ResourceOptions for chaining options together. */ - ResourceOptions withMaximumCacheSize(uint64_t size); + ResourceOptions& withMaximumCacheSize(uint64_t size); /** * @brief Gets the previously set (or default) maximum allowed cache size. @@ -102,7 +102,7 @@ public: * @param context Platform context. * @return reference to ResourceOptions for chaining options together. */ - ResourceOptions withPlatformContext(void* context); + ResourceOptions& withPlatformContext(void* context); /** * @brief Gets the previously set (or default) platform context. diff --git a/platform/darwin/src/MGLMapSnapshotter.mm b/platform/darwin/src/MGLMapSnapshotter.mm index 00ec45f7ff..171f24e4d0 100644 --- a/platform/darwin/src/MGLMapSnapshotter.mm +++ b/platform/darwin/src/MGLMapSnapshotter.mm @@ -624,9 +624,9 @@ const CGFloat MGLSnapshotterMinimumPixelSize = 64; // App-global configuration MGLRendererConfiguration* config = [MGLRendererConfiguration currentConfiguration]; - auto resourceOptions = mbgl::ResourceOptions() - .withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) - .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); + mbgl::ResourceOptions resourceOptions; + resourceOptions.withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); // Create the snapshotter _mbglMapSnapshotter = std::make_unique( diff --git a/platform/darwin/src/MGLOfflineStorage.mm b/platform/darwin/src/MGLOfflineStorage.mm index 5f3b2c7c20..6effd8c3ce 100644 --- a/platform/darwin/src/MGLOfflineStorage.mm +++ b/platform/darwin/src/MGLOfflineStorage.mm @@ -226,8 +226,9 @@ const MGLExceptionName MGLUnsupportedRegionTypeException = @"MGLUnsupportedRegio } _mbglCachePath = cachePath.UTF8String; - auto options = mbgl::ResourceOptions().withCachePath(_mbglCachePath) - .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); + mbgl::ResourceOptions options; + options.withCachePath(_mbglCachePath) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); _mbglFileSource = std::static_pointer_cast(mbgl::FileSource::getSharedFileSource(options)); // Observe for changes to the API base URL (and find out the current one). diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 793d95fffe..50e022013b 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -477,15 +477,15 @@ public: BOOL enableCrossSourceCollisions = !config.perSourceCollisions; _rendererFrontend = std::make_unique(std::move(renderer), self, *_mbglView); - auto mapOptions = mbgl::MapOptions() - .withMapMode(mbgl::MapMode::Continuous) - .withConstrainMode(mbgl::ConstrainMode::None) - .withViewportMode(mbgl::ViewportMode::Default) - .withCrossSourceCollisions(enableCrossSourceCollisions); - - auto resourceOptions = mbgl::ResourceOptions() - .withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) - .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); + mbgl::MapOptions mapOptions; + mapOptions.withMapMode(mbgl::MapMode::Continuous) + .withConstrainMode(mbgl::ConstrainMode::None) + .withViewportMode(mbgl::ViewportMode::Default) + .withCrossSourceCollisions(enableCrossSourceCollisions); + + mbgl::ResourceOptions resourceOptions; + resourceOptions.withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); NSAssert(!_mbglMap, @"_mbglMap should be NULL"); _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index 74189c52f4..c8e3d07908 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -290,15 +290,15 @@ public: BOOL enableCrossSourceCollisions = !config.perSourceCollisions; _rendererFrontend = std::make_unique(std::move(renderer), self, *_mbglView, true); - auto mapOptions = mbgl::MapOptions() - .withMapMode(mbgl::MapMode::Continuous) - .withConstrainMode(mbgl::ConstrainMode::None) - .withViewportMode(mbgl::ViewportMode::Default) - .withCrossSourceCollisions(enableCrossSourceCollisions); - - auto resourceOptions = mbgl::ResourceOptions() - .withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) - .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); + mbgl::MapOptions mapOptions; + mapOptions.withMapMode(mbgl::MapMode::Continuous) + .withConstrainMode(mbgl::ConstrainMode::None) + .withViewportMode(mbgl::ViewportMode::Default) + .withCrossSourceCollisions(enableCrossSourceCollisions); + + mbgl::ResourceOptions resourceOptions; + resourceOptions.withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) + .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 1feeecdd7c..82b157d57a 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1706,19 +1706,19 @@ void QMapboxGL::connectionEstablished() */ mbgl::MapOptions mapOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings) { - return mbgl::MapOptions() + return std::move(mbgl::MapOptions() .withMapMode(static_cast(settings.mapMode())) .withConstrainMode(static_cast(settings.constrainMode())) - .withViewportMode(static_cast(settings.viewportMode())); + .withViewportMode(static_cast(settings.viewportMode()))); } mbgl::ResourceOptions resourceOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings) { - return mbgl::ResourceOptions() + return std::move(mbgl::ResourceOptions() .withAccessToken(settings.accessToken().toStdString()) .withAssetPath(settings.assetPath().toStdString()) .withBaseURL(settings.apiBaseUrl().toStdString()) .withCachePath(settings.cacheDatabasePath().toStdString()) - .withMaximumCacheSize(settings.cacheDatabaseMaximumSize()); + .withMaximumCacheSize(settings.cacheDatabaseMaximumSize())); } QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settings, const QSize &size, qreal pixelRatio_) diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index c1146ab0bc..d0588a44eb 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -16,36 +16,36 @@ MapOptions::~MapOptions() = default; MapOptions::MapOptions(MapOptions&&) = default; MapOptions::MapOptions(const MapOptions& other) : impl_(std::make_unique(*other.impl_)) {} -MapOptions MapOptions::withMapMode(MapMode mode) { +MapOptions& MapOptions::withMapMode(MapMode mode) { impl_->mapMode = mode; - return std::move(*this); + return *this; } MapMode MapOptions::mapMode() const { return impl_->mapMode; } -MapOptions MapOptions::withConstrainMode(ConstrainMode mode) { +MapOptions& MapOptions::withConstrainMode(ConstrainMode mode) { impl_->constrainMode = mode; - return std::move(*this); + return *this; } ConstrainMode MapOptions::constrainMode() const { return impl_->constrainMode; } -MapOptions MapOptions::withViewportMode(ViewportMode mode) { +MapOptions& MapOptions::withViewportMode(ViewportMode mode) { impl_->viewportMode = mode; - return std::move(*this); + return *this; } ViewportMode MapOptions::viewportMode() const { return impl_->viewportMode; } -MapOptions MapOptions::withCrossSourceCollisions(bool enableCollisions) { +MapOptions& MapOptions::withCrossSourceCollisions(bool enableCollisions) { impl_->crossSourceCollisions = enableCollisions; - return std::move(*this); + return *this; } bool MapOptions::crossSourceCollisions() const { diff --git a/src/mbgl/storage/resource_options.cpp b/src/mbgl/storage/resource_options.cpp index dcd7f84f7e..600b535228 100644 --- a/src/mbgl/storage/resource_options.cpp +++ b/src/mbgl/storage/resource_options.cpp @@ -19,54 +19,54 @@ ResourceOptions::~ResourceOptions() = default; ResourceOptions::ResourceOptions(ResourceOptions&&) = default; ResourceOptions::ResourceOptions(const ResourceOptions& other) : impl_(std::make_unique(*other.impl_)) {} -ResourceOptions ResourceOptions::withAccessToken(std::string token) { +ResourceOptions& ResourceOptions::withAccessToken(std::string token) { impl_->accessToken = std::move(token); - return std::move(*this); + return *this; } const std::string& ResourceOptions::accessToken() const { return impl_->accessToken; } -ResourceOptions ResourceOptions::withBaseURL(std::string url) { +ResourceOptions& ResourceOptions::withBaseURL(std::string url) { impl_->baseURL = std::move(url); - return std::move(*this); + return *this; } const std::string& ResourceOptions::baseURL() const { return impl_->baseURL; } -ResourceOptions ResourceOptions::withCachePath(std::string path) { +ResourceOptions& ResourceOptions::withCachePath(std::string path) { impl_->cachePath = std::move(path); - return std::move(*this); + return *this; } const std::string& ResourceOptions::cachePath() const { return impl_->cachePath; } -ResourceOptions ResourceOptions::withAssetPath(std::string path) { +ResourceOptions& ResourceOptions::withAssetPath(std::string path) { impl_->assetPath = std::move(path); - return std::move(*this); + return *this; } const std::string& ResourceOptions::assetPath() const { return impl_->assetPath; } -ResourceOptions ResourceOptions::withMaximumCacheSize(uint64_t size) { +ResourceOptions& ResourceOptions::withMaximumCacheSize(uint64_t size) { impl_->maximumSize = size; - return std::move(*this); + return *this; } uint64_t ResourceOptions::maximumCacheSize() const { return impl_->maximumSize; } -ResourceOptions ResourceOptions::withPlatformContext(void* context) { +ResourceOptions& ResourceOptions::withPlatformContext(void* context) { impl_->platformContext = context; - return std::move(*this); + return *this; } void* ResourceOptions::platformContext() const { -- cgit v1.2.1 From ee5be6dff1b106afa43fac6d714a40446144b667 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 20 Mar 2019 18:54:34 +0100 Subject: [android] - validate license generatrion with nitpick on CI --- platform/android/gradle/android-nitpick.gradle | 10 ++++++++++ platform/android/scripts/validate-license.py | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 platform/android/scripts/validate-license.py diff --git a/platform/android/gradle/android-nitpick.gradle b/platform/android/gradle/android-nitpick.gradle index f8e4a47b0b..32539270f5 100644 --- a/platform/android/gradle/android-nitpick.gradle +++ b/platform/android/gradle/android-nitpick.gradle @@ -17,6 +17,8 @@ task androidNitpick { verifyVendorSubmodulePin(MAPBOX_JAVA_DIR, MAPBOX_JAVA_TAG_PREFIX, versions.mapboxServices) verifyVendorSubmodulePin(MAPBOX_TELEMETRY_DIR, MAPBOX_TELEMETRY_TAG_PREFIX, versions.mapboxTelemetry) verifyVendorSubmodulePin(MAPBOX_GESTURES_DIR, MAPBOX_GESTURES_TAG_PREFIX, versions.mapboxGestures) + + verifyLicenseGeneration() } } @@ -51,4 +53,12 @@ private def verifyVendorSubmodulePin(def dir, def prefix, def version) { "If you've bumped the pin, make sure to verify the version tag prefix in the android-nitpick.gradle file.") } output.close() +} + +private def verifyLicenseGeneration() { + println "Verify license generation with git diff..." + exec { + workingDir = "${rootDir}" + commandLine "python", "scripts/validate-license.py" + } } \ No newline at end of file diff --git a/platform/android/scripts/validate-license.py b/platform/android/scripts/validate-license.py new file mode 100644 index 0000000000..365d7ac265 --- /dev/null +++ b/platform/android/scripts/validate-license.py @@ -0,0 +1,17 @@ +#!/usr/bin/python + +from subprocess import call +from subprocess import Popen, PIPE +import sys + +## Run license generation +call('cd ../../ && make android-license', shell=True) + +## Git diff changes +p = Popen(['git', 'diff', '--name-only', 'LICENSE.md'], stdin=PIPE, stdout=PIPE, stderr=PIPE) +output, err = p.communicate(b"input data that is passed to subprocess' stdin") +if "platform/android/LICENSE.md" in output: + raise ValueError("""An error ocurred while validating the license generation. + Changes were detected to the license generation output + but weren't commited. Run make android-license and + commit the changeset to make this validation pass.""") \ No newline at end of file -- cgit v1.2.1 From 067ff28d0ac5c35c399069457051e53f900696a0 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Sun, 24 Mar 2019 17:15:37 +0200 Subject: [core] ResoureOptions explicit copy via clone() --- include/mbgl/map/map_options.hpp | 3 +-- include/mbgl/storage/resource_options.hpp | 7 +++++-- platform/android/src/file_source.cpp | 2 +- platform/default/src/mbgl/map/map_snapshotter.cpp | 2 +- src/mbgl/map/map_options.cpp | 3 +-- src/mbgl/storage/resource_options.cpp | 6 +++++- 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index b5dc2930c9..617a2d793a 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -17,8 +17,7 @@ public: MapOptions(); ~MapOptions(); - MapOptions(MapOptions&&); - explicit MapOptions(const MapOptions&); + MapOptions(MapOptions&&) noexcept; /** * @brief Sets the map rendering mode. By default, it is set to Continuous diff --git a/include/mbgl/storage/resource_options.hpp b/include/mbgl/storage/resource_options.hpp index e8a56920e0..6d603b8cca 100644 --- a/include/mbgl/storage/resource_options.hpp +++ b/include/mbgl/storage/resource_options.hpp @@ -16,8 +16,9 @@ public: ResourceOptions(); ~ResourceOptions(); - ResourceOptions(ResourceOptions&&); - explicit ResourceOptions(const ResourceOptions&); + ResourceOptions(ResourceOptions&&) noexcept; + + ResourceOptions clone() const; /** * @brief Sets the Mapbox access token - see https://docs.mapbox.com/help/how-mapbox-works/access-tokens/ for details. @@ -112,6 +113,8 @@ public: void* platformContext() const; private: + ResourceOptions(const ResourceOptions&); + class Impl; std::unique_ptr impl_; }; diff --git a/platform/android/src/file_source.cpp b/platform/android/src/file_source.cpp index 94db563efc..41081cd0fb 100644 --- a/platform/android/src/file_source.cpp +++ b/platform/android/src/file_source.cpp @@ -120,7 +120,7 @@ FileSource* FileSource::getNativePeer(jni::JNIEnv& env, const jni::Object& jFileSource) { FileSource* fileSource = FileSource::getNativePeer(env, jFileSource); assert(fileSource != nullptr); - return mbgl::ResourceOptions(fileSource->resourceOptions); + return fileSource->resourceOptions.clone(); } void FileSource::registerNative(jni::JNIEnv& env) { diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index cd8482e4ba..ca5eadafbc 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -174,7 +174,7 @@ MapSnapshotter::MapSnapshotter(std::shared_ptr scheduler, const ResourceOptions& resourceOptions) : impl(std::make_unique>( "Map Snapshotter", std::move(scheduler), style, size, pixelRatio, cameraOptions, - region, programCacheDir, localFontFamily, resourceOptions)) {} + region, programCacheDir, localFontFamily, resourceOptions.clone())) {} MapSnapshotter::~MapSnapshotter() = default; diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index d0588a44eb..7c254476d6 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -13,8 +13,7 @@ public: // These requires the complete type of Impl. MapOptions::MapOptions() : impl_(std::make_unique()) {} MapOptions::~MapOptions() = default; -MapOptions::MapOptions(MapOptions&&) = default; -MapOptions::MapOptions(const MapOptions& other) : impl_(std::make_unique(*other.impl_)) {} +MapOptions::MapOptions(MapOptions&&) noexcept = default; MapOptions& MapOptions::withMapMode(MapMode mode) { impl_->mapMode = mode; diff --git a/src/mbgl/storage/resource_options.cpp b/src/mbgl/storage/resource_options.cpp index 600b535228..c56a22540b 100644 --- a/src/mbgl/storage/resource_options.cpp +++ b/src/mbgl/storage/resource_options.cpp @@ -16,9 +16,13 @@ public: // These requires the complete type of Impl. ResourceOptions::ResourceOptions() : impl_(std::make_unique()) {} ResourceOptions::~ResourceOptions() = default; -ResourceOptions::ResourceOptions(ResourceOptions&&) = default; +ResourceOptions::ResourceOptions(ResourceOptions&&) noexcept = default; ResourceOptions::ResourceOptions(const ResourceOptions& other) : impl_(std::make_unique(*other.impl_)) {} +ResourceOptions ResourceOptions::clone() const { + return ResourceOptions(*this); +} + ResourceOptions& ResourceOptions::withAccessToken(std::string token) { impl_->accessToken = std::move(token); return *this; -- cgit v1.2.1 From 81c48bbca7044fd29b649dc3de1aba5c50b82a05 Mon Sep 17 00:00:00 2001 From: Sam Fader Date: Mon, 25 Mar 2019 09:05:19 -0700 Subject: quick typo fix for OnDidFinishRenderingMapListener method (#14209) --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapView.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java index f87c6a854a..23ce2bdef0 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapView.java @@ -911,7 +911,7 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { /** * Called when the map has finished rendering. * - * @param fully true if map is fully rendered, false if fully rendered + * @param fully true if map is fully rendered, false if not fully rendered */ void onDidFinishRenderingMap(boolean fully); } @@ -1257,4 +1257,4 @@ public class MapView extends FrameLayout implements NativeMapView.ViewCallback { public static void setMapStrictModeEnabled(boolean strictModeEnabled) { MapStrictMode.setStrictModeEnabled(strictModeEnabled); } -} \ No newline at end of file +} -- cgit v1.2.1 From 10114c85bba9c2c0e62aa6361b887717f9f05921 Mon Sep 17 00:00:00 2001 From: Fabian Guerra Soto Date: Mon, 25 Mar 2019 09:25:08 -0700 Subject: [ios, macos, build] Remove DEBUG from logging configuration. (#13933) * [ios, macos] Change the debug flag usage to NDEBUG. * [ios, macos] Add NDEBUG preprocessor macro to ios/macos project conf. --- platform/darwin/src/MGLLoggingConfiguration.h | 2 +- platform/ios/ios.xcodeproj/project.pbxproj | 2 ++ platform/macos/macos.xcodeproj/project.pbxproj | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/darwin/src/MGLLoggingConfiguration.h b/platform/darwin/src/MGLLoggingConfiguration.h index 6782dc60a7..d79336df4c 100644 --- a/platform/darwin/src/MGLLoggingConfiguration.h +++ b/platform/darwin/src/MGLLoggingConfiguration.h @@ -4,7 +4,7 @@ #ifndef MGL_LOGGING_DISABLED #ifndef MGL_LOGGING_ENABLE_DEBUG - #ifdef DEBUG + #ifndef NDEBUG #define MGL_LOGGING_ENABLE_DEBUG 1 #endif #endif diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 535f83728f..a514f4a017 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -3862,6 +3862,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREFIX_HEADER = "$SRCROOT/src/Mapbox-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; HEADER_SEARCH_PATHS = ( "$(mbgl_core_INCLUDE_DIRECTORIES)", "$(mbgl_filesource_INCLUDE_DIRECTORIES)", @@ -4296,6 +4297,7 @@ DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; GCC_PREFIX_HEADER = "$SRCROOT/src/Mapbox-Prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; HEADER_SEARCH_PATHS = ( "$(mbgl_core_INCLUDE_DIRECTORIES)", "$(mbgl_filesource_INCLUDE_DIRECTORIES)", diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index 5d5a94c78a..57c4f198f0 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -2008,6 +2008,7 @@ GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_CPP_RTTI = NO; GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = "NDEBUG=1"; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; -- cgit v1.2.1 From 419bfbe0eb12db8144bc5361bcc90b419e28f429 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Mon, 25 Mar 2019 14:22:35 +0100 Subject: [core] harden fetching camera for bounds when padding is excessive --- src/mbgl/map/map.cpp | 9 +++++++-- test/map/map.test.cpp | 12 ++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 24b2435923..54a95ceaeb 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -205,8 +205,13 @@ CameraOptions cameraForLatLngs(const std::vector& latLngs, const Transfo scaleY -= (padding.top() + padding.bottom()) / height; minScale = util::min(scaleX, scaleY); } - double zoom = transform.getZoom() + util::log2(minScale); - zoom = util::clamp(zoom, transform.getState().getMinZoom(), transform.getState().getMaxZoom()); + + double zoom = transform.getZoom(); + if (minScale > 0) { + zoom = util::clamp(zoom + util::log2(minScale), transform.getState().getMinZoom(), transform.getState().getMaxZoom()); + } else { + Log::Error(Event::General, "Unable to calculate appropriate zoom level for bounds. Vertical or horizontal padding is greater than map's height or width."); + } // Calculate the center point of a virtual bounds that is extended in all directions by padding. ScreenCoordinate centerPixel = nePixel + swPixel; diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index c06fa53744..fc8a7bffba 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -151,6 +151,18 @@ TEST(Map, LatLngBoundsToCamera) { EXPECT_NEAR(*virtualCamera.zoom, 1.55467, 1e-5); } +TEST(Map, LatLngBoundsToCameraWithExcessivePadding) { + MapTest<> test; + + test.map.jumpTo(CameraOptions().withCenter(LatLng { 40.712730, -74.005953 }).withZoom(16.0)); + + LatLngBounds bounds = LatLngBounds::hull({15.68169,73.499857}, {53.560711, 134.77281}); + + CameraOptions virtualCamera = test.map.cameraForLatLngBounds(bounds, {500, 0, 1200, 0}); + ASSERT_TRUE(bounds.contains(*virtualCamera.center)); + EXPECT_NEAR(*virtualCamera.zoom, 16.0, 1e-5); +} + TEST(Map, LatLngBoundsToCameraWithBearing) { MapTest<> test; -- cgit v1.2.1 From c397fd853c8f5743385cc28596d0c7d261d2d1b6 Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Mon, 25 Mar 2019 17:47:10 +0200 Subject: [core] Bump args to 6.2.2 (does not use RTTI) --- .gitmodules | 3 +++ bin/offline.cpp | 2 +- bin/render.cpp | 2 +- cmake/glfw.cmake | 6 +----- cmake/mason-dependencies.cmake | 3 --- cmake/offline.cmake | 6 +----- cmake/render.cmake | 6 +----- cmake/vendor.cmake | 1 + platform/glfw/main.cpp | 2 +- scripts/generate-file-lists.js | 1 + vendor/args | 1 + vendor/args-files.json | 8 ++++++++ vendor/args.cmake | 5 +++++ 13 files changed, 25 insertions(+), 21 deletions(-) create mode 160000 vendor/args create mode 100644 vendor/args-files.json create mode 100644 vendor/args.cmake diff --git a/.gitmodules b/.gitmodules index a36fee4c0e..aeb2663b84 100644 --- a/.gitmodules +++ b/.gitmodules @@ -91,3 +91,6 @@ [submodule "platform/darwin/docs/theme"] path = platform/darwin/docs/theme url = https://github.com/mapbox/jazzy-theme.git +[submodule "vendor/args"] + path = vendor/args + url = https://github.com/Taywee/args diff --git a/bin/offline.cpp b/bin/offline.cpp index e5ce1f75fe..5cd43adfe3 100644 --- a/bin/offline.cpp +++ b/bin/offline.cpp @@ -5,7 +5,7 @@ #include -#include +#include #include #include diff --git a/bin/render.cpp b/bin/render.cpp index 41701913b0..c22d551928 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include diff --git a/cmake/glfw.cmake b/cmake/glfw.cmake index a2adb9fbb5..4ef6890cef 100644 --- a/cmake/glfw.cmake +++ b/cmake/glfw.cmake @@ -2,9 +2,6 @@ add_executable(mbgl-glfw platform/glfw/main.cpp ) -# args requires RTTI -set_source_files_properties(platform/glfw/main.cpp PROPERTIES COMPILE_OPTIONS "-frtti") - target_sources(mbgl-glfw PRIVATE platform/glfw/glfw_view.hpp PRIVATE platform/glfw/glfw_view.cpp @@ -23,10 +20,9 @@ target_link_libraries(mbgl-glfw PRIVATE mbgl-core PRIVATE glfw PRIVATE cheap-ruler-cpp + PRIVATE args ) -target_add_mason_package(mbgl-glfw PRIVATE args) - mbgl_platform_glfw() create_source_groups(mbgl-glfw) diff --git a/cmake/mason-dependencies.cmake b/cmake/mason-dependencies.cmake index 71a94f096f..a6ef7a3a53 100644 --- a/cmake/mason-dependencies.cmake +++ b/cmake/mason-dependencies.cmake @@ -8,14 +8,11 @@ elseif(MBGL_PLATFORM STREQUAL "linux") mason_use(libuv VERSION 1.9.1) mason_use(libpng VERSION 1.6.25) mason_use(libjpeg-turbo VERSION 1.5.0) - mason_use(args VERSION 6.2.0 HEADER_ONLY) if(WITH_EGL) mason_use(swiftshader VERSION 2018-05-31) endif() elseif(MBGL_PLATFORM STREQUAL "macos") - mason_use(args VERSION 6.2.0 HEADER_ONLY) - if(WITH_EGL) mason_use(swiftshader VERSION 2018-05-31) endif() diff --git a/cmake/offline.cmake b/cmake/offline.cmake index b751125297..3fa075f07b 100644 --- a/cmake/offline.cmake +++ b/cmake/offline.cmake @@ -2,9 +2,6 @@ add_executable(mbgl-offline bin/offline.cpp ) -# args requires RTTI -set_source_files_properties(bin/offline.cpp PROPERTIES COMPILE_OPTIONS "-frtti") - target_sources(mbgl-offline PRIVATE platform/default/include/mbgl/util/default_styles.hpp ) @@ -15,10 +12,9 @@ target_include_directories(mbgl-offline target_link_libraries(mbgl-offline PRIVATE mbgl-core + PRIVATE args ) -target_add_mason_package(mbgl-offline PRIVATE args) - mbgl_platform_offline() create_source_groups(mbgl-offline) diff --git a/cmake/render.cmake b/cmake/render.cmake index 776c859bad..a625b3f21f 100644 --- a/cmake/render.cmake +++ b/cmake/render.cmake @@ -2,19 +2,15 @@ add_executable(mbgl-render bin/render.cpp ) -# args requires RTTI -set_source_files_properties(bin/render.cpp PROPERTIES COMPILE_OPTIONS "-frtti") - target_include_directories(mbgl-render PRIVATE platform/default/include ) target_link_libraries(mbgl-render PRIVATE mbgl-core + PRIVATE args ) -target_add_mason_package(mbgl-render PRIVATE args) - mbgl_platform_render() create_source_groups(mbgl-render) diff --git a/cmake/vendor.cmake b/cmake/vendor.cmake index ddeefad76d..7aac53e4cb 100644 --- a/cmake/vendor.cmake +++ b/cmake/vendor.cmake @@ -29,5 +29,6 @@ include(${CMAKE_SOURCE_DIR}/vendor/vector-tile.cmake) include(${CMAKE_SOURCE_DIR}/vendor/wagyu.cmake) if(MBGL_PLATFORM STREQUAL "linux" OR MBGL_PLATFORM STREQUAL "macos") + include(${CMAKE_SOURCE_DIR}/vendor/args.cmake) include(${CMAKE_SOURCE_DIR}/vendor/glfw.cmake) endif() diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 77585718e1..c27e5fe8ce 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/scripts/generate-file-lists.js b/scripts/generate-file-lists.js index 37e4dbc20b..760a01d87c 100755 --- a/scripts/generate-file-lists.js +++ b/scripts/generate-file-lists.js @@ -124,6 +124,7 @@ generateXcodeSourceList('platform/macos/macos.xcodeproj', 'dynamic', 'sdk'); generateXcodeSourceList('platform/ios/ios.xcodeproj', 'dynamic', 'sdk'); const vendorRegex = /^(?:(?:src|include)\/)?(?:(.+)\/)?[^\/]+$/ +generateFileList('vendor/args-files.json', 'vendor/args', vendorRegex, [ "args.hxx" ]); generateFileList('vendor/boost-files.json', 'vendor/boost', vendorRegex, [ "include/**/*.hpp", "include/**/*.h" ]); generateFileList('vendor/cheap-ruler-cpp-files.json', 'vendor/cheap-ruler-cpp', vendorRegex, [ "include/**/*.hpp" ]); generateFileList('vendor/earcut.hpp-files.json', 'vendor/earcut.hpp', vendorRegex, [ "include/**/*.hpp" ]); diff --git a/vendor/args b/vendor/args new file mode 160000 index 0000000000..f68b7e186c --- /dev/null +++ b/vendor/args @@ -0,0 +1 @@ +Subproject commit f68b7e186cd2a020cbddfe3194c1d8ddfeeb1013 diff --git a/vendor/args-files.json b/vendor/args-files.json new file mode 100644 index 0000000000..c3c9bb64c6 --- /dev/null +++ b/vendor/args-files.json @@ -0,0 +1,8 @@ +{ + "//": "This file is generated. Do not edit. Regenerate it with scripts/generate-file-lists.js", + "sources": [], + "public_headers": { + "args.hxx": "vendor/args/args.hxx" + }, + "private_headers": {} +} diff --git a/vendor/args.cmake b/vendor/args.cmake new file mode 100644 index 0000000000..b5839943c2 --- /dev/null +++ b/vendor/args.cmake @@ -0,0 +1,5 @@ +add_library(args INTERFACE) + +target_include_directories(args SYSTEM INTERFACE + ${CMAKE_SOURCE_DIR}/vendor/args +) -- cgit v1.2.1 From 36e63603ec54d25f6f0843c89bb436db1e8997fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Tue, 26 Mar 2019 13:52:11 +0100 Subject: [android] provide more information when the OfflineManager test times out --- .../testapp/offline/OfflineManagerTest.kt | 83 ++++++++++++++-------- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt index 017c0f1f04..8e5f3f7c5f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/offline/OfflineManagerTest.kt @@ -8,17 +8,21 @@ import com.mapbox.mapboxsdk.offline.OfflineRegion import com.mapbox.mapboxsdk.storage.FileSource import com.mapbox.mapboxsdk.testapp.activity.FeatureOverviewActivity import com.mapbox.mapboxsdk.testapp.utils.FileUtils +import org.junit.FixMethodOrder import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith +import org.junit.runners.MethodSorters import java.io.IOException import java.util.concurrent.CountDownLatch +@FixMethodOrder(MethodSorters.NAME_ASCENDING) @RunWith(AndroidJUnit4::class) class OfflineManagerTest { companion object { private const val TEST_DB_FILE_NAME = "offline_test.db" + private lateinit var mergedRegion: OfflineRegion } @Rule @@ -26,14 +30,14 @@ class OfflineManagerTest { var rule = ActivityTestRule(FeatureOverviewActivity::class.java) private val context: Context by lazy { rule.activity } - private val latch: CountDownLatch = CountDownLatch(1) - @Test - fun offlineMergeListDeleteTest() { + @Test(timeout = 30_000) + fun a_copyFileFromAssets() { + val latch = CountDownLatch(1) rule.runOnUiThread { FileUtils.CopyFileFromAssetsTask(rule.activity, object : FileUtils.OnFileCopiedFromAssetsListener { override fun onFileCopiedFromAssets() { - mergeRegion() + latch.countDown() } override fun onError() { @@ -44,42 +48,59 @@ class OfflineManagerTest { latch.await() } - private fun mergeRegion() { - OfflineManager.getInstance(context).mergeOfflineRegions( - FileSource.getResourcesCachePath(rule.activity) + "/" + TEST_DB_FILE_NAME, - object : OfflineManager.MergeOfflineRegionsCallback { - override fun onMerge(offlineRegions: Array?) { + @Test(timeout = 30_000) + fun b_mergeRegion() { + val latch = CountDownLatch(1) + rule.runOnUiThread { + OfflineManager.getInstance(context).mergeOfflineRegions( + FileSource.getResourcesCachePath(rule.activity) + "/" + TEST_DB_FILE_NAME, + object : OfflineManager.MergeOfflineRegionsCallback { + override fun onMerge(offlineRegions: Array?) { + assert(offlineRegions?.size == 1) + latch.countDown() + } + + override fun onError(error: String?) { + throw RuntimeException("Unable to merge external offline database. $error") + } + }) + } + latch.await() + } + + @Test(timeout = 30_000) + fun c_listRegion() { + val latch = CountDownLatch(1) + rule.runOnUiThread { + OfflineManager.getInstance(context).listOfflineRegions(object : OfflineManager.ListOfflineRegionsCallback { + override fun onList(offlineRegions: Array?) { assert(offlineRegions?.size == 1) - listRegion() + mergedRegion = offlineRegions!![0] + latch.countDown() } override fun onError(error: String?) { throw RuntimeException("Unable to merge external offline database. $error") } }) + } + latch.await() } - private fun listRegion() { - OfflineManager.getInstance(context).listOfflineRegions(object : OfflineManager.ListOfflineRegionsCallback { - override fun onList(offlineRegions: Array?) { - assert(offlineRegions?.size == 1) - deleteRegion(offlineRegions!![0]) - } - override fun onError(error: String?) { - throw RuntimeException("Unable to merge external offline database. $error") - } - }) - } - - private fun deleteRegion(offlineRegion: OfflineRegion) { - offlineRegion.delete(object : OfflineRegion.OfflineRegionDeleteCallback { - override fun onDelete() { - latch.countDown() - } + @Test(timeout = 30_000) + fun d_deleteRegion() { + val latch = CountDownLatch(1) + rule.runOnUiThread { + mergedRegion.delete(object : OfflineRegion.OfflineRegionDeleteCallback { + override fun onDelete() { + latch.countDown() + } - override fun onError(error: String?) { - throw RuntimeException("Unable to delete region") - } - }) + override fun onError(error: String?) { + throw RuntimeException("Unable to delete region") + } + }) + } + latch.await() } } \ No newline at end of file -- cgit v1.2.1 From d97ff6ae0570212f2e54ef560e1017482837192b Mon Sep 17 00:00:00 2001 From: Fredrik Karlsson Date: Tue, 26 Mar 2019 21:11:04 +0100 Subject: [ios, macos] Open project using selected toolchain --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index afbcd70d0f..df1ba21afd 100644 --- a/Makefile +++ b/Makefile @@ -95,7 +95,7 @@ macos: $(MACOS_PROJ_PATH) .PHONY: xproj xproj: $(MACOS_PROJ_PATH) - open $(MACOS_WORK_PATH) + xed $(MACOS_WORK_PATH) .PHONY: test test: $(MACOS_PROJ_PATH) @@ -237,7 +237,7 @@ ios: $(IOS_PROJ_PATH) .PHONY: iproj iproj: $(IOS_PROJ_PATH) - open $(IOS_WORK_PATH) + xed $(IOS_WORK_PATH) .PHONY: ios-lint ios-lint: -- cgit v1.2.1 From 7f28afc50786f71566afa57786829a27d7ef3b3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Wed, 27 Mar 2019 10:11:03 +0100 Subject: [core] don't access empty texture pos optionals when buckets are out of sync --- src/mbgl/renderer/layers/render_line_layer.cpp | 4 ++-- src/mbgl/renderer/paint_property_binder.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mbgl/renderer/layers/render_line_layer.cpp b/src/mbgl/renderer/layers/render_line_layer.cpp index a023bc6254..04b191d0f6 100644 --- a/src/mbgl/renderer/layers/render_line_layer.cpp +++ b/src/mbgl/renderer/layers/render_line_layer.cpp @@ -143,8 +143,8 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) { texsize, crossfade, parameters.pixelRatio), - *posA, - *posB, + posA, + posB, LinePatternProgram::TextureBindings{ textures::image::Value{ *geometryTile.iconAtlasTexture->resource, gfx::TextureFilterType::Linear }, }); diff --git a/src/mbgl/renderer/paint_property_binder.hpp b/src/mbgl/renderer/paint_property_binder.hpp index 60866832c6..dd56afb2e8 100644 --- a/src/mbgl/renderer/paint_property_binder.hpp +++ b/src/mbgl/renderer/paint_property_binder.hpp @@ -148,7 +148,7 @@ public: void upload(gfx::Context&) override {} void setPatternParameters(const optional& posA, const optional& posB, CrossfadeParameters&) override { - if (!posA && !posB) { + if (!posA || !posB) { return; } else { constantPatternPositions = std::tuple, std::array> { posB->tlbr(), posA->tlbr() }; -- cgit v1.2.1 From f07a24dd3d2b67d2b3525f9c65f6152048454640 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 27 Mar 2019 09:31:42 +0100 Subject: [android] - don't call OnSurfaceCreated from the main thread --- .../maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java index 6eeb148283..524c1a62ee 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/renderer/glsurfaceview/GLSurfaceViewMapRenderer.java @@ -40,11 +40,6 @@ public class GLSurfaceViewMapRenderer extends MapRenderer implements GLSurfaceVi public void surfaceDestroyed(SurfaceHolder holder) { onSurfaceDestroyed(); } - - @Override - public void surfaceCreated(SurfaceHolder holder) { - onSurfaceCreated(null, null); - } }); } -- cgit v1.2.1 From c7d53676d0dcbc72d71d921e385c656087b788a5 Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Wed, 27 Mar 2019 09:58:41 -0400 Subject: [ios, core] Updates project for iOS SDK 12.2 / Always use vendored optional (#14241) --- circle.yml | 27 ++++++++++++++++++++++ cmake/loop-darwin.cmake | 4 ++++ platform/darwin/src/NSBundle+MGLAdditions.m | 7 +++++- platform/darwin/test/MGLAttributionInfoTests.m | 15 ++++++++++-- platform/darwin/test/MGLOfflineStorageTests.mm | 9 ++++---- .../MGLAnnotationViewIntegrationTests.m | 1 - .../Integration Tests/MGLCameraTransitionTests.mm | 2 +- platform/ios/ios.xcodeproj/project.pbxproj | 6 ++--- platform/ios/src/MGLMapView.mm | 13 +++++++---- vendor/optional.cmake | 10 +++----- 10 files changed, 70 insertions(+), 24 deletions(-) diff --git a/circle.yml b/circle.yml index b47281cf26..063df5573b 100644 --- a/circle.yml +++ b/circle.yml @@ -44,6 +44,8 @@ workflows: - linux-gcc5-debug-coverage - linux-doxygen - ios-debug + - ios-debug-xcode-102: + name: ios-debug-xcode-10.2 - ios-release-template: name: ios-release - ios-release-tag: @@ -924,6 +926,31 @@ jobs: - collect-xcode-build-logs - upload-xcode-build-logs +# ------------------------------------------------------------------------------ + ios-debug-xcode-102: + macos: + xcode: "10.2.0" + environment: + BUILDTYPE: Debug + HOMEBREW_NO_AUTO_UPDATE: 1 + steps: + - install-macos-dependencies + - install-dependencies + - build-ios-test + - check-public-symbols + - run: + name: Check symbol namespacing for mapbox-events-ios + command: make ios-check-events-symbols + - run: + name: Lint plist files + command: make ios-lint + - run: + name: Nitpick Darwin code generation + command: scripts/nitpick/generated-code.js darwin + - save-dependencies + - collect-xcode-build-logs + - upload-xcode-build-logs + # ------------------------------------------------------------------------------ ios-sanitize-nightly: macos: diff --git a/cmake/loop-darwin.cmake b/cmake/loop-darwin.cmake index a330375653..46d8f9edc0 100644 --- a/cmake/loop-darwin.cmake +++ b/cmake/loop-darwin.cmake @@ -7,6 +7,10 @@ target_include_directories(mbgl-loop-darwin PRIVATE src ) +target_link_libraries(mbgl-loop-darwin PUBLIC + optional +) + create_source_groups(mbgl-loop-darwin) set_target_properties(mbgl-loop-darwin PROPERTIES FOLDER "Core") diff --git a/platform/darwin/src/NSBundle+MGLAdditions.m b/platform/darwin/src/NSBundle+MGLAdditions.m index d472e40b1f..da70a95373 100644 --- a/platform/darwin/src/NSBundle+MGLAdditions.m +++ b/platform/darwin/src/NSBundle+MGLAdditions.m @@ -35,10 +35,15 @@ const MGLExceptionName MGLBundleNotFoundException = @"MGLBundleNotFoundException + (nullable NSString *)mgl_applicationBundleIdentifier { NSString *bundleIdentifier = [NSBundle mainBundle].bundleIdentifier; + +#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && (__IPHONE_OS_VERSION_MAX_ALLOWED < 120200)) || \ + (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && (__MAC_OS_X_VERSION_MAX_ALLOWED < 101404)) + // Before SDK 12.2 (bundled with Xcode 10.2): There’s no main bundle identifier when running in a unit test bundle. + // 12.2 and after: the above bundle identifier is: com.apple.dt.xctest.tool if (!bundleIdentifier) { - // There’s no main bundle identifier when running in a unit test bundle. bundleIdentifier = [NSBundle bundleForClass:[MGLAccountManager class]].bundleIdentifier; } +#endif return bundleIdentifier; } diff --git a/platform/darwin/test/MGLAttributionInfoTests.m b/platform/darwin/test/MGLAttributionInfoTests.m index 48779f3407..b6f053a8af 100644 --- a/platform/darwin/test/MGLAttributionInfoTests.m +++ b/platform/darwin/test/MGLAttributionInfoTests.m @@ -55,10 +55,21 @@ XCTAssertEqualObjects(infos[3].URL, [NSURL URLWithString:@"https://apps.mapbox.com/feedback/"]); XCTAssertTrue(infos[3].feedbackLink); NSURL *styleURL = [MGLStyle satelliteStreetsStyleURLWithVersion:99]; + +#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 120200) || \ + (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101404) + NSString *bundleId = @"com.apple.dt.xctest.tool"; +#else + NSString *bundleId = @"com.mapbox.Mapbox"; +#endif + + NSString *urlString = [NSString stringWithFormat:@"https://apps.mapbox.com/feedback/?referrer=%@#/77.63680/12.98108/14.00/0.0/0", bundleId]; XCTAssertEqualObjects([infos[3] feedbackURLAtCenterCoordinate:mapbox zoomLevel:14], - [NSURL URLWithString:@"https://apps.mapbox.com/feedback/?referrer=com.mapbox.Mapbox#/77.63680/12.98108/14.00/0.0/0"]); + [NSURL URLWithString:urlString]); + + urlString = [NSString stringWithFormat:@"https://apps.mapbox.com/feedback/?referrer=%@&owner=mapbox&id=satellite-streets-v99&access_token=pk.feedcafedeadbeefbadebede&map_sdk_version=1.0.0#/77.63680/12.98108/3.14/90.9/13", bundleId]; XCTAssertEqualObjects([infos[3] feedbackURLForStyleURL:styleURL atCenterCoordinate:mapbox zoomLevel:3.14159 direction:90.9 pitch:12.5], - [NSURL URLWithString:@"https://apps.mapbox.com/feedback/?referrer=com.mapbox.Mapbox&owner=mapbox&id=satellite-streets-v99&access_token=pk.feedcafedeadbeefbadebede&map_sdk_version=1.0.0#/77.63680/12.98108/3.14/90.9/13"]); + [NSURL URLWithString:urlString]); } - (void)testStyle { diff --git a/platform/darwin/test/MGLOfflineStorageTests.mm b/platform/darwin/test/MGLOfflineStorageTests.mm index 7f0ead7cab..86dc28eb04 100644 --- a/platform/darwin/test/MGLOfflineStorageTests.mm +++ b/platform/darwin/test/MGLOfflineStorageTests.mm @@ -1,6 +1,7 @@ #import #import "MGLOfflineStorage_Private.h" +#import "NSBundle+MGLAdditions.h" #import "NSDate+MGLAdditions.h" #import @@ -10,7 +11,6 @@ #pragma clang diagnostic ignored "-Wshadow" @interface MGLOfflineStorageTests : XCTestCase - @end @implementation MGLOfflineStorageTests @@ -21,8 +21,7 @@ appropriateForURL:nil create:NO error:nil]; - // Unit tests don't use the main bundle; use com.mapbox.ios.sdk instead. - NSString *bundleIdentifier = [NSBundle bundleForClass:[MGLMapView class]].bundleIdentifier; + NSString *bundleIdentifier = [NSBundle mgl_applicationBundleIdentifier]; cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:bundleIdentifier]; cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:@".mapbox"]; XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:cacheDirectoryURL.path], @"Cache subdirectory should exist."); @@ -208,8 +207,8 @@ appropriateForURL:nil create:NO error:nil]; - // Unit tests don't use the main bundle; use com.mapbox.ios.sdk instead. - NSString *bundleIdentifier = [NSBundle bundleForClass:[MGLMapView class]].bundleIdentifier; + // As of iOS SDK 12.2 unit tests now have a bundle id: com.apple.dt.xctest.tool + NSString *bundleIdentifier = [NSBundle mgl_applicationBundleIdentifier]; cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:bundleIdentifier]; cacheDirectoryURL = [cacheDirectoryURL URLByAppendingPathComponent:@".mapbox"]; XCTAssertTrue([[NSFileManager defaultManager] fileExistsAtPath:cacheDirectoryURL.path], @"Cache subdirectory should exist."); diff --git a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m index 7ec45de072..0b32df55b4 100644 --- a/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m +++ b/platform/ios/Integration Tests/Annotation Tests/MGLAnnotationViewIntegrationTests.m @@ -405,7 +405,6 @@ static const CGFloat kAnnotationScale = 0.125f; NSString * const MGLTestAnnotationReuseIdentifer = @"MGLTestAnnotationReuseIdentifer"; - CGFloat epsilon = 0.0000001; CGSize size = self.mapView.bounds.size; CGSize annotationSize = CGSizeMake(40.0, 40.0); diff --git a/platform/ios/Integration Tests/MGLCameraTransitionTests.mm b/platform/ios/Integration Tests/MGLCameraTransitionTests.mm index e422c46cf4..60d5fc6c9a 100644 --- a/platform/ios/Integration Tests/MGLCameraTransitionTests.mm +++ b/platform/ios/Integration Tests/MGLCameraTransitionTests.mm @@ -277,7 +277,7 @@ // Now set another coordinate. MGLMapCamera *camera = [MGLMapCamera cameraLookingAtCenterCoordinate:target2 - fromDistance:altitude + altitude:altitude pitch:0.0 heading:0.0]; diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index a514f4a017..5122a60b11 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -3677,7 +3677,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Integration Tests/integration-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Integration Test Harness.app/Integration Test Harness"; }; @@ -3707,7 +3707,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.integration-tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Integration Tests/integration-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Integration Test Harness.app/Integration Test Harness"; }; @@ -3992,7 +3992,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.mapbox.integration-tests"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Integration Tests/integration-Bridging-Header.h"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; TARGETED_DEVICE_FAMILY = "1,2"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Integration Test Harness.app/Integration Test Harness"; }; diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 50e022013b..eab690b854 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2512,10 +2512,15 @@ public: { MGLLogInfo(@"Resetting the map to the current style’s default viewport."); auto camera = self.mbglMap.getStyle().getDefaultCamera(); - CGFloat pitch = *camera.pitch; - CLLocationDirection heading = mbgl::util::wrap(*camera.bearing, 0., 360.); - CLLocationDistance altitude = MGLAltitudeForZoomLevel(*camera.zoom, pitch, 0, self.frame.size); - self.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:MGLLocationCoordinate2DFromLatLng(*camera.center) + + double pitch = camera.pitch ? *camera.pitch : 0.0; + double bearing = camera.bearing ? *camera.bearing : 0.0; + double zoom = camera.zoom ? *camera.zoom : 0.0; + mbgl::LatLng center = camera.center ? *camera.center : mbgl::LatLng(); + + CLLocationDirection heading = mbgl::util::wrap(bearing, 0., 360.); + CLLocationDistance altitude = MGLAltitudeForZoomLevel(zoom, pitch, 0, self.frame.size); + self.camera = [MGLMapCamera cameraLookingAtCenterCoordinate:MGLLocationCoordinate2DFromLatLng(center) altitude:altitude pitch:pitch heading:heading]; diff --git a/vendor/optional.cmake b/vendor/optional.cmake index fa299da6a6..ed7bfe8a38 100644 --- a/vendor/optional.cmake +++ b/vendor/optional.cmake @@ -1,9 +1,5 @@ add_library(optional INTERFACE) -# This polyfill is needed for Windows and Android since these standard libraries don't ship with -# usable versions of -if(WIN32 OR MBGL_PLATFORM STREQUAL "android") - target_include_directories(optional SYSTEM INTERFACE - ${CMAKE_SOURCE_DIR}/vendor/optional/include - ) -endif() +target_include_directories(optional SYSTEM INTERFACE + ${CMAKE_SOURCE_DIR}/vendor/optional/include +) -- cgit v1.2.1 From eeecba5c6a86de8714f3ad4168713e077f757a0a Mon Sep 17 00:00:00 2001 From: Julian Rex Date: Wed, 27 Mar 2019 11:18:55 -0400 Subject: [ios, macos] Added missing changelog entries for #14241 (#14250) --- platform/ios/CHANGELOG.md | 1 + platform/macos/CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 325cfe47e2..3e59ae1da8 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -14,6 +14,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT ### Packaging * Added a Galician localization. ([#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095)) +* Added support for building with Xcode 10.2 / iOS SDK 12.2. ([#14241](https://github.com/mapbox/mapbox-gl-native/pull/14241)) ### Offline maps diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 36668dfe22..65c18ea611 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -24,6 +24,7 @@ ### Packaging * Added Czech and Galician localizations. ([#13782](https://github.com/mapbox/mapbox-gl-native/pull/13782), [#14095](https://github.com/mapbox/mapbox-gl-native/pull/14095)) +* Added support for building with Xcode 10.2 / iOS SDK 12.2. ([#14241](https://github.com/mapbox/mapbox-gl-native/pull/14241)) ## 0.13.0 - December 20, 2018 -- cgit v1.2.1 From 35e4066ac755186e77b6db126c8ee89876265525 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 27 Mar 2019 09:50:56 +0100 Subject: [android] - remove request render from MapboxMap#onStart --- .../src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java index ebfac5a021..87b74254f2 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/MapboxMap.java @@ -128,7 +128,6 @@ public final class MapboxMap { * Called when the hosting Activity/Fragment onStart() method is called. */ void onStart() { - nativeMapView.update(); locationComponent.onStart(); } -- cgit v1.2.1 From 0ec89454503befbbfe628c1677955e23911e75c7 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 27 Mar 2019 09:58:58 +0100 Subject: [android] - remove NativeMap#update() --- .../src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java | 2 -- .../src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java | 9 --------- 2 files changed, 11 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java index cf5961a313..e49126531a 100644 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMap.java @@ -29,8 +29,6 @@ interface NativeMap { // Lifecycle API // - void update(); - void resizeView(int width, int height); void onLowMemory(); diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java index 10942d521c..a5f8be788c 100755 --- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java +++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/maps/NativeMapView.java @@ -135,15 +135,6 @@ final class NativeMapView implements NativeMap { nativeDestroy(); } - @Override - public void update() { - if (checkState("update")) { - return; - } - - mapRenderer.requestRender(); - } - @Override public void resizeView(int width, int height) { if (checkState("resizeView")) { -- cgit v1.2.1 From 101cc939dd996150ce7ef6a54ab21533a8507b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Paczos?= Date: Thu, 28 Mar 2019 11:44:18 +0100 Subject: [android] changelog for v7.3.0 --- platform/android/CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md index 4f50a2f038..5387098b76 100644 --- a/platform/android/CHANGELOG.md +++ b/platform/android/CHANGELOG.md @@ -4,6 +4,12 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to ## master +## 7.3.0 - March 28, 2019 + +### Bugs + - Fix MapView reuse issues [#14127](https://github.com/mapbox/mapbox-gl-native/pull/14127) + - Don't call OnSurfaceCreated from the main thread [#14244](https://github.com/mapbox/mapbox-gl-native/pull/14244) + ## 7.3.0-beta.1 - March 20, 2019 ### Features -- cgit v1.2.1 From bbefcb6d516d1602cf1e254ebe90c63727bdc8d6 Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Tue, 12 Mar 2019 13:50:05 +0200 Subject: [core] Add code coverage metrics for core Collect code coverage ratio from codecov.io for a given commit hash, and upload it to the S3 bucket. --- ci.template | 3 +- circle.yml | 6 ++ scripts/publish_core_codecoverage.js | 157 +++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+), 1 deletion(-) create mode 100755 scripts/publish_core_codecoverage.js diff --git a/ci.template b/ci.template index 85e741d5f4..ee3fdab78e 100644 --- a/ci.template +++ b/ci.template @@ -131,7 +131,8 @@ "Resource": [ "arn:aws:s3:::mapbox-loading-dock/raw/mobile.binarysize/*", "arn:aws:s3:::mapbox-loading-dock/raw/mobile.codecoverage/*", - "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.docs_coverage/*" + "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.docs_coverage/*", + "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.codecoverage/*" ] } ] diff --git a/circle.yml b/circle.yml index 063df5573b..d0446736be 100644 --- a/circle.yml +++ b/circle.yml @@ -875,6 +875,12 @@ jobs: curl -sSfL -o codecov https://codecov.io/bash chmod +x codecov ./codecov -c + - run: + name: Upload coverage metrics to s3 + command: | + if [[ $CIRCLE_BRANCH == master ]]; then + scripts/publish_core_codecoverage.js -p Linux -s Core + fi # ------------------------------------------------------------------------------ linux-doxygen: diff --git a/scripts/publish_core_codecoverage.js b/scripts/publish_core_codecoverage.js new file mode 100755 index 0000000000..b490a2fee7 --- /dev/null +++ b/scripts/publish_core_codecoverage.js @@ -0,0 +1,157 @@ +#!/usr/bin/env node + +// Script to retrieve total code coverage ratio from codecov.io +// for a given commit hash, and upload it to the S3 bucket. + +const https = require('https'); +const zlib = require('zlib'); +const AWS = require('aws-sdk'); +const {execSync} = require('child_process'); + +const args = process.argv.slice(2); +const options = { + help: false +}; + +const usage = 'usage: publish_code_coverage.js [options]\n' + +'options: \n' + +' -h, --help \n' + +' -p, --platform \n' + +' -s, --sdk \n' + +' -c, --commit \n'; + +for (var i = 0; i < args.length; i++) { + var arg = args[i]; + + switch(arg) { + case '-h': + case '--help': + options.help = true; + break; + case '-s': + case '--sdk': + options.sdkName = args[i + 1]; + break; + case '-p': + case '--platform': + options.platformName = args[i + 1]; + break; + case '-c': + case '--commit': + options.commitId = args[i + 1]; + break; + } +} + +if (options.help == true) { + console.log(usage); + process.exit(0); +} + +// Commit hash +const commitHash = options.commitId ? options.commitId : process.env['CIRCLE_SHA1']; +if (!options.sdkName || !options.platformName || !commitHash) { + console.log(usage); + process.exit(0); +} + +// Commit Message +const commitMessage = execSync(`git show --pretty=format:%s -s ${commitHash}`).toString().trim(); +if (!commitMessage) { + throw new Error ('Commit message is missing'); +} + +const date = new Date().toISOString().substring(0, 19); + +process.on('uncaughtException', (err) => { + console.error(err); + process.exit(1); +}); + +// Parse the response received from codecov.io and build the +// data point that is going to be uploaded to S3 bucket. +function parseResponse(data) { + if (data && data.commit) { + if (!data.commit.totals || !data.commit.totals.c) { + return; + } + + const source = { + code_coverage: Number(data.commit.totals.c), + platform: options.platformName, + sdk: options.sdkName, + commit: commitHash, + commit_message: commitMessage, + created_at: date + }; + + return source; + } +} + +// Upload to data source used by Mapbox internal metrics dashboards +function uploadData(data) { + return new AWS.S3({region: 'us-east-1'}).putObject({ + Body: zlib.gzipSync(JSON.stringify(data)), + Bucket: 'mapbox-loading-dock', + Key: `raw/mobile_staging.codecoverage/${date.substring(0,10)}/${options.sdkName}-coverage-${commitHash}.json.gz`, + CacheControl: 'max-age=300', + ContentEncoding: 'gzip', + ContentType: 'application/json' + }).promise(); +} + +// Attempt to retrieve code coverage report from codecov.io +// for a given commit hash. +function httpRequest() { + const options = { + hostname: 'codecov.io', + port: 443, + path: '/api/gh/mapbox/mapbox-gl-native/commit/' + commitHash, + method: 'GET' + }; + + return new Promise((resolve, reject) => { + setTimeout(function() { + const req = https.request(options, (res) => { + var body = []; + res.on('data', (chunk) => { + body.push(chunk); + }).on('error', (error) => { + reject(error); + }).on('end', () => { + if (res.statusCode < 200 || res.statusCode >= 300) { + return reject(new Error('Failed to fetch the results from codecov.io. StatusCode=' + res.statusCode)); + } + + try { + body = JSON.parse(Buffer.concat(body).toString()); + resolve(body); + } catch(e) { + reject(e); + } + }); + }); + + // Reject on error + req.on('error', (err) => { + reject(err); + }); + + req.end(); + }, 30000); + }); +} + +httpRequest().then((body) => { + const dataSource = parseResponse(body); + if (dataSource) { + return uploadData(dataSource); + } else { + throw new Error('Failed to parse the results received from codecov.io.'); + } +}).then(data => { + console.log('Successfully uploaded code coverage metrics to S3'); +}).catch(err => { + console.error('Failed to upload code coverage metrics to S3: ' + err.message); +}); -- cgit v1.2.1 From fe8c07710f4444921a560029210ea1831a9ac52e Mon Sep 17 00:00:00 2001 From: Bruno de Oliveira Abinader Date: Thu, 28 Mar 2019 09:38:45 +0200 Subject: [build] Metrics: publish Github Stats --- ci.template | 3 +- circle.yml | 16 +++++ scripts/publish_github_stats.js | 147 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 165 insertions(+), 1 deletion(-) create mode 100755 scripts/publish_github_stats.js diff --git a/ci.template b/ci.template index ee3fdab78e..578ce24c81 100644 --- a/ci.template +++ b/ci.template @@ -132,7 +132,8 @@ "arn:aws:s3:::mapbox-loading-dock/raw/mobile.binarysize/*", "arn:aws:s3:::mapbox-loading-dock/raw/mobile.codecoverage/*", "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.docs_coverage/*", - "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.codecoverage/*" + "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.codecoverage/*", + "arn:aws:s3:::mapbox-loading-dock/raw/mobile_staging.github_stats/*" ] } ] diff --git a/circle.yml b/circle.yml index d0446736be..45b6f1413c 100644 --- a/circle.yml +++ b/circle.yml @@ -66,6 +66,7 @@ workflows: only: - master jobs: + - metrics-nightly - ios-release-template: name: ios-release-nightly - ios-sanitize-nightly @@ -957,6 +958,21 @@ jobs: - collect-xcode-build-logs - upload-xcode-build-logs +# ------------------------------------------------------------------------------ + metrics-nightly: + docker: + - image: mbgl/linux-gcc-5:54f59e3ac5 + working_directory: /src + environment: + LIBSYSCONFCPUS: 2 + JOBS: 2 + steps: + - install-dependencies + - run: + name: Collect GitHub statistics + command: | + scripts/publish_github_stats.js + # ------------------------------------------------------------------------------ ios-sanitize-nightly: macos: diff --git a/scripts/publish_github_stats.js b/scripts/publish_github_stats.js new file mode 100755 index 0000000000..f79a5082d0 --- /dev/null +++ b/scripts/publish_github_stats.js @@ -0,0 +1,147 @@ +#!/usr/bin/env node + +const assert = require('assert'); +const jwt = require('jsonwebtoken'); +const github = require('@octokit/rest')(); +const zlib = require('zlib'); +const AWS = require('aws-sdk'); + +const SIZE_CHECK_APP_ID = 14028; +const SIZE_CHECK_APP_INSTALLATION_ID = 229425; + +// Error handling + +process.on('unhandledRejection', error => { + console.log(error); + process.exit(1) +}); + +// Github authorization + +const pk = process.env['SIZE_CHECK_APP_PRIVATE_KEY']; +if (!pk) { + console.log('Fork PR; not publishing size.'); + process.exit(0); +} + +const key = Buffer.from(pk, 'base64').toString('binary'); +const payload = { + exp: Math.floor(Date.now() / 1000) + 60, + iat: Math.floor(Date.now() / 1000), + iss: SIZE_CHECK_APP_ID +}; + +const token = jwt.sign(payload, key, {algorithm: 'RS256'}); +github.authenticate({type: 'app', token}); + +// Metrics: Github statistics +let openIssuesTotal = 0; +let openIssuesTotalFromNonMembers = 0; +let openIssuesTotalCore = 0; +let openIssuesTotalAndroid = 0; +let openIssuesTotalIOS = 0; +let openIssuesTotalGLJSParity = 0; +let openPullRequestsTotal = 0; +let openPullRequestsTotalFromNonMembers = 0; +let openPullRequestsSinceLastMonth = 0; +let openPullRequestsSinceLastMonthFromNonMembers = 0; + +function collectMetricsFromIssues(issues) { + const oneMonthAgo = function() { let date = new Date(); date.setMonth(date.getMonth() - 1); return date; }(); + + // Metrics + issues.data.forEach(function (issue) { + const issueCreatedAt = new Date(issue.created_at); + const isMapboxAuthor = issue.author_association === "MEMBER"; + + if (issue.pull_request) { + openPullRequestsTotal++; + if (!isMapboxAuthor) { + openPullRequestsTotalFromNonMembers++; + } + if (issueCreatedAt >= oneMonthAgo) { + openPullRequestsSinceLastMonth++; + if (!isMapboxAuthor) { + openPullRequestsSinceLastMonthFromNonMembers++; + } + } + } else { + openIssuesTotal++; + if (!isMapboxAuthor) { + openIssuesTotalFromNonMembers++; + } + issue.labels.forEach(function (label) { + switch (label.name) { + case "Core": + openIssuesTotalCore++; + break; + case "Android": + openIssuesTotalAndroid++; + break; + case "iOS": + openIssuesTotalIOS++; + break; + case "GL JS parity": + openIssuesTotalGLJSParity++; + break; + default: + break; + } + }); + } + }); +} + +function publishMetrics() { + let metrics = { + 'created_at': new Date().toISOString().substring(0, 10), + 'open_issues_total': openIssuesTotal, + 'open_issues_total_from_non_members': openIssuesTotalFromNonMembers, + 'open_issues_total_core': openIssuesTotalCore, + 'open_issues_total_android': openIssuesTotalAndroid, + 'open_issues_total_ios': openIssuesTotalIOS, + 'open_issues_total_gl_js_parity': openIssuesTotalGLJSParity, + 'open_pull_requests_total': openPullRequestsTotal, + 'open_pull_requests_total_from_non_members': openPullRequestsTotalFromNonMembers, + 'open_pull_requests_since_last_month': openPullRequestsSinceLastMonth, + 'open_pull_requests_since_last_month_from_non_members': openPullRequestsSinceLastMonthFromNonMembers + }; + + var promise = new AWS.S3({region: 'us-east-1'}).putObject({ + Body: zlib.gzipSync(JSON.stringify(metrics)), + Bucket: 'mapbox-loading-dock', + Key: `raw/mobile_staging.github_stats/${metrics['created_at']}/METRIC.json.gz`, + CacheControl: 'max-age=300', + ContentEncoding: 'gzip', + ContentType: 'application/json' + }).promise(); + + return Promise.all([promise]).then(data => { + return console.log("Successfully uploaded Github Stats metrics to S3"); + }).catch(err => { + console.log("Error uploading Github Stats metrics to S3 " + err.message); + return err; + }); +} + +function recursiveListForRepo(query) { + assert(query); + query.then(result => { + collectMetricsFromIssues(result); + if (github.hasNextPage(result)) { + recursiveListForRepo(github.getNextPage(result)); + } else { + publishMetrics(); + } + }).catch(error => { + console.log("Error fetching the repository issues list: " + err.message); + }); +} + +github.apps.createInstallationToken({ installation_id: SIZE_CHECK_APP_INSTALLATION_ID }) + .then(({data}) => { + github.authenticate({ type: 'token', token: data.token }); + }) + .then(() => { + recursiveListForRepo(github.issues.listForRepo({ owner: 'mapbox', repo: 'mapbox-gl-native', state: 'open', per_page: 100 })); + }); -- cgit v1.2.1 From e639087c9103b25bd0ea7594ab4280c227243f88 Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Mon, 25 Mar 2019 23:24:02 +0200 Subject: [core] Add getter for Map options Instead of having individual getter for each Map option, add a common getter for all Map options. --- include/mbgl/map/map.hpp | 7 ++----- platform/ios/src/MGLMapView.mm | 2 +- platform/macos/src/MGLMapView.mm | 2 +- src/mbgl/map/map.cpp | 14 ++++++++------ 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index be8bf45142..bd0cfbc0d7 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -91,13 +91,10 @@ public: void setNorthOrientation(NorthOrientation); NorthOrientation getNorthOrientation() const; - // Constrain mode + // Map Options void setConstrainMode(ConstrainMode); - ConstrainMode getConstrainMode() const; - - // Viewport mode void setViewportMode(ViewportMode); - ViewportMode getViewportMode() const; + MapOptions getMapOptions() const; //Projection Mode void setProjectionMode(const ProjectionMode&); diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index eab690b854..f885f67a10 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -1163,7 +1163,7 @@ public: BOOL isVisible = self.superview && self.window; if (isVisible && ! _displayLink) { - if (_mbglMap && self.mbglMap.getConstrainMode() == mbgl::ConstrainMode::None) + if (_mbglMap && self.mbglMap.getMapOptions().constrainMode() == mbgl::ConstrainMode::None) { self.mbglMap.setConstrainMode(mbgl::ConstrainMode::HeightOnly); } diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index c8e3d07908..c5d3279c81 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -695,7 +695,7 @@ public: self.dormant = NO; } - if (window && _mbglMap->getConstrainMode() == mbgl::ConstrainMode::None) { + if (window && _mbglMap->getMapOptions().constrainMode() == mbgl::ConstrainMode::None) { _mbglMap->setConstrainMode(mbgl::ConstrainMode::HeightOnly); } diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 54a95ceaeb..e609e22c97 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -337,10 +337,6 @@ void Map::setConstrainMode(mbgl::ConstrainMode mode) { impl->onUpdate(); } -ConstrainMode Map::getConstrainMode() const { - return impl->transform.getConstrainMode(); -} - #pragma mark - Viewport mode void Map::setViewportMode(mbgl::ViewportMode mode) { @@ -348,8 +344,14 @@ void Map::setViewportMode(mbgl::ViewportMode mode) { impl->onUpdate(); } -ViewportMode Map::getViewportMode() const { - return impl->transform.getViewportMode(); +#pragma mark - Map options + +MapOptions Map::getMapOptions() const { + return std::move(MapOptions() + .withMapMode(impl->mode) + .withConstrainMode(impl->transform.getConstrainMode()) + .withViewportMode(impl->transform.getViewportMode()) + .withCrossSourceCollisions(impl->crossSourceCollisions)); } #pragma mark - Projection mode -- cgit v1.2.1 From 11afef7825d622a237fa026e45e6d61b4de94068 Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Mon, 25 Mar 2019 23:39:31 +0200 Subject: [core] Add interface to change the orientation through MapOptions --- include/mbgl/map/map.hpp | 5 +---- include/mbgl/map/map_options.hpp | 17 +++++++++++++++++ platform/glfw/glfw_view.cpp | 2 +- platform/qt/src/qmapboxgl.cpp | 2 +- src/mbgl/map/map.cpp | 7 ++----- src/mbgl/map/map_impl.cpp | 1 + src/mbgl/map/map_options.cpp | 10 ++++++++++ 7 files changed, 33 insertions(+), 11 deletions(-) diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index bd0cfbc0d7..9134272ea7 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -87,11 +87,8 @@ public: /// @} - // North Orientation - void setNorthOrientation(NorthOrientation); - NorthOrientation getNorthOrientation() const; - // Map Options + void setNorthOrientation(NorthOrientation); void setConstrainMode(ConstrainMode); void setViewportMode(ViewportMode); MapOptions getMapOptions() const; diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index 617a2d793a..8d5c12b96c 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -1,6 +1,7 @@ #pragma once #include +#include #include @@ -86,6 +87,22 @@ public: */ bool crossSourceCollisions() const; + /** + * @brief Sets the orientation of the Map. By default, it is set to + * Upwards. + * + * @param orientation Orientation of the Map. + * @return reference to MapOptions for chaining options together. + */ + MapOptions& withNorthOrientation(NorthOrientation orientation); + + /** + * @brief Gets the previously set (or default) orientation. + * + * @return Map orientation. + */ + NorthOrientation northOrientation() const; + private: class Impl; std::unique_ptr impl_; diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index e768851a53..601642cfa6 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -385,7 +385,7 @@ GLFWView::makeImage(const std::string& id, int width, int height, float pixelRat void GLFWView::nextOrientation() { using NO = mbgl::NorthOrientation; - switch (map->getNorthOrientation()) { + switch (map->getMapOptions().northOrientation()) { case NO::Upwards: map->setNorthOrientation(NO::Rightwards); break; case NO::Rightwards: map->setNorthOrientation(NO::Downwards); break; case NO::Downwards: map->setNorthOrientation(NO::Leftwards); break; diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 82b157d57a..313860890c 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -867,7 +867,7 @@ void QMapboxGL::pitchBy(double pitch_) */ QMapboxGL::NorthOrientation QMapboxGL::northOrientation() const { - return static_cast(d_ptr->mapObj->getNorthOrientation()); + return static_cast(d_ptr->mapObj->getMapOptions().northOrientation()); } /*! diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index e609e22c97..06c637b232 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -326,10 +326,6 @@ void Map::setNorthOrientation(NorthOrientation orientation) { impl->onUpdate(); } -NorthOrientation Map::getNorthOrientation() const { - return impl->transform.getNorthOrientation(); -} - #pragma mark - Constrain mode void Map::setConstrainMode(mbgl::ConstrainMode mode) { @@ -351,7 +347,8 @@ MapOptions Map::getMapOptions() const { .withMapMode(impl->mode) .withConstrainMode(impl->transform.getConstrainMode()) .withViewportMode(impl->transform.getViewportMode()) - .withCrossSourceCollisions(impl->crossSourceCollisions)); + .withCrossSourceCollisions(impl->crossSourceCollisions) + .withNorthOrientation(impl->transform.getNorthOrientation())); } #pragma mark - Projection mode diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index 348e26700f..cdc8c231e4 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -24,6 +24,7 @@ Map::Impl::Impl(RendererFrontend& frontend_, fileSource(std::move(fileSource_)), style(std::make_unique(scheduler, *fileSource, pixelRatio)), annotationManager(*style) { + transform.setNorthOrientation(mapOptions.northOrientation()); style->impl->setObserver(this); rendererFrontend.setObserver(*this); transform.resize(size_); diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index 7c254476d6..b4ad38ac7f 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -7,6 +7,7 @@ public: MapMode mapMode = MapMode::Continuous; ConstrainMode constrainMode = ConstrainMode::HeightOnly; ViewportMode viewportMode = ViewportMode::Default; + NorthOrientation orientation = NorthOrientation::Upwards; bool crossSourceCollisions = true; }; @@ -51,4 +52,13 @@ bool MapOptions::crossSourceCollisions() const { return impl_->crossSourceCollisions; } +MapOptions& MapOptions::withNorthOrientation(NorthOrientation orientation) { + impl_->orientation = orientation; + return *this; +} + +NorthOrientation MapOptions::northOrientation() const { + return impl_->orientation; +} + } // namespace mbgl -- cgit v1.2.1 From 1cc1d4ea08ae02c3cc9b4dd1474845456c17d1bc Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Tue, 26 Mar 2019 00:00:37 +0200 Subject: [core] Add setter/getter for size property in MapOptions --- benchmark/api/query.benchmark.cpp | 4 ++-- benchmark/api/render.benchmark.cpp | 16 ++++++++-------- bin/render.cpp | 4 ++-- include/mbgl/map/map.hpp | 6 +----- include/mbgl/map/map_options.hpp | 16 ++++++++++++++++ platform/android/src/native_map_view.cpp | 5 +++-- platform/default/src/mbgl/map/map_snapshotter.cpp | 4 ++-- platform/glfw/main.cpp | 2 +- platform/ios/src/MGLMapView.mm | 3 ++- platform/macos/src/MGLMapView.mm | 3 ++- platform/node/src/node_map.cpp | 12 ++++++++---- platform/qt/src/qmapboxgl.cpp | 9 +++++---- src/mbgl/map/map.cpp | 20 ++++---------------- src/mbgl/map/map_impl.cpp | 3 +-- src/mbgl/map/map_impl.hpp | 2 +- src/mbgl/map/map_options.cpp | 10 ++++++++++ test/api/annotations.test.cpp | 4 ++-- test/api/api_misuse.test.cpp | 4 ++-- test/api/custom_geometry_source.test.cpp | 4 ++-- test/api/custom_layer.test.cpp | 4 ++-- test/api/query.test.cpp | 4 ++-- test/api/recycle_map.cpp | 4 ++-- test/gl/context.test.cpp | 4 ++-- test/map/map.test.cpp | 17 +++++++++-------- test/map/prefetch.test.cpp | 4 ++-- test/src/mbgl/test/map_adapter.hpp | 3 +-- test/text/local_glyph_rasterizer.test.cpp | 4 ++-- test/util/memory.test.cpp | 12 ++++++------ 28 files changed, 102 insertions(+), 85 deletions(-) diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp index 5e273d69ac..1db958c1be 100644 --- a/benchmark/api/query.benchmark.cpp +++ b/benchmark/api/query.benchmark.cpp @@ -32,8 +32,8 @@ public: util::RunLoop loop; ThreadPool threadPool{ 4 }; HeadlessFrontend frontend { { 1000, 1000 }, 1, threadPool }; - Map map { frontend, MapObserver::nullObserver(), frontend.getSize(), 1, threadPool, - MapOptions().withMapMode(MapMode::Static), + Map map { frontend, MapObserver::nullObserver(), 1, threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; ScreenBox box{{ 0, 0 }, { 1000, 1000 }}; }; diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index b66c3f228c..378ea705f1 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -45,8 +45,8 @@ static void prepare(Map& map, optional json = {}) { static void API_renderStill_reuse_map(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static), + Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map); @@ -58,8 +58,8 @@ static void API_renderStill_reuse_map(::benchmark::State& state) { static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; + Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json")); while (state.KeepRunning()) { @@ -70,8 +70,8 @@ static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; + Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; while (state.KeepRunning()) { prepare(map, { "{}" }); @@ -86,8 +86,8 @@ static void API_renderStill_recreate_map(::benchmark::State& state) { while (state.KeepRunning()) { HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), size, pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; + Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map); frontend.render(map); } diff --git a/bin/render.cpp b/bin/render.cpp index c22d551928..03d1e86144 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -78,8 +78,8 @@ int main(int argc, char *argv[]) { ThreadPool threadPool(4); HeadlessFrontend frontend({ width, height }, pixelRatio, threadPool); - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool, - MapOptions().withMapMode(MapMode::Static), + Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath(cache_file).withAssetPath(asset_root).withAccessToken(std::string(token))); if (style.find("://") == std::string::npos) { diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 9134272ea7..822c400ddf 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -34,7 +34,6 @@ class Map : private util::noncopyable { public: explicit Map(RendererFrontend&, MapObserver&, - Size size, float pixelRatio, Scheduler&, const MapOptions&, @@ -91,16 +90,13 @@ public: void setNorthOrientation(NorthOrientation); void setConstrainMode(ConstrainMode); void setViewportMode(ViewportMode); + void setSize(Size); MapOptions getMapOptions() const; //Projection Mode void setProjectionMode(const ProjectionMode&); ProjectionMode getProjectionMode() const; - // Size - void setSize(Size); - Size getSize() const; - // Projection ScreenCoordinate pixelForLatLng(const LatLng&) const; LatLng latLngForPixel(const ScreenCoordinate&) const; diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index 8d5c12b96c..508d569ea5 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -2,6 +2,7 @@ #include #include +#include #include @@ -103,6 +104,21 @@ public: */ NorthOrientation northOrientation() const; + /** + * @brief Sets the size to resize the map object and renderer backend. + * + * @param size_ A size given in logical pixels. + * @return reference to MapOptions for chaining options together. + */ + MapOptions& withSize(Size size_); + + /** + * @brief Gets the previously set size. + * + * @return Size. + */ + Size size() const; + private: class Impl; std::unique_ptr impl_; diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index 1eb4c56728..d30a216353 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -81,14 +81,15 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env, // Create Map options MapOptions options; options.withMapMode(MapMode::Continuous) + .withSize(mbgl::Size{ static_cast(width), static_cast(height) }) .withConstrainMode(ConstrainMode::HeightOnly) .withViewportMode(ViewportMode::Default) .withCrossSourceCollisions(_crossSourceCollisions); // Create the core map map = std::make_unique( - *rendererFrontend, *this, mbgl::Size{ static_cast(width), static_cast(height) }, - pixelRatio, *threadPool, options, mbgl::android::FileSource::getSharedResourceOptions(_env, jFileSource)); + *rendererFrontend, *this, pixelRatio, *threadPool, options, + mbgl::android::FileSource::getSharedResourceOptions(_env, jFileSource)); } /** diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index ca5eadafbc..d5a71a5508 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -58,7 +58,7 @@ MapSnapshotter::Impl::Impl(std::shared_ptr scheduler_, const ResourceOptions& resourceOptions) : scheduler(std::move(scheduler_)) , frontend(size, pixelRatio, *scheduler, programCacheDir, GLContextMode::Unique, localFontFamily) - , map(frontend, MapObserver::nullObserver(), size, pixelRatio, *scheduler, MapOptions().withMapMode(MapMode::Static), resourceOptions) { + , map(frontend, MapObserver::nullObserver(), pixelRatio, *scheduler, MapOptions().withMapMode(MapMode::Static).withSize(size), resourceOptions) { if (style.first) { map.getStyle().loadJSON(style.second); } else{ @@ -141,7 +141,7 @@ void MapSnapshotter::Impl::setSize(Size size) { } Size MapSnapshotter::Impl::getSize() const { - return map.getSize(); + return map.getMapOptions().size(); } void MapSnapshotter::Impl::setCameraOptions(CameraOptions cameraOptions) { diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index c27e5fe8ce..9f87e579a7 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -110,7 +110,7 @@ int main(int argc, char *argv[]) { mbgl::ThreadPool threadPool(4); GLFWRendererFrontend rendererFrontend { std::make_unique(backend, view->getPixelRatio(), threadPool), backend }; - mbgl::Map map(rendererFrontend, backend, view->getSize(), view->getPixelRatio(), threadPool, mbgl::MapOptions(), resourceOptions); + mbgl::Map map(rendererFrontend, backend, view->getPixelRatio(), threadPool, mbgl::MapOptions().withSize(view->getSize()), resourceOptions); backend.setMap(&map); diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index f885f67a10..036cfd5756 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -479,6 +479,7 @@ public: mbgl::MapOptions mapOptions; mapOptions.withMapMode(mbgl::MapMode::Continuous) + .withSize(self.size) .withConstrainMode(mbgl::ConstrainMode::None) .withViewportMode(mbgl::ViewportMode::Default) .withCrossSourceCollisions(enableCrossSourceCollisions); @@ -488,7 +489,7 @@ public: .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); NSAssert(!_mbglMap, @"_mbglMap should be NULL"); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); // start paused if in IB if (_isTargetingInterfaceBuilder || background) { diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index c5d3279c81..fdcc2090b1 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -292,6 +292,7 @@ public: mbgl::MapOptions mapOptions; mapOptions.withMapMode(mbgl::MapMode::Continuous) + .withSize(self.size) .withConstrainMode(mbgl::ConstrainMode::None) .withViewportMode(mbgl::ViewportMode::Default) .withCrossSourceCollisions(enableCrossSourceCollisions); @@ -300,7 +301,7 @@ public: resourceOptions.withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, self.size, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); // Install the OpenGL layer. Interface Builder’s synchronous drawing means // we can’t display a map, so don’t even bother to have a map layer. diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 7ad9c362bf..bcd5fb1c16 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -631,8 +631,10 @@ void NodeMap::cancel() { }); frontend = std::make_unique(mbgl::Size{ 256, 256 }, pixelRatio, threadpool); - map = std::make_unique(*frontend, mapObserver, frontend->getSize(), pixelRatio, threadpool, - mbgl::MapOptions().withMapMode(mode).withCrossSourceCollisions(crossSourceCollisions), + map = std::make_unique(*frontend, mapObserver, pixelRatio, threadpool, + mbgl::MapOptions().withSize(frontend->getSize()) + .withMapMode(mode) + .withCrossSourceCollisions(crossSourceCollisions), mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this))); // FIXME: Reload the style after recreating the map. We need to find @@ -1212,8 +1214,10 @@ NodeMap::NodeMap(v8::Local options) }()) , mapObserver(NodeMapObserver()) , frontend(std::make_unique(mbgl::Size { 256, 256 }, pixelRatio, threadpool)) - , map(std::make_unique(*frontend, mapObserver, frontend->getSize(), pixelRatio, threadpool, - mbgl::MapOptions().withMapMode(mode).withCrossSourceCollisions(crossSourceCollisions), + , map(std::make_unique(*frontend, mapObserver, pixelRatio, threadpool, + mbgl::MapOptions().withSize(frontend->getSize()) + .withMapMode(mode) + .withCrossSourceCollisions(crossSourceCollisions), mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this)))) , async(new uv_async_t) { async->data = this; diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index 313860890c..ff6a4498dc 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1127,7 +1127,7 @@ void QMapboxGL::resize(const QSize& size_) { auto size = sanitizedSize(size_); - if (d_ptr->mapObj->getSize() == size) + if (d_ptr->mapObj->getMapOptions().size() == size) return; d_ptr->mapObj->setSize(size); @@ -1705,8 +1705,9 @@ void QMapboxGL::connectionEstablished() \a copyrightsHtml is a string with a HTML snippet. */ -mbgl::MapOptions mapOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings) { +mbgl::MapOptions mapOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings, const QSize &size) { return std::move(mbgl::MapOptions() + .withSize(sanitizedSize(size)) .withMapMode(static_cast(settings.mapMode())) .withConstrainMode(static_cast(settings.constrainMode())) .withViewportMode(static_cast(settings.viewportMode()))); @@ -1740,8 +1741,8 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin auto resourceOptions = resourceOptionsFromQMapboxGLSettings(settings); // Setup the Map object. - mapObj = std::make_unique(*this, *m_mapObserver, sanitizedSize(size), m_pixelRatio, *m_threadPool, - mapOptionsFromQMapboxGLSettings(settings), resourceOptions); + mapObj = std::make_unique(*this, *m_mapObserver, m_pixelRatio, *m_threadPool, + mapOptionsFromQMapboxGLSettings(settings, size), resourceOptions); if (settings.resourceTransform()) { m_resourceTransform = std::make_unique>(*mbgl::Scheduler::GetCurrent(), diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index 06c637b232..cfec9952b5 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -29,12 +29,11 @@ using namespace style; Map::Map(RendererFrontend& frontend, MapObserver& observer, - const Size size, const float pixelRatio, Scheduler& scheduler, const MapOptions& mapOptions, const ResourceOptions& resourceOptions) - : impl(std::make_unique(frontend, observer, scheduler, size, pixelRatio, + : impl(std::make_unique(frontend, observer, scheduler, pixelRatio, FileSource::getSharedFileSource(resourceOptions), mapOptions)) {} Map::Map(std::unique_ptr impl_) : impl(std::move(impl_)) {} @@ -308,47 +307,36 @@ BoundOptions Map::getBounds() const { .withMaxZoom(impl->transform.getState().getMaxZoom()); } -#pragma mark - Size +#pragma mark - Map options void Map::setSize(const Size size) { impl->transform.resize(size); impl->onUpdate(); } -Size Map::getSize() const { - return impl->transform.getState().getSize(); -} - -#pragma mark - North Orientation - void Map::setNorthOrientation(NorthOrientation orientation) { impl->transform.setNorthOrientation(orientation); impl->onUpdate(); } -#pragma mark - Constrain mode - void Map::setConstrainMode(mbgl::ConstrainMode mode) { impl->transform.setConstrainMode(mode); impl->onUpdate(); } -#pragma mark - Viewport mode - void Map::setViewportMode(mbgl::ViewportMode mode) { impl->transform.setViewportMode(mode); impl->onUpdate(); } -#pragma mark - Map options - MapOptions Map::getMapOptions() const { return std::move(MapOptions() .withMapMode(impl->mode) .withConstrainMode(impl->transform.getConstrainMode()) .withViewportMode(impl->transform.getViewportMode()) .withCrossSourceCollisions(impl->crossSourceCollisions) - .withNorthOrientation(impl->transform.getNorthOrientation())); + .withNorthOrientation(impl->transform.getNorthOrientation()) + .withSize(impl->transform.getState().getSize())); } #pragma mark - Projection mode diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index cdc8c231e4..afaa05229c 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -10,7 +10,6 @@ namespace mbgl { Map::Impl::Impl(RendererFrontend& frontend_, MapObserver& observer_, Scheduler& scheduler_, - Size size_, float pixelRatio_, std::shared_ptr fileSource_, const MapOptions& mapOptions) @@ -27,7 +26,7 @@ Map::Impl::Impl(RendererFrontend& frontend_, transform.setNorthOrientation(mapOptions.northOrientation()); style->impl->setObserver(this); rendererFrontend.setObserver(*this); - transform.resize(size_); + transform.resize(mapOptions.size()); } Map::Impl::~Impl() { diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp index 13ffdc02ae..90b0a721ca 100644 --- a/src/mbgl/map/map_impl.hpp +++ b/src/mbgl/map/map_impl.hpp @@ -30,7 +30,7 @@ struct StillImageRequest { class Map::Impl : public style::Observer, public RendererObserver { public: - Impl(RendererFrontend&, MapObserver&, Scheduler&, Size size, float pixelRatio, std::shared_ptr, const MapOptions&); + Impl(RendererFrontend&, MapObserver&, Scheduler&, float pixelRatio, std::shared_ptr, const MapOptions&); ~Impl() final; // StyleObserver diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index b4ad38ac7f..98cabb2550 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -9,6 +9,7 @@ public: ViewportMode viewportMode = ViewportMode::Default; NorthOrientation orientation = NorthOrientation::Upwards; bool crossSourceCollisions = true; + Size size; }; // These requires the complete type of Impl. @@ -61,4 +62,13 @@ NorthOrientation MapOptions::northOrientation() const { return impl_->orientation; } +MapOptions& MapOptions::withSize(Size size_) { + impl_->size = size_; + return *this; +} + +Size MapOptions::size() const { + return impl_->size; +} + } // namespace mbgl diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index 2a9737e10b..612c4f0ab8 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -32,8 +32,8 @@ public: float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, std::make_shared(), - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, std::make_shared(), + threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/annotations/") + name, diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp index 6fc04ab26f..17eb2de14b 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -25,9 +25,9 @@ TEST(API, RenderWithoutCallback) { float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), + auto map = std::make_unique(frontend, MapObserver::nullObserver(), pixelRatio, std::make_shared(), threadPool, - MapOptions().withMapMode(MapMode::Static)); + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); map->renderStill(nullptr); // Force Map thread to join. diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp index 58af09c1ac..679291372d 100644 --- a/test/api/custom_geometry_source.test.cpp +++ b/test/api/custom_geometry_source.test.cpp @@ -23,8 +23,8 @@ TEST(CustomGeometrySource, Grid) { auto threadPool = sharedThreadPool(); float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, *threadPool }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, *threadPool, - MapOptions().withMapMode(MapMode::Static), + Map map(frontend, MapObserver::nullObserver(), pixelRatio, *threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index e16d2852ec..4f1429d637 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -93,8 +93,8 @@ TEST(CustomLayer, Basic) { ThreadPool threadPool(4); float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool, - MapOptions().withMapMode(MapMode::Static), + Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index b4297bfe82..0dd9882be2 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -38,8 +38,8 @@ public: ThreadPool threadPool { 4 }; float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, fileSource, + threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; }; std::vector getTopClusterFeature(QueryTest& test) { diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index 7d14bd14de..6f1560d463 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -27,9 +27,9 @@ TEST(API, RecycleMapUpdateImages) { float pixelRatio { 1 }; HeadlessFrontend frontend { pixelRatio, threadPool }; - auto map = std::make_unique(frontend, MapObserver::nullObserver(), frontend.getSize(), + auto map = std::make_unique(frontend, MapObserver::nullObserver(), pixelRatio, std::make_shared(), threadPool, - MapOptions().withMapMode(MapMode::Static)); + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); EXPECT_TRUE(map); diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp index ff9b2ecac2..d9b2750a95 100644 --- a/test/gl/context.test.cpp +++ b/test/gl/context.test.cpp @@ -91,8 +91,8 @@ TEST(GLContextMode, Shared) { HeadlessFrontend frontend { pixelRatio, threadPool, {}, GLContextMode::Shared }; - Map map(frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, threadPool, - MapOptions().withMapMode(MapMode::Static), + Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); map.jumpTo(CameraOptions().withCenter(LatLng { 37.8, -122.5 }).withZoom(10.0)); diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index fc8a7bffba..c50b66efaf 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -41,8 +41,8 @@ public: MapTest(float pixelRatio = 1, MapMode mode = MapMode::Static) : fileSource(std::make_shared()) , frontend(pixelRatio, threadPool) - , map(frontend, observer, frontend.getSize(), pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(mode)) {} + , map(frontend, observer, pixelRatio, + fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {} template MapTest(const std::string& cachePath, const std::string& assetPath, @@ -50,8 +50,8 @@ public: typename std::enable_if::value>::type* = 0) : fileSource(std::make_shared(cachePath, assetPath)) , frontend(pixelRatio, threadPool) - , map(frontend, observer, frontend.getSize(), pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(mode)) {} + , map(frontend, observer, pixelRatio, + fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {} }; TEST(Map, RendererState) { @@ -85,7 +85,7 @@ TEST(Map, RendererState) { const ScreenCoordinate& point = test.frontend.pixelForLatLng(coordinate); EXPECT_NEAR(coordinate.latitude(), latLng.latitude(), 1e-1); EXPECT_NEAR(coordinate.longitude(), latLng.longitude(), 1e-1); - const Size size = test.map.getSize(); + const Size size = test.map.getMapOptions().size(); EXPECT_NEAR(point.x, size.width / 2.0, 1e-7); EXPECT_NEAR(point.y, size.height / 2.0, 1e-7); } @@ -221,9 +221,10 @@ TEST(Map, CameraToLatLngBounds) { test.map.jumpTo(CameraOptions().withCenter(LatLng { 45, 90 }).withZoom(16.0)); + const Size size = test.map.getMapOptions().size(); LatLngBounds bounds = LatLngBounds::hull( test.map.latLngForPixel({}), - test.map.latLngForPixel({ double(test.map.getSize().width), double(test.map.getSize().height) })); + test.map.latLngForPixel({ double(size.width), double(size.height) })); CameraOptions camera = test.map.getCameraOptions(); @@ -734,8 +735,8 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { }); }; - Map map(frontend, observer, frontend.getSize(), pixelRatio, threadPool, - MapOptions().withMapMode(MapMode::Continuous), + Map map(frontend, observer, pixelRatio, threadPool, + MapOptions().withMapMode(MapMode::Continuous).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); diff --git a/test/map/prefetch.test.cpp b/test/map/prefetch.test.cpp index 2830045983..520228e010 100644 --- a/test/map/prefetch.test.cpp +++ b/test/map/prefetch.test.cpp @@ -37,8 +37,8 @@ TEST(Map, PrefetchTiles) { }; HeadlessFrontend frontend { { 512, 512 }, 1, threadPool }; - MapAdapter map(frontend, observer, frontend.getSize(), 1, fileSource, threadPool, - MapOptions().withMapMode(MapMode::Continuous)); + MapAdapter map(frontend, observer, 1, fileSource, threadPool, + MapOptions().withMapMode(MapMode::Continuous).withSize(frontend.getSize())); std::vector tiles; diff --git a/test/src/mbgl/test/map_adapter.hpp b/test/src/mbgl/test/map_adapter.hpp index e0fc449f48..67abea953d 100644 --- a/test/src/mbgl/test/map_adapter.hpp +++ b/test/src/mbgl/test/map_adapter.hpp @@ -12,12 +12,11 @@ class MapAdapter : public Map { public: explicit MapAdapter(RendererFrontend& frontend, MapObserver& observer, - Size size, float ratio, std::shared_ptr fileSource, Scheduler& scheduler, const MapOptions& options) - : Map(std::make_unique(frontend, observer, scheduler, size, ratio, std::move(fileSource), options)) {} + : Map(std::make_unique(frontend, observer, scheduler, ratio, std::move(fileSource), options)) {} }; } // namespace mbgl diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp index a266021f25..ac272e2f9f 100644 --- a/test/text/local_glyph_rasterizer.test.cpp +++ b/test/text/local_glyph_rasterizer.test.cpp @@ -43,8 +43,8 @@ public: ThreadPool threadPool { 4 }; float pixelRatio { 1 }; HeadlessFrontend frontend; - MapAdapter map { frontend, MapObserver::nullObserver(), frontend.getSize(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static)}; + MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, fileSource, + threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/local_glyphs/") + name, diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp index c1ae597986..03545c648b 100644 --- a/test/util/memory.test.cpp +++ b/test/util/memory.test.cpp @@ -73,8 +73,8 @@ TEST(Memory, Vector) { float ratio { 2 }; HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; - MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, - test.threadPool, MapOptions().withMapMode(MapMode::Static)); + MapAdapter map(frontend, MapObserver::nullObserver(), ratio, test.fileSource, + test.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); map.jumpTo(CameraOptions().withZoom(16)); map.getStyle().loadURL("mapbox://streets"); @@ -86,8 +86,8 @@ TEST(Memory, Raster) { float ratio { 2 }; HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; - MapAdapter map(frontend, MapObserver::nullObserver(), frontend.getSize(), ratio, test.fileSource, - test.threadPool, MapOptions().withMapMode(MapMode::Static)); + MapAdapter map(frontend, MapObserver::nullObserver(), ratio, test.fileSource, + test.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); map.getStyle().loadURL("mapbox://satellite"); frontend.render(map); @@ -124,8 +124,8 @@ TEST(Memory, Footprint) { public: FrontendAndMap(MemoryTest& test_, const char* style) : frontend(Size{ 256, 256 }, 2, test_.threadPool) - , map(frontend, MapObserver::nullObserver(), frontend.getSize(), 2, test_.fileSource - , test_.threadPool, MapOptions().withMapMode(MapMode::Static)) { + , map(frontend, MapObserver::nullObserver(), 2, test_.fileSource + , test_.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())) { map.jumpTo(CameraOptions().withZoom(16)); map.getStyle().loadURL(style); frontend.render(map); -- cgit v1.2.1 From f5064e710884d5b822e59d05e51c127c8b3e852b Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Wed, 27 Mar 2019 11:43:40 +0200 Subject: [test] Add unit tests for MapOptions --- test/map/map.test.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index c50b66efaf..d443b5eacc 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -321,6 +321,36 @@ TEST(Map, DefaultBoundOptions) { EXPECT_EQ(*bounds.bounds, LatLngBounds::unbounded()); } +TEST(Map, MapOptions) { + MapTest<> test { 1, MapMode::Continuous }; + + test.map.setNorthOrientation(NorthOrientation::Rightwards); + test.map.setConstrainMode(ConstrainMode::None); + test.map.setViewportMode(ViewportMode::FlippedY); + Size size = { 512, 512 }; + test.map.setSize(size); + + auto options = test.map.getMapOptions(); + EXPECT_EQ(options.mapMode(), MapMode::Continuous); + EXPECT_EQ(options.viewportMode(), ViewportMode::FlippedY); + EXPECT_EQ(options.constrainMode(), ConstrainMode::None); + EXPECT_EQ(options.northOrientation(), NorthOrientation::Rightwards); + EXPECT_EQ(options.size(), size); +} + +TEST(Map, DefaultMapOptions) { + MapTest<> test; + + auto options = test.map.getMapOptions(); + EXPECT_EQ(options.mapMode(), MapMode::Static); + EXPECT_EQ(options.viewportMode(), ViewportMode::Default); + EXPECT_EQ(options.constrainMode(), ConstrainMode::HeightOnly); + EXPECT_EQ(options.northOrientation(), NorthOrientation::Upwards); + EXPECT_TRUE(options.crossSourceCollisions()); + EXPECT_EQ(options.size().width, 256); + EXPECT_EQ(options.size().height, 256); +} + TEST(Map, SetStyleInvalidJSON) { Log::setObserver(std::make_unique()); -- cgit v1.2.1 From 7af00a404f22742fed4a83e9a36d023d7515025f Mon Sep 17 00:00:00 2001 From: Sudarsana Babu Nagineni Date: Wed, 27 Mar 2019 19:17:04 +0200 Subject: [core] Include pixelRatio property in MapOptions Move pixelRatio property from Map constructor to MapOptions. --- benchmark/api/query.benchmark.cpp | 2 +- benchmark/api/render.benchmark.cpp | 19 +++++++++++-------- bin/render.cpp | 4 ++-- include/mbgl/map/map.hpp | 1 - include/mbgl/map/map_options.hpp | 15 +++++++++++++++ platform/android/src/native_map_view.cpp | 3 ++- platform/default/src/mbgl/map/map_snapshotter.cpp | 4 +++- platform/glfw/main.cpp | 6 +++++- platform/ios/src/MGLMapView.mm | 3 ++- platform/macos/src/MGLMapView.mm | 3 ++- platform/node/src/node_map.cpp | 6 ++++-- platform/qt/src/qmapboxgl.cpp | 8 +++++--- src/mbgl/map/map.cpp | 9 +++++---- src/mbgl/map/map_impl.cpp | 3 +-- src/mbgl/map/map_impl.hpp | 2 +- src/mbgl/map/map_options.cpp | 12 +++++++++++- test/api/annotations.test.cpp | 7 +++---- test/api/api_misuse.test.cpp | 5 ++--- test/api/custom_geometry_source.test.cpp | 5 ++--- test/api/custom_layer.test.cpp | 5 ++--- test/api/query.test.cpp | 7 +++---- test/api/recycle_map.cpp | 5 ++--- test/gl/context.test.cpp | 5 ++--- test/map/map.test.cpp | 18 ++++++++++-------- test/map/prefetch.test.cpp | 2 +- test/src/mbgl/test/map_adapter.hpp | 3 +-- test/text/local_glyph_rasterizer.test.cpp | 7 +++---- test/util/memory.test.cpp | 12 ++++++------ 28 files changed, 107 insertions(+), 74 deletions(-) diff --git a/benchmark/api/query.benchmark.cpp b/benchmark/api/query.benchmark.cpp index 1db958c1be..9b7c2d7273 100644 --- a/benchmark/api/query.benchmark.cpp +++ b/benchmark/api/query.benchmark.cpp @@ -32,7 +32,7 @@ public: util::RunLoop loop; ThreadPool threadPool{ 4 }; HeadlessFrontend frontend { { 1000, 1000 }, 1, threadPool }; - Map map { frontend, MapObserver::nullObserver(), 1, threadPool, + Map map { frontend, MapObserver::nullObserver(), threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath("benchmark/fixtures/api/cache.db").withAssetPath(".").withAccessToken("foobar") }; ScreenBox box{{ 0, 0 }, { 1000, 1000 }}; diff --git a/benchmark/api/render.benchmark.cpp b/benchmark/api/render.benchmark.cpp index 378ea705f1..3cff0d9056 100644 --- a/benchmark/api/render.benchmark.cpp +++ b/benchmark/api/render.benchmark.cpp @@ -45,8 +45,8 @@ static void prepare(Map& map, optional json = {}) { static void API_renderStill_reuse_map(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static).withSize(size), + Map map { frontend, MapObserver::nullObserver(), bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map); @@ -58,8 +58,9 @@ static void API_renderStill_reuse_map(::benchmark::State& state) { static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static).withSize(size), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; + Map map { frontend, MapObserver::nullObserver(), bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), + ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map, util::read_file("benchmark/fixtures/api/style_formatted_labels.json")); while (state.KeepRunning()) { @@ -70,8 +71,9 @@ static void API_renderStill_reuse_map_formatted_labels(::benchmark::State& state static void API_renderStill_reuse_map_switch_styles(::benchmark::State& state) { RenderBenchmark bench; HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static).withSize(size), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; + Map map { frontend, MapObserver::nullObserver(), bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), + ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; while (state.KeepRunning()) { prepare(map, { "{}" }); @@ -86,8 +88,9 @@ static void API_renderStill_recreate_map(::benchmark::State& state) { while (state.KeepRunning()) { HeadlessFrontend frontend { size, pixelRatio, bench.threadPool }; - Map map { frontend, MapObserver::nullObserver(), pixelRatio, bench.threadPool, - MapOptions().withMapMode(MapMode::Static).withSize(size), ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; + Map map { frontend, MapObserver::nullObserver(), bench.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), + ResourceOptions().withCachePath(cachePath).withAccessToken("foobar") }; prepare(map); frontend.render(map); } diff --git a/bin/render.cpp b/bin/render.cpp index 03d1e86144..a805953693 100644 --- a/bin/render.cpp +++ b/bin/render.cpp @@ -78,8 +78,8 @@ int main(int argc, char *argv[]) { ThreadPool threadPool(4); HeadlessFrontend frontend({ width, height }, pixelRatio, threadPool); - Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool, - MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), + Map map(frontend, MapObserver::nullObserver(), threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()).withPixelRatio(pixelRatio), ResourceOptions().withCachePath(cache_file).withAssetPath(asset_root).withAccessToken(std::string(token))); if (style.find("://") == std::string::npos) { diff --git a/include/mbgl/map/map.hpp b/include/mbgl/map/map.hpp index 822c400ddf..2fdd72dcb8 100644 --- a/include/mbgl/map/map.hpp +++ b/include/mbgl/map/map.hpp @@ -34,7 +34,6 @@ class Map : private util::noncopyable { public: explicit Map(RendererFrontend&, MapObserver&, - float pixelRatio, Scheduler&, const MapOptions&, const ResourceOptions&); diff --git a/include/mbgl/map/map_options.hpp b/include/mbgl/map/map_options.hpp index 508d569ea5..fcb8c8f32f 100644 --- a/include/mbgl/map/map_options.hpp +++ b/include/mbgl/map/map_options.hpp @@ -119,6 +119,21 @@ public: */ Size size() const; + /** + * @brief Sets the custom pixel ratio. By default, it is set to 1. + * + * @param ratio Pixel ratio value. + * @return reference to MapOptions for chaining options together. + */ + MapOptions& withPixelRatio(float ratio); + + /** + * @brief Gets the previously set (or default) pixel ratio value. + * + * @return pixel ratio value. + */ + float pixelRatio() const; + private: class Impl; std::unique_ptr impl_; diff --git a/platform/android/src/native_map_view.cpp b/platform/android/src/native_map_view.cpp index d30a216353..e74e4c3bbc 100755 --- a/platform/android/src/native_map_view.cpp +++ b/platform/android/src/native_map_view.cpp @@ -82,13 +82,14 @@ NativeMapView::NativeMapView(jni::JNIEnv& _env, MapOptions options; options.withMapMode(MapMode::Continuous) .withSize(mbgl::Size{ static_cast(width), static_cast(height) }) + .withPixelRatio(pixelRatio) .withConstrainMode(ConstrainMode::HeightOnly) .withViewportMode(ViewportMode::Default) .withCrossSourceCollisions(_crossSourceCollisions); // Create the core map map = std::make_unique( - *rendererFrontend, *this, pixelRatio, *threadPool, options, + *rendererFrontend, *this, *threadPool, options, mbgl::android::FileSource::getSharedResourceOptions(_env, jFileSource)); } diff --git a/platform/default/src/mbgl/map/map_snapshotter.cpp b/platform/default/src/mbgl/map/map_snapshotter.cpp index d5a71a5508..227a61d272 100644 --- a/platform/default/src/mbgl/map/map_snapshotter.cpp +++ b/platform/default/src/mbgl/map/map_snapshotter.cpp @@ -58,7 +58,9 @@ MapSnapshotter::Impl::Impl(std::shared_ptr scheduler_, const ResourceOptions& resourceOptions) : scheduler(std::move(scheduler_)) , frontend(size, pixelRatio, *scheduler, programCacheDir, GLContextMode::Unique, localFontFamily) - , map(frontend, MapObserver::nullObserver(), pixelRatio, *scheduler, MapOptions().withMapMode(MapMode::Static).withSize(size), resourceOptions) { + , map(frontend, MapObserver::nullObserver(), *scheduler, + MapOptions().withMapMode(MapMode::Static).withSize(size).withPixelRatio(pixelRatio), + resourceOptions) { if (style.first) { map.getStyle().loadJSON(style.second); } else{ diff --git a/platform/glfw/main.cpp b/platform/glfw/main.cpp index 9f87e579a7..cb3f9b8578 100644 --- a/platform/glfw/main.cpp +++ b/platform/glfw/main.cpp @@ -110,7 +110,11 @@ int main(int argc, char *argv[]) { mbgl::ThreadPool threadPool(4); GLFWRendererFrontend rendererFrontend { std::make_unique(backend, view->getPixelRatio(), threadPool), backend }; - mbgl::Map map(rendererFrontend, backend, view->getPixelRatio(), threadPool, mbgl::MapOptions().withSize(view->getSize()), resourceOptions); + + mbgl::Map map1(rendererFrontend, backend, threadPool,mbgl::MapOptions(), resourceOptions); + + mbgl::Map map(rendererFrontend, backend, threadPool, + mbgl::MapOptions().withSize(view->getSize()).withPixelRatio(view->getPixelRatio()), resourceOptions); backend.setMap(&map); diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 036cfd5756..c94cf477ef 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -480,6 +480,7 @@ public: mbgl::MapOptions mapOptions; mapOptions.withMapMode(mbgl::MapMode::Continuous) .withSize(self.size) + .withPixelRatio(config.scaleFactor) .withConstrainMode(mbgl::ConstrainMode::None) .withViewportMode(mbgl::ViewportMode::Default) .withCrossSourceCollisions(enableCrossSourceCollisions); @@ -489,7 +490,7 @@ public: .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); NSAssert(!_mbglMap, @"_mbglMap should be NULL"); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, *_mbglThreadPool, mapOptions, resourceOptions); // start paused if in IB if (_isTargetingInterfaceBuilder || background) { diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm index fdcc2090b1..091ba462cc 100644 --- a/platform/macos/src/MGLMapView.mm +++ b/platform/macos/src/MGLMapView.mm @@ -293,6 +293,7 @@ public: mbgl::MapOptions mapOptions; mapOptions.withMapMode(mbgl::MapMode::Continuous) .withSize(self.size) + .withPixelRatio(config.scaleFactor) .withConstrainMode(mbgl::ConstrainMode::None) .withViewportMode(mbgl::ViewportMode::Default) .withCrossSourceCollisions(enableCrossSourceCollisions); @@ -301,7 +302,7 @@ public: resourceOptions.withCachePath([[MGLOfflineStorage sharedOfflineStorage] mbglCachePath]) .withAssetPath([NSBundle mainBundle].resourceURL.path.UTF8String); - _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, config.scaleFactor, *_mbglThreadPool, mapOptions, resourceOptions); + _mbglMap = new mbgl::Map(*_rendererFrontend, *_mbglView, *_mbglThreadPool, mapOptions, resourceOptions); // Install the OpenGL layer. Interface Builder’s synchronous drawing means // we can’t display a map, so don’t even bother to have a map layer. diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index bcd5fb1c16..291dea6bb7 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -631,8 +631,9 @@ void NodeMap::cancel() { }); frontend = std::make_unique(mbgl::Size{ 256, 256 }, pixelRatio, threadpool); - map = std::make_unique(*frontend, mapObserver, pixelRatio, threadpool, + map = std::make_unique(*frontend, mapObserver, threadpool, mbgl::MapOptions().withSize(frontend->getSize()) + .withPixelRatio(pixelRatio) .withMapMode(mode) .withCrossSourceCollisions(crossSourceCollisions), mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this))); @@ -1214,8 +1215,9 @@ NodeMap::NodeMap(v8::Local options) }()) , mapObserver(NodeMapObserver()) , frontend(std::make_unique(mbgl::Size { 256, 256 }, pixelRatio, threadpool)) - , map(std::make_unique(*frontend, mapObserver, pixelRatio, threadpool, + , map(std::make_unique(*frontend, mapObserver, threadpool, mbgl::MapOptions().withSize(frontend->getSize()) + .withPixelRatio(pixelRatio) .withMapMode(mode) .withCrossSourceCollisions(crossSourceCollisions), mbgl::ResourceOptions().withPlatformContext(reinterpret_cast(this)))) diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp index ff6a4498dc..4f79525257 100644 --- a/platform/qt/src/qmapboxgl.cpp +++ b/platform/qt/src/qmapboxgl.cpp @@ -1705,9 +1705,10 @@ void QMapboxGL::connectionEstablished() \a copyrightsHtml is a string with a HTML snippet. */ -mbgl::MapOptions mapOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings, const QSize &size) { +mbgl::MapOptions mapOptionsFromQMapboxGLSettings(const QMapboxGLSettings &settings, const QSize &size, qreal pixelRatio) { return std::move(mbgl::MapOptions() .withSize(sanitizedSize(size)) + .withPixelRatio(pixelRatio) .withMapMode(static_cast(settings.mapMode())) .withConstrainMode(static_cast(settings.constrainMode())) .withViewportMode(static_cast(settings.viewportMode()))); @@ -1741,8 +1742,9 @@ QMapboxGLPrivate::QMapboxGLPrivate(QMapboxGL *q, const QMapboxGLSettings &settin auto resourceOptions = resourceOptionsFromQMapboxGLSettings(settings); // Setup the Map object. - mapObj = std::make_unique(*this, *m_mapObserver, m_pixelRatio, *m_threadPool, - mapOptionsFromQMapboxGLSettings(settings, size), resourceOptions); + mapObj = std::make_unique(*this, *m_mapObserver, *m_threadPool, + mapOptionsFromQMapboxGLSettings(settings, size, m_pixelRatio), + resourceOptions); if (settings.resourceTransform()) { m_resourceTransform = std::make_unique>(*mbgl::Scheduler::GetCurrent(), diff --git a/src/mbgl/map/map.cpp b/src/mbgl/map/map.cpp index cfec9952b5..b22a9ee2f2 100644 --- a/src/mbgl/map/map.cpp +++ b/src/mbgl/map/map.cpp @@ -29,12 +29,12 @@ using namespace style; Map::Map(RendererFrontend& frontend, MapObserver& observer, - const float pixelRatio, Scheduler& scheduler, const MapOptions& mapOptions, const ResourceOptions& resourceOptions) - : impl(std::make_unique(frontend, observer, scheduler, pixelRatio, - FileSource::getSharedFileSource(resourceOptions), mapOptions)) {} + : impl(std::make_unique(frontend, observer, scheduler, + FileSource::getSharedFileSource(resourceOptions), + mapOptions)) {} Map::Map(std::unique_ptr impl_) : impl(std::move(impl_)) {} @@ -336,7 +336,8 @@ MapOptions Map::getMapOptions() const { .withViewportMode(impl->transform.getViewportMode()) .withCrossSourceCollisions(impl->crossSourceCollisions) .withNorthOrientation(impl->transform.getNorthOrientation()) - .withSize(impl->transform.getState().getSize())); + .withSize(impl->transform.getState().getSize()) + .withPixelRatio(impl->pixelRatio)); } #pragma mark - Projection mode diff --git a/src/mbgl/map/map_impl.cpp b/src/mbgl/map/map_impl.cpp index afaa05229c..42561cf8bf 100644 --- a/src/mbgl/map/map_impl.cpp +++ b/src/mbgl/map/map_impl.cpp @@ -10,7 +10,6 @@ namespace mbgl { Map::Impl::Impl(RendererFrontend& frontend_, MapObserver& observer_, Scheduler& scheduler_, - float pixelRatio_, std::shared_ptr fileSource_, const MapOptions& mapOptions) : observer(observer_), @@ -18,7 +17,7 @@ Map::Impl::Impl(RendererFrontend& frontend_, scheduler(scheduler_), transform(observer, mapOptions.constrainMode(), mapOptions.viewportMode()), mode(mapOptions.mapMode()), - pixelRatio(pixelRatio_), + pixelRatio(mapOptions.pixelRatio()), crossSourceCollisions(mapOptions.crossSourceCollisions()), fileSource(std::move(fileSource_)), style(std::make_unique(scheduler, *fileSource, pixelRatio)), diff --git a/src/mbgl/map/map_impl.hpp b/src/mbgl/map/map_impl.hpp index 90b0a721ca..7086148276 100644 --- a/src/mbgl/map/map_impl.hpp +++ b/src/mbgl/map/map_impl.hpp @@ -30,7 +30,7 @@ struct StillImageRequest { class Map::Impl : public style::Observer, public RendererObserver { public: - Impl(RendererFrontend&, MapObserver&, Scheduler&, float pixelRatio, std::shared_ptr, const MapOptions&); + Impl(RendererFrontend&, MapObserver&, Scheduler&, std::shared_ptr, const MapOptions&); ~Impl() final; // StyleObserver diff --git a/src/mbgl/map/map_options.cpp b/src/mbgl/map/map_options.cpp index 98cabb2550..4cebb6adab 100644 --- a/src/mbgl/map/map_options.cpp +++ b/src/mbgl/map/map_options.cpp @@ -9,7 +9,8 @@ public: ViewportMode viewportMode = ViewportMode::Default; NorthOrientation orientation = NorthOrientation::Upwards; bool crossSourceCollisions = true; - Size size; + Size size = { 64, 64 }; + float pixelRatio = 1.0; }; // These requires the complete type of Impl. @@ -71,4 +72,13 @@ Size MapOptions::size() const { return impl_->size; } +MapOptions& MapOptions::withPixelRatio(float ratio) { + impl_->pixelRatio = ratio; + return *this; +} + +float MapOptions::pixelRatio() const { + return impl_->pixelRatio; +} + } // namespace mbgl diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp index 612c4f0ab8..11920d1624 100644 --- a/test/api/annotations.test.cpp +++ b/test/api/annotations.test.cpp @@ -29,11 +29,10 @@ class AnnotationTest { public: util::RunLoop loop; ThreadPool threadPool { 4 }; - float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, threadPool }; + HeadlessFrontend frontend { 1, threadPool }; - MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, std::make_shared(), - threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; + MapAdapter map { frontend, MapObserver::nullObserver(), std::make_shared(), threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/annotations/") + name, diff --git a/test/api/api_misuse.test.cpp b/test/api/api_misuse.test.cpp index 17eb2de14b..cca47de69c 100644 --- a/test/api/api_misuse.test.cpp +++ b/test/api/api_misuse.test.cpp @@ -22,11 +22,10 @@ TEST(API, RenderWithoutCallback) { util::RunLoop loop; ThreadPool threadPool(4); - float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, threadPool }; + HeadlessFrontend frontend { 1, threadPool }; auto map = std::make_unique(frontend, MapObserver::nullObserver(), - pixelRatio, std::make_shared(), threadPool, + std::make_shared(), threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); map->renderStill(nullptr); diff --git a/test/api/custom_geometry_source.test.cpp b/test/api/custom_geometry_source.test.cpp index 679291372d..f796e3086b 100644 --- a/test/api/custom_geometry_source.test.cpp +++ b/test/api/custom_geometry_source.test.cpp @@ -21,9 +21,8 @@ TEST(CustomGeometrySource, Grid) { util::RunLoop loop; auto threadPool = sharedThreadPool(); - float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, *threadPool }; - Map map(frontend, MapObserver::nullObserver(), pixelRatio, *threadPool, + HeadlessFrontend frontend { 1, *threadPool }; + Map map(frontend, MapObserver::nullObserver(), *threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); diff --git a/test/api/custom_layer.test.cpp b/test/api/custom_layer.test.cpp index 4f1429d637..c836ab81ac 100644 --- a/test/api/custom_layer.test.cpp +++ b/test/api/custom_layer.test.cpp @@ -91,9 +91,8 @@ TEST(CustomLayer, Basic) { util::RunLoop loop; ThreadPool threadPool(4); - float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, threadPool }; - Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool, + HeadlessFrontend frontend { 1, threadPool }; + Map map(frontend, MapObserver::nullObserver(), threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); diff --git a/test/api/query.test.cpp b/test/api/query.test.cpp index 0dd9882be2..ddf5df6aab 100644 --- a/test/api/query.test.cpp +++ b/test/api/query.test.cpp @@ -36,10 +36,9 @@ public: util::RunLoop loop; std::shared_ptr fileSource = std::make_shared(); ThreadPool threadPool { 4 }; - float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, threadPool }; - MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; + HeadlessFrontend frontend { 1, threadPool }; + MapAdapter map { frontend, MapObserver::nullObserver(), fileSource, threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; }; std::vector getTopClusterFeature(QueryTest& test) { diff --git a/test/api/recycle_map.cpp b/test/api/recycle_map.cpp index 6f1560d463..ac9de9b230 100644 --- a/test/api/recycle_map.cpp +++ b/test/api/recycle_map.cpp @@ -24,11 +24,10 @@ TEST(API, RecycleMapUpdateImages) { util::RunLoop loop; ThreadPool threadPool(4); - float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, threadPool }; + HeadlessFrontend frontend { 1, threadPool }; auto map = std::make_unique(frontend, MapObserver::nullObserver(), - pixelRatio, std::make_shared(), threadPool, + std::make_shared(), threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); EXPECT_TRUE(map); diff --git a/test/gl/context.test.cpp b/test/gl/context.test.cpp index d9b2750a95..291813bd9a 100644 --- a/test/gl/context.test.cpp +++ b/test/gl/context.test.cpp @@ -87,11 +87,10 @@ TEST(GLContextMode, Shared) { util::RunLoop loop; ThreadPool threadPool(4); - float pixelRatio { 1 }; - HeadlessFrontend frontend { pixelRatio, threadPool, {}, GLContextMode::Shared }; + HeadlessFrontend frontend { 1, threadPool, {}, GLContextMode::Shared }; - Map map(frontend, MapObserver::nullObserver(), pixelRatio, threadPool, + Map map(frontend, MapObserver::nullObserver(), threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); diff --git a/test/map/map.test.cpp b/test/map/map.test.cpp index d443b5eacc..be92890b07 100644 --- a/test/map/map.test.cpp +++ b/test/map/map.test.cpp @@ -41,8 +41,8 @@ public: MapTest(float pixelRatio = 1, MapMode mode = MapMode::Static) : fileSource(std::make_shared()) , frontend(pixelRatio, threadPool) - , map(frontend, observer, pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {} + , map(frontend, observer, fileSource, threadPool, + MapOptions().withMapMode(mode).withSize(frontend.getSize()).withPixelRatio(pixelRatio)) {} template MapTest(const std::string& cachePath, const std::string& assetPath, @@ -50,8 +50,8 @@ public: typename std::enable_if::value>::type* = 0) : fileSource(std::make_shared(cachePath, assetPath)) , frontend(pixelRatio, threadPool) - , map(frontend, observer, pixelRatio, - fileSource, threadPool, MapOptions().withMapMode(mode).withSize(frontend.getSize())) {} + , map(frontend, observer, fileSource, threadPool, + MapOptions().withMapMode(mode).withSize(frontend.getSize()).withPixelRatio(pixelRatio)) {} }; TEST(Map, RendererState) { @@ -322,7 +322,8 @@ TEST(Map, DefaultBoundOptions) { } TEST(Map, MapOptions) { - MapTest<> test { 1, MapMode::Continuous }; + float pixelRatio { 2 }; + MapTest<> test { pixelRatio, MapMode::Continuous }; test.map.setNorthOrientation(NorthOrientation::Rightwards); test.map.setConstrainMode(ConstrainMode::None); @@ -336,6 +337,7 @@ TEST(Map, MapOptions) { EXPECT_EQ(options.constrainMode(), ConstrainMode::None); EXPECT_EQ(options.northOrientation(), NorthOrientation::Rightwards); EXPECT_EQ(options.size(), size); + EXPECT_EQ(options.pixelRatio(), pixelRatio); } TEST(Map, DefaultMapOptions) { @@ -349,6 +351,7 @@ TEST(Map, DefaultMapOptions) { EXPECT_TRUE(options.crossSourceCollisions()); EXPECT_EQ(options.size().width, 256); EXPECT_EQ(options.size().height, 256); + EXPECT_EQ(options.pixelRatio(), 1); } TEST(Map, SetStyleInvalidJSON) { @@ -741,7 +744,6 @@ TEST(Map, DontLoadUnneededTiles) { TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { util::RunLoop runLoop; ThreadPool threadPool { 4 }; - float pixelRatio { 1 }; using namespace std::chrono_literals; @@ -753,7 +755,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { util::Timer timer; - HeadlessFrontend frontend(pixelRatio, threadPool); + HeadlessFrontend frontend(1, threadPool); StubMapObserver observer; observer.didFinishRenderingFrameCallback = [&] (MapObserver::RenderMode) { @@ -765,7 +767,7 @@ TEST(Map, TEST_DISABLED_ON_CI(ContinuousRendering)) { }); }; - Map map(frontend, observer, pixelRatio, threadPool, + Map map(frontend, observer, threadPool, MapOptions().withMapMode(MapMode::Continuous).withSize(frontend.getSize()), ResourceOptions().withCachePath(":memory:").withAssetPath("test/fixtures/api/assets")); map.getStyle().loadJSON(util::read_file("test/fixtures/api/water.json")); diff --git a/test/map/prefetch.test.cpp b/test/map/prefetch.test.cpp index 520228e010..3232c99a22 100644 --- a/test/map/prefetch.test.cpp +++ b/test/map/prefetch.test.cpp @@ -37,7 +37,7 @@ TEST(Map, PrefetchTiles) { }; HeadlessFrontend frontend { { 512, 512 }, 1, threadPool }; - MapAdapter map(frontend, observer, 1, fileSource, threadPool, + MapAdapter map(frontend, observer, fileSource, threadPool, MapOptions().withMapMode(MapMode::Continuous).withSize(frontend.getSize())); std::vector tiles; diff --git a/test/src/mbgl/test/map_adapter.hpp b/test/src/mbgl/test/map_adapter.hpp index 67abea953d..5bdab1d164 100644 --- a/test/src/mbgl/test/map_adapter.hpp +++ b/test/src/mbgl/test/map_adapter.hpp @@ -12,11 +12,10 @@ class MapAdapter : public Map { public: explicit MapAdapter(RendererFrontend& frontend, MapObserver& observer, - float ratio, std::shared_ptr fileSource, Scheduler& scheduler, const MapOptions& options) - : Map(std::make_unique(frontend, observer, scheduler, ratio, std::move(fileSource), options)) {} + : Map(std::make_unique(frontend, observer, scheduler, std::move(fileSource), options)) {} }; } // namespace mbgl diff --git a/test/text/local_glyph_rasterizer.test.cpp b/test/text/local_glyph_rasterizer.test.cpp index ac272e2f9f..26e4a2eb1d 100644 --- a/test/text/local_glyph_rasterizer.test.cpp +++ b/test/text/local_glyph_rasterizer.test.cpp @@ -34,17 +34,16 @@ namespace { class LocalGlyphRasterizerTest { public: LocalGlyphRasterizerTest(const optional fontFamily) - : frontend(pixelRatio, threadPool, optional(), GLContextMode::Unique, fontFamily) + : frontend(1, threadPool, optional(), GLContextMode::Unique, fontFamily) { } util::RunLoop loop; std::shared_ptr fileSource = std::make_shared(); ThreadPool threadPool { 4 }; - float pixelRatio { 1 }; HeadlessFrontend frontend; - MapAdapter map { frontend, MapObserver::nullObserver(), pixelRatio, fileSource, - threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; + MapAdapter map { frontend, MapObserver::nullObserver(), fileSource, threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())}; void checkRendering(const char * name) { test::checkImage(std::string("test/fixtures/local_glyphs/") + name, diff --git a/test/util/memory.test.cpp b/test/util/memory.test.cpp index 03545c648b..e3ad976432 100644 --- a/test/util/memory.test.cpp +++ b/test/util/memory.test.cpp @@ -73,8 +73,8 @@ TEST(Memory, Vector) { float ratio { 2 }; HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; - MapAdapter map(frontend, MapObserver::nullObserver(), ratio, test.fileSource, - test.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); + MapAdapter map(frontend, MapObserver::nullObserver(), test.fileSource, test.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()).withPixelRatio(ratio)); map.jumpTo(CameraOptions().withZoom(16)); map.getStyle().loadURL("mapbox://streets"); @@ -86,8 +86,8 @@ TEST(Memory, Raster) { float ratio { 2 }; HeadlessFrontend frontend { { 256, 256 }, ratio, test.threadPool }; - MapAdapter map(frontend, MapObserver::nullObserver(), ratio, test.fileSource, - test.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())); + MapAdapter map(frontend, MapObserver::nullObserver(), test.fileSource, test.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()).withPixelRatio(ratio)); map.getStyle().loadURL("mapbox://satellite"); frontend.render(map); @@ -124,8 +124,8 @@ TEST(Memory, Footprint) { public: FrontendAndMap(MemoryTest& test_, const char* style) : frontend(Size{ 256, 256 }, 2, test_.threadPool) - , map(frontend, MapObserver::nullObserver(), 2, test_.fileSource - , test_.threadPool, MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize())) { + , map(frontend, MapObserver::nullObserver(), test_.fileSource, test_.threadPool, + MapOptions().withMapMode(MapMode::Static).withSize(frontend.getSize()).withPixelRatio(2)) { map.jumpTo(CameraOptions().withZoom(16)); map.getStyle().loadURL(style); frontend.render(map); -- cgit v1.2.1 From 21155772ef086c949f951e32424c36b9dd7dc430 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 27 Mar 2019 15:12:46 +0100 Subject: [android] - fix thread assertion issue while running instrumentation tests --- .../src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java index b56d267b81..c8737e2802 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/maps/MapboxTest.java @@ -1,5 +1,6 @@ package com.mapbox.mapboxsdk.maps; +import android.support.test.annotation.UiThreadTest; import android.support.test.runner.AndroidJUnit4; import com.mapbox.mapboxsdk.Mapbox; import org.junit.Test; @@ -16,6 +17,7 @@ public class MapboxTest { private static final String ACCESS_TOKEN_2 = "pk.0000000002"; @Test + @UiThreadTest public void testConnected() { assertTrue(Mapbox.isConnected()); @@ -31,6 +33,7 @@ public class MapboxTest { } @Test + @UiThreadTest public void setAccessToken() { String realToken = Mapbox.getAccessToken(); Mapbox.setAccessToken(ACCESS_TOKEN); -- cgit v1.2.1 From 4e335d0b050c6d5b94ae0d28cb4fd36b939ad84b Mon Sep 17 00:00:00 2001 From: Alexander Shalamov Date: Thu, 28 Mar 2019 00:44:32 +0200 Subject: [core] Traverse expression tree when checking for property overrides Before this change, symbol layer was only checking whether top level 'text-field' layout property expression is FormatExpression and if it has paint property overrides. This change takes into account that 'text-field' might have nested expressions, thus, requires traversal over child expressions. Fixes: #14254 --- src/mbgl/style/expression/value.cpp | 5 +++ src/mbgl/style/layers/symbol_layer_impl.hpp | 62 ++++++++++++++++++++++------- test/style/style_layer.test.cpp | 12 ++++++ 3 files changed, 65 insertions(+), 14 deletions(-) diff --git a/src/mbgl/style/expression/value.cpp b/src/mbgl/style/expression/value.cpp index 436ed83ecd..c2c2105336 100644 --- a/src/mbgl/style/expression/value.cpp +++ b/src/mbgl/style/expression/value.cpp @@ -166,6 +166,11 @@ mbgl::Value ValueConverter::fromExpressionValue(const Value& value) } options.emplace("text-font", std::vector{ std::string("literal"), fontStack }); } + + if (section.textColor) { + options.emplace("text-color", fromExpressionValue(*section.textColor)); + } + serialized.push_back(options); } return serialized; diff --git a/src/mbgl/style/layers/symbol_layer_impl.hpp b/src/mbgl/style/layers/symbol_layer_impl.hpp index f937fccaa8..9b63e0e8d6 100644 --- a/src/mbgl/style/layers/symbol_layer_impl.hpp +++ b/src/mbgl/style/layers/symbol_layer_impl.hpp @@ -3,9 +3,11 @@ #include #include #include +#include #include #include #include +#include namespace mbgl { namespace style { @@ -56,25 +58,57 @@ struct FormatSectionOverrides> { template static bool hasOverride(const FormattedProperty& formatted) { + + const auto checkLiteral = [] (const TextField::Type& literal) { + for (const auto& section : literal.sections) { + if (Property::hasOverride(section)) { + return true; + } + } + return false; + }; + return formatted.match( - [] (const TextField::Type& t) { - for (const auto& section : t.sections) { - if (Property::hasOverride(section)) { - return true; - } - } - return false; + [&checkLiteral] (const TextField::Type& literal) { + return checkLiteral(literal); }, - [] (const PropertyExpression& t) { - if (t.getExpression().getKind() == expression::Kind::FormatExpression) { - const auto* e = static_cast(&t.getExpression()); - for (const auto& section : e->getSections()) { - if (Property::hasOverride(section)) { - return true; + [&checkLiteral] (const PropertyExpression& property) { + bool expressionHasOverrides = false; + const auto checkExpression = [&](const expression::Expression& e) { + if (expressionHasOverrides) { + return; + } + + if (e.getKind() == expression::Kind::Literal && + e.getType() == expression::type::Formatted) { + const auto* literalExpr = static_cast(&e); + const auto formattedValue = expression::fromExpressionValue(literalExpr->getValue()); + if (formattedValue && checkLiteral(*formattedValue)) { + expressionHasOverrides = true; + } + return; + } + + if (e.getKind() == expression::Kind::FormatExpression) { + const auto* formatExpr = static_cast(&e); + for (const auto& section : formatExpr->getSections()) { + if (Property::hasOverride(section)) { + expressionHasOverrides = true; + break; + } } } + }; + + // Check root property expression and return early. + checkExpression(property.getExpression()); + if (expressionHasOverrides) { + return true; } - return false; + + // Traverse thru children and check whether any of them have overrides. + property.getExpression().eachChild(checkExpression); + return expressionHasOverrides; }, [] (const auto&) { return false; diff --git a/test/style/style_layer.test.cpp b/test/style/style_layer.test.cpp index e58a5fe5d0..7598d888e9 100644 --- a/test/style/style_layer.test.cpp +++ b/test/style/style_layer.test.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -330,6 +331,17 @@ void testHasOverrides(LayoutType& layout) { PropertyExpression propExprOverride(std::move(formatExprOverride)); layout.template get() = PropertyValueType(std::move(propExprOverride)); EXPECT_TRUE(MockOverrides::hasOverrides(layout.template get())); + + // Nested expressions, overridden text-color. + auto formattedExpr1 = format("first paragraph"); + std::vector sections{ { literal("second paragraph"), nullopt, nullopt, toColor(literal("blue")) } }; + auto formattedExpr2 = std::make_unique(std::move(sections)); + std::unordered_map> branches{ { "1st", std::move(formattedExpr1) }, + { "2nd", std::move(formattedExpr2) } }; + auto match = std::make_unique>(type::Formatted, literal("input"), std::move(branches), format("otherwise")); + PropertyExpression nestedPropExpr(std::move(match)); + layout.template get() = PropertyValueType(std::move(nestedPropExpr)); + EXPECT_TRUE(MockOverrides::hasOverrides(layout.template get())); } } // namespace -- cgit v1.2.1 From 43f27e837cb444ba4263405aa4c39a651b222067 Mon Sep 17 00:00:00 2001 From: tobrun Date: Wed, 27 Mar 2019 16:52:29 +0100 Subject: [android] - use different Activity launchmode setup. This faills on pre 6.0 and post 9.0 Androdid OS versions. Stabilize tests. Ignore telemetry dialog test. --- .../mapbox/mapboxsdk/integration/BaseIntegrationTest.kt | 14 +++++++++++--- .../mapboxsdk/integration/FragmentBackStackTest.kt | 17 +++++++++++++---- .../mapboxsdk/integration/GLSurfaceViewReopenTest.kt | 3 ++- .../mapboxsdk/integration/TextureViewReopenTest.kt | 3 ++- .../mapboxsdk/testapp/maps/widgets/AttributionTest.java | 16 ++++++++++++---- .../src/main/AndroidManifest.xml | 9 ++++++--- .../src/main/res/layout/activity_backstack_fragment.xml | 1 + 7 files changed, 47 insertions(+), 16 deletions(-) diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt index be57fb3e2d..aeb8863790 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/BaseIntegrationTest.kt @@ -2,11 +2,13 @@ package com.mapbox.mapboxsdk.integration import android.content.Context import android.content.Intent -import android.content.Intent.FLAG_ACTIVITY_SINGLE_TOP +import android.content.Intent.FLAG_ACTIVITY_NEW_TASK import android.support.test.InstrumentationRegistry import android.support.test.uiautomator.* import org.junit.Before +const val TIMEOUT_UI_SEARCH_WAIT = 5000L + abstract class BaseIntegrationTest { protected lateinit var device: UiDevice @@ -17,12 +19,18 @@ abstract class BaseIntegrationTest { } } +/** + * Launches an activity with FLAG_ACTIVITY_NEW_TASK. + *

+ * To resume an activity, you need to add a single instance launchmode to your manifest configuration. + *

+ */ fun UiDevice.launchActivity(context: Context, clazz: Class<*>) { val applicationPackage = InstrumentationRegistry.getTargetContext().packageName val intent = Intent(context, clazz) - intent.addFlags(FLAG_ACTIVITY_SINGLE_TOP) + intent.addFlags(FLAG_ACTIVITY_NEW_TASK) InstrumentationRegistry.getContext().startActivity(intent) - wait(Until.hasObject(By.pkg(applicationPackage).depth(0)), 5000) + wait(Until.hasObject(By.pkg(applicationPackage).depth(0)), TIMEOUT_UI_SEARCH_WAIT) } fun UiDevice.scrollRecyclerViewTo(recycleItem: String) { diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt index e57e1d1abd..b0f6436bdd 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/FragmentBackStackTest.kt @@ -3,9 +3,14 @@ package com.mapbox.mapboxsdk.integration import android.support.test.filters.LargeTest import android.support.test.rule.ActivityTestRule import android.support.test.runner.AndroidJUnit4 +import android.support.test.uiautomator.By +import android.support.test.uiautomator.SearchCondition import android.support.test.uiautomator.UiSelector +import android.support.test.uiautomator.Until +import com.mapbox.mapboxsdk.testapp.R import com.mapbox.mapboxsdk.testapp.activity.fragment.FragmentBackStackActivity import com.mapbox.mapboxsdk.testapp.activity.maplayout.SimpleMapActivity +import kotlinx.android.synthetic.main.activity_backstack_fragment.view.* import org.junit.Before import org.junit.Rule import org.junit.Test @@ -22,7 +27,7 @@ class FragmentBackStackTest : BaseIntegrationTest() { @Test @LargeTest - fun backPressedOnBackStackResumed(){ + fun backPressedOnBackStackResumed() { device.waitForIdle() clickReplaceFragmentButton() device.pressHome() @@ -32,12 +37,16 @@ class FragmentBackStackTest : BaseIntegrationTest() { device.waitForIdle() } - private fun clickReplaceFragmentButton(){ - device.findObject(UiSelector().text("REPLACE WITH EMPTY FRAGMENT")).click() + private fun clickReplaceFragmentButton() { + device.findObject(UiSelector().description(textDescription)).click() } - private fun backPressBackStack(){ + private fun backPressBackStack() { device.pressBack() // pops fragment, showing map device.pressBack() // finish activity } + + private companion object { + const val textDescription = "btn_change_fragment" + } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt index 755c5fc560..f22b5f7c9d 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/GLSurfaceViewReopenTest.kt @@ -24,6 +24,7 @@ class GLSurfaceViewReopenTest : BaseIntegrationTest() { device.waitForIdle() device.pressHome() device.waitForIdle() - device.launchActivity(activityRule.activity.applicationContext, SimpleMapActivity::class.java) + device.launchActivity(activityRule.activity, SimpleMapActivity::class.java) + device.waitForIdle() } } diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt index cc171ca905..44da557904 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/integration/TextureViewReopenTest.kt @@ -27,6 +27,7 @@ class TextureViewReopenTest : BaseIntegrationTest() { device.waitForIdle() device.pressHome() device.waitForIdle() - device.launchActivity(activityRule.activity.applicationContext, TextureViewDebugModeActivity::class.java) + device.launchActivity(activityRule.activity, TextureViewDebugModeActivity::class.java) + device.waitForIdle() } } \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java index 0fadd33325..ca5c9adc1f 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/maps/widgets/AttributionTest.java @@ -3,6 +3,7 @@ package com.mapbox.mapboxsdk.testapp.maps.widgets; import android.app.Instrumentation; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.support.test.espresso.UiController; import android.support.test.espresso.ViewAction; import android.support.test.espresso.intent.Intents; @@ -31,12 +32,14 @@ import static android.support.test.espresso.intent.Intents.intended; import static android.support.test.espresso.intent.Intents.intending; import static android.support.test.espresso.intent.matcher.IntentMatchers.hasAction; import static android.support.test.espresso.intent.matcher.IntentMatchers.hasData; +import static android.support.test.espresso.matcher.RootMatchers.isDialog; import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed; import static android.support.test.espresso.matcher.ViewMatchers.withId; import static android.support.test.espresso.matcher.ViewMatchers.withText; import static org.hamcrest.CoreMatchers.allOf; import static org.hamcrest.CoreMatchers.anything; import static org.hamcrest.core.IsNot.not; +import static org.junit.Assume.assumeTrue; public class AttributionTest extends EspressoTest { @@ -126,15 +129,20 @@ public class AttributionTest extends EspressoTest { @Test public void testTelemetryDialog() { + assumeTrue( + "Can only run on API Level 23 or newer because of instability", + Build.VERSION.SDK_INT >= 23 + ); + validateTestSetup(); // click on View to open dialog onView(withId(R.id.attributionView)).perform(click()); - onView(withText(R.string.mapbox_attributionsDialogTitle)).check(matches(isDisplayed())); + onView(withText(R.string.mapbox_attributionsDialogTitle)).inRoot(isDialog()).check(matches(isDisplayed())); // click on item to open second dialog - onView(withText(R.string.mapbox_telemetrySettings)).perform(click()); - onView(withText(R.string.mapbox_attributionTelemetryTitle)).check(matches(isDisplayed())); + onView(withText(R.string.mapbox_telemetrySettings)).inRoot(isDialog()).perform(click()); + onView(withText(R.string.mapbox_attributionTelemetryTitle)).inRoot(isDialog()).check(matches(isDisplayed())); } @After @@ -206,4 +214,4 @@ public class AttributionTest extends EspressoTest { interface InvokeViewAction { void onViewAction(UiController uiController, View view); } -} +} \ No newline at end of file diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index cec5bd879b..a5cc549cc2 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -173,7 +173,8 @@ + android:label="@string/activity_map_fragment_backstack" + android:launchMode="singleInstance"> @@ -407,7 +408,8 @@ + android:label="@string/activity_simple_map" + android:launchMode="singleInstance"> @@ -720,7 +722,8 @@ + android:label="@string/activity_textureview_debug" + android:launchMode="singleInstance"> diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_backstack_fragment.xml b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_backstack_fragment.xml index b6b672cf73..10c11a9320 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_backstack_fragment.xml +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_backstack_fragment.xml @@ -10,6 +10,7 @@