Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
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
95 changes: 95 additions & 0 deletions MapboxGLAndroidSDKTestApp/src/main/assets/fill_color_style.json
Original file line number Diff line number Diff line change
@@ -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"]
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -74,4 +78,5 @@
android:id="@+id/action_bring_water_to_front"
android:title="@string/bring_water_to_front"
mapbox:showAsAction="never" />

</menu>
1 change: 1 addition & 0 deletions MapboxGLAndroidSDKTestApp/src/main/res/values/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion vendor/mapbox-gl-native
Submodule mapbox-gl-native updated 235 files