@chrtco/sdk 0.10.16 → 0.10.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +61 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +61 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -27022,11 +27022,13 @@ function buildLayersForClass(objectClass, ct, sourceId = DEFAULT_REGION, opts =
|
|
|
27022
27022
|
["linear"],
|
|
27023
27023
|
["zoom"],
|
|
27024
27024
|
10,
|
|
27025
|
-
0.
|
|
27025
|
+
0.16,
|
|
27026
|
+
11,
|
|
27027
|
+
0.22,
|
|
27026
27028
|
12,
|
|
27027
|
-
0.
|
|
27029
|
+
0.3,
|
|
27028
27030
|
13,
|
|
27029
|
-
0.
|
|
27031
|
+
0.5,
|
|
27030
27032
|
14,
|
|
27031
27033
|
0.9,
|
|
27032
27034
|
16,
|
|
@@ -27037,12 +27039,45 @@ function buildLayersForClass(objectClass, ct, sourceId = DEFAULT_REGION, opts =
|
|
|
27037
27039
|
layer.layout = {
|
|
27038
27040
|
...layer.layout,
|
|
27039
27041
|
"icon-size": hazardIconSize,
|
|
27040
|
-
|
|
27041
|
-
|
|
27042
|
-
//
|
|
27043
|
-
//
|
|
27044
|
-
//
|
|
27045
|
-
//
|
|
27042
|
+
// ── A HAZARD IS NEVER SUPPRESSED BY COLLISION ────────────────────
|
|
27043
|
+
//
|
|
27044
|
+
// This was `allow-overlap: false, icon-optional: true`, chosen to stop
|
|
27045
|
+
// adjacent rocks stacking into a black mass — a real problem, and the
|
|
27046
|
+
// reasoning above it only ever considered rock-against-rock.
|
|
27047
|
+
//
|
|
27048
|
+
// The same two flags also made hazards lose against EVERY other
|
|
27049
|
+
// class, and the nav aids they lose to are `allow-overlap: true` and
|
|
27050
|
+
// so can never lose in return. A rock beside a buoy was dropped;
|
|
27051
|
+
// `icon-optional: true` means an icon that collides is simply not
|
|
27052
|
+
// drawn, and a hazard symbol carries no label to fall back to, so it
|
|
27053
|
+
// vanished with nothing left behind to notice. Observed at Sculpin
|
|
27054
|
+
// Ledge (42°39.6'N 070°36.9'W) at Harbor scale.
|
|
27055
|
+
//
|
|
27056
|
+
// Which hazard wins was also decided by an accident of stack
|
|
27057
|
+
// position: UWTROC sits at draw index 802, below the nav aids at
|
|
27058
|
+
// ~947, while WRECKS sits at 950 above them — so rocks beat buoys and
|
|
27059
|
+
// wrecks lost to them, for no reason anyone chose.
|
|
27060
|
+
//
|
|
27061
|
+
// Deconflicting hazards against each other stays; it just no longer
|
|
27062
|
+
// runs through suppression:
|
|
27063
|
+
// - `symbol-sort-key` (below) still ranks by danger, and with
|
|
27064
|
+
// overlap allowed it now sets DRAW ORDER, so the worst hazard is
|
|
27065
|
+
// the one painted on top rather than the one that survives.
|
|
27066
|
+
// - the icon-size curve above is what keeps a dense ledge legible
|
|
27067
|
+
// at the zoomed-out end of Harbor. That is now the only thing
|
|
27068
|
+
// doing it, which is why its low end was lowered in the same
|
|
27069
|
+
// change.
|
|
27070
|
+
//
|
|
27071
|
+
// ⚠ `icon-ignore-placement` is deliberately LEFT AT ITS DEFAULT
|
|
27072
|
+
// (false). Hazards no longer yield to anything, but they still
|
|
27073
|
+
// occupy the collision index, so a label that would sit on top of a
|
|
27074
|
+
// rock moves instead of covering it.
|
|
27075
|
+
"icon-allow-overlap": true,
|
|
27076
|
+
"icon-optional": false,
|
|
27077
|
+
// Retained, with a narrower job than it had. With overlap allowed
|
|
27078
|
+
// this no longer suppresses a neighbouring hazard; it pads the box
|
|
27079
|
+
// hazards present to OTHER classes' placement, keeping labels off
|
|
27080
|
+
// them.
|
|
27046
27081
|
"icon-padding": 2,
|
|
27047
27082
|
"symbol-sort-key": [
|
|
27048
27083
|
"case",
|
|
@@ -27065,6 +27100,18 @@ function buildLayersForClass(objectClass, ct, sourceId = DEFAULT_REGION, opts =
|
|
|
27065
27100
|
"icon-allow-overlap": true,
|
|
27066
27101
|
"icon-ignore-placement": true
|
|
27067
27102
|
};
|
|
27103
|
+
const valnmrNum = ["to-number", ["coalesce", ["get", "VALNMR"], ["get", "valnmr"], 0], 0];
|
|
27104
|
+
const isMajor = [">=", valnmrNum, 10];
|
|
27105
|
+
const majorLayer = {
|
|
27106
|
+
...layer,
|
|
27107
|
+
id: `${layer.id}-major`,
|
|
27108
|
+
filter: layer.filter ? ["all", layer.filter, isMajor] : isMajor,
|
|
27109
|
+
layout: { ...layer.layout },
|
|
27110
|
+
minzoom: 6
|
|
27111
|
+
};
|
|
27112
|
+
layer.filter = layer.filter ? ["all", layer.filter, ["!", isMajor]] : ["!", isMajor];
|
|
27113
|
+
layer.minzoom = scaminToMinZoom(entry?.scamin) ?? layer.minzoom;
|
|
27114
|
+
layers.push(majorLayer);
|
|
27068
27115
|
}
|
|
27069
27116
|
} else if (resolved.layout) {
|
|
27070
27117
|
layer.layout = resolved.layout;
|
|
@@ -28879,10 +28926,12 @@ function generateStyle(palette = "DAY", opts = {}) {
|
|
|
28879
28926
|
const symbolSet = opts.symbolSet ?? "s52";
|
|
28880
28927
|
const spriteBase = `${opts.tileBaseUrl ?? "https://tiles.chrt.co"}/v1/sprites`;
|
|
28881
28928
|
const isLndareFill = (l) => /^s52-LNDARE-fill-band\d+$/.test(l.id);
|
|
28929
|
+
const isSeaareFill = (l) => /^s52-SEAARE-fill-band\d+$/.test(l.id);
|
|
28882
28930
|
const emitted = opts.land ? (() => {
|
|
28883
|
-
const
|
|
28884
|
-
const
|
|
28885
|
-
|
|
28931
|
+
const lndareFills = layers.filter(isLndareFill);
|
|
28932
|
+
const seaareFills = layers.filter(isSeaareFill);
|
|
28933
|
+
const rest = layers.filter((l) => !isLndareFill(l) && !isSeaareFill(l));
|
|
28934
|
+
return [rest[0], ...seaareFills, ...lndareFills, ...rest.slice(1)];
|
|
28886
28935
|
})() : layers;
|
|
28887
28936
|
const style = {
|
|
28888
28937
|
version: 8,
|