[android] - move all layer, source, image, light and transition configurations to style.java
This commit is contained in:
@@ -79,7 +79,7 @@ class LocationLayerControllerTest : BaseActivityTest() {
|
||||
component.isLocationComponentEnabled = true
|
||||
component.renderMode = RenderMode.NORMAL
|
||||
uiController.loopMainThreadForAtLeast(MAP_RENDER_DELAY)
|
||||
assertThat(mapboxMap.getSource(LOCATION_SOURCE), notNullValue())
|
||||
assertThat(mapboxMap.getStyle().getSource(LOCATION_SOURCE), notNullValue())
|
||||
}
|
||||
}
|
||||
executeComponentTest(componentAction)
|
||||
@@ -220,7 +220,7 @@ class LocationLayerControllerTest : BaseActivityTest() {
|
||||
assertThat(component.renderMode, `is`(equalTo(RenderMode.NORMAL)))
|
||||
|
||||
// Check that the Source has been re-added to the new map style
|
||||
val source: GeoJsonSource? = mapboxMap.getSourceAs(LOCATION_SOURCE)
|
||||
val source: GeoJsonSource? = mapboxMap.getStyle().getSourceAs(LOCATION_SOURCE)
|
||||
assertThat(source, notNullValue())
|
||||
|
||||
// Check that all layers visibilities are set to visible
|
||||
|
||||
@@ -99,7 +99,7 @@ class MapboxTestingUtils {
|
||||
|
||||
fun MapboxMap.addImageFromDrawable(string: String, drawable: Drawable) {
|
||||
val bitmapFromDrawable = getBitmapFromDrawable(drawable)
|
||||
this.addImage(string, bitmapFromDrawable)
|
||||
this.style.addImage(string, bitmapFromDrawable)
|
||||
}
|
||||
|
||||
private fun getBitmapFromDrawable(drawable: Drawable): Bitmap {
|
||||
|
||||
@@ -30,12 +30,12 @@ public class GeoJsonConversionTest extends BaseActivityTest {
|
||||
public void testEmptyFeatureCollection() {
|
||||
validateTestSetup();
|
||||
onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(
|
||||
mapboxMap.getStyle().addSource(
|
||||
new CustomGeometrySource("test-id",
|
||||
new CustomProvider(fromFeatures(singletonList(fromGeometry(fromGeometries(emptyList())))))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -43,12 +43,12 @@ public class GeoJsonConversionTest extends BaseActivityTest {
|
||||
public void testPointFeatureCollection() {
|
||||
validateTestSetup();
|
||||
onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(
|
||||
mapboxMap.getStyle().addSource(
|
||||
new CustomGeometrySource("test-id",
|
||||
new CustomProvider(fromFeatures(singletonList(fromGeometry(Point.fromLngLat(0.0,0.0)))))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -56,12 +56,12 @@ public class GeoJsonConversionTest extends BaseActivityTest {
|
||||
public void testMultiPointFeatureCollection() {
|
||||
validateTestSetup();
|
||||
onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(
|
||||
mapboxMap.getStyle().addSource(
|
||||
new CustomGeometrySource("test-id",
|
||||
new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList())))))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -70,12 +70,12 @@ public class GeoJsonConversionTest extends BaseActivityTest {
|
||||
public void testPolygonFeatureCollection() {
|
||||
validateTestSetup();
|
||||
onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(
|
||||
mapboxMap.getStyle().addSource(
|
||||
new CustomGeometrySource("test-id",
|
||||
new CustomProvider(fromFeatures(singletonList(fromGeometry(Polygon.fromLngLats(emptyList())))))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -83,12 +83,12 @@ public class GeoJsonConversionTest extends BaseActivityTest {
|
||||
public void testMultiPolygonFeatureCollection() {
|
||||
validateTestSetup();
|
||||
onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(
|
||||
mapboxMap.getStyle().addSource(
|
||||
new CustomGeometrySource("test-id",
|
||||
new CustomProvider(fromFeatures(singletonList(fromGeometry(fromPolygon(Polygon.fromLngLats(emptyList()))))))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -96,12 +96,12 @@ public class GeoJsonConversionTest extends BaseActivityTest {
|
||||
public void testLineStringFeatureCollection() {
|
||||
validateTestSetup();
|
||||
onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(
|
||||
mapboxMap.getStyle().addSource(
|
||||
new CustomGeometrySource("test-id",
|
||||
new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLngLats(emptyList())))))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -109,12 +109,12 @@ public class GeoJsonConversionTest extends BaseActivityTest {
|
||||
public void testMultiLineStringFeatureCollection() {
|
||||
validateTestSetup();
|
||||
onMapView().perform(getMapboxMapAction((uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(
|
||||
mapboxMap.getStyle().addSource(
|
||||
new CustomGeometrySource("test-id",
|
||||
new CustomProvider(fromFeatures(singletonList(fromGeometry(fromLineString(fromLngLats(emptyList()))))))
|
||||
)
|
||||
);
|
||||
mapboxMap.addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
mapboxMap.getStyle().addLayer(new SymbolLayer("test-id", "test-id"));
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -151,7 +151,7 @@ public class AttributionTest extends BaseActivityTest {
|
||||
|
||||
private void buildUrlSpans() {
|
||||
onView(withId(R.id.mapView)).perform(new MapboxMapAction((uiController, view) -> {
|
||||
for (Source source : mapboxMap.getSources()) {
|
||||
for (Source source : mapboxMap.getStyle().getSources()) {
|
||||
String attributionSource = source.getAttribution();
|
||||
if (!TextUtils.isEmpty(attributionSource)) {
|
||||
SpannableStringBuilder htmlBuilder = (SpannableStringBuilder) Html.fromHtml(attributionSource);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class BackgroundLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
layer = mapboxMap.getLayerAs("background");
|
||||
layer = mapboxMap.getStyle().getLayerAs("background");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ public class CircleLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new CircleLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,9 +39,9 @@ class CustomGeometrySourceTest : BaseActivityTest() {
|
||||
fun threadsShutdownWhenSourceRemovedTest() {
|
||||
validateTestSetup()
|
||||
invoke(mapboxMap) { uiController, mapboxMap ->
|
||||
mapboxMap.removeLayer(ID_GRID_LAYER)
|
||||
mapboxMap.getStyle().removeLayer(ID_GRID_LAYER)
|
||||
uiController.loopMainThreadForAtLeast(3000)
|
||||
mapboxMap.removeSource(ID_GRID_SOURCE)
|
||||
mapboxMap.getStyle().removeSource(ID_GRID_SOURCE)
|
||||
uiController.loopMainThreadForAtLeast(1000)
|
||||
Assert.assertTrue("There should be no threads running when the source is removed.",
|
||||
Thread.getAllStackTraces().keys.filter {
|
||||
@@ -55,12 +55,12 @@ class CustomGeometrySourceTest : BaseActivityTest() {
|
||||
fun threadsRestartedWhenSourceReAddedTest() {
|
||||
validateTestSetup()
|
||||
invoke(mapboxMap) { uiController, mapboxMap ->
|
||||
mapboxMap.removeLayer((rule.activity as GridSourceActivity).layer)
|
||||
mapboxMap.getStyle().removeLayer((rule.activity as GridSourceActivity).layer)
|
||||
uiController.loopMainThreadForAtLeast(3000)
|
||||
mapboxMap.removeSource(ID_GRID_SOURCE)
|
||||
mapboxMap.getStyle().removeSource(ID_GRID_SOURCE)
|
||||
uiController.loopMainThreadForAtLeast(1000)
|
||||
mapboxMap.addSource((rule.activity as GridSourceActivity).source)
|
||||
mapboxMap.addLayer((rule.activity as GridSourceActivity).layer)
|
||||
mapboxMap.getStyle().addSource((rule.activity as GridSourceActivity).source)
|
||||
mapboxMap.getStyle().addLayer((rule.activity as GridSourceActivity).layer)
|
||||
uiController.loopMainThreadForAtLeast(1000)
|
||||
Assert.assertTrue("Threads should be restarted when the source is re-added to the map.",
|
||||
Thread.getAllStackTraces().keys.filter {
|
||||
|
||||
@@ -242,7 +242,7 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
Expression expression3 = eq(literal("Łukasz"), literal("lukasz"), collator(literal(false), eq(literal(2),
|
||||
literal(1))));
|
||||
|
||||
mapboxMap.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
Layer layer = new CircleLayer("layer", "source")
|
||||
.withProperties(circleColor(
|
||||
switchCase(
|
||||
@@ -250,7 +250,7 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
literal(ColorUtils.colorToRgbaString(Color.RED))
|
||||
)
|
||||
));
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
uiController.loopMainThreadForAtLeast(1000);
|
||||
assertFalse(mapboxMap.queryRenderedFeatures(mapboxMap.getProjection().toScreenLocation(latLng), "layer")
|
||||
.isEmpty());
|
||||
@@ -282,9 +282,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry("test")
|
||||
@@ -304,9 +304,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry("test", formatFontScale(1.75))
|
||||
@@ -326,9 +326,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -355,9 +355,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -386,9 +386,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -421,9 +421,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
|
||||
feature.addStringProperty("test_property", "test");
|
||||
feature.addNumberProperty("test_property_number", 1.5);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", feature));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -450,9 +450,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
Feature feature = Feature.fromGeometry(Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
|
||||
feature.addStringProperty("test_property", "test");
|
||||
feature.addNumberProperty("test_property_number", 1.5);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", feature));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", feature));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
Expression expression = format(
|
||||
formatEntry(
|
||||
@@ -477,9 +477,9 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
LatLng latLng = new LatLng(51, 17);
|
||||
mapboxMap.addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
mapboxMap.getStyle().addSource(new GeoJsonSource("source", Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude())));
|
||||
SymbolLayer layer = new SymbolLayer("layer", "source");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
layer.setProperties(textField("test"));
|
||||
waitForLayer(uiController, mapboxMap, latLng);
|
||||
@@ -534,13 +534,13 @@ public class ExpressionTest extends BaseActivityTest {
|
||||
try {
|
||||
source = new GeoJsonSource("amsterdam-parks-source",
|
||||
ResourceUtils.readRawResource(rule.getActivity(), R.raw.amsterdam));
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
} catch (IOException ioException) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add a fill layer
|
||||
mapboxMap.addLayer(layer = new FillLayer("amsterdam-parks-layer", source.getId())
|
||||
mapboxMap.getStyle().addLayer(layer = new FillLayer("amsterdam-parks-layer", source.getId())
|
||||
.withProperties(
|
||||
fillColor(rgba(0.0f, 0.0f, 0.0f, 0.5f)),
|
||||
fillOutlineColor(rgb(0, 0, 255)),
|
||||
|
||||
@@ -39,13 +39,13 @@ public class FillExtrusionLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new FillExtrusionLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ public class FillLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new FillLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class GeoJsonSourceTests extends BaseActivityTest {
|
||||
} catch (IOException exception) {
|
||||
Timber.e(exception);
|
||||
}
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -61,8 +61,8 @@ public class GeoJsonSourceTests extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("source", Point.fromLngLat(0d, 0d));
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -77,8 +77,8 @@ public class GeoJsonSourceTests extends BaseActivityTest {
|
||||
} catch (IOException exception) {
|
||||
Timber.e(exception);
|
||||
}
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ public class GeoJsonSourceTests extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("source");
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.addLayer(new CircleLayer("layer", source.getId()));
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
mapboxMap.getStyle().addLayer(new CircleLayer("layer", source.getId()));
|
||||
|
||||
source.setGeoJson(Point.fromLngLat(0, 0));
|
||||
source.setGeoJson(Point.fromLngLat(-25, -25));
|
||||
@@ -146,9 +146,9 @@ public class GeoJsonSourceTests extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
MapboxMapAction.invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("source");
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
Layer layer = new CircleLayer("layer", source.getId());
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
try {
|
||||
source.setGeoJson(Feature.fromJson(ResourceUtils.readRawResource(rule.getActivity(), resource)));
|
||||
@@ -156,8 +156,8 @@ public class GeoJsonSourceTests extends BaseActivityTest {
|
||||
Timber.e(exception);
|
||||
}
|
||||
|
||||
mapboxMap.removeLayer(layer);
|
||||
mapboxMap.removeSource(source);
|
||||
mapboxMap.getStyle().removeLayer(layer);
|
||||
mapboxMap.getStyle().removeSource(source);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ public class HeatmapLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new HeatmapLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ public class HillshadeLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new HillshadeLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class ImageTest extends BaseActivityTest {
|
||||
assertTrue(drawable instanceof BitmapDrawable);
|
||||
|
||||
Bitmap bitmapSet = ((BitmapDrawable) drawable).getBitmap();
|
||||
mapboxMap.addImage(IMAGE_ID, bitmapSet);
|
||||
mapboxMap.getStyle().addImage(IMAGE_ID, bitmapSet);
|
||||
|
||||
Bitmap bitmapGet = mapboxMap.getImage(IMAGE_ID);
|
||||
assertTrue(bitmapGet.sameAs(bitmapSet));
|
||||
|
||||
@@ -160,7 +160,7 @@ public class LightTest extends BaseActivityTest {
|
||||
fillExtrusionBase(Expression.get("min_height")),
|
||||
fillExtrusionOpacity(0.6f)
|
||||
);
|
||||
mapboxMap.addLayer(fillExtrusionLayer);
|
||||
mapboxMap.getStyle().addLayer(fillExtrusionLayer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ public class LineLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new LineLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -39,13 +39,13 @@ public class RasterLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new RasterLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
List<Layer> layers = mapboxMap.getLayers();
|
||||
List<Layer> layers = mapboxMap.getStyle().getLayers();
|
||||
assertNotNull(layers);
|
||||
assertTrue(layers.size() > 0);
|
||||
for (Layer layer : layers) {
|
||||
@@ -89,12 +89,12 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
List<Layer> layers = mapboxMap.getLayers();
|
||||
Source source = mapboxMap.getSources().get(0);
|
||||
List<Layer> layers = mapboxMap.getStyle().getLayers();
|
||||
Source source = mapboxMap.getStyle().getSources().get(0);
|
||||
|
||||
// Test inserting with invalid above-id
|
||||
try {
|
||||
mapboxMap.addLayerAbove(new CircleLayer("invalid-id-layer-test", source.getId()), "no-such-layer-here-man");
|
||||
mapboxMap.getStyle().addLayerAbove(new CircleLayer("invalid-id-layer-test", source.getId()), "no-such-layer-here-man");
|
||||
fail("Should have thrown exception");
|
||||
} catch (CannotAddLayerException ex) {
|
||||
// Yeah
|
||||
@@ -103,14 +103,14 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
|
||||
// Insert as last
|
||||
CircleLayer last = new CircleLayer("this is the last one", source.getId());
|
||||
mapboxMap.addLayerAbove(last, layers.get(layers.size() - 1).getId());
|
||||
layers = mapboxMap.getLayers();
|
||||
mapboxMap.getStyle().addLayerAbove(last, layers.get(layers.size() - 1).getId());
|
||||
layers = mapboxMap.getStyle().getLayers();
|
||||
assertEquals(last.getId(), layers.get(layers.size() - 1).getId());
|
||||
|
||||
// Insert
|
||||
CircleLayer second = new CircleLayer("this is the second one", source.getId());
|
||||
mapboxMap.addLayerAbove(second, layers.get(0).getId());
|
||||
layers = mapboxMap.getLayers();
|
||||
mapboxMap.getStyle().addLayerAbove(second, layers.get(0).getId());
|
||||
layers = mapboxMap.getStyle().getLayers();
|
||||
assertEquals(second.getId(), layers.get(1).getId());
|
||||
}
|
||||
});
|
||||
@@ -124,14 +124,14 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
// Remove by index
|
||||
Layer firstLayer = mapboxMap.getLayers().get(0);
|
||||
boolean removed = mapboxMap.removeLayerAt(0);
|
||||
Layer firstLayer = mapboxMap.getStyle().getLayers().get(0);
|
||||
boolean removed = mapboxMap.getStyle().removeLayerAt(0);
|
||||
assertTrue(removed);
|
||||
assertNotNull(firstLayer);
|
||||
|
||||
// Test remove by index bounds checks
|
||||
Timber.i("Remove layer at index > size");
|
||||
assertFalse(mapboxMap.removeLayerAt(Integer.MAX_VALUE));
|
||||
assertNull(mapboxMap.getStyle().removeLayerAt(Integer.MAX_VALUE));
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -141,12 +141,12 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
onView(withId(R.id.mapView)).perform(new BaseViewAction() {
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
List<Layer> layers = mapboxMap.getLayers();
|
||||
Source source = mapboxMap.getSources().get(0);
|
||||
List<Layer> layers = mapboxMap.getStyle().getLayers();
|
||||
Source source = mapboxMap.getStyle().getSources().get(0);
|
||||
|
||||
// Test inserting out of range
|
||||
try {
|
||||
mapboxMap.addLayerAt(new CircleLayer("invalid-id-layer-test", source.getId()), layers.size());
|
||||
mapboxMap.getStyle().addLayerAt(new CircleLayer("invalid-id-layer-test", source.getId()), layers.size());
|
||||
fail("Should have thrown exception");
|
||||
} catch (CannotAddLayerException ex) {
|
||||
// Yeah
|
||||
@@ -155,14 +155,14 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
|
||||
// Insert at current last position
|
||||
CircleLayer last = new CircleLayer("this is the last one", source.getId());
|
||||
mapboxMap.addLayerAt(last, layers.size() - 1);
|
||||
layers = mapboxMap.getLayers();
|
||||
mapboxMap.getStyle().addLayerAt(last, layers.size() - 1);
|
||||
layers = mapboxMap.getStyle().getLayers();
|
||||
assertEquals(last.getId(), layers.get(layers.size() - 2).getId());
|
||||
|
||||
// Insert at start
|
||||
CircleLayer second = new CircleLayer("this is the first one", source.getId());
|
||||
mapboxMap.addLayerAt(second, 0);
|
||||
layers = mapboxMap.getLayers();
|
||||
mapboxMap.getStyle().addLayerAt(second, 0);
|
||||
layers = mapboxMap.getStyle().getLayers();
|
||||
assertEquals(second.getId(), layers.get(0).getId());
|
||||
}
|
||||
});
|
||||
@@ -176,7 +176,7 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
List<Source> sources = mapboxMap.getSources();
|
||||
List<Source> sources = mapboxMap.getStyle().getSources();
|
||||
assertNotNull(sources);
|
||||
assertTrue(sources.size() > 0);
|
||||
for (Source source : sources) {
|
||||
@@ -191,34 +191,34 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
public void testAddRemoveSource() {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
|
||||
mapboxMap.removeSource("my-source");
|
||||
mapboxMap.getStyle().addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
|
||||
mapboxMap.getStyle().removeSource("my-source");
|
||||
|
||||
// Add initial source
|
||||
mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
|
||||
mapboxMap.getStyle().addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
|
||||
|
||||
// Remove
|
||||
boolean removeOk = mapboxMap.removeSource("my-source");
|
||||
boolean removeOk = mapboxMap.getStyle().removeSource("my-source");
|
||||
assertTrue(removeOk);
|
||||
assertNull(mapboxMap.getLayer("my-source"));
|
||||
assertNull(mapboxMap.getStyle().getLayer("my-source"));
|
||||
|
||||
// Add
|
||||
Source source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
|
||||
// Remove, preserving the reference
|
||||
mapboxMap.removeSource(source);
|
||||
mapboxMap.getStyle().removeSource(source);
|
||||
|
||||
// Re-add the reference...
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
|
||||
// Ensure it's there
|
||||
Assert.assertNotNull(mapboxMap.getSource(source.getId()));
|
||||
Assert.assertNotNull(mapboxMap.getStyle().getSource(source.getId()));
|
||||
|
||||
// Test adding a duplicate source
|
||||
try {
|
||||
Source source2 = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
|
||||
mapboxMap.addSource(source2);
|
||||
mapboxMap.getStyle().addSource(source2);
|
||||
fail("Should not have been allowed to add a source with a duplicate id");
|
||||
} catch (CannotAddSourceException cannotAddSourceException) {
|
||||
// OK
|
||||
@@ -232,7 +232,7 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
VectorSource source = new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl());
|
||||
});
|
||||
}
|
||||
@@ -242,7 +242,7 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
RasterSource source = new RasterSource("my-source", "mapbox://mapbox.mapbox-terrain-v2");
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
assertEquals("mapbox://mapbox.mapbox-terrain-v2", source.getUrl());
|
||||
});
|
||||
}
|
||||
@@ -252,7 +252,7 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
validateTestSetup();
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
GeoJsonSource source = new GeoJsonSource("my-source");
|
||||
mapboxMap.addSource(source);
|
||||
mapboxMap.getStyle().addSource(source);
|
||||
assertNull(source.getUrl());
|
||||
try {
|
||||
source.setUrl(new URL("http://mapbox.com/my-file.json"));
|
||||
@@ -271,10 +271,10 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
mapboxMap.addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
|
||||
mapboxMap.addLayer(new LineLayer("my-layer", "my-source"));
|
||||
mapboxMap.removeSource("my-source");
|
||||
assertNotNull(mapboxMap.getSource("my-source"));
|
||||
mapboxMap.getStyle().addSource(new VectorSource("my-source", "mapbox://mapbox.mapbox-terrain-v2"));
|
||||
mapboxMap.getStyle().addLayer(new LineLayer("my-layer", "my-source"));
|
||||
mapboxMap.getStyle().removeSource("my-source");
|
||||
assertNotNull(mapboxMap.getStyle().getSource("my-source"));
|
||||
}
|
||||
|
||||
});
|
||||
@@ -282,28 +282,28 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
|
||||
@Test
|
||||
public void testRemoveNonExistingSource() {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> mapboxMap.removeSource("source"));
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> mapboxMap.getStyle().removeSource("source"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveNonExistingLayer() {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
assertFalse(mapboxMap.removeLayer("layer"));
|
||||
assertFalse(mapboxMap.removeLayerAt(mapboxMap.getLayers().size() + 1));
|
||||
assertFalse(mapboxMap.removeLayerAt(-1));
|
||||
assertFalse(mapboxMap.getStyle().removeLayer("layer"));
|
||||
assertFalse(mapboxMap.getStyle().removeLayerAt(mapboxMap.getStyle().getLayers().size() + 1));
|
||||
assertFalse(mapboxMap.getStyle().removeLayerAt(-1));
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRemoveExistingLayer() {
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
Layer firstLayer = mapboxMap.getLayers().get(0);
|
||||
assertTrue(mapboxMap.removeLayer(firstLayer));
|
||||
Layer firstLayer = mapboxMap.getStyle().getLayers().get(0);
|
||||
assertTrue(mapboxMap.getStyle().removeLayer(firstLayer));
|
||||
|
||||
firstLayer = mapboxMap.getLayers().get(0);
|
||||
assertTrue(mapboxMap.removeLayer(firstLayer.getId()));
|
||||
firstLayer = mapboxMap.getStyle().getLayers().get(0);
|
||||
assertTrue(mapboxMap.getStyle().removeLayer(firstLayer.getId()));
|
||||
|
||||
assertTrue(mapboxMap.removeLayerAt(0));
|
||||
assertTrue(mapboxMap.getStyle().removeLayerAt(0));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -332,37 +332,37 @@ public class RuntimeStyleTests extends BaseActivityTest {
|
||||
@Override
|
||||
public void perform(UiController uiController, View view) {
|
||||
// Get initial
|
||||
assertNotNull(mapboxMap.getLayer("building"));
|
||||
assertNotNull(mapboxMap.getStyle().getLayer("building"));
|
||||
|
||||
// Remove
|
||||
boolean removed = mapboxMap.removeLayer("building");
|
||||
boolean removed = mapboxMap.getStyle().removeLayer("building");
|
||||
assertTrue(removed);
|
||||
assertNull(mapboxMap.getLayer("building"));
|
||||
assertNull(mapboxMap.getStyle().getLayer("building"));
|
||||
|
||||
// Add
|
||||
FillLayer layer = new FillLayer("building", "composite");
|
||||
layer.setSourceLayer("building");
|
||||
mapboxMap.addLayer(layer);
|
||||
assertNotNull(mapboxMap.getLayer("building"));
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
assertNotNull(mapboxMap.getStyle().getLayer("building"));
|
||||
|
||||
// Assure the reference still works
|
||||
layer.setProperties(PropertyFactory.visibility(Property.VISIBLE));
|
||||
|
||||
// Remove, preserving the reference
|
||||
mapboxMap.removeLayer(layer);
|
||||
mapboxMap.getStyle().removeLayer(layer);
|
||||
|
||||
// Property setters should still work
|
||||
layer.setProperties(PropertyFactory.fillColor(Color.RED));
|
||||
|
||||
// Re-add the reference...
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
|
||||
// Ensure it's there
|
||||
Assert.assertNotNull(mapboxMap.getLayer(layer.getId()));
|
||||
Assert.assertNotNull(mapboxMap.getStyle().getLayer(layer.getId()));
|
||||
|
||||
// Test adding a duplicate layer
|
||||
try {
|
||||
mapboxMap.addLayer(new FillLayer("building", "composite"));
|
||||
mapboxMap.getStyle().addLayer(new FillLayer("building", "composite"));
|
||||
fail("Should not have been allowed to add a layer with a duplicate id");
|
||||
} catch (CannotAddLayerException cannotAddLayerException) {
|
||||
// OK
|
||||
|
||||
@@ -41,13 +41,13 @@ public class SymbolLayerTest extends BaseActivityTest {
|
||||
private void setupLayer() {
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new SymbolLayer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,18 +48,18 @@ public class <%- camelize(type) %>LayerTest extends BaseActivityTest {
|
||||
<% if (type === 'background') { -%>
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
layer = mapboxMap.getLayerAs("background");
|
||||
layer = mapboxMap.getStyle().getLayerAs("background");
|
||||
});
|
||||
<% } else { -%>
|
||||
Timber.i("Retrieving layer");
|
||||
invoke(mapboxMap, (uiController, mapboxMap) -> {
|
||||
if ((layer = mapboxMap.getLayerAs("my-layer")) == null) {
|
||||
if ((layer = mapboxMap.getStyle().getLayerAs("my-layer")) == null) {
|
||||
Timber.i("Adding layer");
|
||||
layer = new <%- camelize(type) %>Layer("my-layer", "composite");
|
||||
layer.setSourceLayer("composite");
|
||||
mapboxMap.addLayer(layer);
|
||||
mapboxMap.getStyle().addLayer(layer);
|
||||
// Layer reference is now stale, get new reference
|
||||
layer = mapboxMap.getLayerAs("my-layer");
|
||||
layer = mapboxMap.getStyle().getLayerAs("my-layer");
|
||||
}
|
||||
});
|
||||
<% } -%>
|
||||
|
||||
@@ -120,7 +120,7 @@ public class LightTest extends BaseActivityTest {
|
||||
fillExtrusionBase(Expression.get("min_height")),
|
||||
fillExtrusionOpacity(0.6f)
|
||||
);
|
||||
mapboxMap.addLayer(fillExtrusionLayer);
|
||||
mapboxMap.getStyle().addLayer(fillExtrusionLayer);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user