Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[android] - expose source layer identifier #8709

Merged
merged 2 commits into from
Apr 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions platform/android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public CircleLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public FillLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ public void setMaxZoom(float zoom) {

protected native void nativeSetSourceLayer(String sourceLayer);

protected native String nativeGetSourceLayer();

protected native float nativeGetMinZoom();

protected native float nativeGetMaxZoom();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public LineLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ public SymbolLayer withSourceLayer(String sourceLayer) {
return this;
}

/**
* Get the source layer.
*
* @return sourceLayer the source layer to get
*/
public String getSourceLayer() {
return nativeGetSourceLayer();
}

/**
* Set a single filter.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ public void testBackgroundOpacityAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getBackgroundOpacity().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,21 @@ public void testSetVisibility() {
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 testCircleRadiusTransition() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -737,7 +752,6 @@ public void testCircleTranslateAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getCircleTranslate().getFunction().getStops()).size());
}


@Test
public void testCircleTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -774,7 +788,6 @@ public void testCircleTranslateAnchorAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getCircleTranslateAnchor().getFunction().getStops()).size());
}


@Test
public void testCirclePitchScaleAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -1259,7 +1272,6 @@ public void testCircleStrokeOpacityAsCompositeFunction() {
assertEquals(0.9f, stop.out, 0.001f);
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public void testSetVisibility() {
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() {
Expand Down Expand Up @@ -594,7 +608,6 @@ public void testFillTranslateAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getFillTranslate().getFunction().getStops()).size());
}


@Test
public void testFillTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -679,7 +692,6 @@ public void testFillPatternAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getFillPattern().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public void testSetVisibility() {
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() {
Expand Down Expand Up @@ -120,7 +134,6 @@ public void testLineCapAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getLineCap().getFunction().getStops()).size());
}


@Test
public void testLineJoinAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -157,7 +170,6 @@ public void testLineJoinAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getLineJoin().getFunction().getStops()).size());
}


@Test
public void testLineMiterLimitAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -195,7 +207,6 @@ public void testLineMiterLimitAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getLineMiterLimit().getFunction().getStops()).size());
}


@Test
public void testLineRoundLimitAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -573,7 +584,6 @@ public void testLineTranslateAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getLineTranslate().getFunction().getStops()).size());
}


@Test
public void testLineTranslateAnchorAsConstant() {
checkViewIsDisplayed(R.id.mapView);
Expand Down Expand Up @@ -1226,7 +1236,6 @@ public void testLinePatternAsCameraFunction() {
assertEquals(1, ((IntervalStops) layer.getLinePattern().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ public void testRasterFadeDurationAsCameraFunction() {
assertEquals(1, ((ExponentialStops) layer.getRasterFadeDuration().getFunction().getStops()).size());
}


@After
public void unregisterIntentServiceIdlingResource() {
Espresso.unregisterIdlingResources(idlingResource);
Expand Down
Loading