This is an automated email from the ASF dual-hosted git repository.

bchapuis pushed a commit to branch road-width
in repository https://gitbox.apache.org/repos/asf/incubator-baremaps.git


The following commit(s) were added to refs/heads/road-width by this push:
     new 14015cce Simplify waterways and interpolate line width
14015cce is described below

commit 14015cce97f47ac6c16f77d517d8b34a4ac594d1
Author: Bertil Chapuis <[email protected]>
AuthorDate: Thu Jan 4 22:56:08 2024 +0100

    Simplify waterways and interpolate line width
---
 basemap/layers/highway/highway_line.js   | 12 ---------
 basemap/layers/waterway/line.js          | 43 ++++++++++++++++---------------
 basemap/layers/waterway/tunnel_casing.js | 41 -----------------------------
 basemap/layers/waterway/tunnel_line.js   | 44 --------------------------------
 basemap/style.js                         |  6 -----
 basemap/themes/default.js                |  5 ++--
 6 files changed, 25 insertions(+), 126 deletions(-)

diff --git a/basemap/layers/highway/highway_line.js 
b/basemap/layers/highway/highway_line.js
index 1bc1fa2a..e8530c99 100644
--- a/basemap/layers/highway/highway_line.js
+++ b/basemap/layers/highway/highway_line.js
@@ -17,18 +17,6 @@
 import {asLayerObject, withSortKeys} from "../../utils/utils.js";
 import theme from "../../theme.js";
 
