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

commit 79f19f456f013de8af6de88da99d3aa772311240
Author: Bertil Chapuis <[email protected]>
AuthorDate: Thu Jan 4 11:54:26 2024 +0100

    Clean unused file and fix trunk width
---
 basemap/layers/highway/bridge_line.js       |   2 +-
 basemap/layers/highway/bridge_outline.js    |   2 +-
 basemap/layers/highway/construction_dash.js |   2 +-
 basemap/layers/highway/construction_line.js |   2 +-
 basemap/layers/highway/highway_line.js      |   2 +-
 basemap/layers/highway/highway_outline.js   |   2 +-
 basemap/layers/highway/tunnel_line.js       |   2 +-
 basemap/layers/highway/tunnel_outline.js    |   2 +-
 basemap/utils/layer.js                      | 195 ----------------------------
 9 files changed, 8 insertions(+), 203 deletions(-)

diff --git a/basemap/layers/highway/bridge_line.js 
b/basemap/layers/highway/bridge_line.js
index 19be03b1..c4ea0f19 100644
--- a/basemap/layers/highway/bridge_line.js
+++ b/basemap/layers/highway/bridge_line.js
@@ -34,7 +34,7 @@ let directives = [
             ['==', ['get', 'highway'], 'trunk_link'],
         ],
         'line-color': theme.bridgeLineTrunkLineColor,
