@mapcreator/sdk 1.5.10 → 1.5.11
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/adornments/scalebar.d.ts +5 -2
- package/dist/mapcreator-sdk.js +84 -75
- package/dist/mapcreator-sdk.umd.cjs +57 -57
- package/dist/report.html +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
import { Map } from '@mapcreator/maplibre-gl';
|
|
2
1
|
import { JobObjectScalebar } from '../types/jobObject';
|
|
3
|
-
|
|
2
|
+
import { Map } from '@mapcreator/maplibre-gl';
|
|
3
|
+
export declare function useScalebar(scalebar: JobObjectScalebar, map: Map, vapiUrl: string, accessToken: string, mapScale: number): {
|
|
4
|
+
element: HTMLElement;
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
};
|
package/dist/mapcreator-sdk.js
CHANGED
|
@@ -38487,121 +38487,128 @@ var Dl = {
|
|
|
38487
38487
|
foot: "ft",
|
|
38488
38488
|
nauticalMile: "nm"
|
|
38489
38489
|
};
|
|
38490
|
-
function Ol(e, t, n) {
|
|
38491
|
-
let
|
|
38492
|
-
|
|
38493
|
-
|
|
38494
|
-
|
|
38490
|
+
function Ol(e, t, n, r, i) {
|
|
38491
|
+
let a = document.createElement("div");
|
|
38492
|
+
a.className = "adornment";
|
|
38493
|
+
let o = "ArialMT";
|
|
38494
|
+
return {
|
|
38495
|
+
element: a,
|
|
38496
|
+
ready: Lr(e.font ?? o, n, r).then(() => {
|
|
38497
|
+
a.innerHTML = kl(t, e, i, o), t.on("move", () => {
|
|
38498
|
+
a.innerHTML = kl(t, e, i, o);
|
|
38499
|
+
});
|
|
38500
|
+
})
|
|
38501
|
+
};
|
|
38495
38502
|
}
|
|
38496
|
-
function kl(e, t, n) {
|
|
38497
|
-
let { maxWidth:
|
|
38498
|
-
let n = j("meter", e,
|
|
38503
|
+
function kl(e, t, n, r) {
|
|
38504
|
+
let { maxWidth: i = 100, fontSize: a = 8, font: o = r, color: s = "#000000", unit: c = "metric_and_imperial" } = t, l = e.getCenter(), u = e.projectWithScaleCorrection(l), d = w(l, e.unprojectWithScaleCorrection([u.x + i, u.y])), f = Object.fromEntries(Object.entries(Dl).map(([e, t]) => {
|
|
38505
|
+
let n = j("meter", e, d), r = Tl(n) || 0;
|
|
38499
38506
|
return [e, {
|
|
38500
38507
|
value: n,
|
|
38501
38508
|
ratio: n ? r / n : 0,
|
|
38502
38509
|
humanized: r < 1 ? `${wl(r).join("/")} ${t}` : `${r} ${t}`
|
|
38503
38510
|
}];
|
|
38504
|
-
})),
|
|
38505
|
-
imperial:
|
|
38506
|
-
metric:
|
|
38507
|
-
nautical:
|
|
38508
|
-
},
|
|
38509
|
-
metric: Math.round(
|
|
38510
|
-
imperial: Math.round(
|
|
38511
|
-
},
|
|
38512
|
-
if (
|
|
38513
|
-
let e =
|
|
38511
|
+
})), p = f.meter.value > 1e3 ? f.kilometer : f.meter, m = f.foot.value > 5280 ? f.mile : f.foot, h = {
|
|
38512
|
+
imperial: m,
|
|
38513
|
+
metric: p,
|
|
38514
|
+
nautical: f.nauticalMile
|
|
38515
|
+
}, g = c === "metric_and_imperial" ? void 0 : h[c], _ = {
|
|
38516
|
+
metric: Math.round(i * p.ratio),
|
|
38517
|
+
imperial: Math.round(i * m.ratio)
|
|
38518
|
+
}, v = c === "metric_and_imperial" ? Math.max(_.metric, _.imperial) : Math.round(i * (g?.ratio ?? 0)), y = a + 7;
|
|
38519
|
+
if (c === "metric_and_imperial") {
|
|
38520
|
+
let e = y + a * 2;
|
|
38514
38521
|
return `
|
|
38515
38522
|
<svg
|
|
38516
38523
|
class="adornment-svg"
|
|
38517
38524
|
xmlns="http://www.w3.org/2000/svg"
|
|
38518
|
-
width="${
|
|
38525
|
+
width="${v * n}"
|
|
38519
38526
|
height="${e * n}"
|
|
38520
|
-
viewBox="0 0 ${
|
|
38527
|
+
viewBox="0 0 ${v} ${e}"
|
|
38521
38528
|
>
|
|
38522
38529
|
<line
|
|
38523
38530
|
x1="0"
|
|
38524
|
-
y1="${
|
|
38525
|
-
x2="${
|
|
38526
|
-
y2="${
|
|
38527
|
-
stroke="${
|
|
38531
|
+
y1="${y - .5}"
|
|
38532
|
+
x2="${v}"
|
|
38533
|
+
y2="${y - .5}"
|
|
38534
|
+
stroke="${s}"
|
|
38528
38535
|
stroke-width="1"
|
|
38529
38536
|
/>
|
|
38530
38537
|
<line
|
|
38531
38538
|
x1="0.5"
|
|
38532
|
-
y1="${
|
|
38539
|
+
y1="${y - 5}"
|
|
38533
38540
|
x2="0.5"
|
|
38534
|
-
y2="${
|
|
38535
|
-
stroke="${
|
|
38541
|
+
y2="${y + 5}"
|
|
38542
|
+
stroke="${s}"
|
|
38536
38543
|
stroke-width="1"
|
|
38537
38544
|
/>
|
|
38538
38545
|
<line
|
|
38539
|
-
x1="${
|
|
38540
|
-
y1="${
|
|
38541
|
-
x2="${
|
|
38542
|
-
y2="${
|
|
38543
|
-
stroke="${
|
|
38546
|
+
x1="${_.imperial - .5}"
|
|
38547
|
+
y1="${y - 5}"
|
|
38548
|
+
x2="${_.imperial - .5}"
|
|
38549
|
+
y2="${y}"
|
|
38550
|
+
stroke="${s}"
|
|
38544
38551
|
stroke-width="1"
|
|
38545
38552
|
/>
|
|
38546
38553
|
<line
|
|
38547
|
-
x1="${
|
|
38548
|
-
y1="${
|
|
38549
|
-
x2="${
|
|
38550
|
-
y2="${
|
|
38551
|
-
stroke="${
|
|
38554
|
+
x1="${_.metric - .5}"
|
|
38555
|
+
y1="${y}"
|
|
38556
|
+
x2="${_.metric - .5}"
|
|
38557
|
+
y2="${y + 5}"
|
|
38558
|
+
stroke="${s}"
|
|
38552
38559
|
stroke-width="1"
|
|
38553
38560
|
/>
|
|
38554
38561
|
<text
|
|
38555
38562
|
x="0"
|
|
38556
|
-
y="${
|
|
38557
|
-
font-size="${
|
|
38558
|
-
font-family="${
|
|
38563
|
+
y="${y + 7 + a}"
|
|
38564
|
+
font-size="${a}px"
|
|
38565
|
+
font-family="${o}"
|
|
38559
38566
|
font-weight="bold"
|
|
38560
|
-
fill="${
|
|
38567
|
+
fill="${s}"
|
|
38561
38568
|
text-anchor="start"
|
|
38562
38569
|
>
|
|
38563
38570
|
0
|
|
38564
38571
|
</text>
|
|
38565
38572
|
<text
|
|
38566
|
-
x="${
|
|
38567
|
-
y="${
|
|
38568
|
-
font-size="${
|
|
38569
|
-
font-family="${
|
|
38573
|
+
x="${_.imperial}"
|
|
38574
|
+
y="${y - 7}"
|
|
38575
|
+
font-size="${a}px"
|
|
38576
|
+
font-family="${o}"
|
|
38570
38577
|
font-weight="bold"
|
|
38571
|
-
fill="${
|
|
38578
|
+
fill="${s}"
|
|
38572
38579
|
text-anchor="end"
|
|
38573
38580
|
>
|
|
38574
|
-
${
|
|
38581
|
+
${m.humanized}
|
|
38575
38582
|
</text>
|
|
38576
38583
|
<text
|
|
38577
|
-
x="${
|
|
38578
|
-
y="${
|
|
38579
|
-
font-size="${
|
|
38580
|
-
font-family="${
|
|
38584
|
+
x="${_.metric}"
|
|
38585
|
+
y="${y + 7 + a}"
|
|
38586
|
+
font-size="${a}px"
|
|
38587
|
+
font-family="${o}"
|
|
38581
38588
|
font-weight="bold"
|
|
38582
|
-
fill="${
|
|
38589
|
+
fill="${s}"
|
|
38583
38590
|
text-anchor="end"
|
|
38584
38591
|
>
|
|
38585
|
-
${
|
|
38592
|
+
${p.humanized}
|
|
38586
38593
|
</text>
|
|
38587
38594
|
</svg>
|
|
38588
38595
|
`;
|
|
38589
38596
|
}
|
|
38590
|
-
let
|
|
38597
|
+
let b = y + a + 5;
|
|
38591
38598
|
return `
|
|
38592
38599
|
<svg
|
|
38593
38600
|
class="adornment-svg"
|
|
38594
38601
|
xmlns="http://www.w3.org/2000/svg"
|
|
38595
|
-
width="${
|
|
38596
|
-
height="${
|
|
38597
|
-
viewBox="0 0 ${
|
|
38602
|
+
width="${v * n}"
|
|
38603
|
+
height="${b * n}"
|
|
38604
|
+
viewBox="0 0 ${v} ${b}"
|
|
38598
38605
|
>
|
|
38599
38606
|
<line
|
|
38600
38607
|
x1="0"
|
|
38601
38608
|
y1="4.5"
|
|
38602
|
-
x2="${
|
|
38609
|
+
x2="${v}"
|
|
38603
38610
|
y2="4.5"
|
|
38604
|
-
stroke="${
|
|
38611
|
+
stroke="${s}"
|
|
38605
38612
|
stroke-width="1"
|
|
38606
38613
|
/>
|
|
38607
38614
|
<line
|
|
@@ -38609,38 +38616,38 @@ function kl(e, t, n) {
|
|
|
38609
38616
|
y1="0"
|
|
38610
38617
|
x2="0.5"
|
|
38611
38618
|
y2="10"
|
|
38612
|
-
stroke="${
|
|
38619
|
+
stroke="${s}"
|
|
38613
38620
|
stroke-width="1"
|
|
38614
38621
|
/>
|
|
38615
38622
|
<line
|
|
38616
|
-
x1="${
|
|
38623
|
+
x1="${v - .5}"
|
|
38617
38624
|
y1="0"
|
|
38618
|
-
x2="${
|
|
38625
|
+
x2="${v - .5}"
|
|
38619
38626
|
y2="10"
|
|
38620
|
-
stroke="${
|
|
38627
|
+
stroke="${s}"
|
|
38621
38628
|
stroke-width="1"
|
|
38622
38629
|
/>
|
|
38623
38630
|
<text
|
|
38624
38631
|
x="0"
|
|
38625
|
-
y="${
|
|
38626
|
-
font-size="${
|
|
38627
|
-
font-family="${
|
|
38632
|
+
y="${a + 12}"
|
|
38633
|
+
font-size="${a}px"
|
|
38634
|
+
font-family="${o}"
|
|
38628
38635
|
font-weight="bold"
|
|
38629
|
-
fill="${
|
|
38636
|
+
fill="${s}"
|
|
38630
38637
|
text-anchor="start"
|
|
38631
38638
|
>
|
|
38632
38639
|
0
|
|
38633
38640
|
</text>
|
|
38634
38641
|
<text
|
|
38635
|
-
x="${
|
|
38636
|
-
y="${
|
|
38637
|
-
font-size="${
|
|
38638
|
-
font-family="${
|
|
38642
|
+
x="${v}"
|
|
38643
|
+
y="${a + 12}"
|
|
38644
|
+
font-size="${a}px"
|
|
38645
|
+
font-family="${o}"
|
|
38639
38646
|
font-weight="bold"
|
|
38640
|
-
fill="${
|
|
38647
|
+
fill="${s}"
|
|
38641
38648
|
text-anchor="end"
|
|
38642
38649
|
>
|
|
38643
|
-
${
|
|
38650
|
+
${g?.humanized ?? ""}
|
|
38644
38651
|
</text>
|
|
38645
38652
|
</svg>
|
|
38646
38653
|
`;
|
|
@@ -38700,10 +38707,12 @@ async function Pl(e, t, n, r, i, a, o, s, c, l) {
|
|
|
38700
38707
|
buttons: []
|
|
38701
38708
|
}), u.forEach((t) => {
|
|
38702
38709
|
if (t.type === "custom") Ll(de(t, c), t.position, t.stacking);
|
|
38703
|
-
else if (t.type === "scalebar") Ll(Ol(t, n, c), t.position, t.stacking);
|
|
38704
38710
|
else if (t.type === "northArrow") Ll(ji(t, n, c), t.position, t.stacking);
|
|
38705
38711
|
else if (t.type === "webControls" && t.buttons && l !== "video") Ll(da(t, n, r, i, f), t.position, t.stacking);
|
|
38706
|
-
else if (t.type === "
|
|
38712
|
+
else if (t.type === "scalebar") {
|
|
38713
|
+
let { element: e, ready: r } = Ol(t, n, a, s, c);
|
|
38714
|
+
Ll(e, t.position, t.stacking), d.push(r);
|
|
38715
|
+
} else if (t.type === "insetMap") {
|
|
38707
38716
|
let { element: e, ready: r } = vl(t, n, o, c);
|
|
38708
38717
|
Ll(e, t.position, t.stacking), d.push(r);
|
|
38709
38718
|
} else if (t.type === "heading") {
|
|
@@ -1007,94 +1007,94 @@ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matr
|
|
|
1007
1007
|
>
|
|
1008
1008
|
${S.join(``)}
|
|
1009
1009
|
</svg>
|
|
1010
|
-
`,Sl(e)}function xl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=vl*t,o=qc(),s;if(i){let{lng:e,lat:t}=r;s=_l().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=ml().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Sl(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Cl(n),{path:l,projection:u}=xl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;$n(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Cl(e){let t=e.getCanvas().width,n=e.getCanvas().height,r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([N(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,N(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([N(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,N(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var wl=[10,5,3,2,1];function Tl(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function El(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of wl)if(n>=e)return e*t;return Dl(n)*t}function Dl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Ol={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function kl(e,t,n){let
|
|
1010
|
+
`,Sl(e)}function xl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=vl*t,o=qc(),s;if(i){let{lng:e,lat:t}=r;s=_l().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=ml().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Sl(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Cl(n),{path:l,projection:u}=xl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;$n(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Cl(e){let t=e.getCanvas().width,n=e.getCanvas().height,r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([N(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,N(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([N(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,N(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var wl=[10,5,3,2,1];function Tl(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function El(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of wl)if(n>=e)return e*t;return Dl(n)*t}function Dl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Ol={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function kl(e,t,n,r,i){let a=document.createElement(`div`);a.className=`adornment`;let o=`ArialMT`;return{element:a,ready:Lr(e.font??o,n,r).then(()=>{a.innerHTML=Al(t,e,i,o),t.on(`move`,()=>{a.innerHTML=Al(t,e,i,o)})})}}function Al(e,t,n,r){let{maxWidth:i=100,fontSize:a=8,font:o=r,color:s=`#000000`,unit:c=`metric_and_imperial`}=t,l=e.getCenter(),u=e.projectWithScaleCorrection(l),d=T(l,e.unprojectWithScaleCorrection([u.x+i,u.y])),f=Object.fromEntries(Object.entries(Ol).map(([e,t])=>{let n=M(`meter`,e,d),r=El(n)||0;return[e,{value:n,ratio:n?r/n:0,humanized:r<1?`${Tl(r).join(`/`)} ${t}`:`${r} ${t}`}]})),p=f.meter.value>1e3?f.kilometer:f.meter,m=f.foot.value>5280?f.mile:f.foot,h={imperial:m,metric:p,nautical:f.nauticalMile},g=c===`metric_and_imperial`?void 0:h[c],_={metric:Math.round(i*p.ratio),imperial:Math.round(i*m.ratio)},v=c===`metric_and_imperial`?Math.max(_.metric,_.imperial):Math.round(i*(g?.ratio??0)),y=a+7;if(c===`metric_and_imperial`){let e=y+a*2;return`
|
|
1011
1011
|
<svg
|
|
1012
1012
|
class="adornment-svg"
|
|
1013
1013
|
xmlns="http://www.w3.org/2000/svg"
|
|
1014
|
-
width="${
|
|
1014
|
+
width="${v*n}"
|
|
1015
1015
|
height="${e*n}"
|
|
1016
|
-
viewBox="0 0 ${
|
|
1016
|
+
viewBox="0 0 ${v} ${e}"
|
|
1017
1017
|
>
|
|
1018
1018
|
<line
|
|
1019
1019
|
x1="0"
|
|
1020
|
-
y1="${
|
|
1021
|
-
x2="${
|
|
1022
|
-
y2="${
|
|
1023
|
-
stroke="${
|
|
1020
|
+
y1="${y-.5}"
|
|
1021
|
+
x2="${v}"
|
|
1022
|
+
y2="${y-.5}"
|
|
1023
|
+
stroke="${s}"
|
|
1024
1024
|
stroke-width="1"
|
|
1025
1025
|
/>
|
|
1026
1026
|
<line
|
|
1027
1027
|
x1="0.5"
|
|
1028
|
-
y1="${
|
|
1028
|
+
y1="${y-5}"
|
|
1029
1029
|
x2="0.5"
|
|
1030
|
-
y2="${
|
|
1031
|
-
stroke="${
|
|
1030
|
+
y2="${y+5}"
|
|
1031
|
+
stroke="${s}"
|
|
1032
1032
|
stroke-width="1"
|
|
1033
1033
|
/>
|
|
1034
1034
|
<line
|
|
1035
|
-
x1="${
|
|
1036
|
-
y1="${
|
|
1037
|
-
x2="${
|
|
1038
|
-
y2="${
|
|
1039
|
-
stroke="${
|
|
1035
|
+
x1="${_.imperial-.5}"
|
|
1036
|
+
y1="${y-5}"
|
|
1037
|
+
x2="${_.imperial-.5}"
|
|
1038
|
+
y2="${y}"
|
|
1039
|
+
stroke="${s}"
|
|
1040
1040
|
stroke-width="1"
|
|
1041
1041
|
/>
|
|
1042
1042
|
<line
|
|
1043
|
-
x1="${
|
|
1044
|
-
y1="${
|
|
1045
|
-
x2="${
|
|
1046
|
-
y2="${
|
|
1047
|
-
stroke="${
|
|
1043
|
+
x1="${_.metric-.5}"
|
|
1044
|
+
y1="${y}"
|
|
1045
|
+
x2="${_.metric-.5}"
|
|
1046
|
+
y2="${y+5}"
|
|
1047
|
+
stroke="${s}"
|
|
1048
1048
|
stroke-width="1"
|
|
1049
1049
|
/>
|
|
1050
1050
|
<text
|
|
1051
1051
|
x="0"
|
|
1052
|
-
y="${
|
|
1053
|
-
font-size="${
|
|
1054
|
-
font-family="${
|
|
1052
|
+
y="${y+7+a}"
|
|
1053
|
+
font-size="${a}px"
|
|
1054
|
+
font-family="${o}"
|
|
1055
1055
|
font-weight="bold"
|
|
1056
|
-
fill="${
|
|
1056
|
+
fill="${s}"
|
|
1057
1057
|
text-anchor="start"
|
|
1058
1058
|
>
|
|
1059
1059
|
0
|
|
1060
1060
|
</text>
|
|
1061
1061
|
<text
|
|
1062
|
-
x="${
|
|
1063
|
-
y="${
|
|
1064
|
-
font-size="${
|
|
1065
|
-
font-family="${
|
|
1062
|
+
x="${_.imperial}"
|
|
1063
|
+
y="${y-7}"
|
|
1064
|
+
font-size="${a}px"
|
|
1065
|
+
font-family="${o}"
|
|
1066
1066
|
font-weight="bold"
|
|
1067
|
-
fill="${
|
|
1067
|
+
fill="${s}"
|
|
1068
1068
|
text-anchor="end"
|
|
1069
1069
|
>
|
|
1070
|
-
${
|
|
1070
|
+
${m.humanized}
|
|
1071
1071
|
</text>
|
|
1072
1072
|
<text
|
|
1073
|
-
x="${
|
|
1074
|
-
y="${
|
|
1075
|
-
font-size="${
|
|
1076
|
-
font-family="${
|
|
1073
|
+
x="${_.metric}"
|
|
1074
|
+
y="${y+7+a}"
|
|
1075
|
+
font-size="${a}px"
|
|
1076
|
+
font-family="${o}"
|
|
1077
1077
|
font-weight="bold"
|
|
1078
|
-
fill="${
|
|
1078
|
+
fill="${s}"
|
|
1079
1079
|
text-anchor="end"
|
|
1080
1080
|
>
|
|
1081
|
-
${
|
|
1081
|
+
${p.humanized}
|
|
1082
1082
|
</text>
|
|
1083
1083
|
</svg>
|
|
1084
|
-
`}let y
|
|
1084
|
+
`}let b=y+a+5;return`
|
|
1085
1085
|
<svg
|
|
1086
1086
|
class="adornment-svg"
|
|
1087
1087
|
xmlns="http://www.w3.org/2000/svg"
|
|
1088
|
-
width="${
|
|
1089
|
-
height="${
|
|
1090
|
-
viewBox="0 0 ${
|
|
1088
|
+
width="${v*n}"
|
|
1089
|
+
height="${b*n}"
|
|
1090
|
+
viewBox="0 0 ${v} ${b}"
|
|
1091
1091
|
>
|
|
1092
1092
|
<line
|
|
1093
1093
|
x1="0"
|
|
1094
1094
|
y1="4.5"
|
|
1095
|
-
x2="${
|
|
1095
|
+
x2="${v}"
|
|
1096
1096
|
y2="4.5"
|
|
1097
|
-
stroke="${
|
|
1097
|
+
stroke="${s}"
|
|
1098
1098
|
stroke-width="1"
|
|
1099
1099
|
/>
|
|
1100
1100
|
<line
|
|
@@ -1102,41 +1102,41 @@ vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matr
|
|
|
1102
1102
|
y1="0"
|
|
1103
1103
|
x2="0.5"
|
|
1104
1104
|
y2="10"
|
|
1105
|
-
stroke="${
|
|
1105
|
+
stroke="${s}"
|
|
1106
1106
|
stroke-width="1"
|
|
1107
1107
|
/>
|
|
1108
1108
|
<line
|
|
1109
|
-
x1="${
|
|
1109
|
+
x1="${v-.5}"
|
|
1110
1110
|
y1="0"
|
|
1111
|
-
x2="${
|
|
1111
|
+
x2="${v-.5}"
|
|
1112
1112
|
y2="10"
|
|
1113
|
-
stroke="${
|
|
1113
|
+
stroke="${s}"
|
|
1114
1114
|
stroke-width="1"
|
|
1115
1115
|
/>
|
|
1116
1116
|
<text
|
|
1117
1117
|
x="0"
|
|
1118
|
-
y="${
|
|
1119
|
-
font-size="${
|
|
1120
|
-
font-family="${
|
|
1118
|
+
y="${a+12}"
|
|
1119
|
+
font-size="${a}px"
|
|
1120
|
+
font-family="${o}"
|
|
1121
1121
|
font-weight="bold"
|
|
1122
|
-
fill="${
|
|
1122
|
+
fill="${s}"
|
|
1123
1123
|
text-anchor="start"
|
|
1124
1124
|
>
|
|
1125
1125
|
0
|
|
1126
1126
|
</text>
|
|
1127
1127
|
<text
|
|
1128
|
-
x="${
|
|
1129
|
-
y="${
|
|
1130
|
-
font-size="${
|
|
1131
|
-
font-family="${
|
|
1128
|
+
x="${v}"
|
|
1129
|
+
y="${a+12}"
|
|
1130
|
+
font-size="${a}px"
|
|
1131
|
+
font-family="${o}"
|
|
1132
1132
|
font-weight="bold"
|
|
1133
|
-
fill="${
|
|
1133
|
+
fill="${s}"
|
|
1134
1134
|
text-anchor="end"
|
|
1135
1135
|
>
|
|
1136
|
-
${
|
|
1136
|
+
${g?.humanized??``}
|
|
1137
1137
|
</text>
|
|
1138
1138
|
</svg>
|
|
1139
|
-
`}function jl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=[e.titleFont??a,e.subtitleFont??a],s=Array.from(new Set(o));return{element:i,ready:Promise.all(s.map(e=>Lr(e,t,n))).then(()=>{i.innerHTML=Ml(e,a,r)})}}function Ml(e,t,n){let{title:r,titleColor:i=`#000000`,titleFont:a=t,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFont:u=t,subtitleFontSize:d=12,subtitleJustify:f=`center`,background:p=`#ffffff`,showBackground:m=!1}=e,h=0,g=0,_=0,v=0,y=0,b=r.trim().length>0?ci([r],a,o):null,x=c.trim().length>0?ci([c],u,d):null;if(h=Math.max(b?.width??0,x?.width??0),b){let{ascent:e,descent:t}=b;g=e+t,v=8+e}if(x){let{ascent:e,descent:t}=x;_=e+t,y=b?v+b.descent+e+6:8+e}let S=h+16,C=g+_+16,w=s===`center`?S/2:s===`right`?S-8:8,T=f===`center`?S/2:f===`right`?S-8:8,E=``;if(E+=`<svg class="adornment-svg" xmlns="http://www.w3.org/2000/svg" width="${S*n}" height="${C*n}" viewBox="0 0 ${S} ${C}">`,E+=`<rect x="0" y="0" width="${S}" height="${C}" fill="${p}" rx="6" style="visibility:${m?`visible`:`hidden`}" />`,b||x){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=f===`center`?`middle`:f===`right`?`end`:`start`;E+=`<text x="${w}" y="${v}" fill="${i}" font-family="${a}" font-size="${o}" text-anchor="${e}">`,b&&(E+=`${Wr(r)}`),x&&(E+=`<tspan x="${T}" y="${y}" fill="${l}" font-family="${u}" font-size="${d}" text-anchor="${t}">`,E+=`${Wr(c)}`,E+=`</tspan>`),E+=`</text>`}return E+=`</svg>`,E}var Nl=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],Pl=new Map;async function Fl(e,t,n,r,i,a,o,s,c,l){let u=[...e.adornments??[]];Il(n,t,c,l);let d=[],f=u.some(e=>![`copyright`,`webControls`].includes(e.type));ua()&&f&&!u.some(e=>e.type===`webControls`)&&u.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),u.forEach(t=>{if(t.type===`custom`)Rl(fe(t,c),t.position,t.stacking);else if(t.type===`scalebar`)Rl(kl(t,n,c),t.position,t.stacking);else if(t.type===`northArrow`)Rl(ji(t,n,c),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&l!==`video`)Rl(da(t,n,r,i,f),t.position,t.stacking);else if(t.type===`insetMap`){let{element:e,ready:r}=yl(t,n,o,c);Rl(e,t.position,t.stacking),d.push(r)}else if(t.type===`heading`){let{element:e,ready:n}=jl(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`manualLegend`){let{element:e,ready:n}=Ai(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Si(t,e,n,a,s,c);Rl(r,t.position,t.stacking),d.push(i)}else t.type===`copyright`&&l===`video`&&Rl(pa(t,n,c),t.position,t.stacking)}),zl(n),n.on(`moveend`,()=>zl(n)),await Promise.all(d)}function Il(e,t,n,r){let i=e.getContainer();for(let e of Nl){let a=document.createElement(`div`);a.classList.add(`adornment-container`,e),a.style.cssText=Ll(e,t[e],n,r);let o=document.createElement(`div`),s=document.createElement(`div`);o.classList.add(`inner`),s.classList.add(`inner`,`vertical`),a.append(o,s),i.appendChild(a),Pl.set(e,{horizontal:o,vertical:s})}}function Ll(e,t,n,r){let i=p[e],a=``,o=[],s=t.x*n,c=t.y*n,{unit:l}=t;return i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r!==`video`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function Rl(e,t,n){ua()&&!e.classList.contains(`web-control`)&&e.classList.add(`hide`),n||=[`left_center`,`right_center`].includes(t)?`vertical`:`horizontal`;let r=Pl.get(t),i=t===`left_center`||t===`right_center`?`vertical`:`horizontal`;r?.[i].hasChildNodes()||(n=i),(r?.[n])?.appendChild(e)}function zl(e){let t=Array.from(document.querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),n=[];t.forEach(e=>{let t=e.getBoundingClientRect();t&&n.push([t.x,t.y,t.x+t.width,t.y+t.height])}),e.setLabelFreeAreas(n)}function Bl(e){for(let t of h){let n=g[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function Vl(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Hl(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Hl(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:vr(t)}}}function Ul(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Wl(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Wl(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?li(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[pr(t.center,t.radius*n)]},{type:`LineString`,coordinates:mr(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var Gl=`Roboto-Regular`;function Kl(e,t,n,r,i){let a=[],o=new Set,s=new Set,c=[`match`,[`get`,`text-font`]],l=!!t.clustering;for(let n of t.models)(n.visible??!0)&&a.push(Jl(e,t,n,1,r,i)),o.add(n.textFont),s.add(n.textLineHeight??1.2);if(Array.from(o).length>0){for(let e of Array.from(o))c.push(e,[`literal`,[e,Gl]]);c.push([`literal`,[Gl]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:a},cluster:l,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let u=!t.collisionDetection,d=t.labelCollisionDetection===void 0?u:!t.labelCollisionDetection;s.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":u,"icon-ignore-placement":u,"text-allow-overlap":d,"text-ignore-placement":d,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),l&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[Gl]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),s.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),ql(e,t))}function ql(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function Jl(e,t,n,r,i,a){let o=n.svg===void 0?void 0:di(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:ni(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?ui(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?li(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?li(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function Yl(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=te(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;Xl(i,n,a)}return o}function Xl(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(Zl(r,n),e)}}function Zl(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var Ql=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
|
|
1139
|
+
`}function jl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=[e.titleFont??a,e.subtitleFont??a],s=Array.from(new Set(o));return{element:i,ready:Promise.all(s.map(e=>Lr(e,t,n))).then(()=>{i.innerHTML=Ml(e,a,r)})}}function Ml(e,t,n){let{title:r,titleColor:i=`#000000`,titleFont:a=t,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFont:u=t,subtitleFontSize:d=12,subtitleJustify:f=`center`,background:p=`#ffffff`,showBackground:m=!1}=e,h=0,g=0,_=0,v=0,y=0,b=r.trim().length>0?ci([r],a,o):null,x=c.trim().length>0?ci([c],u,d):null;if(h=Math.max(b?.width??0,x?.width??0),b){let{ascent:e,descent:t}=b;g=e+t,v=8+e}if(x){let{ascent:e,descent:t}=x;_=e+t,y=b?v+b.descent+e+6:8+e}let S=h+16,C=g+_+16,w=s===`center`?S/2:s===`right`?S-8:8,T=f===`center`?S/2:f===`right`?S-8:8,E=``;if(E+=`<svg class="adornment-svg" xmlns="http://www.w3.org/2000/svg" width="${S*n}" height="${C*n}" viewBox="0 0 ${S} ${C}">`,E+=`<rect x="0" y="0" width="${S}" height="${C}" fill="${p}" rx="6" style="visibility:${m?`visible`:`hidden`}" />`,b||x){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=f===`center`?`middle`:f===`right`?`end`:`start`;E+=`<text x="${w}" y="${v}" fill="${i}" font-family="${a}" font-size="${o}" text-anchor="${e}">`,b&&(E+=`${Wr(r)}`),x&&(E+=`<tspan x="${T}" y="${y}" fill="${l}" font-family="${u}" font-size="${d}" text-anchor="${t}">`,E+=`${Wr(c)}`,E+=`</tspan>`),E+=`</text>`}return E+=`</svg>`,E}var Nl=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],Pl=new Map;async function Fl(e,t,n,r,i,a,o,s,c,l){let u=[...e.adornments??[]];Il(n,t,c,l);let d=[],f=u.some(e=>![`copyright`,`webControls`].includes(e.type));ua()&&f&&!u.some(e=>e.type===`webControls`)&&u.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),u.forEach(t=>{if(t.type===`custom`)Rl(fe(t,c),t.position,t.stacking);else if(t.type===`northArrow`)Rl(ji(t,n,c),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&l!==`video`)Rl(da(t,n,r,i,f),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=kl(t,n,a,s,c);Rl(e,t.position,t.stacking),d.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=yl(t,n,o,c);Rl(e,t.position,t.stacking),d.push(r)}else if(t.type===`heading`){let{element:e,ready:n}=jl(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`manualLegend`){let{element:e,ready:n}=Ai(t,a,s,c);Rl(e,t.position,t.stacking),d.push(n)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Si(t,e,n,a,s,c);Rl(r,t.position,t.stacking),d.push(i)}else t.type===`copyright`&&l===`video`&&Rl(pa(t,n,c),t.position,t.stacking)}),zl(n),n.on(`moveend`,()=>zl(n)),await Promise.all(d)}function Il(e,t,n,r){let i=e.getContainer();for(let e of Nl){let a=document.createElement(`div`);a.classList.add(`adornment-container`,e),a.style.cssText=Ll(e,t[e],n,r);let o=document.createElement(`div`),s=document.createElement(`div`);o.classList.add(`inner`),s.classList.add(`inner`,`vertical`),a.append(o,s),i.appendChild(a),Pl.set(e,{horizontal:o,vertical:s})}}function Ll(e,t,n,r){let i=p[e],a=``,o=[],s=t.x*n,c=t.y*n,{unit:l}=t;return i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r!==`video`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function Rl(e,t,n){ua()&&!e.classList.contains(`web-control`)&&e.classList.add(`hide`),n||=[`left_center`,`right_center`].includes(t)?`vertical`:`horizontal`;let r=Pl.get(t),i=t===`left_center`||t===`right_center`?`vertical`:`horizontal`;r?.[i].hasChildNodes()||(n=i),(r?.[n])?.appendChild(e)}function zl(e){let t=Array.from(document.querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),n=[];t.forEach(e=>{let t=e.getBoundingClientRect();t&&n.push([t.x,t.y,t.x+t.width,t.y+t.height])}),e.setLabelFreeAreas(n)}function Bl(e){for(let t of h){let n=g[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function Vl(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Hl(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Hl(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:vr(t)}}}function Ul(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Wl(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Wl(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?li(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?li(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?li(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[pr(t.center,t.radius*n)]},{type:`LineString`,coordinates:mr(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var Gl=`Roboto-Regular`;function Kl(e,t,n,r,i){let a=[],o=new Set,s=new Set,c=[`match`,[`get`,`text-font`]],l=!!t.clustering;for(let n of t.models)(n.visible??!0)&&a.push(Jl(e,t,n,1,r,i)),o.add(n.textFont),s.add(n.textLineHeight??1.2);if(Array.from(o).length>0){for(let e of Array.from(o))c.push(e,[`literal`,[e,Gl]]);c.push([`literal`,[Gl]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:a},cluster:l,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let u=!t.collisionDetection,d=t.labelCollisionDetection===void 0?u:!t.labelCollisionDetection;s.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":u,"icon-ignore-placement":u,"text-allow-overlap":d,"text-ignore-placement":d,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),l&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[Gl]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),s.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":c,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),ql(e,t))}function ql(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function Jl(e,t,n,r,i,a){let o=n.svg===void 0?void 0:di(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:ni(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?ui(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?li(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?li(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function Yl(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=te(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;Xl(i,n,a)}return o}function Xl(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(Zl(r,n),e)}}function Zl(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var Ql=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
|
|
1140
1140
|
`,$l=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="11" viewBox="0 0 10 11" fill="currentColor"><path d="M.21.71a.714.714 0 0 1 1.011 0l3.78 3.78L8.778.71a.715.715 0 0 1 1.013 1.01L6.01 5.501l3.78 3.778a.715.715 0 0 1-1.01 1.012L5 6.51l-3.779 3.78A.716.716 0 0 1 .21 9.28L3.99 5.5.21 1.721A.714.714 0 0 1 .21.71"/></svg>
|
|
1141
1141
|
`,eu=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m5.678 4.647-4.282 4.4A.814.814 0 1 1 .23 7.914l3.177-3.266L.23 1.381A.814.814 0 1 1 1.396.246z"/></svg>
|
|
1142
1142
|
`,tu=`<svg width="20" height="20" viewBox="0 0 40 40" stroke="currentColor" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 4.167 1.667 35.834h36.667z" stroke-width="2" stroke-linejoin="round"/><path d="M20 29.167v.834m0-14.167.007 8.333" stroke-width="2" stroke-linecap="round"/></svg>
|