summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobrun <tobrun@mapbox.com>2017-04-19 15:05:08 +0200
committerGitHub <noreply@github.com>2017-04-19 15:05:08 +0200
commit553ec88dc0350b9b034a0370300653d94f092382 (patch)
tree291aaa4e26979090a5b233d69e9cba557f0ab5f2
parent9c1150cfe9c1d7c4992e421695ce7c83a4840339 (diff)
downloadqtlocation-mapboxgl-553ec88dc0350b9b034a0370300653d94f092382.tar.gz
[android] - expose source layer identifier (#8709)
-rw-r--r--platform/android/CHANGELOG.md1
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java9
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java9
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java2
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java9
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java9
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs9
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java16
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java19
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java1
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java50
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs18
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java23
-rw-r--r--platform/android/src/style/layers/layer.cpp20
-rw-r--r--platform/android/src/style/layers/layer.hpp6
-rw-r--r--platform/android/src/style/layers/layer.hpp.ejs1
18 files changed, 168 insertions, 53 deletions
diff --git a/platform/android/CHANGELOG.md b/platform/android/CHANGELOG.md
index 8dcdcb296d..e94303fb15 100644
--- a/platform/android/CHANGELOG.md
+++ b/platform/android/CHANGELOG.md
@@ -17,6 +17,7 @@ Mapbox welcomes participation and contributions from everyone. If you'd like to
* OfflineRegion are validated if the bounds is found in the world bounds, else onError will be invoked [#8517](https://github.com/mapbox/mapbox-gl-native/pull/8517)
* Polygon holes [#8557](https://github.com/mapbox/mapbox-gl-native/pull/8557) and [#8722](https://github.com/mapbox/mapbox-gl-native/pull/8722)
* Custom location source [#8710](https://github.com/mapbox/mapbox-gl-native/pull/8710)
+* Expose source layer identifier [#8709](https://github.com/mapbox/mapbox-gl-native/pull/8709).
* Ensure surface is created after display and context [#8759](https://github.com/mapbox/mapbox-gl-native/pull/8759)
## 5.0.2 - April 3, 2017
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java
index d5cc80f7e9..1a7df06031 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/CircleLayer.java
@@ -60,6 +60,15 @@ public class CircleLayer extends Layer {
}
/**
+ * Get the source layer.
+ *
+ * @return sourceLayer the source layer to get
+ */
+ public String getSourceLayer() {
+ return nativeGetSourceLayer();
+ }
+
+ /**
* Set a single filter.
*
* @param filter the filter to set
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java
index b765aa6642..3719ae9e1b 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/FillLayer.java
@@ -60,6 +60,15 @@ public class FillLayer extends Layer {
}
/**
+ * Get the source layer.
+ *
+ * @return sourceLayer the source layer to get
+ */
+ public String getSourceLayer() {
+ return nativeGetSourceLayer();
+ }
+
+ /**
* Set a single filter.
*
* @param filter the filter to set
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java
index b4120f4f9a..5015dd009d 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/Layer.java
@@ -73,6 +73,8 @@ public abstract class Layer {
protected native void nativeSetSourceLayer(String sourceLayer);
+ protected native String nativeGetSourceLayer();
+
protected native float nativeGetMinZoom();
protected native float nativeGetMaxZoom();
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java
index 575b582988..ca106cc106 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/LineLayer.java
@@ -60,6 +60,15 @@ public class LineLayer extends Layer {
}
/**
+ * Get the source layer.
+ *
+ * @return sourceLayer the source layer to get
+ */
+ public String getSourceLayer() {
+ return nativeGetSourceLayer();
+ }
+
+ /**
* Set a single filter.
*
* @param filter the filter to set
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java
index 318991c032..290e162da8 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/SymbolLayer.java
@@ -60,6 +60,15 @@ public class SymbolLayer extends Layer {
}
/**
+ * Get the source layer.
+ *
+ * @return sourceLayer the source layer to get
+ */
+ public String getSourceLayer() {
+ return nativeGetSourceLayer();
+ }
+
+ /**
* Set a single filter.
*
* @param filter the filter to set
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs
index 316b3aeac1..56e0af8b45 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/style/layers/layer.java.ejs
@@ -80,6 +80,15 @@ public class <%- camelize(type) %>Layer extends Layer {
<% } -%>
<% if (type !== 'background' && type !== 'raster') { -%>
/**
+ * Get the source layer.
+ *
+ * @return sourceLayer the source layer to get
+ */
+ public String getSourceLayer() {
+ return nativeGetSourceLayer();
+ }
+
+ /**
* Set a single filter.
*
* @param filter the filter to set
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
index 4f94dcc28b..ef73dc7850 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/BackgroundLayerTest.java
@@ -234,7 +234,6 @@ public class BackgroundLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size());
}
-
@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
index 7b8a03fb35..11843ce28f 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/CircleLayerTest.java
@@ -84,6 +84,21 @@ public class CircleLayerTest extends BaseStyleTest {
}
@Test
+ public void testSourceLayer() {
+ checkViewIsDisplayed(R.id.mapView);
+ Timber.i("Visibility");
+ assertNotNull(layer);
+
+ // Get initial
+ assertEquals(layer.getSourceLayer(), "composite");
+
+ // Set
+ final String sourceLayer = "test";
+ layer.setSourceLayer(sourceLayer);
+ assertEquals(layer.getSourceLayer(), sourceLayer);
+ }
+
+ @Test
public void testCircleRadiusTransition() {
checkViewIsDisplayed(R.id.mapView);
Timber.i("circle-radiusTransitionOptions");
@@ -737,7 +752,6 @@ public class CircleLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).size());
}
-
@Test
public void testCircleTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -774,7 +788,6 @@ public class CircleLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getCircleTranslateAnchor().getFunction().getStops()).size());
}
-
@Test
public void testCirclePitchScaleAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1259,7 +1272,6 @@ public class CircleLayerTest extends BaseStyleTest {
assertEquals(0.9f, stop.out, 0.001f);
}
-
@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
index 63dac76edd..edbfcb1106 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/FillLayerTest.java
@@ -83,6 +83,20 @@ public class FillLayerTest extends BaseStyleTest {
assertEquals(layer.getVisibility().getValue(), NONE);
}
+ @Test
+ public void testSourceLayer() {
+ checkViewIsDisplayed(R.id.mapView);
+ Timber.i("Visibility");
+ assertNotNull(layer);
+
+ // Get initial
+ assertEquals(layer.getSourceLayer(), "composite");
+
+ // Set
+ final String sourceLayer = "test";
+ layer.setSourceLayer(sourceLayer);
+ assertEquals(layer.getSourceLayer(), sourceLayer);
+ }
@Test
public void testFillAntialiasAsConstant() {
@@ -594,7 +608,6 @@ public class FillLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).size());
}
-
@Test
public void testFillTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -679,7 +692,6 @@ public class FillLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getFillPattern().getFunction().getStops()).size());
}
-
@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
index 110d23dd90..7263b5de73 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/LineLayerTest.java
@@ -83,6 +83,20 @@ public class LineLayerTest extends BaseStyleTest {
assertEquals(layer.getVisibility().getValue(), NONE);
}
+ @Test
+ public void testSourceLayer() {
+ checkViewIsDisplayed(R.id.mapView);
+ Timber.i("Visibility");
+ assertNotNull(layer);
+
+ // Get initial
+ assertEquals(layer.getSourceLayer(), "composite");
+
+ // Set
+ final String sourceLayer = "test";
+ layer.setSourceLayer(sourceLayer);
+ assertEquals(layer.getSourceLayer(), sourceLayer);
+ }
@Test
public void testLineCapAsConstant() {
@@ -120,7 +134,6 @@ public class LineLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getLineCap().getFunction().getStops()).size());
}
-
@Test
public void testLineJoinAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -157,7 +170,6 @@ public class LineLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getLineJoin().getFunction().getStops()).size());
}
-
@Test
public void testLineMiterLimitAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -195,7 +207,6 @@ public class LineLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).size());
}
-
@Test
public void testLineRoundLimitAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -573,7 +584,6 @@ public class LineLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).size());
}
-
@Test
public void testLineTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1226,7 +1236,6 @@ public class LineLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getLinePattern().getFunction().getStops()).size());
}
-
@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
index 2d902a7432..8ff3911cd1 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/RasterLayerTest.java
@@ -426,7 +426,6 @@ public class RasterLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size());
}
-
@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
index d81965f2c9..97fc3e07d3 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/SymbolLayerTest.java
@@ -83,6 +83,20 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(layer.getVisibility().getValue(), NONE);
}
+ @Test
+ public void testSourceLayer() {
+ checkViewIsDisplayed(R.id.mapView);
+ Timber.i("Visibility");
+ assertNotNull(layer);
+
+ // Get initial
+ assertEquals(layer.getSourceLayer(), "composite");
+
+ // Set
+ final String sourceLayer = "test";
+ layer.setSourceLayer(sourceLayer);
+ assertEquals(layer.getSourceLayer(), sourceLayer);
+ }
@Test
public void testSymbolPlacementAsConstant() {
@@ -120,7 +134,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getSymbolPlacement().getFunction().getStops()).size());
}
-
@Test
public void testSymbolSpacingAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -158,7 +171,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getSymbolSpacing().getFunction().getStops()).size());
}
-
@Test
public void testSymbolAvoidEdgesAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -195,7 +207,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getSymbolAvoidEdges().getFunction().getStops()).size());
}
-
@Test
public void testIconAllowOverlapAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -232,7 +243,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getIconAllowOverlap().getFunction().getStops()).size());
}
-
@Test
public void testIconIgnorePlacementAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -269,7 +279,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getIconIgnorePlacement().getFunction().getStops()).size());
}
-
@Test
public void testIconOptionalAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -306,7 +315,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getIconOptional().getFunction().getStops()).size());
}
-
@Test
public void testIconRotationAlignmentAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -343,7 +351,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getIconRotationAlignment().getFunction().getStops()).size());
}
-
@Test
public void testIconSizeAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -381,7 +388,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getIconSize().getFunction().getStops()).size());
}
-
@Test
public void testIconSizeAsIdentitySourceFunction() {
checkViewIsDisplayed(R.id.mapView);
@@ -526,7 +532,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getIconTextFit().getFunction().getStops()).size());
}
-
@Test
public void testIconTextFitPaddingAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -564,7 +569,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getIconTextFitPadding().getFunction().getStops()).size());
}
-
@Test
public void testIconImageAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -601,7 +605,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getIconImage().getFunction().getStops()).size());
}
-
@Test
public void testIconImageAsIdentitySourceFunction() {
checkViewIsDisplayed(R.id.mapView);
@@ -792,7 +795,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(0.9f, stop.out, 0.001f);
}
-
@Test
public void testIconPaddingAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -830,7 +832,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getIconPadding().getFunction().getStops()).size());
}
-
@Test
public void testIconKeepUprightAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -867,7 +868,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getIconKeepUpright().getFunction().getStops()).size());
}
-
@Test
public void testIconOffsetAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -950,7 +950,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(IntervalStops.class, layer.getIconOffset().getFunction().getStops().getClass());
}
-
@Test
public void testTextPitchAlignmentAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -987,7 +986,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextPitchAlignment().getFunction().getStops()).size());
}
-
@Test
public void testTextRotationAlignmentAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1024,7 +1022,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextRotationAlignment().getFunction().getStops()).size());
}
-
@Test
public void testTextFieldAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1106,7 +1103,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(IntervalStops.class, layer.getTextField().getFunction().getStops().getClass());
}
-
@Test
public void testTextFontAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1143,7 +1139,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextFont().getFunction().getStops()).size());
}
-
@Test
public void testTextSizeAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1181,7 +1176,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextSize().getFunction().getStops()).size());
}
-
@Test
public void testTextSizeAsIdentitySourceFunction() {
checkViewIsDisplayed(R.id.mapView);
@@ -1327,7 +1321,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextMaxWidth().getFunction().getStops()).size());
}
-
@Test
public void testTextLineHeightAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1365,7 +1358,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextLineHeight().getFunction().getStops()).size());
}
-
@Test
public void testTextLetterSpacingAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1403,7 +1395,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextLetterSpacing().getFunction().getStops()).size());
}
-
@Test
public void testTextJustifyAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1440,7 +1431,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextJustify().getFunction().getStops()).size());
}
-
@Test
public void testTextAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1477,7 +1467,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextAnchor().getFunction().getStops()).size());
}
-
@Test
public void testTextMaxAngleAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1515,7 +1504,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextMaxAngle().getFunction().getStops()).size());
}
-
@Test
public void testTextRotateAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1553,7 +1541,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextRotate().getFunction().getStops()).size());
}
-
@Test
public void testTextRotateAsIdentitySourceFunction() {
checkViewIsDisplayed(R.id.mapView);
@@ -1699,7 +1686,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextPadding().getFunction().getStops()).size());
}
-
@Test
public void testTextKeepUprightAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1736,7 +1722,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextKeepUpright().getFunction().getStops()).size());
}
-
@Test
public void testTextTransformAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1818,7 +1803,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(IntervalStops.class, layer.getTextTransform().getFunction().getStops().getClass());
}
-
@Test
public void testTextOffsetAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1901,7 +1885,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(IntervalStops.class, layer.getTextOffset().getFunction().getStops().getClass());
}
-
@Test
public void testTextAllowOverlapAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1938,7 +1921,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextAllowOverlap().getFunction().getStops()).size());
}
-
@Test
public void testTextIgnorePlacementAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -1975,7 +1957,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextIgnorePlacement().getFunction().getStops()).size());
}
-
@Test
public void testTextOptionalAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -2800,7 +2781,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getIconTranslate().getFunction().getStops()).size());
}
-
@Test
public void testIconTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -3625,7 +3605,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((ExponentialStops) layer.getTextTranslate().getFunction().getStops()).size());
}
-
@Test
public void testTextTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
@@ -3662,7 +3641,6 @@ public class SymbolLayerTest extends BaseStyleTest {
assertEquals(1, ((IntervalStops) layer.getTextTranslateAnchor().getFunction().getStops()).size());
}
-
@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
index 8aa0f15954..fd0c177fb8 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/style/layer.junit.ejs
@@ -91,9 +91,26 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
layer.setProperties(visibility(NONE));
assertEquals(layer.getVisibility().getValue(), NONE);
}
+<% if (!(type === 'background' || type === 'raster')) { -%>
+ @Test
+ public void testSourceLayer() {
+ checkViewIsDisplayed(R.id.mapView);
+ Timber.i("Visibility");
+ assertNotNull(layer);
+
+ // Get initial
+ assertEquals(layer.getSourceLayer(), "composite");
+
+ // Set
+ final String sourceLayer = "test";
+ layer.setSourceLayer(sourceLayer);
+ assertEquals(layer.getSourceLayer(), sourceLayer);
+ }
+<% } -%>
<% for (const property of properties) { -%>
<% if (property.transition) { -%>
+
@Test
public void test<%- camelize(property.name) %>Transition() {
checkViewIsDisplayed(R.id.mapView);
@@ -363,7 +380,6 @@ public class <%- camelize(type) %>LayerTest extends BaseStyleTest {
assertEquals(layer.get<%- camelize(property.name) %>AsInt(), Color.RED);
}
<% } -%>
-
<% } -%>
@After
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
index f63ede9bce..f6754af0f9 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java
@@ -17,12 +17,14 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback;
import com.mapbox.mapboxsdk.style.functions.Function;
import com.mapbox.mapboxsdk.style.functions.stops.ExponentialStops;
import com.mapbox.mapboxsdk.style.functions.stops.Stop;
+import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.layers.FillLayer;
import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.layers.LineLayer;
import com.mapbox.mapboxsdk.style.layers.Property;
import com.mapbox.mapboxsdk.style.layers.PropertyValue;
import com.mapbox.mapboxsdk.style.layers.RasterLayer;
+import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
import com.mapbox.mapboxsdk.style.layers.TransitionOptions;
import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.style.sources.RasterSource;
@@ -41,6 +43,7 @@ import java.io.Reader;
import java.io.StringWriter;
import java.io.Writer;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import timber.log.Timber;
@@ -408,7 +411,25 @@ public class RuntimeStyleActivity extends AppCompatActivity {
lineWidth(20f)
);
- mapboxMap.addLayer(layer);
+ // adding layers below "road" layers
+ List<Layer> layers = mapboxMap.getLayers();
+ Layer latestLayer = null;
+ Collections.reverse(layers);
+ for (Layer currentLayer : layers) {
+ if (currentLayer instanceof FillLayer && ((FillLayer) currentLayer).getSourceLayer().equals("road")) {
+ latestLayer = currentLayer;
+ } else if (currentLayer instanceof CircleLayer && ((CircleLayer) currentLayer).getSourceLayer().equals("road")) {
+ latestLayer = currentLayer;
+ } else if (currentLayer instanceof SymbolLayer && ((SymbolLayer) currentLayer).getSourceLayer().equals("road")) {
+ latestLayer = currentLayer;
+ } else if (currentLayer instanceof LineLayer && ((LineLayer) currentLayer).getSourceLayer().equals("road")) {
+ latestLayer = currentLayer;
+ }
+ }
+
+ if (latestLayer != null) {
+ mapboxMap.addLayerBelow(layer, latestLayer.getId());
+ }
// Need to get a fresh handle
layer = mapboxMap.getLayerAs("terrainLayer");
diff --git a/platform/android/src/style/layers/layer.cpp b/platform/android/src/style/layers/layer.cpp
index 6c9de51a0d..58c0c5ee84 100644
--- a/platform/android/src/style/layers/layer.cpp
+++ b/platform/android/src/style/layers/layer.cpp
@@ -144,6 +144,25 @@ namespace android {
}
}
+ jni::String Layer::getSourceLayer(jni::JNIEnv& env) {
+ using namespace mbgl::style;
+
+ std::string sourceLayerId;
+ if (layer.is<FillLayer>()) {
+ sourceLayerId = layer.as<FillLayer>()->getSourceLayer();
+ } else if (layer.is<LineLayer>()) {
+ sourceLayerId = layer.as<LineLayer>()->getSourceLayer();
+ } else if (layer.is<SymbolLayer>()) {
+ sourceLayerId = layer.as<SymbolLayer>()->getSourceLayer();
+ } else if (layer.is<CircleLayer>()) {
+ sourceLayerId = layer.as<CircleLayer>()->getSourceLayer();
+ } else {
+ mbgl::Log::Warning(mbgl::Event::JNI, "Layer doesn't support source layer");
+ }
+
+ return jni::Make<jni::String>(env, sourceLayerId);
+ }
+
jni::jfloat Layer::getMinZoom(jni::JNIEnv&){
return layer.getMinZoom();
}
@@ -180,6 +199,7 @@ namespace android {
METHOD(&Layer::setPaintProperty, "nativeSetPaintProperty"),
METHOD(&Layer::setFilter, "nativeSetFilter"),
METHOD(&Layer::setSourceLayer, "nativeSetSourceLayer"),
+ METHOD(&Layer::getSourceLayer, "nativeGetSourceLayer"),
METHOD(&Layer::getMinZoom, "nativeGetMinZoom"),
METHOD(&Layer::getMaxZoom, "nativeGetMaxZoom"),
METHOD(&Layer::setMinZoom, "nativeSetMinZoom"),
diff --git a/platform/android/src/style/layers/layer.hpp b/platform/android/src/style/layers/layer.hpp
index deea7a6613..78c3f80b48 100644
--- a/platform/android/src/style/layers/layer.hpp
+++ b/platform/android/src/style/layers/layer.hpp
@@ -66,9 +66,11 @@ public:
/* common properties, but not shared by all */
- void setFilter(jni::JNIEnv& env, jni::Array<jni::Object<>> jfilter);
+ void setFilter(jni::JNIEnv&, jni::Array<jni::Object<>>);
- void setSourceLayer(jni::JNIEnv& env, jni::String sourceLayer);
+ void setSourceLayer(jni::JNIEnv&, jni::String);
+
+ jni::String getSourceLayer(jni::JNIEnv&);
// Property getters
diff --git a/platform/android/src/style/layers/layer.hpp.ejs b/platform/android/src/style/layers/layer.hpp.ejs
index d1e84ac2d4..837049b4c3 100644
--- a/platform/android/src/style/layers/layer.hpp.ejs
+++ b/platform/android/src/style/layers/layer.hpp.ejs
@@ -44,7 +44,6 @@ public:
jni::Object<TransitionOptions> get<%- camelize(property.name) %>Transition(jni::JNIEnv&);
<% } -%>
<% } -%>
-
jni::jobject* createJavaPeer(jni::JNIEnv&);
}; // class <%- camelize(type) %>Layer