diff --git a/MapboxGLAndroidSDKTestApp/src/main/assets/fill_color_style.json b/MapboxGLAndroidSDKTestApp/src/main/assets/fill_color_style.json new file mode 100644 index 000000000..2282f181b --- /dev/null +++ b/MapboxGLAndroidSDKTestApp/src/main/assets/fill_color_style.json @@ -0,0 +1,95 @@ +{ + "version": 8, + "zoom": 10, + "center": [0, 0], + "sources": { + "quadrants": { + "type": "geojson", + "data": { + "type": "FeatureCollection", + "features": [ + { + "type": "Feature", + "properties": { + "name": "ABC", + "color": "red" + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-180, -90], + [-180, 0], + [0, 0], + [0, -90], + [-180, -90] + ]] + } + }, + { + "type": "Feature", + "properties": { + "name": "DEF", + "color": "#00ff00" + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [-180, 90], + [-180, 0], + [0, 0], + [0, 90], + [-180, 90] + ]] + } + }, + { + "type": "Feature", + "properties": { + "name": "GHI", + "color": "#0000ff" + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [180, -90], + [180, 0], + [0, 0], + [0, -90], + [180, -90] + ]] + } + }, + { + "type": "Feature", + "properties": { + "name": "GHI", + "color": "#ffff00" + }, + "geometry": { + "type": "Polygon", + "coordinates": [[ + [180, 90], + [180, 0], + [0, 0], + [0, 90], + [180, 90] + ]] + } + } + ] + } + } + }, + "glyphs": "local://glyphs/{fontstack}/{range}.pbf", + "layers": [ + { + "id": "colors", + "type": "fill", + "source": "quadrants", + "filter": ["in", "#", ["get", "color"]], + "paint": { + "fill-color": ["get", "color"] + } + } + ] +} \ No newline at end of file diff --git a/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java b/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java index 63e9c9ca0..8d23b0a0b 100644 --- a/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java +++ b/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/style/RuntimeStyleActivity.java @@ -118,7 +118,6 @@ protected void onCreate(Bundle savedInstanceState) { // Center and Zoom (Amsterdam, zoomed to streets) mapboxMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.379189, 4.899431), 1)); - mapboxMap.setStyle( new Style.Builder() .fromUri(Style.MAPBOX_STREETS) @@ -243,6 +242,9 @@ public boolean onOptionsItemSelected(MenuItem item) { case R.id.action_bring_water_to_front: bringWaterToFront(); return true; + case R.id.action_fill_filter_color: + styleFillColorLayer(); + return true; default: return super.onOptionsItemSelected(item); } @@ -532,6 +534,11 @@ private void addCustomTileSource() { mapboxMap.getStyle().addLayer(lineLayer); } + private void styleFillColorLayer() { + mapboxMap.setStyle(new Style.Builder().fromUri("asset://fill_color_style.json")); + mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(31, -100), 3)); + } + private void styleFillFilterLayer() { mapboxMap.setStyle(new Style.Builder().fromUri("asset://fill_filter_style.json")); mapboxMap.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(31, -100), 3)); diff --git a/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml b/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml index b302568fa..6a21f640c 100644 --- a/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml +++ b/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_runtime_style.xml @@ -58,6 +58,10 @@ android:id="@+id/action_fill_filter" android:title="@string/apply_filtered_fill" mapbox:showAsAction="never" /> + + diff --git a/MapboxGLAndroidSDKTestApp/src/main/res/values/actions.xml b/MapboxGLAndroidSDKTestApp/src/main/res/values/actions.xml index 00ac9930c..09c67914e 100644 --- a/MapboxGLAndroidSDKTestApp/src/main/res/values/actions.xml +++ b/MapboxGLAndroidSDKTestApp/src/main/res/values/actions.xml @@ -77,6 +77,7 @@ Change the water color on zoom Custom tiles Apply filtered fill + Apply filtered fill color Apply text size fill Apply filtered line Apply numeric fill filter diff --git a/vendor/mapbox-gl-native b/vendor/mapbox-gl-native index fb0c7c93a..639434b3e 160000 --- a/vendor/mapbox-gl-native +++ b/vendor/mapbox-gl-native @@ -1 +1 @@ -Subproject commit fb0c7c93a0f82cae603edc29e7e9a56024ed2b39 +Subproject commit 639434b3efd144b465f2dd118cb3b9acce2b6b31