@metoceanapi/wxtiles-leaflet 1.0.5 → 1.0.6-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/CHANGELOG.md +44 -3
- package/dist/es/defaults/colorschemes.d.ts +2 -0
- package/dist/es/defaults/styles.d.ts +2 -0
- package/dist/es/defaults/uconv.d.ts +2 -0
- package/dist/es/mercator.d.ts +4 -0
- package/dist/es/qtree.d.ts +8 -0
- package/dist/es/tile.d.ts +33 -53
- package/dist/es/tilesLayer.d.ts +112 -0
- package/dist/es/wxtiles.css +1 -0
- package/dist/es/wxtiles.d.ts +24 -0
- package/dist/es/wxtiles.js +1 -0
- package/dist/es/wxtools.d.ts +15 -17
- package/dist/web/wxtiles.css +1 -0
- package/dist/web/wxtiles.js +1 -0
- package/package.json +12 -19
- package/.prettierrc.js +0 -1
- package/.vscode/launch.json +0 -22
- package/.vscode/settings.json +0 -6
- package/build.js +0 -32
- package/dist/es/bundle.css +0 -1
- package/dist/es/bundle.js +0 -1
- package/dist/es/index.d.ts +0 -2
- package/dist/es/tileLayer.d.ts +0 -100
- package/dist/es/wxtile-js.d.ts +0 -11
- package/dist/web/wxtile.css +0 -1
- package/dist/web/wxtile.js +0 -1
- package/examples/README.md +0 -16
- package/examples/getTile.html +0 -109
- package/examples/group.html +0 -93
- package/examples/res/icon.png +0 -0
- package/examples/res/wxtiles-logo.png +0 -0
- package/examples/scalar.html +0 -66
- package/examples/setStyle.html +0 -191
- package/examples/setTime.html +0 -93
- package/examples/setupcomplete.html +0 -71
- package/examples/setupcompletePromice.html +0 -71
- package/examples/vector.html +0 -64
- package/tsconfig.json +0 -19
- package/watch-public.js +0 -56
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metoceanapi/wxtiles-leaflet",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6-18",
|
|
4
4
|
"description": "WxTile JS lib to render wxtiles datalayers",
|
|
5
|
-
"main": "dist/es/
|
|
6
|
-
"types": "dist/es/
|
|
5
|
+
"main": "dist/es/wxtiles.js",
|
|
6
|
+
"types": "dist/es/wxtiles.d.ts",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "rm -rf dist/ && node build.js && tsc",
|
|
9
|
-
"start": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
9
|
+
"start": "node watch-public.js",
|
|
10
|
+
"preversion": "npm run build",
|
|
11
|
+
"version": "changelogkeeper && git add CHANGELOG.md"
|
|
12
12
|
},
|
|
13
13
|
"repository": {
|
|
14
14
|
"type": "git",
|
|
@@ -20,22 +20,15 @@
|
|
|
20
20
|
"url": "https://github.com/metoceanapi/wxtiles-leaflet/issues"
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/metoceanapi/wxtiles-leaflet#readme",
|
|
23
|
-
"prettier": "@metservice/prettier",
|
|
24
23
|
"devDependencies": {
|
|
25
|
-
"@
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"esbuild": "^0.9.6",
|
|
30
|
-
"esbuild-plugin-sass": "^0.3.4",
|
|
24
|
+
"@types/leaflet": "^1.7.5",
|
|
25
|
+
"changelogkeeper": "^1.2.0",
|
|
26
|
+
"esbuild": "^0.12.28",
|
|
27
|
+
"esbuild-plugin-external-global": "^1.0.1",
|
|
31
28
|
"express": "^4.17.1",
|
|
32
|
-
"
|
|
33
|
-
"open": "^8.0.4",
|
|
34
|
-
"prettier": "^2.2.1",
|
|
35
|
-
"pretty-quick": "^3.1.0",
|
|
36
|
-
"typescript": "^4.1.5"
|
|
29
|
+
"typescript": "^4.4.3"
|
|
37
30
|
},
|
|
38
31
|
"peerDependencies": {
|
|
39
|
-
"leaflet": "1.
|
|
32
|
+
"leaflet": "^1.7.1"
|
|
40
33
|
}
|
|
41
34
|
}
|
package/.prettierrc.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('@metservice/prettier');
|
package/.vscode/launch.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Use IntelliSense to learn about possible attributes.
|
|
3
|
-
// Hover to view descriptions of existing attributes.
|
|
4
|
-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
-
"version": "0.2.0",
|
|
6
|
-
"configurations": [
|
|
7
|
-
{
|
|
8
|
-
"type": "chrome",
|
|
9
|
-
"request": "launch",
|
|
10
|
-
"name": "Launch Chrome",
|
|
11
|
-
"file": "${file}",
|
|
12
|
-
"webRoot": "${workspaceFolder}/examples"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"type": "chrome",
|
|
16
|
-
"request": "launch",
|
|
17
|
-
"name": "Launch",
|
|
18
|
-
"url": "http://localhost:3001",
|
|
19
|
-
"webRoot": "${workspaceFolder}/public"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
package/.vscode/settings.json
DELETED
package/build.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const esbuild = require('esbuild');
|
|
2
|
-
const sassPlugin = require('esbuild-plugin-sass');
|
|
3
|
-
|
|
4
|
-
const sharedConfig = {
|
|
5
|
-
entryPoints: ['src/index.ts'],
|
|
6
|
-
bundle: true,
|
|
7
|
-
plugins: [sassPlugin()],
|
|
8
|
-
loader: {
|
|
9
|
-
'.woff': 'dataurl',
|
|
10
|
-
},
|
|
11
|
-
target: 'es2015',
|
|
12
|
-
minify: true,
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
// BUILD as ESModules
|
|
16
|
-
esbuild
|
|
17
|
-
.build({
|
|
18
|
-
...sharedConfig,
|
|
19
|
-
format: 'esm',
|
|
20
|
-
outfile: 'dist/es/bundle.js',
|
|
21
|
-
})
|
|
22
|
-
.catch((e) => console.error(e.message));
|
|
23
|
-
|
|
24
|
-
// build for web
|
|
25
|
-
esbuild
|
|
26
|
-
.build({
|
|
27
|
-
...sharedConfig,
|
|
28
|
-
format: 'iife',
|
|
29
|
-
outfile: 'dist/web/wxtile.js',
|
|
30
|
-
globalName: 'wxtilejs',
|
|
31
|
-
})
|
|
32
|
-
.catch((e) => console.error(e.message));
|
package/dist/es/bundle.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@font-face{font-family:barbs;src:url(data:font/woff;base64,d09GRgABAAAAAAowAA0AAAAAQJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAKFAAAABoAAAAci1SsR0dERUYAAAn4AAAAHAAAAB4AJwApT1MvMgAAAZwAAAA3AAAAYH2xStJjbWFwAAAB9AAAAHsAAAFilx+PDGdhc3AAAAnwAAAACAAAAAj//wADZ2x5ZgAAArgAAAY5AAA6tI1syaloZWFkAAABMAAAADIAAAA2EYD96GhoZWEAAAFkAAAAIAAAACQEngFOaG10eAAAAdQAAAAeAAAAjEiz9nJsb2NhAAACcAAAAEgAAABI4UDuum1heHAAAAGEAAAAGAAAACAALAFFbmFtZQAACPQAAACjAAABPiCVCBtwb3N0AAAJmAAAAFcAAABy3/XX1HicY2BkYGAA4ssLn/rF89t8ZeBmYQCBGxPuPoTR/5f9q2acxbQOyOVgYAKJAgCXyg8XAAB4nGNgZGBgjvn3hoGBye7/MgYGxlkMQBEUoAwAfRUE73icY2BkYGBQZnRh4GAAAUYGNAAAC3cAc3icY2BiMmGcwMDKwMCggQFPMKACRmSOU2ZRCoMDkJHCHPPvDYhkFIGpYapmjgFSCgyMAInXCUQAeJxjkmeAA0YRBgYmu/9HgHgZEK+jKwa6AwCJsjosAAB4nGNgYGBmgGAZBkYGEIgB8hjBfBYGByDNw8DBwARkMzDwMigwRDGk/P8PVgfiOTIkAnmM/7/+f/z/8P+9UBPggJGNAS7EyAQkmBjQFECsxgtYWNnYOTi5uHl4+fgFBIWERUTFxCUkpaRlZCHycvIKioTMGEAAAG77EEYAAAAAHAAcABwAHAG0AjoCugN8BD4FRAZKB5II2gpmCqoLMgu6DIQNTg5cD2oQvBIO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anZ7vd793Hq9bq+JYChhifU6WJciyZql9GgFtrW9vbW1vbVNPsVC6/oLWLtjWOUTZy02kSJRkn8OJj6AihqtVrM1xZ34NmGJ9RpYnUjqOkdpEuX557lR2k+x/+rqp02BrsOs6XZdvwXr5nFY75wfHoO1ZRi6sY5s/8KFB9kHef86QkaYFJGxfgnW8/7fXMqjuXAk8kSxp8IKMMuyrYdg4kVU8K0l2EEGNf3CJebPwPzICPN4fU+K2V5qt9v0BvAwNxsvA0Aq0Fkeyo+nvi+H+1/0v3mECmMAeJx9zT0LglAYxfG/pr1QRDS0tLgHofQZWhtCmhNREcRCcXDsA7S29lU7xjN7l/t7znMPF1jxwWE4DnO2ZpcZB/NE+dnsyXezz5KXear8q5eOt1Cy+bcGu6zZmyfKT2ZPvph9dpTmqfI3MT1PMnISUt3E/TPLk1S6aizoqLRqNGZFVyXCSGVkddPY0Or7BzUBEUdCxVnTlo86iI7hWP0HkHwruQB4nG3DORbBUAAAwPk/lXMgtogkdpLOcgwNSprcPzy1eW9EP10n+Kf/HUSJgaHUyNjE1ExmLrdQKFWWVtY2tnb2Do5qjZOzi2uIvfz1bu+P5636ANo8C3kAAAAAAf//AAJ4nGNgZGBg4AFiMSBmYmAEQiUgZgHzGAAFFABReJxjYGBgZACCW0YfWkD0nSAGKxgNAEMXBVIAAA==) format("woff")}.error-tile{display:flex;justify-content:center;align-items:center}.s-tile canvas{position:absolute}.canvas-fill{z-index:1}.canvas-slines{z-index:2}.canvas-vector{z-index:3}.wxtiles-logo{width:270px}
|
package/dist/es/bundle.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var W=Math.pow;var p=(e,t,o)=>new Promise((n,s)=>{var i=c=>{try{l(o.next(c))}catch(m){s(m)}},r=c=>{try{l(o.throw(c))}catch(m){s(m)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,r);l((o=o.apply(e,t)).next())});var J={comment1:["degC: ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["hPa: ['Pa', 100]' -> hPa = Pa * 100 + 0 (0 - could be ommited)",0],K:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"W/m^2":["W/m^2",1],"W m**2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100]},Q={none:["#00000000","#00000000"],rainbow:["#f00","#ff0","#0f0","#0ff","#00f","#f0f"],rainbow2:["#f00","#ff0","#0f0","#0ff","#00f","#f0f","#f00"],rainbowzerro:["#ff000000","#f00","#ff0","#0f0","#0ff","#00f","#f0f"],bluebird:["#00f","#f0f","#0ff","#80f","#88f"],bluebirdzerro:["#0000ff00","#00f","#f0f","#0ff","#80f","#88f"],bw:["#000","#fff"],wb:["#fff","#000"],redish:["#f0f","#f00","#ff0"],greenish:["#ff0","#0f0","#0ff"],blueish:["#f0f","#00f","#0ff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"]},j={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0}},F,z,Z;function O({colorStyles:e={},units:t={},colorSchemes:o={}}={}){window.wxlogging&&console.log("WxTile lib setup: start"),F=Object.assign({},J,t),z=Object.assign({},o,Q),Z=Y(e),window.wxlogging&&console.log("WxTile lib setup: styles unrolled"),document.fonts.load("32px barbs"),document.fonts.load("32px arrows"),window.wxlogging&&console.log("WxTile lib setup is done"+JSON.stringify({colorStyles:e,units:t,colorSchemes:o}))}function A(){return Z}function N(){return z}function k(e,t,o){let n=o?Object.assign({},F,o):F;if(!n||!e||!t||e===t||!n[e]||!n[t]||n[e][0]!==n[t][0]){window.wxlogging&&console.log(e===t?"Trivial converter:":"Inconvertible units. Default converter is used:",e," -> ",t);let r=l=>l;return r.trivial=!0,r}window.wxlogging&&console.log("Converter: From:",e," To:",t);let s=n[e][1]/n[t][1],i=(n[e][2]||0)/n[t][1]-(n[t][2]||0)/n[t][1];return i?r=>s*r+i:r=>s*r}function Y(e){let t=Object.assign({},j);for(let s in e){let i=e[s];if(Array.isArray(i))for(let r=0;r<i.length;++r)t[s+"["+r+"]"]=Object.assign({},i[r]);else t[s]=Object.assign({},i)}let o=(s,i)=>{if(i==="base")return j.base;let r=s[i];(!r.parent||!(r.parent in s))&&(r.parent="base");let l=o(s,r.parent);return Object.assign(r,Object.assign({},l,r,{parent:"base"}))},n={};for(let s in t)n[s]=o(t,s);return n}function tt(e){let t=new Map;return o=>{let n=t.get(o);return n===void 0&&(n=e(o),t.set(o,n)),n}}function et(e,t){return p(this,null,function*(){let o=new Image;o.crossOrigin="anonymous";let n=()=>{o.src=""};return t.addEventListener("abort",n),o.src=e,yield o.decode(),t.removeEventListener("abort",n),o})}function nt(e,t){return p(this,null,function*(){let o=i=>{let r=i.height*i.width,l=new Uint16Array(i.data.buffer),c=new Uint16Array(r);for(let a=0;a<r;a++)c[a]=l[a*2];let m=new Uint8Array(i.data.buffer);for(let a=0;a<8;++a)m[a]=m[a*4+2];let g=new DataView(i.data.buffer),u=g.getFloat32(0,!0),h=g.getFloat32(4,!0),d=(h-u)/65535,f=ot(c);return{raw:c,dmin:u,dmax:h,dmul:d,integral:f,radius:0}},n=Object.assign(document.createElement("canvas"),{width:258,height:258,imageSmoothingEnabled:!1}).getContext("2d");if(!n)return Promise.reject();let s=yield et(e,t);return n.drawImage(s,0,0),o(n.getImageData(0,0,258,258))})}function B(){let e=new AbortController,t=tt(o=>nt(o,e.signal));return t.abort=()=>e.abort(),t}function ot(e){let t=new Uint32Array(258*258),o=new Uint32Array(258*258);t[0]=e[0],o[0]=e[0]===0?0:1;for(let n=1;n<258;++n)t[n]=e[n]+t[n-1],t[258*n]=e[258*n]+t[258*n-258],o[n]=(e[n]===0?0:1)+o[n-1],o[258*n]=(e[258*n]===0?0:1)+o[258*n-258];for(let n=1,s=259;n<258;++n,++s)for(let i=1;i<258;++i,++s)t[s]=e[s]+t[s-258]+t[s-1]-t[s-258-1],o[s]=(e[s]===0?0:1)+o[s-258]+o[s-1]-o[s-258-1];return{integral:t,integralNZ:o}}function H(e,t){if(t<0||t===e.radius)return e;e.radius=t;let o=258,{integral:n,integralNZ:s}=e.integral;for(let i=1;i<o;i++)for(let r=1;r<o;r++){if(!e.raw[o*i+r])continue;let l=Math.min(t,r-1,o-1-r),c=Math.min(t,i-1,o-1-i),m=o*(i-c-1)+r,g=o*(i+c)+r,u=s[m-l-1],h=s[m+l],d=s[g-l-1],f=s[g+l],a=u+f-h-d,b=n[m-l-1],x=n[m+l],y=n[g-l-1],w=n[g+l],S=b+w-x-y;e.raw[i*o+r]=S/a}return e}function C(e){let t=e>>0&255,o=e>>8&255,n=e>>16&255,s=t.toString(16),i=o.toString(16),r=n.toString(16);return s=s.length===2?s:"0"+s,i=i.length===2?i:"0"+i,r=r.length===2?r:"0"+r,"#"+s+i+r}function v(e){if(e[0]==="#"){if(e.length===4)return+("0xff"+e[3]+e[3]+e[2]+e[2]+e[1]+e[1]);if(e.length===7)return+("0xff"+e[5]+e[6]+e[3]+e[4]+e[1]+e[2]);if(e.length===9)return+("0x"+e[7]+e[8]+e[5]+e[6]+e[3]+e[4]+e[1]+e[2])}return window.wxlogging&&console.log("wrong color format",e),0}function T(e){return p(this,null,function*(){return(yield fetch(e)).json()})}function L(e,t="",o){var s;let n=document.createElement(e);return n.className=t,o&&((s=o.appendChild)==null||s.call(o,n)),n}function U(e,t,o){let n=e>>0&255,s=e>>8&255,i=e>>16&255,r=e>>>24,l=t>>0&255,c=t>>8&255,m=t>>16&255,g=t>>>24,u=n+o*(l-n),h=s+o*(c-s),d=i+o*(m-i),f=r+o*(g-r);return u|h<<8|d<<16|f<<24}function G(e,t,o){let n=[];for(let s=0;s<o;++s)n.push(s*(t-e)/(o-1)+e);return n}function st(e,t,o){return e>o?o:e<t?t:e}var I=class{constructor(t,o,[n,s],i){let r=s-n;this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let l=[];this.DataToStyle=k(o,t.units,t.extraUnits),this.DataToStyle.trivial&&(t.units=o),i&&(this.DataToKnots=k(o,"knot"));let c=k(t.units,o,t.extraUnits),m=a=>~~(65535*st((c(a)-n)/(s-n),0,1));if(Array.isArray(t.colorMap)){t.colorMap.sort((a,b)=>a[0]<b[0]?-1:a[0]>b[0]?1:0);for(let[a]of t.colorMap)l.push(m(a))}else{if(t.levels||(t.levels=G(this.DataToStyle(n),this.DataToStyle(s),10)),t.levels.sort((a,b)=>a<b?-1:a>b?1:0),!t.colors){let a=N();t.colorScheme&&t.colorScheme in a?t.colors=a[t.colorScheme]:t.colors=a.wb}for(let a of t.levels)l.push(m(a))}let g=65536,u=R(g,t);this.ticks=u.ticks;let h=u.ticks[0].data,f=u.ticks[u.ticks.length-1].data-h;for(let a=0;a<65536;++a){let b=r*a/65535+n,x=this.DataToStyle(b),y=Math.round((g-1)*(x-h)/f);y<=0?this.colorsI[a]=t.showBelowMin?u.colors[0]:0:y>=g?this.colorsI[a]=t.showAboveMax?u.colors[g-1]:0:this.colorsI[a]=u.colors[y]}this.colorsI[0]=0;for(let a=0;a<l[0];++a)this.levelIndex[a]=0;for(let a=0;a<l.length-1;a++)for(let b=l[a];b<l[a+1]+1;++b)this.levelIndex[b]=a;for(let a=l[l.length-1];a<65536;++a)this.levelIndex[a]=l.length-1}};function K(e){var o;if(e!==0&&-.1<e&&e<.1)return e.toExponential(2);let t=e.toString();return((o=t.split(".")[1])==null?void 0:o.length)>2?e.toFixed(2):t}function R(e,t){let o={size:e,showBelowMin:t.showBelowMin,showAboveMax:t.showAboveMax,units:t.units,colors:new Uint32Array(e),ticks:[]},{colorMap:n,levels:s,colors:i}=t,r=t.fill!=="solid";if(n){let h=n[0][0],d=n[n.length-1][0]-h;for(let[f,a]of n){let b=~~((f-h)/d*(e-1)),x={data:f,dataString:K(f),color:a,pos:b};o.ticks.push(x)}for(let f=0;f<n.length-1;f++){let a=o.ticks[f].pos,b=o.ticks[f+1].pos,x=v(n[f][1]),y=r?v(n[f+1][1]):0;for(let w=a;w<b;++w)o.colors[w]=r?U(x,y,(w-a)/(b-a)):x}return o.colors[e-1]=v(n[n.length-1][1]),o}if(!i||!s)return o;let l=0,c=0,m=-1;for(let h=0;h<e;++h){let d=h*(i.length-1)/e;m!==~~d&&(m=~~d,l=v(i[m]),c=i.length>m+1?v(i[m+1]):l),o.colors[h]=r?U(l,c,d-m):l}o.colors[e-1]=v(i[i.length-1]);let g=s[0],u=(e-1)/(s[s.length-1]-g);for(let h of s){let d=~~((h-g)*u),f={data:h,dataString:K(h),color:C(o.colors[d]),pos:d};o.ticks.push(f)}return o}function rt(e,t){if(!t)return e;let o=.9999999/Math.pow(2,t.z),n=t.x*256*o,s=t.y*256*o,i={raw:new Uint16Array(258*258),dmin:e.dmin,dmax:e.dmax,dmul:e.dmul},{raw:r}=i;for(let l=-1,c=0;l<=256;l++){let m=s+l*o,g=Math.floor(m),u=m-g;for(let h=-1;h<=256;h++,c++){let d=n+h*o,f=Math.floor(d),a=d-f,b=f+1+(g+1)*258,x=e.raw[b],y=e.raw[b+1],w=e.raw[b+258],S=e.raw[b+258+1];switch((x?1:0)|(y?2:0)|(w?4:0)|(S?8:0)){case 0:r[c]=0;continue;case 1:r[c]=x;continue;case 2:r[c]=y;continue;case 3:w=x,S=y;break;case 4:r[c]=w;continue;case 5:y=x,S=w;break;case 6:S=y+w>>1,x=S;break;case 7:S=y+w>>1;break;case 8:r[c]=S;continue;case 9:y=x+S>>1,w=y;break;case 10:x=y,w=S;break;case 11:w=x+S>>1;break;case 12:x=w,y=S;break;case 13:y=x+S>>1;break;case 14:x=y+w>>1;break}x=e.dmin+e.dmul*x,y=e.dmin+e.dmul*y,w=e.dmin+e.dmul*w,S=e.dmin+e.dmul*S;let M=E(x,y,a),D=E(w,S,a);r[c]=(E(M,D,u)-e.dmin)/e.dmul,r[c]===0&&(r[c]=1)}}return i}function E(e,t,o){let n=((t-e)%360+540)%360-180;return(e+n*o+360)%360}function it(e,t){if(!t)return e;let o=.9999999/Math.pow(2,t.z),n=t.x*256*o,s=t.y*256*o,i={raw:new Uint16Array(258*258),dmin:e.dmin,dmax:e.dmax,dmul:e.dmul},{raw:r}=i;for(let l=-1,c=0;l<=256;l++){let m=s+l*o,g=Math.floor(m),u=m-g;for(let h=-1;h<=256;h++,c++){let d=n+h*o,f=Math.floor(d),a=d-f,b=f+1+(g+1)*258,x=e.raw[b],y=e.raw[b+1],w=e.raw[b+258],S=e.raw[b+258+1];switch((x?1:0)|(y?2:0)|(w?4:0)|(S?8:0)){case 7:r[c]=a+u<1?a*(y-x)+u*(w-x)+x:0;continue;case 14:r[c]=a+u<1?0:a*(S-w)+u*(S-y)+y+w-S;continue;case 11:r[c]=u<a?(1-a)*(x-y)+u*(S-y)+y:0;continue;case 13:r[c]=u<a?0:(1-a)*(w-S)+u*(w-x)+x+S-w;continue;case 15:r[c]=a+u<1?a*(y-x)+u*(w-x)+x:a*(S-w)+u*(S-y)+y+w-S;continue;default:r[c]=0}}}return i}function V({layer:e,coords:t,done:o}){let n=L("div","leaflet-tile s-tile");if(e.dataSource){let s=new $({layer:e,coords:t,tileEl:n});s._load().then(()=>{s.draw(),o()}).catch(i=>{console.log(i),o()}),n.wxtile=s}else setTimeout(o);return n}var $=class{constructor({layer:t,coords:o,tileEl:n}){this.data=[];this.sLines=[];this.coords=o,this.layer=t,this.canvasFill=L("canvas","s-tile canvas-fill",n),this.canvasSlines=L("canvas","s-tile canvas-slines",n),this.canvasVector=this.canvasFill,this.canvasFill.width=this.canvasFill.height=this.canvasSlines.width=this.canvasSlines.height=256;function s(i){let r=i.getContext("2d");if(!r)throw"error";return r}this.canvasFillCtx=s(this.canvasFill),this.canvasSlinesCtx=s(this.canvasSlines),this.canvasVectorCtx=this.canvasFillCtx,this.imData=this.canvasFillCtx.createImageData(256,256)}draw(){this.data.length!==0&&(this._drawFillAndIsolines(),this._drawVector(),this._drawDegree(),this._drawStaticSlines())}clearSLinesCanvas(){this.canvasSlinesCtx.clearRect(0,0,256,256)}drawSLines(t){if(this.sLines.length===0)return;let o=this.canvasSlinesCtx;if(o.clearRect(0,0,256,256),this.layer.style.streamLineColor==="none"){this.sLines=[];return}let n=this.layer.style.streamLineColor.substr(0,7);t=t>>7;for(let s=0;s<this.sLines.length;++s){let i=this.sLines[s],r=i.length-1,l=(t+(1+i[0].x)*(1+i[0].y))%30;for(let c=0;c<r;++c){let m=i[c],g=i[c+1],u=1-(l-c)/r;(u<0||u>1)&&(u=0);let h=(~~(u*255)).toString(16);o.strokeStyle=n+(h.length<2?"0"+h:h);let d=1+~~((1.2-u)*5);o.lineWidth=d,o.beginPath(),o.moveTo(m.x,m.y),o.lineTo(g.x,g.y),o.stroke()}}}getData({x:t,y:o}){if(!this.data.length)return;let n=this.data[0].raw[(o+1)*258+(t+1)];return{raw:n,data:this.data[0].dmin+this.data[0].dmul*n}}_load(){return p(this,null,function*(){try{let{upCoords:t,subCoords:o}=this._splitCoords(this.coords),n=this._coordsToURLs(t),s=yield Promise.all(n.map(this.layer.loadData)),i=this.layer.dataSource.units==="degree"?rt:it,r=l=>i(H(l,this.layer.style.blurRadius),o);this.data=s.map(r),this.layer.vector&&(this._vectorPrepare(),this._createSLines())}catch(t){this.data=[],this.canvasFillCtx.clearRect(0,0,256,256),this.canvasSlinesCtx.clearRect(0,0,256,256)}return this})}_splitCoords(t){let o=t.z-this.layer.dataSource.meta.maxZoom;if(o<=0)return{upCoords:t};let n={x:t.x>>>o,y:t.y>>>o,z:this.layer.dataSource.meta.maxZoom},s={x:t.x&(1<<o)-1,y:t.y&(1<<o)-1,z:o};return{upCoords:n,subCoords:s}}_coordsToURLs(t){let o=this.layer.dataSource.baseURL.replace("{z}",String(t.z)).replace("{x}",String(t.x)).replace("{y}",String(t.y));return this.layer.dataSource.variables.map(n=>o.replace("{var}",n))}_vectorPrepare(){this.data.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[t,o,n]=this.data;t.dmax=1.42*Math.max(-o.dmin,o.dmax,-n.dmin,n.dmax),t.dmul=(t.dmax-t.dmin)/65535;for(let s=0;s<258*258;++s){if(!o.raw[s]||!n.raw[s]){t.raw[s]=0;continue}let i=o.dmin+o.dmul*o.raw[s],r=n.dmin+n.dmul*n.raw[s];t.raw[s]=Math.sqrt(r*r+i*i)/t.dmul}}_drawFillAndIsolines(){let t=this.canvasFillCtx;t.clearRect(0,0,256,256);let o=this.imData,n=new Uint32Array(o.data.buffer),{raw:s}=this.data[0],{clut:i,style:r}=this.layer,{levelIndex:l,colorsI:c}=i;if(r.fill!=="none"){let g=c;for(let u=0,h=0,d=259;u<256;++u,d+=2)for(let f=0;f<256;++f,++h,++d)n[h]=g[s[d]]}else n.fill(0);let m=[];if(r.isolineColor!=="none"){let g=r.isolineColor[0]==="#"?v(r.isolineColor):0;for(let u=0,h=0;u<256;u+=1)for(let d=0;d<256;d+=1){let f=(u+1)*258+(d+1),a=s[f],b=s[f+1],x=s[f+258];if(!a||!b||!x)continue;let y=l[a],w=l[b],S=l[x];if(y!==w||y!==S){let P=Math.max(y,w,S),M=Math.max(a,b,x),D=u*256+d;switch(r.isolineColor){case"inverted":n[D]=~c[M]|4278190080;break;case"fill":n[D]=c[M]|4278190080;break;default:n[D]=g;break}r.isolineText&&!(++h%255)&&d>20&&d<235&&u>20&&u<235&&m.push({x:d,y:u,d:a,dr:b,db:x,mli:P})}}}if(t.putImageData(o,0,0),m.length!==0){t.font="1.1em Sans-serif",t.lineWidth=2,t.strokeStyle="white",t.fillStyle="black",t.textAlign="center",t.textBaseline="middle";for(let{x:g,y:u,d:h,dr:d,db:f,mli:a}of m){let b=this.layer.clut.ticks[a].dataString,x=Math.atan2(h-d,f-h);t.save(),t.translate(g,u),t.rotate(x<-1.57||x>1.57?x+3.14:x),t.strokeText(b,0,0),t.fillText(b,0,0),t.restore()}}}_drawStaticSlines(){if(!this.sLines.length||!this.layer.style.streamLineStatic)return;let t=this.canvasSlinesCtx;if(t.clearRect(0,0,256,256),this.layer.style.streamLineColor==="none"){this.sLines=[];return}t.lineWidth=2,t.strokeStyle=this.layer.style.streamLineColor,t.beginPath();for(let o=this.sLines.length;o--;){let n=this.sLines[o];for(let s=0;s<n.length-1;++s){let i=n[s],r=n[s+1];t.moveTo(i.x,i.y),t.lineTo(r.x,r.y)}}t.stroke()}_drawVector(){if(!this.layer.vector||!this.layer.clut.DataToKnots||!this.layer.style.vectorColor||this.layer.style.vectorColor==="none"||!this.layer.style.vectorType||this.layer.style.vectorType==="none")return;let t=this.canvasVectorCtx;switch(this.layer.style.vectorType){case"barbs":t.font="40px barbs";break;case"arrows":t.font="50px arrows";break;default:t.font=this.layer.style.vectorType}t.textAlign="start",t.textBaseline="alphabetic";let[o,n,s]=this.data,i=this.layer.style.addDegrees?.017453292519943*this.layer.style.addDegrees:0,r=32;for(let l=r/2;l<256;l+=r)for(let c=r/2;c<256;c+=r){let m=c+1+(l+1)*258;if(!o.raw[m])continue;let g=Math.atan2(n.dmin+n.raw[m]*n.dmul,s.dmin+s.raw[m]*s.dmul),u=o.dmin+o.raw[m]*o.dmul,h=this.layer.dataSource.variables[0].includes("current")?5:.2,d=Math.min(this.layer.clut.DataToKnots(u)*h,25)+65,f=String.fromCharCode(d);switch(this.layer.style.vectorColor){case"inverted":t.fillStyle=C(~this.layer.clut.colorsI[o.raw[m]]);break;case"fill":t.fillStyle=C(this.layer.clut.colorsI[o.raw[m]]);break;default:t.fillStyle=this.layer.style.vectorColor;break}t.save(),t.translate(c,l),t.rotate(g+i),t.fillText(f,0,0),t.restore()}}_drawDegree(){if(this.layer.dataSource.units!=="degree")return;let t=this.canvasVectorCtx,o=this.layer.style.addDegrees?.017453292519943*this.layer.style.addDegrees:0;t.font="50px arrows",t.textAlign="start",t.textBaseline="alphabetic";let n=this.data[0],s="L",i=32;for(let r=i/2;r<256;r+=i)for(let l=i/2;l<256;l+=i){let c=l+1+(r+1)*258;if(!n.raw[c])continue;let g=(n.dmin+n.raw[c]*n.dmul+180)*.01745329251;switch(this.layer.style.vectorColor){case"inverted":t.fillStyle=C(~this.layer.clut.colorsI[n.raw[c]]);break;case"fill":t.fillStyle=C(this.layer.clut.colorsI[n.raw[c]]);break;default:t.fillStyle=this.layer.style.vectorColor;break}t.save(),t.translate(l,r),t.rotate(g+o),t.fillText(s,0,0),t.restore()}}_createSLines(){if(!this.layer.style.streamLineColor||this.layer.style.streamLineColor==="none")return;let t=this.layer.style.streamLineSpeedFactor||1;this.sLines=[];let[o,n,s]=this.data,i=Math.max(this.coords.z-this.layer.dataSource.meta.maxZoom,0),r=Math.min(W(2,i+5),128),l=~~(120+i*60);for(let c=0;c<=256;c+=r)for(let m=0;m<=256;m+=r){if(!o.raw[m+c*258])continue;let g=[],u=m,h=c;for(let d=0;d<=l&&u>=0&&u<=256&&h>=0&&h<=256;d++){!(d%(l/6))&&g.push({x:~~u,y:~~h});let f=~~u+1+(~~h+1)*258;if(!o.raw[f])break;u+=t*(n.dmin+n.raw[f]*n.dmul)/o.dmax,h-=t*(s.dmin+s.raw[f]*s.dmul)/o.dmax}u=m,h=c;for(let d=1;d<=l&&u>=0&&u<=256&&h>=0&&h<=256;d++){!(d%(l/6))&&g.unshift({x:~~u,y:~~h});let f=~~u+1+(~~h+1)*258;if(!o.raw[f])break;u-=t*(n.dmin+n.raw[f]*n.dmul)/o.dmax,h+=t*(s.dmin+s.raw[f]*s.dmul)/o.dmax}g.length>2&&this.sLines.push(g)}}};var q={initializeLayer({dataSource:e,options:t={},lazy:o=!0}){if(window.wxlogging&&console.log("Creating a WxTile layer:"+JSON.stringify({dataSource:e,options:t})),!e){window.wxlogging&&console.log("dataSource is empty!");return}Object.assign(this.options,t),this.styles=A(),e.ext||(e.ext="webp"),this.wxtiles=new Map;let n=()=>{window.wxlogging&&console.log("Setup:",e.name),this.setupCompletePromise=this._setUpDataSet(e),this.setupCompletePromise.then(()=>{window.wxlogging&&console.log("Setup complete:",this.dataSource.name,this.error&&". error:"+this.error||""),this._initializeEvents(),this._map&&this._onAddL(),this.fire("setupcomplete",{layer:this})})};o?this.once("add",n):n(),this.on("remove",this._onRemoveL,this)},createTile(e,t){return this.error?(setTimeout(t),Object.assign(L("div","error-tile"),{innerHTML:this.error})):V({layer:this,coords:e,done:t})},getSetupCompletePromise(){return this.setupCompletePromise},getTile(e){if(!this._map||this.error)return;let t=this._map.getZoom(),{x:o,y:n}=this._map.project(e,t),s={x:~~(o/256),y:~~(n/256)},i=this.wxtiles.get(`${s.x}:${s.y}:${t}`);if(!i||!i.data)return;let r={x:~~(o-s.x*256),y:~~(n-s.y*256)},l=i.getData(r);if(!l)return;let{raw:c,data:m}=l,g=this.clut.colorsI[c],u=C(g),h=this.clut.DataToStyle(m);return{tile:i,data:m,raw:c,rgba:g,hexColor:u,inStyleUnits:h,tilePoint:r,units:this.style.units}},setStyle(e){if(!this.dataSource){window.wxlogging&&console.log("setStyle: failed. Lazy setup not finished yet.");return}if(!(this.dataSource.styleName===e&&e!=="custom")){if(e&&(this.dataSource.styleName=e),e==="custom"&&this.styles.custom){(!this.styles.custom.parent||!(this.styles.custom.parent in this.styles))&&(this.styles.custom.parent="base");let t=this.styles[this.styles.custom.parent];this.styles.custom=Object.assign(Object.assign({},t),this.styles.custom)}this.dataSource.styleName in this.styles?Array.isArray(this.styles[this.dataSource.styleName])&&(this.dataSource.styleName+="[0]"):(this.dataSource.styleName=this.dataSource.name+"[0]",this.dataSource.styleName in this.styles||(this.dataSource.styleName="base",window.wxlogging&&console.log(`cant find the style (${e}), default is used`)));try{let t=this.styles[this.dataSource.styleName];this.style=Object.assign({},t);let o=this.style.streamLineColor;o!=="none"&&o.length<7&&(this.style.streamLineColor="#"+o[1]+o[1]+o[2]+o[2]+o[3]+o[3]);let n=this.dataSource.minmax[0];this.clut=new I(this.style,this.dataSource.units,n,this.vector)}catch(t){this.error="setStyle: impossible error in RawCLUT",window.wxlogging&&console.log(this.error,t);return}e&&(this._checkAndStartSlinesAnimation(),this._reloadTiles()),window.wxlogging&&console.log('setStyle: "'+this.dataSource.styleName+'" for '+this.dataSource.name+" complete."),this.fire("setstyle",{layer:this})}},getStyle(){if(!this.dataSource){window.wxlogging&&console.log("getStyle: failed. Lazy setup not finished yet.");return}return this.dataSource&&this.dataSource.styleName||""},getStyleName(){if(!this.dataSource){window.wxlogging&&console.log("getStyleName: failed. Lazy setup not finished yet.");return}return this.dataSource&&this.style&&this.style.name||"no style"},setTime(e){if(!this.dataSource){window.wxlogging&&console.log("setTime: failed. Lazy setup not finished yet.");return}let t=this._getClosestTimeString(e);if(this.dataSource.time!==t){this.dataSource.time=t,this.dataSource.baseURL=this.dataSource.originURI+this.dataSource.instance+`{var}/${this.dataSource.time}/{z}/{x}/{y}.${this.dataSource.ext}`,this.fire("settime",{layer:this,layerTime:t}),window.wxlogging&&console.log("setTime: "+t+" for "+this.dataSource.name+" complete.");let o=this._reloadTiles();return o.then(()=>{var c;let n=(c=this.wxtiles.entries().next().value)==null?void 0:c[1];if(!n)return;let[s,i]=this.dataSource.minmax[0],{dmin:r,dmax:l}=n.data[0];(Math.abs(r-s)>.01||Math.abs(l-i)>.01)&&(this.dataSource.minmax=n.data.map(m=>[m.dmin,m.dmax]),this._updateMinMax(),this.setStyle())}),o}return Promise.resolve()},getTime(){if(!this.dataSource){window.wxlogging&&console.log("getTime: failed. Lazy setup not finished yet.");return}return this.dataSource.time},getTimes(){if(!this.dataSource){window.wxlogging&&console.log("getTimes: failed. Lazy setup not finished yet.");return}return this.dataSource.meta.times},checkDataChanged(){return p(this,null,function*(){if(!this.dataSource)return window.wxlogging&&console.log("getTimes: failed. Lazy setup not finished yet."),Promise.resolve(!1);let e=yield T(this.dataSource.originURI+"instances.json"),t=e[e.length-1]+"/";if(this.dataSource.instance!==t)return!0;let o=yield T(this.dataSource.originURI+t+"meta.json");return this.dataSource.meta.times.toString()!==o.times.toString()})},reloadData(){return this._setUpDataSet()},getLegendData(e){if(!this.error){if(!this.clut){window.wxlogging&&console.log("getLegendData: failed. Lazy setup not finished yet:"+this.dataSource.name);return}return R(e,this.style)}},setTimeAnimationMode(e=2){this.oldMaxZoom=this.dataSource.meta.maxZoom;let t=this._map.getZoom(),n=(t<this.oldMaxZoom?t:this.oldMaxZoom)-e;this.dataSource.meta.maxZoom=n<0?0:n},unsetTimeAnimationMode(){var e,t;!this.oldMaxZoom||!((t=(e=this.dataSource)==null?void 0:e.meta)==null?void 0:t.maxZoom)||(this.dataSource.meta.maxZoom=this.oldMaxZoom,this._reloadTiles())},getMinMax(){let[e,t]=this.dataSource.minmax[0];return{min:e,max:t}},_setUpDataSet(e){return p(this,null,function*(){if(e&&!(e.dataset&&e.variables&&Array.isArray(e.variables)&&e.variables.length>0&&e.variables.length<3)){this.error=e.name+": dataSource error",window.wxlogging&&console.log(this.error);return}e&&(this.dataSource=e),this._stopLoadingResetLoadDataFunc(),this.dataSource.originURI=this.dataSource.serverURI+"/"+this.dataSource.dataset+"/";try{let t=yield T(this.dataSource.originURI+"instances.json");this.dataSource.instance=t[t.length-1]+"/"}catch(t){this.error=this.dataSource.name+": load instances.json error",window.wxlogging&&console.log(this.error);return}try{let t=this.dataSource.originURI+this.dataSource.instance+"meta.json";this.dataSource.meta=yield T(t)}catch(t){this.error=this.dataSource.name+": load meta.json error",window.wxlogging&&console.log(this.error);return}this.vector=this.dataSource.variables.length===2,this.animation=this.vector,this.dataSource.units=this.dataSource.meta.variablesMeta[this.dataSource.variables[0]].units,this.dataSource.minmax=this.dataSource.variables.map(t=>[this.dataSource.meta.variablesMeta[t].min,this.dataSource.meta.variablesMeta[t].max]),this._updateMinMax(),e&&(this.setTime(Date.now()),this.setStyle())})},_updateMinMax(){if(!this.vector)return;let[[e,t],[o,n]]=this.dataSource.minmax;this.dataSource.minmax.unshift([0,1.42*Math.max(-e,t,-o,n)])},_initializeEvents(){this.error||(this.on("tileload",e=>{this.wxtiles.set(`${e.coords.x}:${e.coords.y}:${e.coords.z}`,e.tile.wxtile)}),this.on("tileunload",e=>{this.wxtiles.delete(`${e.coords.x}:${e.coords.y}:${e.coords.z}`)}),this.on("add",this._onAddL,this))},_checkZoom(){(!this._map||this._map.getZoom()<this.dataSource.meta.maxZoom)&&this._stopLoadingResetLoadDataFunc()},_onAddL(){window.wxlogging&&console.log("onadd:",this.dataSource.name),this.error||this._map.on("zoomstart",this._checkZoom,this),this.setupCompletePromise.then(()=>{this.redraw(),this._checkAndStartSlinesAnimation()})},_onRemoveL(){window.wxlogging&&console.log("onremove:",this.dataSource.name),this._map.off("zoomstart",this._checkZoom,this),this.setupCompletePromise.then(()=>{this._stopLoadingResetLoadDataFunc(),this._stopSlinesAnimation()})},_stopLoadingResetLoadDataFunc(){var e;(e=this.loadData)==null||e.abort(),this.loadData=B()},_checkAndStartSlinesAnimation(){if(this.animFrame||!this.animation||!this.vector||!this.style.streamLineColor||this.style.streamLineColor==="none")return;let e=t=>{if(!this.animation||this.style.streamLineStatic){this._stopSlinesAnimation();return}this.wxtiles.forEach(o=>o.drawSLines(t)),this.animFrame=requestAnimationFrame(e)};e()},_stopSlinesAnimation(){cancelAnimationFrame(this.animFrame),this.wxtiles.forEach(e=>e.clearSLinesCanvas()),this.animFrame=0},_getClosestTimeString(e){return this.dataSource.meta.times.find(t=>new Date(t).getTime()>=e)||this.dataSource.meta.times[this.dataSource.meta.times.length-1]},_redrawTiles(){!this.wxtiles||this.animationRedrawID||(this.animationRedrawID=requestAnimationFrame(()=>{this.wxtiles.forEach(e=>e.draw()),this.animationRedrawID=null}))},_reloadTiles(){let e=[];this.wxtiles.forEach(o=>e.push(o._load()));let t=Promise.all(e);return t.then(()=>this._redrawTiles()),t}};var _=window.L,at=_.GridLayer.extend(q);function X(e){let t=new at;return t.initializeLayer(e),t}var lt={options:{URI:""},onAdd(){let e=document.createElement("img");return e.src=this.options.URI,e.className="wxtiles-logo",e}},ct=_.Control.extend(lt);function ut(e){return window.wxlogging&&console.log("Add watermark:",JSON.stringify(e)),new ct(e)}var ht=_.GridLayer.extend({createTile(e){let t=document.createElement("div");return t.innerHTML=[e.x,e.y,e.z].join(", "),t.style.outline="1px solid red",t}});function mt(){window.wxlogging&&console.log("Add WxDebugCoordsLayer:");let e=new ht;return e.setZIndex(1e3),e}function dt(e){return _.layerGroup(e.map(X))}function ft(e){console.log(e?"Logging on":"Logging off"),window.wxlogging=e}export{mt as WxDebugCoordsLayer,A as WxGetColorStyles,dt as WxTileGroupLayer,X as WxTileLayer,O as WxTileLibSetup,ft as WxTileLogging,ut as WxTileWatermark};
|
package/dist/es/index.d.ts
DELETED
package/dist/es/tileLayer.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export namespace WxGridLayerProto {
|
|
2
|
-
function initializeLayer({ dataSource, options, lazy }: {
|
|
3
|
-
dataSource: any;
|
|
4
|
-
options?: {} | undefined;
|
|
5
|
-
lazy?: boolean | undefined;
|
|
6
|
-
}): void;
|
|
7
|
-
function initializeLayer({ dataSource, options, lazy }: {
|
|
8
|
-
dataSource: any;
|
|
9
|
-
options?: {} | undefined;
|
|
10
|
-
lazy?: boolean | undefined;
|
|
11
|
-
}): void;
|
|
12
|
-
function createTile(coords: any, done: any): HTMLElement & {
|
|
13
|
-
innerHTML: any;
|
|
14
|
-
};
|
|
15
|
-
function createTile(coords: any, done: any): HTMLElement & {
|
|
16
|
-
innerHTML: any;
|
|
17
|
-
};
|
|
18
|
-
function getSetupCompletePromise(): any;
|
|
19
|
-
function getSetupCompletePromise(): any;
|
|
20
|
-
function getTile(latlng: any): {
|
|
21
|
-
tile: any;
|
|
22
|
-
data: any;
|
|
23
|
-
raw: any;
|
|
24
|
-
rgba: any;
|
|
25
|
-
hexColor: string;
|
|
26
|
-
inStyleUnits: any;
|
|
27
|
-
tilePoint: {
|
|
28
|
-
x: number;
|
|
29
|
-
y: number;
|
|
30
|
-
};
|
|
31
|
-
units: any;
|
|
32
|
-
} | undefined;
|
|
33
|
-
function getTile(latlng: any): {
|
|
34
|
-
tile: any;
|
|
35
|
-
data: any;
|
|
36
|
-
raw: any;
|
|
37
|
-
rgba: any;
|
|
38
|
-
hexColor: string;
|
|
39
|
-
inStyleUnits: any;
|
|
40
|
-
tilePoint: {
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
};
|
|
44
|
-
units: any;
|
|
45
|
-
} | undefined;
|
|
46
|
-
function setStyle(name: any): void;
|
|
47
|
-
function setStyle(name: any): void;
|
|
48
|
-
function getStyle(): any;
|
|
49
|
-
function getStyle(): any;
|
|
50
|
-
function getStyleName(): any;
|
|
51
|
-
function getStyleName(): any;
|
|
52
|
-
function setTime(unixTime: any): Promise<void> | Promise<any[]> | undefined;
|
|
53
|
-
function setTime(unixTime: any): Promise<void> | Promise<any[]> | undefined;
|
|
54
|
-
function getTime(): any;
|
|
55
|
-
function getTime(): any;
|
|
56
|
-
function getTimes(): any;
|
|
57
|
-
function getTimes(): any;
|
|
58
|
-
function checkDataChanged(): Promise<boolean>;
|
|
59
|
-
function checkDataChanged(): Promise<boolean>;
|
|
60
|
-
function reloadData(): Promise<void>;
|
|
61
|
-
function reloadData(): Promise<void>;
|
|
62
|
-
function getLegendData(legendSize: any): import("./RawCLUT").Legend | undefined;
|
|
63
|
-
function getLegendData(legendSize: any): import("./RawCLUT").Legend | undefined;
|
|
64
|
-
function setTimeAnimationMode(l?: number): void;
|
|
65
|
-
function setTimeAnimationMode(l?: number): void;
|
|
66
|
-
function unsetTimeAnimationMode(): void;
|
|
67
|
-
function unsetTimeAnimationMode(): void;
|
|
68
|
-
function getMinMax(): {
|
|
69
|
-
min: any;
|
|
70
|
-
max: any;
|
|
71
|
-
};
|
|
72
|
-
function getMinMax(): {
|
|
73
|
-
min: any;
|
|
74
|
-
max: any;
|
|
75
|
-
};
|
|
76
|
-
function _setUpDataSet(dataSource: any): Promise<void>;
|
|
77
|
-
function _setUpDataSet(dataSource: any): Promise<void>;
|
|
78
|
-
function _updateMinMax(): void;
|
|
79
|
-
function _updateMinMax(): void;
|
|
80
|
-
function _initializeEvents(): void;
|
|
81
|
-
function _initializeEvents(): void;
|
|
82
|
-
function _checkZoom(): void;
|
|
83
|
-
function _checkZoom(): void;
|
|
84
|
-
function _onAddL(): void;
|
|
85
|
-
function _onAddL(): void;
|
|
86
|
-
function _onRemoveL(): void;
|
|
87
|
-
function _onRemoveL(): void;
|
|
88
|
-
function _stopLoadingResetLoadDataFunc(): void;
|
|
89
|
-
function _stopLoadingResetLoadDataFunc(): void;
|
|
90
|
-
function _checkAndStartSlinesAnimation(): void;
|
|
91
|
-
function _checkAndStartSlinesAnimation(): void;
|
|
92
|
-
function _stopSlinesAnimation(): void;
|
|
93
|
-
function _stopSlinesAnimation(): void;
|
|
94
|
-
function _getClosestTimeString(unixTime: any): any;
|
|
95
|
-
function _getClosestTimeString(unixTime: any): any;
|
|
96
|
-
function _redrawTiles(): void;
|
|
97
|
-
function _redrawTiles(): void;
|
|
98
|
-
function _reloadTiles(): Promise<any[]>;
|
|
99
|
-
function _reloadTiles(): Promise<any[]>;
|
|
100
|
-
}
|
package/dist/es/wxtile-js.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { WxTileLibSetup, WxGetColorStyles, ColorStylesWeakMixed, Units, ColorSchemes, LibSetupObject } from './wxtools';
|
|
2
|
-
export declare function WxTileLayer(settings: any): any;
|
|
3
|
-
export declare function WxTileWatermark(options: any): {
|
|
4
|
-
options: {
|
|
5
|
-
URI: string;
|
|
6
|
-
};
|
|
7
|
-
onAdd(): HTMLImageElement;
|
|
8
|
-
} & import("leaflet").Control;
|
|
9
|
-
export declare function WxDebugCoordsLayer(): any;
|
|
10
|
-
export declare function WxTileGroupLayer(group: any): import("leaflet").LayerGroup<any>;
|
|
11
|
-
export declare function WxTileLogging(on: any): void;
|
package/dist/web/wxtile.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@font-face{font-family:barbs;src:url(data:font/woff;base64,d09GRgABAAAAAAowAA0AAAAAQJwAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAAAKFAAAABoAAAAci1SsR0dERUYAAAn4AAAAHAAAAB4AJwApT1MvMgAAAZwAAAA3AAAAYH2xStJjbWFwAAAB9AAAAHsAAAFilx+PDGdhc3AAAAnwAAAACAAAAAj//wADZ2x5ZgAAArgAAAY5AAA6tI1syaloZWFkAAABMAAAADIAAAA2EYD96GhoZWEAAAFkAAAAIAAAACQEngFOaG10eAAAAdQAAAAeAAAAjEiz9nJsb2NhAAACcAAAAEgAAABI4UDuum1heHAAAAGEAAAAGAAAACAALAFFbmFtZQAACPQAAACjAAABPiCVCBtwb3N0AAAJmAAAAFcAAABy3/XX1HicY2BkYGAA4ssLn/rF89t8ZeBmYQCBGxPuPoTR/5f9q2acxbQOyOVgYAKJAgCXyg8XAAB4nGNgZGBgjvn3hoGBye7/MgYGxlkMQBEUoAwAfRUE73icY2BkYGBQZnRh4GAAAUYGNAAAC3cAc3icY2BiMmGcwMDKwMCggQFPMKACRmSOU2ZRCoMDkJHCHPPvDYhkFIGpYapmjgFSCgyMAInXCUQAeJxjkmeAA0YRBgYmu/9HgHgZEK+jKwa6AwCJsjosAAB4nGNgYGBmgGAZBkYGEIgB8hjB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+sYVuOEWXfr9fk6pYR9buQjVA+TAfusebAqUWS9Mb8wP99ud9o4yIA2uG3KHia8w9HEPeL9TQFrLoqsNylToHFOn95kHxqUYr6uEJav1ql13dsHazmKrLcWGo2FZSS+ZzbPwDbPkE+xCbry5TpG171/wFrzWcuRYhXFxUZjkVLfs2fvO0sbpcCNxcZiKGGJ9W+wNiLJKiMzanZ7vd793Hq9bq+JYChhifU6WJciyZql9GgFtrW9vbW1vbVNPsVC6/oLWLtjWOUTZy02kSJRkn8OJj6AihqtVrM1xZ34NmGJ9RpYnUjqOkdpEuX557lR2k+x/+rqp02BrsOs6XZdvwXr5nFY75wfHoO1ZRi6sY5s/8KFB9kHef86QkaYFJGxfgnW8/7fXMqjuXAk8kSxp8IKMMuyrYdg4kVU8K0l2EEGNf3CJebPwPzICPN4fU+K2V5qt9v0BvAwNxsvA0Aq0Fkeyo+nvi+H+1/0v3mECmMAeJx9zT0LglAYxfG/pr1QRDS0tLgHofQZWhtCmhNREcRCcXDsA7S29lU7xjN7l/t7znMPF1jxwWE4DnO2ZpcZB/NE+dnsyXezz5KXear8q5eOt1Cy+bcGu6zZmyfKT2ZPvph9dpTmqfI3MT1PMnISUt3E/TPLk1S6aizoqLRqNGZFVyXCSGVkddPY0Or7BzUBEUdCxVnTlo86iI7hWP0HkHwruQB4nG3DORbBUAAAwPk/lXMgtogkdpLOcgwNSprcPzy1eW9EP10n+Kf/HUSJgaHUyNjE1ExmLrdQKFWWVtY2tnb2Do5qjZOzi2uIvfz1bu+P5636ANo8C3kAAAAAAf//AAJ4nGNgZGBg4AFiMSBmYmAEQiUgZgHzGAAFFABReJxjYGBgZACCW0YfWkD0nSAGKxgNAEMXBVIAAA==) format("woff")}.error-tile{display:flex;justify-content:center;align-items:center}.s-tile canvas{position:absolute}.canvas-fill{z-index:1}.canvas-slines{z-index:2}.canvas-vector{z-index:3}.wxtiles-logo{width:270px}
|
package/dist/web/wxtile.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var wxtilejs=(()=>{var et=Object.defineProperty;var z=Math.pow;var ot=(e,t)=>{for(var o in t)et(e,o,{get:t[o],enumerable:!0})};var p=(e,t,o)=>new Promise((n,s)=>{var i=c=>{try{l(o.next(c))}catch(m){s(m)}},r=c=>{try{l(o.throw(c))}catch(m){s(m)}},l=c=>c.done?n(c.value):Promise.resolve(c.value).then(i,r);l((o=o.apply(e,t)).next())});var yt={};ot(yt,{WxDebugCoordsLayer:()=>Q,WxGetColorStyles:()=>T,WxTileGroupLayer:()=>Y,WxTileLayer:()=>j,WxTileLibSetup:()=>U,WxTileLogging:()=>tt,WxTileWatermark:()=>J});var nt={comment1:["degC: ['K', 1, 273.15] -> degC = K * 1 + 273.15",0],comment2:["hPa: ['Pa', 100]' -> hPa = Pa * 100 + 0 (0 - could be ommited)",0],K:["K",1],F:["K",.5555555555,255.372222222],C:["K",1,273.15],degC:["K",1,273.15],"kg/m^2/s":["kg/m^2/s",1],"Kg m**-2 s**-1":["kg/m^2/s",1],"W/m^2":["W/m^2",1],"W m**2":["W/m^2",1],"m/s":["m/s",1],"m s**-1":["m/s",1],knot:["m/s",.514444],knots:["m/s",.514444],"km/h":["m/s",.27777777777],s:["s",1],sec:["s",1],h:["s",3600],min:["s",60],m:["m",1],cm:["m",.01],inch:["m",.0254],Pa:["Pa",1],hPa:["Pa",100]},st={none:["#00000000","#00000000"],rainbow:["#f00","#ff0","#0f0","#0ff","#00f","#f0f"],rainbow2:["#f00","#ff0","#0f0","#0ff","#00f","#f0f","#f00"],rainbowzerro:["#ff000000","#f00","#ff0","#0f0","#0ff","#00f","#f0f"],bluebird:["#00f","#f0f","#0ff","#80f","#88f"],bluebirdzerro:["#0000ff00","#00f","#f0f","#0ff","#80f","#88f"],bw:["#000","#fff"],wb:["#fff","#000"],redish:["#f0f","#f00","#ff0"],greenish:["#ff0","#0f0","#0ff"],blueish:["#f0f","#00f","#0ff"],hspastel:["#AC6EA4FF","#8E92BDFF","#ACD4DEFF","#E9DC8EFF","#E7A97DFF","#E59074FF","#BE7E68FF","#A88F86FF"]},Z={base:{parent:void 0,name:"base",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0},custom:{parent:void 0,name:"custom",fill:"gradient",isolineColor:"inverted",isolineText:!0,vectorType:"arrows",vectorColor:"inverted",streamLineColor:"#777",streamLineSpeedFactor:1,streamLineStatic:!1,showBelowMin:!0,showAboveMax:!0,colorScheme:"rainbow",colors:void 0,colorMap:void 0,levels:void 0,blurRadius:0,addDegrees:0,units:"",extraUnits:void 0}},F,O,N;function U({colorStyles:e={},units:t={},colorSchemes:o={}}={}){window.wxlogging&&console.log("WxTile lib setup: start"),F=Object.assign({},nt,t),O=Object.assign({},o,st),N=rt(e),window.wxlogging&&console.log("WxTile lib setup: styles unrolled"),document.fonts.load("32px barbs"),document.fonts.load("32px arrows"),window.wxlogging&&console.log("WxTile lib setup is done"+JSON.stringify({colorStyles:e,units:t,colorSchemes:o}))}function T(){return N}function B(){return O}function k(e,t,o){let n=o?Object.assign({},F,o):F;if(!n||!e||!t||e===t||!n[e]||!n[t]||n[e][0]!==n[t][0]){window.wxlogging&&console.log(e===t?"Trivial converter:":"Inconvertible units. Default converter is used:",e," -> ",t);let r=l=>l;return r.trivial=!0,r}window.wxlogging&&console.log("Converter: From:",e," To:",t);let s=n[e][1]/n[t][1],i=(n[e][2]||0)/n[t][1]-(n[t][2]||0)/n[t][1];return i?r=>s*r+i:r=>s*r}function rt(e){let t=Object.assign({},Z);for(let s in e){let i=e[s];if(Array.isArray(i))for(let r=0;r<i.length;++r)t[s+"["+r+"]"]=Object.assign({},i[r]);else t[s]=Object.assign({},i)}let o=(s,i)=>{if(i==="base")return Z.base;let r=s[i];(!r.parent||!(r.parent in s))&&(r.parent="base");let l=o(s,r.parent);return Object.assign(r,Object.assign({},l,r,{parent:"base"}))},n={};for(let s in t)n[s]=o(t,s);return n}function it(e){let t=new Map;return o=>{let n=t.get(o);return n===void 0&&(n=e(o),t.set(o,n)),n}}function at(e,t){return p(this,null,function*(){let o=new Image;o.crossOrigin="anonymous";let n=()=>{o.src=""};return t.addEventListener("abort",n),o.src=e,yield o.decode(),t.removeEventListener("abort",n),o})}function ct(e,t){return p(this,null,function*(){let o=i=>{let r=i.height*i.width,l=new Uint16Array(i.data.buffer),c=new Uint16Array(r);for(let a=0;a<r;a++)c[a]=l[a*2];let m=new Uint8Array(i.data.buffer);for(let a=0;a<8;++a)m[a]=m[a*4+2];let g=new DataView(i.data.buffer),u=g.getFloat32(0,!0),h=g.getFloat32(4,!0),d=(h-u)/65535,f=lt(c);return{raw:c,dmin:u,dmax:h,dmul:d,integral:f,radius:0}},n=Object.assign(document.createElement("canvas"),{width:258,height:258,imageSmoothingEnabled:!1}).getContext("2d");if(!n)return Promise.reject();let s=yield at(e,t);return n.drawImage(s,0,0),o(n.getImageData(0,0,258,258))})}function H(){let e=new AbortController,t=it(o=>ct(o,e.signal));return t.abort=()=>e.abort(),t}function lt(e){let t=new Uint32Array(258*258),o=new Uint32Array(258*258);t[0]=e[0],o[0]=e[0]===0?0:1;for(let n=1;n<258;++n)t[n]=e[n]+t[n-1],t[258*n]=e[258*n]+t[258*n-258],o[n]=(e[n]===0?0:1)+o[n-1],o[258*n]=(e[258*n]===0?0:1)+o[258*n-258];for(let n=1,s=259;n<258;++n,++s)for(let i=1;i<258;++i,++s)t[s]=e[s]+t[s-258]+t[s-1]-t[s-258-1],o[s]=(e[s]===0?0:1)+o[s-258]+o[s-1]-o[s-258-1];return{integral:t,integralNZ:o}}function G(e,t){if(t<0||t===e.radius)return e;e.radius=t;let o=258,{integral:n,integralNZ:s}=e.integral;for(let i=1;i<o;i++)for(let r=1;r<o;r++){if(!e.raw[o*i+r])continue;let l=Math.min(t,r-1,o-1-r),c=Math.min(t,i-1,o-1-i),m=o*(i-c-1)+r,g=o*(i+c)+r,u=s[m-l-1],h=s[m+l],d=s[g-l-1],f=s[g+l],a=u+f-h-d,b=n[m-l-1],x=n[m+l],y=n[g-l-1],w=n[g+l],S=b+w-x-y;e.raw[i*o+r]=S/a}return e}function C(e){let t=e>>0&255,o=e>>8&255,n=e>>16&255,s=t.toString(16),i=o.toString(16),r=n.toString(16);return s=s.length===2?s:"0"+s,i=i.length===2?i:"0"+i,r=r.length===2?r:"0"+r,"#"+s+i+r}function v(e){if(e[0]==="#"){if(e.length===4)return+("0xff"+e[3]+e[3]+e[2]+e[2]+e[1]+e[1]);if(e.length===7)return+("0xff"+e[5]+e[6]+e[3]+e[4]+e[1]+e[2]);if(e.length===9)return+("0x"+e[7]+e[8]+e[5]+e[6]+e[3]+e[4]+e[1]+e[2])}return window.wxlogging&&console.log("wrong color format",e),0}function M(e){return p(this,null,function*(){return(yield fetch(e)).json()})}function L(e,t="",o){var s;let n=document.createElement(e);return n.className=t,o&&((s=o.appendChild)==null||s.call(o,n)),n}function I(e,t,o){let n=e>>0&255,s=e>>8&255,i=e>>16&255,r=e>>>24,l=t>>0&255,c=t>>8&255,m=t>>16&255,g=t>>>24,u=n+o*(l-n),h=s+o*(c-s),d=i+o*(m-i),f=r+o*(g-r);return u|h<<8|d<<16|f<<24}function K(e,t,o){let n=[];for(let s=0;s<o;++s)n.push(s*(t-e)/(o-1)+e);return n}function ut(e,t,o){return e>o?o:e<t?t:e}var R=class{constructor(t,o,[n,s],i){let r=s-n;this.levelIndex=new Uint32Array(65536),this.colorsI=new Uint32Array(65536);let l=[];this.DataToStyle=k(o,t.units,t.extraUnits),this.DataToStyle.trivial&&(t.units=o),i&&(this.DataToKnots=k(o,"knot"));let c=k(t.units,o,t.extraUnits),m=a=>~~(65535*ut((c(a)-n)/(s-n),0,1));if(Array.isArray(t.colorMap)){t.colorMap.sort((a,b)=>a[0]<b[0]?-1:a[0]>b[0]?1:0);for(let[a]of t.colorMap)l.push(m(a))}else{if(t.levels||(t.levels=K(this.DataToStyle(n),this.DataToStyle(s),10)),t.levels.sort((a,b)=>a<b?-1:a>b?1:0),!t.colors){let a=B();t.colorScheme&&t.colorScheme in a?t.colors=a[t.colorScheme]:t.colors=a.wb}for(let a of t.levels)l.push(m(a))}let g=65536,u=E(g,t);this.ticks=u.ticks;let h=u.ticks[0].data,f=u.ticks[u.ticks.length-1].data-h;for(let a=0;a<65536;++a){let b=r*a/65535+n,x=this.DataToStyle(b),y=Math.round((g-1)*(x-h)/f);y<=0?this.colorsI[a]=t.showBelowMin?u.colors[0]:0:y>=g?this.colorsI[a]=t.showAboveMax?u.colors[g-1]:0:this.colorsI[a]=u.colors[y]}this.colorsI[0]=0;for(let a=0;a<l[0];++a)this.levelIndex[a]=0;for(let a=0;a<l.length-1;a++)for(let b=l[a];b<l[a+1]+1;++b)this.levelIndex[b]=a;for(let a=l[l.length-1];a<65536;++a)this.levelIndex[a]=l.length-1}};function $(e){var o;if(e!==0&&-.1<e&&e<.1)return e.toExponential(2);let t=e.toString();return((o=t.split(".")[1])==null?void 0:o.length)>2?e.toFixed(2):t}function E(e,t){let o={size:e,showBelowMin:t.showBelowMin,showAboveMax:t.showAboveMax,units:t.units,colors:new Uint32Array(e),ticks:[]},{colorMap:n,levels:s,colors:i}=t,r=t.fill!=="solid";if(n){let h=n[0][0],d=n[n.length-1][0]-h;for(let[f,a]of n){let b=~~((f-h)/d*(e-1)),x={data:f,dataString:$(f),color:a,pos:b};o.ticks.push(x)}for(let f=0;f<n.length-1;f++){let a=o.ticks[f].pos,b=o.ticks[f+1].pos,x=v(n[f][1]),y=r?v(n[f+1][1]):0;for(let w=a;w<b;++w)o.colors[w]=r?I(x,y,(w-a)/(b-a)):x}return o.colors[e-1]=v(n[n.length-1][1]),o}if(!i||!s)return o;let l=0,c=0,m=-1;for(let h=0;h<e;++h){let d=h*(i.length-1)/e;m!==~~d&&(m=~~d,l=v(i[m]),c=i.length>m+1?v(i[m+1]):l),o.colors[h]=r?I(l,c,d-m):l}o.colors[e-1]=v(i[i.length-1]);let g=s[0],u=(e-1)/(s[s.length-1]-g);for(let h of s){let d=~~((h-g)*u),f={data:h,dataString:$(h),color:C(o.colors[d]),pos:d};o.ticks.push(f)}return o}function ht(e,t){if(!t)return e;let o=.9999999/Math.pow(2,t.z),n=t.x*256*o,s=t.y*256*o,i={raw:new Uint16Array(258*258),dmin:e.dmin,dmax:e.dmax,dmul:e.dmul},{raw:r}=i;for(let l=-1,c=0;l<=256;l++){let m=s+l*o,g=Math.floor(m),u=m-g;for(let h=-1;h<=256;h++,c++){let d=n+h*o,f=Math.floor(d),a=d-f,b=f+1+(g+1)*258,x=e.raw[b],y=e.raw[b+1],w=e.raw[b+258],S=e.raw[b+258+1];switch((x?1:0)|(y?2:0)|(w?4:0)|(S?8:0)){case 0:r[c]=0;continue;case 1:r[c]=x;continue;case 2:r[c]=y;continue;case 3:w=x,S=y;break;case 4:r[c]=w;continue;case 5:y=x,S=w;break;case 6:S=y+w>>1,x=S;break;case 7:S=y+w>>1;break;case 8:r[c]=S;continue;case 9:y=x+S>>1,w=y;break;case 10:x=y,w=S;break;case 11:w=x+S>>1;break;case 12:x=w,y=S;break;case 13:y=x+S>>1;break;case 14:x=y+w>>1;break}x=e.dmin+e.dmul*x,y=e.dmin+e.dmul*y,w=e.dmin+e.dmul*w,S=e.dmin+e.dmul*S;let A=W(x,y,a),D=W(w,S,a);r[c]=(W(A,D,u)-e.dmin)/e.dmul,r[c]===0&&(r[c]=1)}}return i}function W(e,t,o){let n=((t-e)%360+540)%360-180;return(e+n*o+360)%360}function mt(e,t){if(!t)return e;let o=.9999999/Math.pow(2,t.z),n=t.x*256*o,s=t.y*256*o,i={raw:new Uint16Array(258*258),dmin:e.dmin,dmax:e.dmax,dmul:e.dmul},{raw:r}=i;for(let l=-1,c=0;l<=256;l++){let m=s+l*o,g=Math.floor(m),u=m-g;for(let h=-1;h<=256;h++,c++){let d=n+h*o,f=Math.floor(d),a=d-f,b=f+1+(g+1)*258,x=e.raw[b],y=e.raw[b+1],w=e.raw[b+258],S=e.raw[b+258+1];switch((x?1:0)|(y?2:0)|(w?4:0)|(S?8:0)){case 7:r[c]=a+u<1?a*(y-x)+u*(w-x)+x:0;continue;case 14:r[c]=a+u<1?0:a*(S-w)+u*(S-y)+y+w-S;continue;case 11:r[c]=u<a?(1-a)*(x-y)+u*(S-y)+y:0;continue;case 13:r[c]=u<a?0:(1-a)*(w-S)+u*(w-x)+x+S-w;continue;case 15:r[c]=a+u<1?a*(y-x)+u*(w-x)+x:a*(S-w)+u*(S-y)+y+w-S;continue;default:r[c]=0}}}return i}function q({layer:e,coords:t,done:o}){let n=L("div","leaflet-tile s-tile");if(e.dataSource){let s=new V({layer:e,coords:t,tileEl:n});s._load().then(()=>{s.draw(),o()}).catch(i=>{console.log(i),o()}),n.wxtile=s}else setTimeout(o);return n}var V=class{constructor({layer:t,coords:o,tileEl:n}){this.data=[];this.sLines=[];this.coords=o,this.layer=t,this.canvasFill=L("canvas","s-tile canvas-fill",n),this.canvasSlines=L("canvas","s-tile canvas-slines",n),this.canvasVector=this.canvasFill,this.canvasFill.width=this.canvasFill.height=this.canvasSlines.width=this.canvasSlines.height=256;function s(i){let r=i.getContext("2d");if(!r)throw"error";return r}this.canvasFillCtx=s(this.canvasFill),this.canvasSlinesCtx=s(this.canvasSlines),this.canvasVectorCtx=this.canvasFillCtx,this.imData=this.canvasFillCtx.createImageData(256,256)}draw(){this.data.length!==0&&(this._drawFillAndIsolines(),this._drawVector(),this._drawDegree(),this._drawStaticSlines())}clearSLinesCanvas(){this.canvasSlinesCtx.clearRect(0,0,256,256)}drawSLines(t){if(this.sLines.length===0)return;let o=this.canvasSlinesCtx;if(o.clearRect(0,0,256,256),this.layer.style.streamLineColor==="none"){this.sLines=[];return}let n=this.layer.style.streamLineColor.substr(0,7);t=t>>7;for(let s=0;s<this.sLines.length;++s){let i=this.sLines[s],r=i.length-1,l=(t+(1+i[0].x)*(1+i[0].y))%30;for(let c=0;c<r;++c){let m=i[c],g=i[c+1],u=1-(l-c)/r;(u<0||u>1)&&(u=0);let h=(~~(u*255)).toString(16);o.strokeStyle=n+(h.length<2?"0"+h:h);let d=1+~~((1.2-u)*5);o.lineWidth=d,o.beginPath(),o.moveTo(m.x,m.y),o.lineTo(g.x,g.y),o.stroke()}}}getData({x:t,y:o}){if(!this.data.length)return;let n=this.data[0].raw[(o+1)*258+(t+1)];return{raw:n,data:this.data[0].dmin+this.data[0].dmul*n}}_load(){return p(this,null,function*(){try{let{upCoords:t,subCoords:o}=this._splitCoords(this.coords),n=this._coordsToURLs(t),s=yield Promise.all(n.map(this.layer.loadData)),i=this.layer.dataSource.units==="degree"?ht:mt,r=l=>i(G(l,this.layer.style.blurRadius),o);this.data=s.map(r),this.layer.vector&&(this._vectorPrepare(),this._createSLines())}catch(t){this.data=[],this.canvasFillCtx.clearRect(0,0,256,256),this.canvasSlinesCtx.clearRect(0,0,256,256)}return this})}_splitCoords(t){let o=t.z-this.layer.dataSource.meta.maxZoom;if(o<=0)return{upCoords:t};let n={x:t.x>>>o,y:t.y>>>o,z:this.layer.dataSource.meta.maxZoom},s={x:t.x&(1<<o)-1,y:t.y&(1<<o)-1,z:o};return{upCoords:n,subCoords:s}}_coordsToURLs(t){let o=this.layer.dataSource.baseURL.replace("{z}",String(t.z)).replace("{x}",String(t.x)).replace("{y}",String(t.y));return this.layer.dataSource.variables.map(n=>o.replace("{var}",n))}_vectorPrepare(){this.data.unshift({raw:new Uint16Array(258*258),dmin:0,dmax:0,dmul:0});let[t,o,n]=this.data;t.dmax=1.42*Math.max(-o.dmin,o.dmax,-n.dmin,n.dmax),t.dmul=(t.dmax-t.dmin)/65535;for(let s=0;s<258*258;++s){if(!o.raw[s]||!n.raw[s]){t.raw[s]=0;continue}let i=o.dmin+o.dmul*o.raw[s],r=n.dmin+n.dmul*n.raw[s];t.raw[s]=Math.sqrt(r*r+i*i)/t.dmul}}_drawFillAndIsolines(){let t=this.canvasFillCtx;t.clearRect(0,0,256,256);let o=this.imData,n=new Uint32Array(o.data.buffer),{raw:s}=this.data[0],{clut:i,style:r}=this.layer,{levelIndex:l,colorsI:c}=i;if(r.fill!=="none"){let g=c;for(let u=0,h=0,d=259;u<256;++u,d+=2)for(let f=0;f<256;++f,++h,++d)n[h]=g[s[d]]}else n.fill(0);let m=[];if(r.isolineColor!=="none"){let g=r.isolineColor[0]==="#"?v(r.isolineColor):0;for(let u=0,h=0;u<256;u+=1)for(let d=0;d<256;d+=1){let f=(u+1)*258+(d+1),a=s[f],b=s[f+1],x=s[f+258];if(!a||!b||!x)continue;let y=l[a],w=l[b],S=l[x];if(y!==w||y!==S){let P=Math.max(y,w,S),A=Math.max(a,b,x),D=u*256+d;switch(r.isolineColor){case"inverted":n[D]=~c[A]|4278190080;break;case"fill":n[D]=c[A]|4278190080;break;default:n[D]=g;break}r.isolineText&&!(++h%255)&&d>20&&d<235&&u>20&&u<235&&m.push({x:d,y:u,d:a,dr:b,db:x,mli:P})}}}if(t.putImageData(o,0,0),m.length!==0){t.font="1.1em Sans-serif",t.lineWidth=2,t.strokeStyle="white",t.fillStyle="black",t.textAlign="center",t.textBaseline="middle";for(let{x:g,y:u,d:h,dr:d,db:f,mli:a}of m){let b=this.layer.clut.ticks[a].dataString,x=Math.atan2(h-d,f-h);t.save(),t.translate(g,u),t.rotate(x<-1.57||x>1.57?x+3.14:x),t.strokeText(b,0,0),t.fillText(b,0,0),t.restore()}}}_drawStaticSlines(){if(!this.sLines.length||!this.layer.style.streamLineStatic)return;let t=this.canvasSlinesCtx;if(t.clearRect(0,0,256,256),this.layer.style.streamLineColor==="none"){this.sLines=[];return}t.lineWidth=2,t.strokeStyle=this.layer.style.streamLineColor,t.beginPath();for(let o=this.sLines.length;o--;){let n=this.sLines[o];for(let s=0;s<n.length-1;++s){let i=n[s],r=n[s+1];t.moveTo(i.x,i.y),t.lineTo(r.x,r.y)}}t.stroke()}_drawVector(){if(!this.layer.vector||!this.layer.clut.DataToKnots||!this.layer.style.vectorColor||this.layer.style.vectorColor==="none"||!this.layer.style.vectorType||this.layer.style.vectorType==="none")return;let t=this.canvasVectorCtx;switch(this.layer.style.vectorType){case"barbs":t.font="40px barbs";break;case"arrows":t.font="50px arrows";break;default:t.font=this.layer.style.vectorType}t.textAlign="start",t.textBaseline="alphabetic";let[o,n,s]=this.data,i=this.layer.style.addDegrees?.017453292519943*this.layer.style.addDegrees:0,r=32;for(let l=r/2;l<256;l+=r)for(let c=r/2;c<256;c+=r){let m=c+1+(l+1)*258;if(!o.raw[m])continue;let g=Math.atan2(n.dmin+n.raw[m]*n.dmul,s.dmin+s.raw[m]*s.dmul),u=o.dmin+o.raw[m]*o.dmul,h=this.layer.dataSource.variables[0].includes("current")?5:.2,d=Math.min(this.layer.clut.DataToKnots(u)*h,25)+65,f=String.fromCharCode(d);switch(this.layer.style.vectorColor){case"inverted":t.fillStyle=C(~this.layer.clut.colorsI[o.raw[m]]);break;case"fill":t.fillStyle=C(this.layer.clut.colorsI[o.raw[m]]);break;default:t.fillStyle=this.layer.style.vectorColor;break}t.save(),t.translate(c,l),t.rotate(g+i),t.fillText(f,0,0),t.restore()}}_drawDegree(){if(this.layer.dataSource.units!=="degree")return;let t=this.canvasVectorCtx,o=this.layer.style.addDegrees?.017453292519943*this.layer.style.addDegrees:0;t.font="50px arrows",t.textAlign="start",t.textBaseline="alphabetic";let n=this.data[0],s="L",i=32;for(let r=i/2;r<256;r+=i)for(let l=i/2;l<256;l+=i){let c=l+1+(r+1)*258;if(!n.raw[c])continue;let g=(n.dmin+n.raw[c]*n.dmul+180)*.01745329251;switch(this.layer.style.vectorColor){case"inverted":t.fillStyle=C(~this.layer.clut.colorsI[n.raw[c]]);break;case"fill":t.fillStyle=C(this.layer.clut.colorsI[n.raw[c]]);break;default:t.fillStyle=this.layer.style.vectorColor;break}t.save(),t.translate(l,r),t.rotate(g+o),t.fillText(s,0,0),t.restore()}}_createSLines(){if(!this.layer.style.streamLineColor||this.layer.style.streamLineColor==="none")return;let t=this.layer.style.streamLineSpeedFactor||1;this.sLines=[];let[o,n,s]=this.data,i=Math.max(this.coords.z-this.layer.dataSource.meta.maxZoom,0),r=Math.min(z(2,i+5),128),l=~~(120+i*60);for(let c=0;c<=256;c+=r)for(let m=0;m<=256;m+=r){if(!o.raw[m+c*258])continue;let g=[],u=m,h=c;for(let d=0;d<=l&&u>=0&&u<=256&&h>=0&&h<=256;d++){!(d%(l/6))&&g.push({x:~~u,y:~~h});let f=~~u+1+(~~h+1)*258;if(!o.raw[f])break;u+=t*(n.dmin+n.raw[f]*n.dmul)/o.dmax,h-=t*(s.dmin+s.raw[f]*s.dmul)/o.dmax}u=m,h=c;for(let d=1;d<=l&&u>=0&&u<=256&&h>=0&&h<=256;d++){!(d%(l/6))&&g.unshift({x:~~u,y:~~h});let f=~~u+1+(~~h+1)*258;if(!o.raw[f])break;u-=t*(n.dmin+n.raw[f]*n.dmul)/o.dmax,h+=t*(s.dmin+s.raw[f]*s.dmul)/o.dmax}g.length>2&&this.sLines.push(g)}}};var X={initializeLayer({dataSource:e,options:t={},lazy:o=!0}){if(window.wxlogging&&console.log("Creating a WxTile layer:"+JSON.stringify({dataSource:e,options:t})),!e){window.wxlogging&&console.log("dataSource is empty!");return}Object.assign(this.options,t),this.styles=T(),e.ext||(e.ext="webp"),this.wxtiles=new Map;let n=()=>{window.wxlogging&&console.log("Setup:",e.name),this.setupCompletePromise=this._setUpDataSet(e),this.setupCompletePromise.then(()=>{window.wxlogging&&console.log("Setup complete:",this.dataSource.name,this.error&&". error:"+this.error||""),this._initializeEvents(),this._map&&this._onAddL(),this.fire("setupcomplete",{layer:this})})};o?this.once("add",n):n(),this.on("remove",this._onRemoveL,this)},createTile(e,t){return this.error?(setTimeout(t),Object.assign(L("div","error-tile"),{innerHTML:this.error})):q({layer:this,coords:e,done:t})},getSetupCompletePromise(){return this.setupCompletePromise},getTile(e){if(!this._map||this.error)return;let t=this._map.getZoom(),{x:o,y:n}=this._map.project(e,t),s={x:~~(o/256),y:~~(n/256)},i=this.wxtiles.get(`${s.x}:${s.y}:${t}`);if(!i||!i.data)return;let r={x:~~(o-s.x*256),y:~~(n-s.y*256)},l=i.getData(r);if(!l)return;let{raw:c,data:m}=l,g=this.clut.colorsI[c],u=C(g),h=this.clut.DataToStyle(m);return{tile:i,data:m,raw:c,rgba:g,hexColor:u,inStyleUnits:h,tilePoint:r,units:this.style.units}},setStyle(e){if(!this.dataSource){window.wxlogging&&console.log("setStyle: failed. Lazy setup not finished yet.");return}if(!(this.dataSource.styleName===e&&e!=="custom")){if(e&&(this.dataSource.styleName=e),e==="custom"&&this.styles.custom){(!this.styles.custom.parent||!(this.styles.custom.parent in this.styles))&&(this.styles.custom.parent="base");let t=this.styles[this.styles.custom.parent];this.styles.custom=Object.assign(Object.assign({},t),this.styles.custom)}this.dataSource.styleName in this.styles?Array.isArray(this.styles[this.dataSource.styleName])&&(this.dataSource.styleName+="[0]"):(this.dataSource.styleName=this.dataSource.name+"[0]",this.dataSource.styleName in this.styles||(this.dataSource.styleName="base",window.wxlogging&&console.log(`cant find the style (${e}), default is used`)));try{let t=this.styles[this.dataSource.styleName];this.style=Object.assign({},t);let o=this.style.streamLineColor;o!=="none"&&o.length<7&&(this.style.streamLineColor="#"+o[1]+o[1]+o[2]+o[2]+o[3]+o[3]);let n=this.dataSource.minmax[0];this.clut=new R(this.style,this.dataSource.units,n,this.vector)}catch(t){this.error="setStyle: impossible error in RawCLUT",window.wxlogging&&console.log(this.error,t);return}e&&(this._checkAndStartSlinesAnimation(),this._reloadTiles()),window.wxlogging&&console.log('setStyle: "'+this.dataSource.styleName+'" for '+this.dataSource.name+" complete."),this.fire("setstyle",{layer:this})}},getStyle(){if(!this.dataSource){window.wxlogging&&console.log("getStyle: failed. Lazy setup not finished yet.");return}return this.dataSource&&this.dataSource.styleName||""},getStyleName(){if(!this.dataSource){window.wxlogging&&console.log("getStyleName: failed. Lazy setup not finished yet.");return}return this.dataSource&&this.style&&this.style.name||"no style"},setTime(e){if(!this.dataSource){window.wxlogging&&console.log("setTime: failed. Lazy setup not finished yet.");return}let t=this._getClosestTimeString(e);if(this.dataSource.time!==t){this.dataSource.time=t,this.dataSource.baseURL=this.dataSource.originURI+this.dataSource.instance+`{var}/${this.dataSource.time}/{z}/{x}/{y}.${this.dataSource.ext}`,this.fire("settime",{layer:this,layerTime:t}),window.wxlogging&&console.log("setTime: "+t+" for "+this.dataSource.name+" complete.");let o=this._reloadTiles();return o.then(()=>{var c;let n=(c=this.wxtiles.entries().next().value)==null?void 0:c[1];if(!n)return;let[s,i]=this.dataSource.minmax[0],{dmin:r,dmax:l}=n.data[0];(Math.abs(r-s)>.01||Math.abs(l-i)>.01)&&(this.dataSource.minmax=n.data.map(m=>[m.dmin,m.dmax]),this._updateMinMax(),this.setStyle())}),o}return Promise.resolve()},getTime(){if(!this.dataSource){window.wxlogging&&console.log("getTime: failed. Lazy setup not finished yet.");return}return this.dataSource.time},getTimes(){if(!this.dataSource){window.wxlogging&&console.log("getTimes: failed. Lazy setup not finished yet.");return}return this.dataSource.meta.times},checkDataChanged(){return p(this,null,function*(){if(!this.dataSource)return window.wxlogging&&console.log("getTimes: failed. Lazy setup not finished yet."),Promise.resolve(!1);let e=yield M(this.dataSource.originURI+"instances.json"),t=e[e.length-1]+"/";if(this.dataSource.instance!==t)return!0;let o=yield M(this.dataSource.originURI+t+"meta.json");return this.dataSource.meta.times.toString()!==o.times.toString()})},reloadData(){return this._setUpDataSet()},getLegendData(e){if(!this.error){if(!this.clut){window.wxlogging&&console.log("getLegendData: failed. Lazy setup not finished yet:"+this.dataSource.name);return}return E(e,this.style)}},setTimeAnimationMode(e=2){this.oldMaxZoom=this.dataSource.meta.maxZoom;let t=this._map.getZoom(),n=(t<this.oldMaxZoom?t:this.oldMaxZoom)-e;this.dataSource.meta.maxZoom=n<0?0:n},unsetTimeAnimationMode(){var e,t;!this.oldMaxZoom||!((t=(e=this.dataSource)==null?void 0:e.meta)==null?void 0:t.maxZoom)||(this.dataSource.meta.maxZoom=this.oldMaxZoom,this._reloadTiles())},getMinMax(){let[e,t]=this.dataSource.minmax[0];return{min:e,max:t}},_setUpDataSet(e){return p(this,null,function*(){if(e&&!(e.dataset&&e.variables&&Array.isArray(e.variables)&&e.variables.length>0&&e.variables.length<3)){this.error=e.name+": dataSource error",window.wxlogging&&console.log(this.error);return}e&&(this.dataSource=e),this._stopLoadingResetLoadDataFunc(),this.dataSource.originURI=this.dataSource.serverURI+"/"+this.dataSource.dataset+"/";try{let t=yield M(this.dataSource.originURI+"instances.json");this.dataSource.instance=t[t.length-1]+"/"}catch(t){this.error=this.dataSource.name+": load instances.json error",window.wxlogging&&console.log(this.error);return}try{let t=this.dataSource.originURI+this.dataSource.instance+"meta.json";this.dataSource.meta=yield M(t)}catch(t){this.error=this.dataSource.name+": load meta.json error",window.wxlogging&&console.log(this.error);return}this.vector=this.dataSource.variables.length===2,this.animation=this.vector,this.dataSource.units=this.dataSource.meta.variablesMeta[this.dataSource.variables[0]].units,this.dataSource.minmax=this.dataSource.variables.map(t=>[this.dataSource.meta.variablesMeta[t].min,this.dataSource.meta.variablesMeta[t].max]),this._updateMinMax(),e&&(this.setTime(Date.now()),this.setStyle())})},_updateMinMax(){if(!this.vector)return;let[[e,t],[o,n]]=this.dataSource.minmax;this.dataSource.minmax.unshift([0,1.42*Math.max(-e,t,-o,n)])},_initializeEvents(){this.error||(this.on("tileload",e=>{this.wxtiles.set(`${e.coords.x}:${e.coords.y}:${e.coords.z}`,e.tile.wxtile)}),this.on("tileunload",e=>{this.wxtiles.delete(`${e.coords.x}:${e.coords.y}:${e.coords.z}`)}),this.on("add",this._onAddL,this))},_checkZoom(){(!this._map||this._map.getZoom()<this.dataSource.meta.maxZoom)&&this._stopLoadingResetLoadDataFunc()},_onAddL(){window.wxlogging&&console.log("onadd:",this.dataSource.name),this.error||this._map.on("zoomstart",this._checkZoom,this),this.setupCompletePromise.then(()=>{this.redraw(),this._checkAndStartSlinesAnimation()})},_onRemoveL(){window.wxlogging&&console.log("onremove:",this.dataSource.name),this._map.off("zoomstart",this._checkZoom,this),this.setupCompletePromise.then(()=>{this._stopLoadingResetLoadDataFunc(),this._stopSlinesAnimation()})},_stopLoadingResetLoadDataFunc(){var e;(e=this.loadData)==null||e.abort(),this.loadData=H()},_checkAndStartSlinesAnimation(){if(this.animFrame||!this.animation||!this.vector||!this.style.streamLineColor||this.style.streamLineColor==="none")return;let e=t=>{if(!this.animation||this.style.streamLineStatic){this._stopSlinesAnimation();return}this.wxtiles.forEach(o=>o.drawSLines(t)),this.animFrame=requestAnimationFrame(e)};e()},_stopSlinesAnimation(){cancelAnimationFrame(this.animFrame),this.wxtiles.forEach(e=>e.clearSLinesCanvas()),this.animFrame=0},_getClosestTimeString(e){return this.dataSource.meta.times.find(t=>new Date(t).getTime()>=e)||this.dataSource.meta.times[this.dataSource.meta.times.length-1]},_redrawTiles(){!this.wxtiles||this.animationRedrawID||(this.animationRedrawID=requestAnimationFrame(()=>{this.wxtiles.forEach(e=>e.draw()),this.animationRedrawID=null}))},_reloadTiles(){let e=[];this.wxtiles.forEach(o=>e.push(o._load()));let t=Promise.all(e);return t.then(()=>this._redrawTiles()),t}};var _=window.L,dt=_.GridLayer.extend(X);function j(e){let t=new dt;return t.initializeLayer(e),t}var ft={options:{URI:""},onAdd(){let e=document.createElement("img");return e.src=this.options.URI,e.className="wxtiles-logo",e}},gt=_.Control.extend(ft);function J(e){return window.wxlogging&&console.log("Add watermark:",JSON.stringify(e)),new gt(e)}var xt=_.GridLayer.extend({createTile(e){let t=document.createElement("div");return t.innerHTML=[e.x,e.y,e.z].join(", "),t.style.outline="1px solid red",t}});function Q(){window.wxlogging&&console.log("Add WxDebugCoordsLayer:");let e=new xt;return e.setZIndex(1e3),e}function Y(e){return _.layerGroup(e.map(j))}function tt(e){console.log(e?"Logging on":"Logging off"),window.wxlogging=e}return yt;})();
|
package/examples/README.md
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
This folder contains examples of how to use different bit of functionality in tiles JS libary.
|
|
2
|
-
Everu example is a standalone HTML file
|
|
3
|
-
NOTE: build before run examples.
|
|
4
|
-
```
|
|
5
|
-
npm run build
|
|
6
|
-
```
|
|
7
|
-
|
|
8
|
-
* getTile.html - How to pick data values from the mouse position.
|
|
9
|
-
* group.html - how to show and hide multiple layers same canvas.
|
|
10
|
-
* scalar.html - an example of how render a scalar value tempature.
|
|
11
|
-
* vector.html - an example of how render a vector value (u,v) wind.
|
|
12
|
-
* setStyle.html - how change the style of a layer dynamically.
|
|
13
|
-
* setTime.html - how select the timestamp of a layer.
|
|
14
|
-
* setupcomplete(promise).html - how to hook a callback to the setupcomplete event.
|
|
15
|
-
This event is triggered when all the metadata from tiles.metoceanapi.com is loaded and the layer is about to be render.
|
|
16
|
-
After this event you are allow to read or set the library properties time, style.
|
package/examples/getTile.html
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>WxTiles v2.0</title>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<link rel="shortcut icon" href="res/icon.png" type="image/x-icon" />
|
|
8
|
-
|
|
9
|
-
<!-- LEAFLET lib goes first -->
|
|
10
|
-
<link
|
|
11
|
-
rel="stylesheet"
|
|
12
|
-
href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
|
|
13
|
-
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
|
|
14
|
-
crossorigin=""
|
|
15
|
-
/>
|
|
16
|
-
|
|
17
|
-
<script
|
|
18
|
-
src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
|
|
19
|
-
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
|
|
20
|
-
crossorigin=""
|
|
21
|
-
></script>
|
|
22
|
-
|
|
23
|
-
<!-- WxTile lib goes here -->
|
|
24
|
-
<script src="../dist/web/wxtile.js"></script>
|
|
25
|
-
<link rel="stylesheet" href="../dist/web/wxtile.css" />
|
|
26
|
-
</head>
|
|
27
|
-
|
|
28
|
-
<body style="margin: 0">
|
|
29
|
-
<div id="map" style="height: 100vh; width: 100vw"></div>
|
|
30
|
-
|
|
31
|
-
<script>
|
|
32
|
-
('use strict');
|
|
33
|
-
const { WxTileLogging, WxTileLibSetup, WxTileWatermark, WxTileLayer, WxGetColorStyles } = window.wxtilejs;
|
|
34
|
-
|
|
35
|
-
// Leaflet basic setup // set the main Leaflet's map object, compose and add base layers
|
|
36
|
-
const map = L.map('map', { center: [-37.803113, 174.878166], zoom: 5, zoomControl: false });
|
|
37
|
-
|
|
38
|
-
WxTileLogging(true); // use wxtiles logging -> console.log
|
|
39
|
-
WxTileWatermark({ URI: 'res/wxtiles-logo.png', position: 'topleft' }).addTo(map); // set the correct URI
|
|
40
|
-
// ESSENTIAL step to get lib ready.
|
|
41
|
-
WxTileLibSetup({}); // if empty defaults are used
|
|
42
|
-
|
|
43
|
-
// SCALAR field setup
|
|
44
|
-
const layerS = WxTileLayer({
|
|
45
|
-
dataSource: {
|
|
46
|
-
serverURI: 'https://tiles.metoceanapi.com/data/', // server to fetch data from
|
|
47
|
-
ext: 'png', // png / webp (default) - wxtilesplitter output format
|
|
48
|
-
dataset: 'ecwmf.global', // dataset of the dataset
|
|
49
|
-
variables: ['air.temperature.at-2m'], // variable(s) to be used for the layer rendering
|
|
50
|
-
name: 'air.temperature.at-2m', // attribute of the dataSource to be used externally
|
|
51
|
-
styleName: 'base', // The name of the style (from styles.json) to apply for the layer
|
|
52
|
-
},
|
|
53
|
-
// Lazy setup
|
|
54
|
-
// 'true': perform setup and data loading on 'addTo(map)'.
|
|
55
|
-
// 'false': start loading immediately, but loading is not finished when layer is created.
|
|
56
|
-
// the signal 'setupcomplete' is fired when loading is finished.
|
|
57
|
-
// useful when a big bunch of layers is used, so layers are not wasting memory and bandwidth.
|
|
58
|
-
lazy: false,
|
|
59
|
-
options: {
|
|
60
|
-
opacity: 0.99,
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
layerS.addTo(map);
|
|
64
|
-
|
|
65
|
-
// VECTOR field setup
|
|
66
|
-
const layerV = WxTileLayer({
|
|
67
|
-
dataSource: {
|
|
68
|
-
serverURI: 'https://tiles.metoceanapi.com/data/', // server to fetch data from
|
|
69
|
-
ext: 'png', // png / webp (default) - wxtilesplitter output format
|
|
70
|
-
dataset: 'ecwmf.global', // dataset of the dataset
|
|
71
|
-
variables: ['wind.speed.eastward.at-10m', 'wind.speed.northward.at-10m'], // variabls to be used for the layer rendering
|
|
72
|
-
name: 'wind speed at 10m', // attribute of the dataSource to be used externally
|
|
73
|
-
styleName: 'base', // The name of the style (from styles.json) to apply for the layer
|
|
74
|
-
},
|
|
75
|
-
// Lazy setup
|
|
76
|
-
// 'true': perform setup and data loading on 'addTo(map)'.
|
|
77
|
-
// 'false': start loading immediately, but loading is not finished when layer is created.
|
|
78
|
-
// the signal 'setupcomplete' is fired when loading is finished.
|
|
79
|
-
// useful when a big bunch of layers is used, so layers are not wasting memory and bandwidth.
|
|
80
|
-
lazy: false,
|
|
81
|
-
options: { opacity: 0.4 },
|
|
82
|
-
});
|
|
83
|
-
layerV.addTo(map);
|
|
84
|
-
|
|
85
|
-
// ONCLICK
|
|
86
|
-
map.on('click', (e) => {
|
|
87
|
-
let content = '';
|
|
88
|
-
map.eachLayer((layer) => {
|
|
89
|
-
if (layer.getTile) {
|
|
90
|
-
// check if layer is a wxLayer
|
|
91
|
-
const tile = layer.getTile(e.latlng);
|
|
92
|
-
const time = layer.getTime();
|
|
93
|
-
content += tile
|
|
94
|
-
? `<p>
|
|
95
|
-
<div style="width: 18px;height: 18px;float: left;margin-right: 5px;background:${tile.hexColor}"></div>
|
|
96
|
-
${tile.tile.layer.dataSource.name} ${tile.inStyleUnits} (${time})
|
|
97
|
-
</p>`
|
|
98
|
-
: '';
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
L.popup()
|
|
103
|
-
.setLatLng(e.latlng)
|
|
104
|
-
.setContent(content + `${e.latlng}`)
|
|
105
|
-
.openOn(map);
|
|
106
|
-
});
|
|
107
|
-
</script>
|
|
108
|
-
</body>
|
|
109
|
-
</html>
|
package/examples/group.html
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html>
|
|
3
|
-
<head>
|
|
4
|
-
<title>WxTiles v2.0</title>
|
|
5
|
-
<meta charset="utf-8" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<link rel="shortcut icon" href="res/icon.png" type="image/x-icon" />
|
|
8
|
-
|
|
9
|
-
<!-- LEAFLET lib goes first -->
|
|
10
|
-
<link
|
|
11
|
-
rel="stylesheet"
|
|
12
|
-
href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
|
|
13
|
-
integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
|
|
14
|
-
crossorigin=""
|
|
15
|
-
/>
|
|
16
|
-
|
|
17
|
-
<script
|
|
18
|
-
src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js"
|
|
19
|
-
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
|
|
20
|
-
crossorigin=""
|
|
21
|
-
></script>
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
<!-- WxTile lib goes here -->
|
|
25
|
-
<script src="../dist/web/wxtile.js"></script>
|
|
26
|
-
<link rel="stylesheet" href="../dist/web/wxtile.css" />
|
|
27
|
-
</head>
|
|
28
|
-
|
|
29
|
-
<body style="margin: 0">
|
|
30
|
-
<div id="map" style="height: 100vh; width: 100vw"></div>
|
|
31
|
-
|
|
32
|
-
<script>
|
|
33
|
-
('use strict');
|
|
34
|
-
const { WxTileLogging, WxTileLibSetup, WxTileWatermark, WxTileLayer, WxGetColorStyles, WxTileGroupLayer } = window.wxtilejs;
|
|
35
|
-
|
|
36
|
-
// Leaflet basic setup // set the main Leaflet's map object, compose and add base layers
|
|
37
|
-
const map = L.map('map', { center: [-37.803113, 174.878166], zoom: 5, zoomControl: false });
|
|
38
|
-
|
|
39
|
-
WxTileLogging(true); // use wxtiles logging -> console.log
|
|
40
|
-
WxTileWatermark({ URI: 'res/wxtiles-logo.png', position: 'topleft' }).addTo(map); // set the correct URI
|
|
41
|
-
// ESSENTIAL step to get lib ready.
|
|
42
|
-
WxTileLibSetup(); // if empty defaults are used
|
|
43
|
-
|
|
44
|
-
// group setup
|
|
45
|
-
const layersGroupSettings = [
|
|
46
|
-
{
|
|
47
|
-
dataSource: {
|
|
48
|
-
serverURI: 'https://tiles.metoceanapi.com/data', // server to fetch data from
|
|
49
|
-
ext: 'png', // png / webp (default) - wxtilesplitter output format
|
|
50
|
-
dataset: 'ecwmf.global', // dataset of the dataset
|
|
51
|
-
variables: ['air.temperature.at-2m'], // variable(s) to be used for the layer rendering
|
|
52
|
-
name: 'air.temperature.at-2m', // attribute of the dataSource to be used externally
|
|
53
|
-
styleName: 'base', // The name of the style (from styles.json) to apply for the layer
|
|
54
|
-
},
|
|
55
|
-
// Lazy setup
|
|
56
|
-
// 'true': perform setup and data loading on 'addTo(map)'.
|
|
57
|
-
// 'false': start loading immediately, but loading is not finished when layer is created.
|
|
58
|
-
// the signal 'setupcomplete' is fired when loading is finished.
|
|
59
|
-
// useful when a big bunch of layers is used, so layers are not wasting memory and bandwidth.
|
|
60
|
-
lazy: true,
|
|
61
|
-
options: {
|
|
62
|
-
opacity: 0.99,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
dataSource: {
|
|
67
|
-
serverURI: 'https://tiles.metoceanapi.com/data', // server to fetch data from
|
|
68
|
-
ext: 'png', // png / webp (default) - wxtilesplitter output format
|
|
69
|
-
dataset: 'ecwmf.global', // dataset of the dataset
|
|
70
|
-
variables: ['wind.speed.eastward.at-10m', 'wind.speed.northward.at-10m'], // variabls to be used for the layer rendering
|
|
71
|
-
name: 'wind speed at 10m', // attribute of the dataSource to be used externally
|
|
72
|
-
styleName: 'base', // The name of the style (from styles.json) to apply for the layer
|
|
73
|
-
},
|
|
74
|
-
// Lazy setup
|
|
75
|
-
// 'true': perform setup and data loading on 'addTo(map)'.
|
|
76
|
-
// 'false': start loading immediately, but loading is not finished when layer is created.
|
|
77
|
-
// the signal 'setupcomplete' is fired when loading is finished.
|
|
78
|
-
// useful when a big bunch of layers is used, so layers are not wasting memory and bandwidth.
|
|
79
|
-
lazy: true,
|
|
80
|
-
options: { opacity: 0.99 },
|
|
81
|
-
},
|
|
82
|
-
];
|
|
83
|
-
// create group of layers using layersGroupSettings
|
|
84
|
-
const wxgroup = WxTileGroupLayer(layersGroupSettings);
|
|
85
|
-
// add to map
|
|
86
|
-
wxgroup.addTo(map);
|
|
87
|
-
// get all setupCompletePromises
|
|
88
|
-
const completePromises = wxgroup.getLayers().map((l) => l.setupCompletePromise);
|
|
89
|
-
// wait all and log setup complete
|
|
90
|
-
Promise.all(completePromises).then(() => alert('group setup complete. So, tiles are being loaded and rendered now.'));
|
|
91
|
-
</script>
|
|
92
|
-
</body>
|
|
93
|
-
</html>
|
package/examples/res/icon.png
DELETED
|
Binary file
|