-        'road-width': 8,
+        'road-width': 10,
     },
     {
         filter: [
diff --git a/basemap/layers/highway/bridge_outline.js 
b/basemap/layers/highway/bridge_outline.js
index f1ed2bcf..7b6d81eb 100644
--- a/basemap/layers/highway/bridge_outline.js
+++ b/basemap/layers/highway/bridge_outline.js
@@ -35,7 +35,7 @@ let directives = [
             ['==', ['get', 'highway'], 'trunk_link'],
         ],
         'line-color': theme.bridgeOutlineTrunkLineColor,
-        'road-gap-width': 8,
+        'road-gap-width': 10,
         'road-width': 2,
     },
     {
diff --git a/basemap/layers/highway/construction_dash.js 
b/basemap/layers/highway/construction_dash.js
index 2ddadb08..706911b6 100644
--- a/basemap/layers/highway/construction_dash.js
+++ b/basemap/layers/highway/construction_dash.js
@@ -35,7 +35,7 @@ let directives = [
             ['==', ['get', 'construction'], 'trunk'],
         ],
         'line-color': theme.constructionDashConstructionTrunkLineColor,
-        'road-width': 12,
+        'road-width': 14,
     },
     {
         filter: [
diff --git a/basemap/layers/highway/construction_line.js 
b/basemap/layers/highway/construction_line.js
index 7a77722b..aebb3475 100644
--- a/basemap/layers/highway/construction_line.js
+++ b/basemap/layers/highway/construction_line.js
@@ -41,7 +41,7 @@ let directives = [
             ]
         ],
         'line-color': theme.constructionLineConstructionTrunkLineColor,
-        'road-width': 12,
+        'road-width': 14,
     },
     {
         filter: [
diff --git a/basemap/layers/highway/highway_line.js 
b/basemap/layers/highway/highway_line.js
index d8fcc6cf..1d0bdb99 100644
--- a/basemap/layers/highway/highway_line.js
+++ b/basemap/layers/highway/highway_line.js
@@ -34,7 +34,7 @@ let directives = [
             ['==', ['get', 'highway'], 'trunk_link'],
         ],
         'line-color': theme.highwayLineTrunkLineColor,
-        'road-width': 8,
+        'road-width': 10,
     },
     {
         filter: [
diff --git a/basemap/layers/highway/highway_outline.js 
b/basemap/layers/highway/highway_outline.js
index c69638b2..75e197c1 100644
--- a/basemap/layers/highway/highway_outline.js
+++ b/basemap/layers/highway/highway_outline.js
@@ -35,7 +35,7 @@ let directives = [
             ['==', ['get', 'highway'], 'trunk_link'],
         ],
         'line-color': theme.highwayOutlineTrunkLineColor,
-        'road-gap-width': 8,
+        'road-gap-width': 10,
         'road-width': 2,
     },
     {
diff --git a/basemap/layers/highway/tunnel_line.js 
b/basemap/layers/highway/tunnel_line.js
index 9d3f6c4e..71d0437e 100644
--- a/basemap/layers/highway/tunnel_line.js
+++ b/basemap/layers/highway/tunnel_line.js
@@ -35,7 +35,7 @@ let directives = [
             ['==', ['get', 'highway'], 'trunk_link'],
         ],
         'line-color': theme.tunnelLineTrunkLineColor,
-        'road-width': 8,
+        'road-width': 10,
     },
     {
         filter: [
diff --git a/basemap/layers/highway/tunnel_outline.js 
b/basemap/layers/highway/tunnel_outline.js
index 13526e5a..9b554b7d 100644
--- a/basemap/layers/highway/tunnel_outline.js
+++ b/basemap/layers/highway/tunnel_outline.js
@@ -36,7 +36,7 @@ let directives = [
             ['==', ['get', 'highway'], 'trunk_link'],
         ],
         'line-color': theme.tunnelOutlineTrunkLineColor,
-        'road-gap-width': 8,
+        'road-gap-width': 10,
         'road-width': 2,
     },
     {
diff --git a/basemap/utils/layer.js b/basemap/utils/layer.js
deleted file mode 100644
index 49f85665..00000000
--- a/basemap/utils/layer.js
+++ /dev/null
@@ -1,195 +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.
- **/
-export default function layer(layer) {
-    return {
-        id: layer['id'],
-        type: layer['type'],
-        filter: filter(layer),
-        source: layer['source'],
-        'source-layer': layer['source-layer'],
-        minzoom: layer['minzoom'],
-        maxzoom: layer['maxzoom'],
-        layout: layer['directives']
-            ? Object.assign(
-                {
-                    ...textFont(layer),
-                    ...textField(layer),
-                    ...textSize(layer),
-                    ...textMaxWidth(layer),
-                    ...iconImage(layer),
-                    ...lineSortKey(layer),
-                    ...fillSortKey(layer),
-                },
-                layer['layout'],
-            )
-            : layer['layout'],
-        paint: layer['directives']
-            ? Object.assign(
-                {
-                    ...textColor(layer),
-                    ...textHaloColor(layer),
-                    ...textHaloWidth(layer),
-                    ...iconColor(layer),
-                    ...fillColor(layer),
-                    ...fillOutlineColor(layer),
-                    ...lineColor(layer),
-                    ...lineWidth(layer),
-                    ...lineGapWidth(layer),
-                    ...roadWidth(layer),
-                    ...roadGapWidth(layer),
-                },
-                layer['paint'],
-            )
-            : layer['paint'],
-    }
-}
-
-function filter(layer) {
-    if (layer['filter'] && layer['directives']) {
-        return [
-            'all',
-            layer['filter'],
-            ['any', ...layer['directives'].map((rule) => rule['filter'])],
-        ]
-    } else if (layer['directives']) {
-        return ['any', ...layer['directives'].map((rule) => rule['filter'])]
-    } else if (layer['filter']) {
-        return layer['filter']
-    } else {
-        return []
-    }
-}
-
-
-function iconImage(layer) {
-    return mergeDirectives(layer, 'icon-image', 'none')
-}
-
-function iconColor(layer) {
-    return mergeDirectives(layer, 'icon-color', 'rgba(0, 0, 0, 0)')
-}
-
-function textFont(layer) {
-    return mergeDirectives(layer, 'text-font', "Arial")
-}
-
-function textField(layer) {
-    return mergeDirectives(layer, 'text-field', null)
-}
-
-function textSize(layer) {
-    return mergeDirectives(layer, 'text-size', 12)
-}
-
-function textMaxWidth(layer) {
-    return mergeDirectives(layer, 'text-max-width', 4)
-}
-
-function textColor(layer) {
-    return mergeDirectives(layer, 'text-color', 'rgba(0, 0, 0, 0)')
-}
-
-function textHaloColor(layer) {
-    return mergeDirectives(layer, 'text-halo-color', 'rgba(0, 0, 0, 0)')
-}
-
-function textHaloWidth(layer) {
-    return mergeDirectives(layer, 'text-halo-width', 0)
-}
-
-function fillColor(layer) {
-    return mergeDirectives(layer, 'fill-color', 'rgba(0, 0, 0, 0)')
-}
-
-function fillOutlineColor(layer) {
-    return mergeDirectives(layer, 'fill-outline-color', 'rgba(0, 0, 0, 0)')
-}
-
-function lineColor(layer) {
-    return mergeDirectives(layer, 'line-color', 'rgba(0, 0, 0, 0)')
-}
-
-function lineWidth(layer) {
-    return mergeDirectives(layer, 'line-width', 0)
-}
-
-function lineGapWidth(layer) {
-    return mergeDirectives(layer, 'line-gap-width', 0)
-}
-
-function lineSortKey(layer) {
-    return mergeDirectives(layer, 'line-sort-key', 0)
-}
-
-function fillSortKey(layer) {
-    return mergeDirectives(layer, 'fill-sort-key', 0)
-}
-
-function mergeDirectives(layer, property, value) {
-    let cases = layer['directives'].flatMap((rule) => {
-        if (rule[property]) {
-            return [rule['filter'], rule[property]]
-        } else {
-            return []
-        }
-    })
-    if (cases.length == 0) {
-        return {}
-    }
-    return {
-        [property]: ['case', ...cases, value],
-    }
-}
-
-function roadWidth(layer) {
-    return mergeInterpolatedDirective(layer, 'road-width', 'line-width', 1)
-}
-
-function roadGapWidth(layer) {
-    return mergeInterpolatedDirective(layer, 'road-gap-width', 
'line-gap-width', 1)
-}
-
-function mergeInterpolatedDirective(layer, property, alias, value) {
-    let cases = layer['directives'].flatMap((directive) => {
-        if (directive[property]) {
-            return [directive['filter'], directive[property]]
-        } else {
-            return []
-        }
-    })
-    if (cases.length == 0) {
-        return {}
-    }
-    return {
-        [alias]: [
-            'interpolate',
-            ['exponential', 1.1],
-            ['zoom'],
-            5,
-            0.1,
-            20,
-            ['case', ...cases, value],
-        ],
-    }
-}
-
-function groupBy(xs, key) {
-    return xs.reduce(function (rv, x) {
-        ;(rv[x[key]] = rv[x[key]] || []).push(x)
-        return rv
-    }, {})
-}

Reply via email to