-const highwayMotorwayLineWidth = [5, 1, 16, 8];
-const highwayTrunkLineWidth = [5, 1, 16, 6];
-const highwayPrimaryLineWidth = [5, 1, 16, 6];
-const highwaySecondaryLineWidth = [5, 1, 16, 5];
-const highwayTertiaryLineWidth = [5, 1, 16, 4];
-const highwayBuswayLineWidth = [5, 1, 16, 4];
-const highwayUnclassifiedLineWidth = [5, 1, 16, 3];
-const highwayResidentialLineWidth = [5, 1, 16, 3];
-const highwayLivingStreetLineWidth = [5, 1, 16, 3];
-const highwayServiceLineWidth = [5, 1, 16, 3];
-const highwayRacewayLineWidth = [5, 1, 16, 2];
-const highwayPedestrianLineWidth = [5, 1, 16, 1];
 let directives = [
     {
         filter: [
diff --git a/basemap/layers/waterway/line.js b/basemap/layers/waterway/line.js
index d321c9cf..41ab5fc5 100644
--- a/basemap/layers/waterway/line.js
+++ b/basemap/layers/waterway/line.js
@@ -15,30 +15,33 @@
  limitations under the License.
  **/
 import theme from "../../theme.js";
+import {asLayerObject, withSortKeys} from "../../utils/utils.js";
 
+let directives = [
+    {
+        "filter": ["!", ["has", "tunnel"]],
+        "line-color": theme.waterwayLineColor,
+        "line-width-stops": [4, 1, 14, 1],
+    },
+    {
+        "filter": ["has", "tunnel"],
+        "line-color": theme.waterwayTunnelColor,
+        "line-width-stops": [4, 1, 14, 1],
+    },
+];
 
-export default {
+let layer = asLayerObject(withSortKeys(directives), {
     "id": "waterway",
     "type": "line",
-    "filter": [
-        "all",
-        ["!=", "tunnel", "yes"],
-        ["!=", "tunnel", "culvert"]
-    ],
     "source": "baremaps",
     "source-layer": "waterway",
-    "layout": {
-        "line-cap": "round",
-        "line-join": "round",
-        "visibility": "visible"
+    layout: {
+        visibility: 'visible',
+        'line-cap': 'round',
+        'line-join': 'round',
     },
-    "paint": {
-        "line-width": [
-            "interpolate",
-            ["exponential", 1.2],
-            ["zoom"],
-            4, 0, 20, 12
-        ],
-        "line-color": theme.waterwayLineWaterwayLineColor
-    }
-}
+});
+
+console.log(JSON.stringify(layer, null, 2));
+
+export default layer;
diff --git a/basemap/layers/waterway/tunnel_casing.js 
b/basemap/layers/waterway/tunnel_casing.js
deleted file mode 100644
index a74011b8..00000000
--- a/basemap/layers/waterway/tunnel_casing.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to you under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- **/
-import theme from "../../theme.js";
-
-
-export default {
-    "id": "waterway_tunnel_casing",
-    "type": "line",
-    "filter": [
-        "any",
-        ["==", "tunnel", "yes"],
-        ["==", "tunnel", "culvert"]
-    ],
-    "source": "baremaps",
-    "source-layer": "waterway",
-    "layout": {
-        "visibility": "visible"
-    },
-    "paint": {
-        "line-width": [
-            "interpolate", ["exponential", 1.2], ["zoom"], 4, 0, 20,
-            12
-        ],
-        "line-color": theme.waterwayTunnelCasingLineColor,
-        "line-dasharray": [0.3, 0.15]
-    }
-}
diff --git a/basemap/layers/waterway/tunnel_line.js 
b/basemap/layers/waterway/tunnel_line.js
deleted file mode 100644
index 0d946076..00000000
--- a/basemap/layers/waterway/tunnel_line.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- Licensed to the Apache Software Foundation (ASF) under one or more
- contributor license agreements.  See the NOTICE file distributed with
- this work for additional information regarding copyright ownership.
- The ASF licenses this file to you under the Apache License, Version 2.0
- (the "License"); you may not use this file except in compliance with
- the License.  You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- **/
-import theme from "../../theme.js";
-
-
-export default {
-    "id": "waterway_tunnel",
-    "type": "line",
-    "filter": [
-        "any",
-        ["==", "tunnel", "yes"],
-        ["==", "tunnel", "culvert"]
-    ],
-    "source": "baremaps",
-    "source-layer": "waterway",
-    "layout": {
-        "line-cap": "round",
-        "line-join": "round",
-        "visibility": "visible"
-    },
-    "paint": {
-        "line-width": [
-            "interpolate",
-            ["exponential", 1.2],
-            ["zoom"],
-            4, 0, 20, 8
-        ],
-        "line-color": theme.waterwayTunnelLineLineColor
-    }
-}
diff --git a/basemap/style.js b/basemap/style.js
index 246e35bf..8df66067 100644
--- a/basemap/style.js
+++ b/basemap/style.js
@@ -51,14 +51,11 @@ import ocean_overlay from './layers/ocean/overlay.js';
 import route_line from "./layers/route/style.js"
 import building_shape from "./layers/building/shape.js";
 import building_extrusion from "./layers/building/extrusion.js";
-import building_number from "./layers/building/number.js";
 import man_made_bridge from "./layers/man_made/bridge.js";
 import man_made_pier_line from "./layers/man_made/pier_line.js";
 import man_made_pier_label from "./layers/man_made/pier_label.js";
 import waterway_line from "./layers/waterway/line.js"
 import waterway_label from "./layers/waterway/label.js"
-import waterway_tunnel_line from "./layers/waterway/tunnel_line.js"
-import waterway_tunnel_casing from "./layers/waterway/tunnel_casing.js"
 import icon from "./layers/point/icon.js";
 import country_label from './layers/point/country_label.js';
 import point_label from './layers/point/point_label.js';
@@ -90,8 +87,6 @@ export default {
         leisure_overlay,
         ocean_overlay,
         waterway_line,
-        waterway_tunnel_casing,
-        waterway_tunnel_line,
         man_made_bridge,
         amenity_fountain,
         highway_tunnel_outline,
@@ -117,7 +112,6 @@ export default {
         boundary_line,
         waterway_label,
         building_extrusion,
-        building_number,
         icon,
         point_label,
         country_label,
diff --git a/basemap/themes/default.js b/basemap/themes/default.js
index e5b99b52..4f1b723f 100644
--- a/basemap/themes/default.js
+++ b/basemap/themes/default.js
@@ -604,9 +604,8 @@ export default {
     tunnelOutlineUnclassifiedLineColor: 'rgba(211, 207, 206, 1)',
     waterwayLabelTextColor: 'rgba(26, 109, 187, 1)',
     waterwayLabelTextHaloColor: 'rgba(255, 255, 255, 0.8)',
-    waterwayLineWaterwayLineColor: 'rgb(170, 211, 223)',
-    waterwayTunnelCasingLineColor: 'rgb(170, 211, 223)',
-    waterwayTunnelLineLineColor: 'rgb(243, 247, 247)',
+    waterwayLineColor: 'rgb(170, 211, 223)',
+    waterwayTunnelColor: 'rgb(216,237,250)',
     highwayMotorwayLineWidth: [5, 0.5, 16, 7],
     highwayTrunkLineWidth: [5, 0.5, 16, 6],
     highwayPrimaryLineWidth: [5, 0.5, 16, 6],

Reply via email to