Add test demo for filter with expression in (#218)
* Add test demo for filter with expression in * Update gl-native
This commit is contained in:
@@ -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"]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -118,7 +118,6 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
|
||||
// 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 class RuntimeStyleActivity extends AppCompatActivity {
|
||||
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 @@ public class RuntimeStyleActivity extends AppCompatActivity {
|
||||
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));
|
||||
|
||||
@@ -58,6 +58,10 @@
|
||||
android:id="@+id/action_fill_filter"
|
||||
android:title="@string/apply_filtered_fill"
|
||||
mapbox:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_fill_filter_color"
|
||||
android:title="@string/apply_filtered_fill_color"
|
||||
mapbox:showAsAction="never" />
|
||||
<item
|
||||
android:id="@+id/action_textsize_filter"
|
||||
android:title="@string/apply_textsize_fill"
|
||||
@@ -74,4 +78,5 @@
|
||||
android:id="@+id/action_bring_water_to_front"
|
||||
android:title="@string/bring_water_to_front"
|
||||
mapbox:showAsAction="never" />
|
||||
|
||||
</menu>
|
||||
|
||||
@@ -77,6 +77,7 @@
|
||||
<string name="change_the_water_color_on_zoom">Change the water color on zoom</string>
|
||||
<string name="custom_tiles">Custom tiles</string>
|
||||
<string name="apply_filtered_fill">Apply filtered fill</string>
|
||||
<string name="apply_filtered_fill_color">Apply filtered fill color</string>
|
||||
<string name="apply_textsize_fill">Apply text size fill</string>
|
||||
<string name="apply_filtered_line">Apply filtered line</string>
|
||||
<string name="apply_numeric_fill_filter">Apply numeric fill filter</string>
|
||||
|
||||
2
vendor/mapbox-gl-native
vendored
2
vendor/mapbox-gl-native
vendored
Submodule vendor/mapbox-gl-native updated: fb0c7c93a0...639434b3ef
Reference in New Issue
Block a user