Skip to content

Commit

Permalink
Add style directives directives (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
bchapuis authored Feb 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3580b83 commit 20730ac
Showing 15 changed files with 266 additions and 82 deletions.
44 changes: 44 additions & 0 deletions basemap/layers/aerialway/circle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
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": "aerialway_circle",
"type": "circle",
"filter": [
"any",
["==", "aerialway", "pylon"],
["==", "aerialway", "station"],
],
"source": "baremaps",
"source-layer": "point",
"layout": {
"visibility": "visible"
},
"paint": {
'circle-pitch-alignment': 'map',
"circle-color": theme.powerTowerCircleColor,
"circle-radius": [
"interpolate",
["exponential", 1],
["zoom"],
14, 1,
20, 8
]
}
}
4 changes: 2 additions & 2 deletions basemap/layers/aerialway/line.js
Original file line number Diff line number Diff line change
@@ -15,12 +15,12 @@
limitations under the License.
**/
import theme from "../../theme.js";
import {asLayerObject, withSortKeys} from "../../utils/utils";
import {asLayerObject, withSortKeys} from "../../utils/utils.js";


let directives = [
{
filter: ['==', ["geometry-type"], 'LineString'],
filter: ['has', 'aerialway'],
'line-color': theme.aerialwayLineColor,
'line-width': 1,
},
39 changes: 39 additions & 0 deletions basemap/layers/attraction/line.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
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 {asLayerObject, withSortKeys} from "../../utils/utils.js";
import theme from "../../theme.js";

let directives = [
{
filter: ['==', ['get', 'attraction'], "water_slide"],
'line-color': theme.attractionWaterSlideLineColor,
'line-width-stops': theme.attractionWaterSlideLineWidth,
},

];

export default asLayerObject(withSortKeys(directives), {
id: 'attraction_line',
type: 'line',
source: 'baremaps',
'source-layer': 'attraction',
layout: {
visibility: 'visible',
'line-cap': 'round',
'line-join': 'round',
},
});
59 changes: 0 additions & 59 deletions basemap/layers/attraction/style.js

This file was deleted.

42 changes: 42 additions & 0 deletions basemap/layers/barrier/line.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
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 {asLayerObject, withSortKeys} from "../../utils/utils.js";
import theme from "../../theme.js";

let directives = [
{
filter: ['==', ['get', 'barrier'], 'hedge'],
'line-color': theme.barrierHedgeLineColor,
'line-width-stops': theme.barrierHedgeLineWidth,
},
];

export default asLayerObject(withSortKeys(directives), {
id: 'barrier_line',
source: 'baremaps',
'source-layer': 'barrier',
type: 'line',
layout: {
visibility: 'visible',
'line-cap': 'round',
'line-join': 'round',
},
filter: [
'all',
['==', ['geometry-type'], 'LineString'],
],
});
14 changes: 10 additions & 4 deletions basemap/layers/boundary/line.js
Original file line number Diff line number Diff line change
@@ -18,25 +18,31 @@ import {asLayerObject, withSortKeys} from "../../utils/utils.js";
import theme from "../../theme.js";

let directives = [
{
filter: ['==', ['get', 'admin_level'], "0"],
'line-color': theme.boundaryAdminLevelLineColor,
},

{
filter: ['==', ['get', 'admin_level'], "1"],
'line-color': theme.boundaryAdminLevelLineColor,
'line-width': 3,
},
{
filter: ['==', ['get', 'admin_level'], "2"],
'line-color': theme.boundaryAdminLevelLineColor,
'line-width': 3,
},
{
filter: ['==', ['get', 'admin_level'], "3"],
'line-color': theme.boundaryAdminLevelLineColor,
'line-width': 2,
},
{
filter: ['==', ['get', 'admin_level'], "4"],
'line-color': theme.boundaryAdminLevelLineColor,
'line-width': 2,
},
{
filter: ['has', 'boundary'],
'line-color': theme.boundaryAdminLevelLineColor,
'line-width': 1,
},
];

2 changes: 1 addition & 1 deletion basemap/layers/building/fill.js
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ export default {
visibility: 'visible',
},
paint: {
'fill-antialias': false,
'fill-antialias': true,
'fill-color': theme.buildingFillColor,
'fill-outline-color': theme.buildingOutlineColor,
'fill-opacity': [
4 changes: 0 additions & 4 deletions basemap/layers/landuse/background.js
Original file line number Diff line number Diff line change
@@ -47,10 +47,6 @@ let directives = [
filter: ['==', ['get', 'landuse'], 'plant_nursery'],
'fill-color': theme.landusePlantNurseryBackgroundFillColor,
},
{
filter: ['==', ['get', 'landuse'], 'military'],
'fill-color': theme.landuseMilitaryBackgroundFillColor,
},
{
filter: ['==', ['get', 'landuse'], 'landfill'],
'fill-color': theme.landuseLandfillBackgroundFillColor,
4 changes: 4 additions & 0 deletions basemap/layers/landuse/overlay.js
Original file line number Diff line number Diff line change
@@ -19,6 +19,10 @@ import {asLayerObject, withSortKeys} from "../../utils/utils.js";
import theme from "../../theme.js";

let directives = [
{
filter: ['==', ['get', 'landuse'], 'military'],
'fill-color': theme.landuseMilitaryOverlayFillColor,
},
{
filter: ['==', ['get', 'landuse'], 'forest'],
'fill-color': theme.landuseForestOverlayFillColor,
39 changes: 39 additions & 0 deletions basemap/layers/leisure/line.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
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 {asLayerObject, withSortKeys} from "../../utils/utils.js";
import theme from "../../theme.js";


export let directives = [
{
'filter': ['==', ['get', 'leisure'], 'nature_reserve'],
'line-color': theme.leisureNatureReserveLineColor,
'line-width': 2,
},
];

export default asLayerObject(withSortKeys(directives), {
'id': 'leisure_line',
'source': 'baremaps',
'source-layer': 'leisure',
'type': 'line',
'layout': {
'visibility': 'visible',
'line-cap': 'round',
'line-join': 'round',
},
});
4 changes: 4 additions & 0 deletions basemap/layers/man_made/man_made_fill.js
Original file line number Diff line number Diff line change
@@ -30,6 +30,10 @@ let directives = [
{
filter: ['==', ['get', 'man_made'], 'pier'],
'fill-color': theme.manMadePierFillColor,
},
{
filter: ['==', ['get', 'man_made'], 'wastewater_plant'],
'fill-color': theme.manMadeWasteWaterPlantFillColor,
}
];

10 changes: 5 additions & 5 deletions basemap/layers/natural/background.js
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ import theme from "../../theme.js";
let directives = [
{
filter: ['==', ['get', 'natural'], 'glacier'],
'fill-color': theme.naturalGlacierBackgroundFillColor
'fill-color': theme.naturalGlacierBackgroundFillColor,
},
{
filter: ['==', ['get', 'natural'], 'wood'],
@@ -39,14 +39,14 @@ let directives = [
filter: ['==', ['get', 'natural'], 'grassland'],
'fill-color': theme.naturalGrasslandBackgroundFillColor
},
{
filter: ['==', ['get', 'natural'], 'bare_rock'],
'fill-color': theme.naturalBareRockBackgroundFillColor
},
{
filter: ['==', ['get', 'natural'], 'scree'],
'fill-color': theme.naturalScreeBackgroundFillColor
},
{
filter: ['==', ['get', 'natural'], 'bare_rock'],
'fill-color': theme.naturalBareRockBackgroundFillColor
},
{
filter: ['==', ['get', 'natural'], 'shingle'],
'fill-color': theme.naturalShingleBackgroundFillColor
48 changes: 48 additions & 0 deletions basemap/layers/natural/line.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
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 {asLayerObject, withSortKeys} from "../../utils/utils.js";
import theme from "../../theme.js";

let directives = [
{
filter: ['==', ['get', 'natural'], 'cliff'],
'line-color': theme.naturalCliffLineColor,
'line-width-stops': theme.naturalCliffLineWidth,
},
{
filter: ['==', ['get', 'natural'], 'tree_row'],
'line-color': theme.naturalTreeRowLineColor,
'line-width-stops': theme.naturalTreeRowLineWidth,
},

];

export default asLayerObject(withSortKeys(directives), {
id: 'natural_line',
source: 'baremaps',
'source-layer': 'natural',
type: 'line',
layout: {
visibility: 'visible',
'line-cap': 'round',
'line-join': 'round',
},
filter: [
'all',
['==', ['geometry-type'], 'LineString'],
],
});
Loading

0 comments on commit 20730ac

Please sign in to comment.