From 7a0f95095d0aeedd753322003a74572c8999028c Mon Sep 17 00:00:00 2001 From: Brandon Liu Date: Wed, 12 Jul 2023 15:29:42 +0800 Subject: [PATCH] Re-order default style to correct casings for bridges and tunnels [#42] (#50) --- base/src/base_layers.ts | 326 ++++++++++++++++++++-------------------- 1 file changed, 163 insertions(+), 163 deletions(-) diff --git a/base/src/base_layers.ts b/base/src/base_layers.ts index 1b03529e..58862ead 100644 --- a/base/src/base_layers.ts +++ b/base/src/base_layers.ts @@ -200,28 +200,6 @@ export function nolabels_layers(source: string, c: Theme): any[] { visibility: casingVisibility, }, }, - { - id: "roads_tunnels_other", - type: "line", - source: source, - "source-layer": "roads", - filter: ["all", ["<", "pmap:level", 0], ["==", "pmap:kind", "other"]], - paint: { - "line-color": c.tunnel_other, - "line-dasharray": [1, 1], - "line-width": [ - "interpolate", - ["exponential", 1.6], - ["zoom"], - 14, - 0, - 14.5, - 0.5, - 20, - 12, - ], - }, - }, { id: "roads_tunnels_minor_casing", type: "line", @@ -260,31 +238,6 @@ export function nolabels_layers(source: string, c: Theme): any[] { visibility: casingVisibility, }, }, - { - id: "roads_tunnels_minor", - type: "line", - source: source, - "source-layer": "roads", - filter: [ - "all", - ["<", "pmap:level", 0], - ["==", "pmap:kind", "minor_road"], - ], - paint: { - "line-color": c.tunnel_minor, - "line-width": [ - "interpolate", - ["exponential", 1.6], - ["zoom"], - 12, - 0, - 12.5, - 0.5, - 20, - 32, - ], - }, - }, { id: "roads_tunnels_medium_casing", type: "line", @@ -324,18 +277,19 @@ export function nolabels_layers(source: string, c: Theme): any[] { }, }, { - id: "roads_tunnels_medium", + id: "roads_tunnels_major_casing", type: "line", source: source, "source-layer": "roads", filter: [ "all", ["<", "pmap:level", 0], - ["==", "pmap:kind", "medium_road"], + ["==", "pmap:kind", "major_road"], ], paint: { - "line-color": c.tunnel_medium, - "line-width": [ + "line-color": c.tunnel_major_casing, + "line-dasharray": [3, 2], + "line-gap-width": [ "interpolate", ["exponential", 1.6], ["zoom"], @@ -343,42 +297,50 @@ export function nolabels_layers(source: string, c: Theme): any[] { 0, 7.5, 0.5, - 20, + 19, 32, ], + "line-width": [ + "interpolate", + ["exponential", 1.6], + ["zoom"], + 9, + 0, + 9.5, + 1, + ], + }, + layout: { + visibility: casingVisibility, }, }, { - id: "roads_tunnels_major_casing", + id: "roads_tunnels_highway_casing", type: "line", source: source, "source-layer": "roads", - filter: [ - "all", - ["<", "pmap:level", 0], - ["==", "pmap:kind", "major_road"], - ], + filter: ["all", ["<", "pmap:level", 0], ["==", "pmap:kind", "highway"]], paint: { - "line-color": c.tunnel_major_casing, + "line-color": c.tunnel_highway_casing, "line-dasharray": [3, 2], "line-gap-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 7, + 3, 0, - 7.5, + 3.5, 0.5, - 19, + 18, 32, ], "line-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 9, + 7, 0, - 9.5, + 7.5, 1, ], }, @@ -387,50 +349,89 @@ export function nolabels_layers(source: string, c: Theme): any[] { }, }, { - id: "roads_tunnels_major", + id: "roads_tunnels_other", + type: "line", + source: source, + "source-layer": "roads", + filter: ["all", ["<", "pmap:level", 0], ["==", "pmap:kind", "other"]], + paint: { + "line-color": c.tunnel_other, + "line-dasharray": [1, 1], + "line-width": [ + "interpolate", + ["exponential", 1.6], + ["zoom"], + 14, + 0, + 14.5, + 0.5, + 20, + 12, + ], + }, + }, + { + id: "roads_tunnels_minor", type: "line", source: source, "source-layer": "roads", filter: [ "all", ["<", "pmap:level", 0], - ["==", "pmap:kind", "major_road"], + ["==", "pmap:kind", "minor_road"], ], paint: { - "line-color": c.tunnel_major, + "line-color": c.tunnel_minor, "line-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 7, + 12, 0, - 7.5, + 12.5, 0.5, - 19, + 20, 32, ], }, }, { - id: "roads_tunnels_highway_casing", + id: "roads_tunnels_medium", type: "line", source: source, "source-layer": "roads", - filter: ["all", ["<", "pmap:level", 0], ["==", "pmap:kind", "highway"]], + filter: [ + "all", + ["<", "pmap:level", 0], + ["==", "pmap:kind", "medium_road"], + ], paint: { - "line-color": c.tunnel_highway_casing, - "line-dasharray": [3, 2], - "line-gap-width": [ + "line-color": c.tunnel_medium, + "line-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 3, + 7, 0, - 3.5, + 7.5, 0.5, - 18, + 20, 32, ], + }, + }, + { + id: "roads_tunnels_major", + type: "line", + source: source, + "source-layer": "roads", + filter: [ + "all", + ["<", "pmap:level", 0], + ["==", "pmap:kind", "major_road"], + ], + paint: { + "line-color": c.tunnel_major, "line-width": [ "interpolate", ["exponential", 1.6], @@ -438,12 +439,11 @@ export function nolabels_layers(source: string, c: Theme): any[] { 7, 0, 7.5, - 1, + 0.5, + 19, + 32, ], }, - layout: { - visibility: casingVisibility, - }, }, { id: "roads_tunnels_highway", @@ -832,28 +832,6 @@ export function nolabels_layers(source: string, c: Theme): any[] { visibility: casingVisibility, }, }, - { - id: "roads_bridges_other", - type: "line", - source: source, - "source-layer": "roads", - filter: ["all", [">", "pmap:level", 0], ["==", "pmap:kind", "other"]], - paint: { - "line-color": c.bridges_other, - "line-dasharray": [2, 1], - "line-width": [ - "interpolate", - ["exponential", 1.6], - ["zoom"], - 14, - 0, - 14.5, - 0.5, - 20, - 12, - ], - }, - }, { id: "roads_bridges_minor_casing", type: "line", @@ -891,31 +869,6 @@ export function nolabels_layers(source: string, c: Theme): any[] { visibility: casingVisibility, }, }, - { - id: "roads_bridges_minor", - type: "line", - source: source, - "source-layer": "roads", - filter: [ - "all", - [">", "pmap:level", 0], - ["==", "pmap:kind", "minor_road"], - ], - paint: { - "line-color": c.bridges_minor, - "line-width": [ - "interpolate", - ["exponential", 1.6], - ["zoom"], - 12, - 0, - 12.5, - 0.5, - 20, - 32, - ], - }, - }, { id: "roads_bridges_medium_casing", type: "line", @@ -954,18 +907,18 @@ export function nolabels_layers(source: string, c: Theme): any[] { }, }, { - id: "roads_bridges_medium", + id: "roads_bridges_major_casing", type: "line", source: source, "source-layer": "roads", filter: [ "all", [">", "pmap:level", 0], - ["==", "pmap:kind", "medium_road"], + ["==", "pmap:kind", "major_road"], ], paint: { - "line-color": c.bridges_medium, - "line-width": [ + "line-color": c.bridges_major_casing, + "line-gap-width": [ "interpolate", ["exponential", 1.6], ["zoom"], @@ -973,41 +926,49 @@ export function nolabels_layers(source: string, c: Theme): any[] { 0, 7.5, 0.5, - 20, + 19, 32, ], + "line-width": [ + "interpolate", + ["exponential", 1.6], + ["zoom"], + 9, + 0, + 9.5, + 1, + ], + }, + layout: { + visibility: casingVisibility, }, }, { - id: "roads_bridges_major_casing", + id: "roads_bridges_highway_casing", type: "line", source: source, "source-layer": "roads", - filter: [ - "all", - [">", "pmap:level", 0], - ["==", "pmap:kind", "major_road"], - ], + filter: ["all", [">", "pmap:level", 0], ["==", "pmap:kind", "highway"]], paint: { - "line-color": c.bridges_major_casing, + "line-color": c.bridges_highway_casing, "line-gap-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 7, + 3, 0, - 7.5, + 3.5, 0.5, - 19, + 18, 32, ], "line-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 9, + 7, 0, - 9.5, + 7.5, 1, ], }, @@ -1016,49 +977,89 @@ export function nolabels_layers(source: string, c: Theme): any[] { }, }, { - id: "roads_bridges_major", + id: "roads_bridges_other", + type: "line", + source: source, + "source-layer": "roads", + filter: ["all", [">", "pmap:level", 0], ["==", "pmap:kind", "other"]], + paint: { + "line-color": c.bridges_other, + "line-dasharray": [2, 1], + "line-width": [ + "interpolate", + ["exponential", 1.6], + ["zoom"], + 14, + 0, + 14.5, + 0.5, + 20, + 12, + ], + }, + }, + { + id: "roads_bridges_minor", type: "line", source: source, "source-layer": "roads", filter: [ "all", [">", "pmap:level", 0], - ["==", "pmap:kind", "major_road"], + ["==", "pmap:kind", "minor_road"], ], paint: { - "line-color": c.bridges_major, + "line-color": c.bridges_minor, "line-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 7, + 12, 0, - 7.5, + 12.5, 0.5, - 19, + 20, 32, ], }, }, { - id: "roads_bridges_highway_casing", + id: "roads_bridges_medium", type: "line", source: source, "source-layer": "roads", - filter: ["all", [">", "pmap:level", 0], ["==", "pmap:kind", "highway"]], + filter: [ + "all", + [">", "pmap:level", 0], + ["==", "pmap:kind", "medium_road"], + ], paint: { - "line-color": c.bridges_highway_casing, - "line-gap-width": [ + "line-color": c.bridges_medium, + "line-width": [ "interpolate", ["exponential", 1.6], ["zoom"], - 3, + 7, 0, - 3.5, + 7.5, 0.5, - 18, + 20, 32, ], + }, + }, + { + id: "roads_bridges_major", + type: "line", + source: source, + "source-layer": "roads", + filter: [ + "all", + [">", "pmap:level", 0], + ["==", "pmap:kind", "major_road"], + ], + paint: { + "line-color": c.bridges_major, "line-width": [ "interpolate", ["exponential", 1.6], @@ -1066,12 +1067,11 @@ export function nolabels_layers(source: string, c: Theme): any[] { 7, 0, 7.5, - 1, + 0.5, + 19, + 32, ], }, - layout: { - visibility: casingVisibility, - }, }, { id: "roads_bridges_highway",