m4-w-fast 1.0.0

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/README.md ADDED
@@ -0,0 +1,97 @@
1
+ # m4文件绘图程序
2
+
3
+ ### 使用
4
+
5
+ 1. 安装这个库
6
+ ```shell
7
+ npm i m4-w-fast
8
+ ```
9
+
10
+ 2. 使用示例
11
+ ```vue
12
+ <script lang="ts" setup>
13
+ import * as L from 'leaflet'
14
+ import 'leaflet/dist/leaflet.css'
15
+ import ReadFileM4Fast from 'm4-w-fast'
16
+
17
+ const file = '' // 这里是你的m4文件路径
18
+
19
+ const init = async() => {
20
+ const read = new ReadFileM4Fast(file)
21
+ await read.start()
22
+ // 此时, 你已经有解析过的数据了
23
+
24
+ // 开始计算等值面
25
+ const break = [] // 这里取决于你的色标分级
26
+ const isoBands = read.getIsoBandsFast(break)
27
+
28
+ // 叠加绘图 leaflet为例
29
+ L.geoJson(isoBands, {
30
+ style(feature) {
31
+ if (!feature) return {}
32
+ const z = feature.properties.z
33
+ const rgba = read.getColorFast(z, level, color)
34
+ return {
35
+ weight: 3,
36
+ opacity: 1,
37
+ color: 'red',
38
+ stroke: false, // 如果你需要等值线开启他
39
+ fillColor: rgba,
40
+ fillOpacity: 0.5
41
+ }
42
+ }
43
+ }).addTo(map)
44
+
45
+ </script>
46
+ ```
47
+
48
+ 3. webWorker使用示例 (worker主要用来裁切文件)
49
+ ```vue
50
+ <script lang="ts" setup>
51
+ import * as L from 'leaflet'
52
+ import 'leaflet/dist/leaflet.css'
53
+ import ReadFileM4Fast from 'm4-w-fast'
54
+ import { getIsoWorkerUrl, getIntersectWorkerUrl } from 'm4-w-fast/worker-urls'
55
+ import isoWorkerUrl from 'm4-w-fast/dist/isoBands.worker?url'
56
+ import intersectWorkerUrl from 'm4-w-fast/dist/intersect.worker?url'
57
+
58
+ import geojson from './620000.json'
59
+ import type { FeatureCollection } from 'geojson'
60
+
61
+ const file = '' // 这里是你的m4文件路径
62
+
63
+ const init = async() => {
64
+ const read = new ReadFileM4Fast(file)
65
+ await read.start()
66
+ // 此时, 你已经有解析过的数据了
67
+
68
+ // 开始计算等值面
69
+ const break = [] // 这里取决于你的色标分级
70
+
71
+ // 如果数据量实在是大, 可以考虑用他来计算, 但是实测 180w条数据下也没必要用他
72
+ const isoBands = await read.getIsoBandsFastByWorker(break, isoWorkerUrl)
73
+
74
+ // 根据边界裁切文件
75
+ const intersection = await read.clipDataByJson(isoBands, geojson as FeatureCollection, intersectWorkerUrl)
76
+
77
+ // 叠加绘图 leaflet为例
78
+ L.geoJson(intersection, {
79
+ style(feature) {
80
+ if (!feature) return {}
81
+ const z = feature.properties.z
82
+ const rgba = read.getColorFast(z, level, color)
83
+ return {
84
+ weight: 3,
85
+ opacity: 1,
86
+ color: 'red',
87
+ stroke: false, // 如果你需要等值线开启他
88
+ fillColor: rgba,
89
+ fillOpacity: 0.5
90
+ }
91
+ }
92
+ }).addTo(map)
93
+
94
+ ```
95
+
96
+ #### @author: wangrl
97
+ #### 维护随缘
@@ -0,0 +1,2 @@
1
+ import ReadFileM4Fast from './readFile';
2
+ export default ReadFileM4Fast;
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ (function(_0x562be9,_0x4dc18d){var _0x53ba4b=a0_0x52fa,_0x2158a3=_0x562be9();while(!![]){try{var _0x5f500b=-parseInt(_0x53ba4b(0x91))/0x1*(-parseInt(_0x53ba4b(0x94))/0x2)+parseInt(_0x53ba4b(0x92))/0x3+parseInt(_0x53ba4b(0x96))/0x4*(parseInt(_0x53ba4b(0x93))/0x5)+-parseInt(_0x53ba4b(0x8f))/0x6*(parseInt(_0x53ba4b(0x8d))/0x7)+parseInt(_0x53ba4b(0x8c))/0x8+parseInt(_0x53ba4b(0x95))/0x9*(parseInt(_0x53ba4b(0x90))/0xa)+parseInt(_0x53ba4b(0x8e))/0xb;if(_0x5f500b===_0x4dc18d)break;else _0x2158a3['push'](_0x2158a3['shift']());}catch(_0x1ab065){_0x2158a3['push'](_0x2158a3['shift']());}}}(a0_0x2460,0x3b149));import a0_0x47af85 from'./readFile';export default a0_0x47af85;function a0_0x52fa(_0x5e65c9,_0x526b31){var _0x2460ad=a0_0x2460();return a0_0x52fa=function(_0x52fa5a,_0x1b83d0){_0x52fa5a=_0x52fa5a-0x8c;var _0x408592=_0x2460ad[_0x52fa5a];return _0x408592;},a0_0x52fa(_0x5e65c9,_0x526b31);}function a0_0x2460(){var _0x2ddb63=['381072NfyphO','5ovWKGC','4XCVAaw','26748zBbNCh','208604JRKAXa','413640mrVour','417025wChmub','1399893pDmkdP','48KcmMUd','580yOksTb','94037zkFVql'];a0_0x2460=function(){return _0x2ddb63;};return a0_0x2460();}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ const a1_0x40af19=a1_0x3f40;function a1_0x3f40(_0x117ea,_0x301c8b){const _0x366438=a1_0x3664();return a1_0x3f40=function(_0x3f40b9,_0x35a7a0){_0x3f40b9=_0x3f40b9-0x138;let _0x2cfcfa=_0x366438[_0x3f40b9];return _0x2cfcfa;},a1_0x3f40(_0x117ea,_0x301c8b);}(function(_0x28da12,_0x3973db){const _0x520aa4=a1_0x3f40,_0x41e0f9=_0x28da12();while(!![]){try{const _0x591c91=parseInt(_0x520aa4(0x13f))/0x1+parseInt(_0x520aa4(0x13a))/0x2*(parseInt(_0x520aa4(0x13d))/0x3)+-parseInt(_0x520aa4(0x141))/0x4*(-parseInt(_0x520aa4(0x138))/0x5)+-parseInt(_0x520aa4(0x149))/0x6+parseInt(_0x520aa4(0x13e))/0x7+-parseInt(_0x520aa4(0x148))/0x8*(-parseInt(_0x520aa4(0x144))/0x9)+parseInt(_0x520aa4(0x13b))/0xa*(-parseInt(_0x520aa4(0x13c))/0xb);if(_0x591c91===_0x3973db)break;else _0x41e0f9['push'](_0x41e0f9['shift']());}catch(_0x3c8793){_0x41e0f9['push'](_0x41e0f9['shift']());}}}(a1_0x3664,0xa77aa));import a1_0x32dc47 from'@turf/intersect';function a1_0x3664(){const _0x23674e=['length','4408aiNusw','351534CFjYzx','message','addEventListener','22235TLexEH','random','2uIiepc','35196110wtYfBC','11tAVjRK','3233709ptPUSU','7748475GrFtxu','931536qxHVXt','properties','236UEtZUF','data','push','14463amjXhj','coordinates','geometry'];a1_0x3664=function(){return _0x23674e;};return a1_0x3664();}import a1_0x2f49e from'@turf/boolean-within';self[a1_0x40af19(0x14b)](a1_0x40af19(0x14a),_0x45bcc5=>{const _0x678300=a1_0x40af19,{isoChunk:_0x28a0e7,gansuFeatures:_0x299045}=_0x45bcc5[_0x678300(0x142)],_0x8a6c90=[];for(const _0x2f57ac of _0x28a0e7){try{if(!_0x2f57ac?.[_0x678300(0x146)])continue;if(!(_0x678300(0x145)in _0x2f57ac['geometry'])||_0x2f57ac[_0x678300(0x146)][_0x678300(0x145)][_0x678300(0x147)]===0x0)continue;for(const _0x371bfa of _0x299045){let _0x5e53a6=null;try{a1_0x2f49e(_0x2f57ac,_0x371bfa)?_0x5e53a6=_0x2f57ac:_0x5e53a6=a1_0x32dc47(_0x371bfa,_0x2f57ac);}catch{}_0x5e53a6&&(_0x5e53a6[_0x678300(0x140)]=_0x2f57ac['properties'],_0x5e53a6['id']=Math[_0x678300(0x139)]()*0x5f5e100,_0x8a6c90[_0x678300(0x143)](_0x5e53a6));}}catch{}}self['postMessage']({'features':_0x8a6c90});});
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ const a2_0x3363bc=a2_0x28fb;function a2_0x28fb(_0xe638d0,_0x3c0378){const _0x24ed99=a2_0x24ed();return a2_0x28fb=function(_0x28fbdb,_0x3c0310){_0x28fbdb=_0x28fbdb-0x123;let _0x6fb46f=_0x24ed99[_0x28fbdb];return _0x6fb46f;},a2_0x28fb(_0xe638d0,_0x3c0378);}(function(_0x14c276,_0x36b07d){const _0x310260=a2_0x28fb,_0x5a6fe4=_0x14c276();while(!![]){try{const _0x2b2f6e=parseInt(_0x310260(0x134))/0x1*(parseInt(_0x310260(0x126))/0x2)+parseInt(_0x310260(0x137))/0x3+-parseInt(_0x310260(0x127))/0x4*(parseInt(_0x310260(0x13b))/0x5)+parseInt(_0x310260(0x132))/0x6*(-parseInt(_0x310260(0x136))/0x7)+parseInt(_0x310260(0x130))/0x8+-parseInt(_0x310260(0x13a))/0x9*(parseInt(_0x310260(0x129))/0xa)+-parseInt(_0x310260(0x125))/0xb*(parseInt(_0x310260(0x13d))/0xc);if(_0x2b2f6e===_0x36b07d)break;else _0x5a6fe4['push'](_0x5a6fe4['shift']());}catch(_0x367d39){_0x5a6fe4['push'](_0x5a6fe4['shift']());}}}(a2_0x24ed,0x984af));import{contours}from'd3-contour';function a2_0x24ed(){const _0x574eb7=['3087747akOnoM','plus','contour','43101DKVgLw','10YokntS','length','36CBEYlT','push','isNaN','size','568293EybkwE','1007582HKIwsb','1412160PrRqIy','postMessage','1990WPHioK','isArray','Polygon','coordinates','Feature','number','filter','9562400xsxzfH','message','1742814wPDVGM','addEventListener','1WUYMBG','times','7bLFxTU'];a2_0x24ed=function(){return _0x574eb7;};return a2_0x24ed();}import a2_0x486a47 from'big.js';self[a2_0x3363bc(0x133)](a2_0x3363bc(0x131),_0x5db560=>{const _0x200966=a2_0x3363bc,{breaks:_0x574669,values:_0x216278,nx:_0xd254ac,ny:_0x52bd42,minLat:_0x37ead7,maxVal:_0x36c917,minVal:_0x21ad4b,minLng:_0x15a694,gjLng:_0x589fe2,gjLat:_0xe1035d}=_0x5db560['data'];let _0x309b53=[];for(let _0x59eb86=0x0;_0x59eb86<_0x574669[_0x200966(0x13c)];_0x59eb86++){const _0x41f4e0=_0x574669[_0x59eb86];if(_0x41f4e0<_0x21ad4b||_0x41f4e0>_0x36c917)continue;const _0x2c334e=contours()[_0x200966(0x124)]([_0xd254ac,_0x52bd42]),_0x2eada3=_0x2c334e[_0x200966(0x139)](_0x216278,_0x41f4e0);if(!_0x2eada3||!_0x2eada3['coordinates'])continue;for(const _0x19c54b of _0x2eada3[_0x200966(0x12c)]){let _0x465214=[];if(Array[_0x200966(0x12a)](_0x19c54b)&&_0x19c54b[_0x200966(0x13c)]>0x0&&Array['isArray'](_0x19c54b[0x0])&&typeof _0x19c54b[0x0][0x0]===_0x200966(0x12e))_0x465214=[_0x19c54b];else{if(Array[_0x200966(0x12a)](_0x19c54b))_0x465214=_0x19c54b;else continue;}for(const _0x58cd12 of _0x465214){const _0x14913c=_0x58cd12['map'](_0x5e8bbb=>{const _0x522b63=_0x200966,_0x3f90ab=_0x5e8bbb[0x0],_0x7ae496=_0x5e8bbb[0x1];if(_0x3f90ab==null||_0x7ae496==null||Number[_0x522b63(0x123)](_0x3f90ab)||Number['isNaN'](_0x7ae496))return null;const _0x579b94=a2_0x486a47(_0x15a694)[_0x522b63(0x138)](a2_0x486a47(_0x3f90ab)['times'](_0x589fe2))['toNumber'](),_0x109758=a2_0x486a47(_0x37ead7)[_0x522b63(0x138)](a2_0x486a47(_0x7ae496)[_0x522b63(0x135)](_0xe1035d))['toNumber']();return[_0x579b94,_0x109758];})[_0x200966(0x12f)](_0x52e0c7=>_0x52e0c7!==null),_0x5840d6=_0x14913c[_0x200966(0x12f)]((_0x48405b,_0x24c73f,_0x9987d2)=>{if(_0x24c73f===0x0)return!![];const _0xb2e4f1=_0x9987d2[_0x24c73f-0x1];return!(_0x48405b[0x0]===_0xb2e4f1[0x0]&&_0x48405b[0x1]===_0xb2e4f1[0x1]);});if(_0x5840d6['length']<0x3)continue;const _0x4b4a1a=_0x5840d6[0x0],_0x2ce65d=_0x5840d6[_0x5840d6[_0x200966(0x13c)]-0x1];(_0x4b4a1a[0x0]!==_0x2ce65d[0x0]||_0x4b4a1a[0x1]!==_0x2ce65d[0x1])&&_0x5840d6[_0x200966(0x13e)]([_0x4b4a1a[0x0],_0x4b4a1a[0x1]]),_0x309b53['push']({'type':_0x200966(0x12d),'properties':{'z':_0x41f4e0},'geometry':{'type':_0x200966(0x12b),'coordinates':[_0x5840d6]}});}}}self[_0x200966(0x128)]({'features':_0x309b53});});
@@ -0,0 +1,72 @@
1
+ import * as turf from '@turf/turf';
2
+ import type { FeatureCollection, Polygon, MultiPolygon } from 'geojson';
3
+ export declare class _readFileDiamond4 {
4
+ filePath: string;
5
+ json: JSONData[];
6
+ gjLng: number;
7
+ gjLat: number;
8
+ lngLineNum: number;
9
+ latLineNum: number;
10
+ minLng: number;
11
+ minLat: number;
12
+ jsonMap: Map<string, number>;
13
+ maxVal: number;
14
+ minVal: number;
15
+ constructor(filePath: string);
16
+ start(): Promise<"该时次未获取到文件" | "该时次文件数据异常" | undefined>;
17
+ getJson(): JSONData[];
18
+ setJson(json: JSONData[]): void;
19
+ getBreaks(): number[];
20
+ getGridPoints(): turf.helpers.FeatureCollection<turf.helpers.Point, turf.helpers.Properties>;
21
+ getIsoLines(breaks?: number[]): turf.helpers.FeatureCollection<turf.helpers.MultiLineString, turf.helpers.Properties>;
22
+ getIsoBands(breaks?: number[]): turf.helpers.FeatureCollection<turf.helpers.MultiPolygon, turf.helpers.Properties>;
23
+ getIsoColor(z: string, level: number[], color: (number[] | string)[]): string;
24
+ /**
25
+ * fast 模式
26
+ * @param breaks
27
+ */
28
+ getIsoBandsFast(breaks?: number[]): FeatureCollection;
29
+ /**
30
+ * 适配fast模式的取色
31
+ * @param z
32
+ * @param level
33
+ * @param color
34
+ */
35
+ getColorFast(z: number, level: number[], color: (number[] | string)[]): string;
36
+ /**
37
+ * 数组分块
38
+ * @param arr
39
+ * @param parts
40
+ */
41
+ private chunkArray;
42
+ /**
43
+ * 裁剪数据
44
+ * @param iosBands
45
+ * @param json
46
+ * @param workerUrl
47
+ */
48
+ clipDataByJson: (iosBands: FeatureCollection, json: FeatureCollection, intersectWorkerUrl: string) => Promise<turf.helpers.FeatureCollection<Polygon | MultiPolygon, turf.helpers.Properties>>;
49
+ getIsoBandsFastByWorker: (breaks: number[] | undefined, bandsWorkerUrl: string) => Promise<FeatureCollection>;
50
+ getIsoBandsFastBase: (breaks?: number[]) => {
51
+ type: string;
52
+ features: never[];
53
+ values?: undefined;
54
+ breaks?: undefined;
55
+ nx?: undefined;
56
+ ny?: undefined;
57
+ } | {
58
+ values: number[];
59
+ breaks: number[];
60
+ nx: number;
61
+ ny: number;
62
+ type?: undefined;
63
+ features?: undefined;
64
+ };
65
+ private sortFeaturesByArea;
66
+ }
67
+ interface JSONData {
68
+ lat: number;
69
+ lng: number;
70
+ val: number;
71
+ }
72
+ export default _readFileDiamond4;
@@ -0,0 +1 @@
1
+ function a3_0x28c5(_0xb6aad9,_0x587ec4){const _0x5956d4=a3_0x5956();return a3_0x28c5=function(_0x28c547,_0x541a2d){_0x28c547=_0x28c547-0x10f;let _0x35b9d7=_0x5956d4[_0x28c547];return _0x35b9d7;},a3_0x28c5(_0xb6aad9,_0x587ec4);}const a3_0x1255da=a3_0x28c5;(function(_0xe817f4,_0x3f0485){const _0x59338e=a3_0x28c5,_0x200740=_0xe817f4();while(!![]){try{const _0x54ac62=-parseInt(_0x59338e(0x10f))/0x1+-parseInt(_0x59338e(0x110))/0x2*(-parseInt(_0x59338e(0x12f))/0x3)+-parseInt(_0x59338e(0x147))/0x4+parseInt(_0x59338e(0x113))/0x5*(-parseInt(_0x59338e(0x15e))/0x6)+-parseInt(_0x59338e(0x12a))/0x7+-parseInt(_0x59338e(0x11c))/0x8+parseInt(_0x59338e(0x117))/0x9*(parseInt(_0x59338e(0x12d))/0xa);if(_0x54ac62===_0x3f0485)break;else _0x200740['push'](_0x200740['shift']());}catch(_0x531a02){_0x200740['push'](_0x200740['shift']());}}}(a3_0x5956,0xc4a23));function a3_0x5956(){const _0x15c447=['1366782TwsqWL','sort','minVal','module','该时次文件数据异常','latLineNum','get','points','onerror','964382bsIHmd','2465308tcwzJm','from','error','10srYLqZ','isArray','isNaN','terminate','9XZqxaj','sortFeaturesByArea','length','min','toNumber','2482616pBHpPI','ceil','isobands','times','postMessage','trim','getIsoColor','size','breaks','max','indexOf','flat','getIsoBandsFastByWorker','forEach','9366105nxTqGE','lat','getGridPoints','27688030RVPKct','clipDataByJson','3mkaKTg','getIsoBands','该时次未获取到文件','all','abs','setJson','lngLineNum','getJson','features','properties','map','onmessage','floor','rgba(','hardwareConcurrency','push','gjLng','chunkArray','FeatureCollection','maxVal','slice','getIsoLines','Polygon','Feature','510912trsmWR','getIsoBandsFastBase','data','contour','minLng','coordinates','filter','geometry','__area','jsonMap','minLat','val','json','string','gjLat','getIsoBandsFast','plus','split','featureCollection','getBreaks','rgba(255,255,255,0)','filePath','isolines'];a3_0x5956=function(){return _0x15c447;};return a3_0x5956();}import*as a3_0x447ddd from'@turf/turf';import a3_0x53cded from'big.js';import{contours}from'd3-contour';export class _readFileDiamond4{[a3_0x1255da(0x15c)];[a3_0x1255da(0x153)]=[];[a3_0x1255da(0x13f)]=0x0;[a3_0x1255da(0x155)]=0x0;['lngLineNum']=0x0;[a3_0x1255da(0x163)]=0x0;[a3_0x1255da(0x14b)]=0x0;['minLat']=0x0;[a3_0x1255da(0x150)]=new Map();[a3_0x1255da(0x142)]=-Infinity;[a3_0x1255da(0x160)]=Infinity;constructor(_0x564798){const _0x2f3661=a3_0x1255da;this[_0x2f3661(0x15c)]=_0x564798;}async['start'](){const _0x1bc5e6=a3_0x1255da,_0x9ab7f4=await fetch(this['filePath']);if(!_0x9ab7f4['ok'])return _0x1bc5e6(0x131);const _0x56ad50=await _0x9ab7f4['text'](),_0x267c6d=_0x56ad50['split']('\x0a');if(_0x267c6d['length']<0x4)return _0x1bc5e6(0x162);const _0x47201d=(_0x267c6d[0x1]??'')[_0x1bc5e6(0x121)]()['split'](/\s+/);let _0x4bd325=0x2;while(_0x47201d[_0x1bc5e6(0x119)]<0x13){_0x47201d['push'](...(_0x267c6d[_0x4bd325]??'')[_0x1bc5e6(0x121)]()[_0x1bc5e6(0x158)](/\s+/)),_0x4bd325++;}this[_0x1bc5e6(0x13f)]=Number(_0x47201d[0x6]);const _0x12d3b8=Number(_0x47201d[0x8]),_0x114ebd=Number(_0x47201d[0xa]),_0x5d6328=Number(_0x47201d[0xb]);this[_0x1bc5e6(0x135)]=Number(_0x47201d[0xc]),this[_0x1bc5e6(0x163)]=Number(_0x47201d[0xd]),this['minLng']=_0x12d3b8,this[_0x1bc5e6(0x151)]=_0x114ebd,this['gjLat']=Math[_0x1bc5e6(0x133)](Number(_0x47201d[0x7]))*(_0x114ebd>_0x5d6328?-0x1:0x1);const _0x25817b=this[_0x1bc5e6(0x135)],_0x23f09e=this[_0x1bc5e6(0x163)],_0x4faacb=_0x25817b*_0x23f09e;if(_0x4faacb===0x0)return;const _0x42aca6=Array['from']({'length':this[_0x1bc5e6(0x135)]});for(let _0x1558e1=0x0;_0x1558e1<this[_0x1bc5e6(0x135)];_0x1558e1++){_0x42aca6[_0x1558e1]=a3_0x53cded(_0x12d3b8)[_0x1bc5e6(0x157)](a3_0x53cded(_0x1558e1)[_0x1bc5e6(0x11f)](this[_0x1bc5e6(0x13f)]))[_0x1bc5e6(0x11b)]();}const _0x3488d2=Array[_0x1bc5e6(0x111)]({'length':this['latLineNum']});for(let _0x1e793b=0x0;_0x1e793b<this['latLineNum'];_0x1e793b++){_0x3488d2[_0x1e793b]=a3_0x53cded(_0x114ebd)[_0x1bc5e6(0x157)](a3_0x53cded(_0x1e793b)['times'](this[_0x1bc5e6(0x155)]))[_0x1bc5e6(0x11b)]();}this[_0x1bc5e6(0x153)]=Array[_0x1bc5e6(0x111)]({'length':this[_0x1bc5e6(0x135)]*this['latLineNum']});let _0x2de998=0x0;for(let _0x377139=_0x4bd325;_0x377139<_0x267c6d[_0x1bc5e6(0x119)]&&_0x2de998<_0x4faacb;_0x377139++){const _0x44d599=_0x267c6d[_0x377139]??'',_0x2f8cca=_0x44d599[_0x1bc5e6(0x121)]()[_0x1bc5e6(0x158)](/\s+/);if(!_0x2f8cca)continue;for(let _0x488624=0x0;_0x488624<_0x2f8cca['length'];_0x488624++){const _0x39746b=Number(_0x2f8cca[_0x488624]);this[_0x1bc5e6(0x142)]=Math[_0x1bc5e6(0x125)](this[_0x1bc5e6(0x142)],_0x39746b),this[_0x1bc5e6(0x160)]=Math[_0x1bc5e6(0x11a)](this[_0x1bc5e6(0x160)],_0x39746b);const _0x3c24b0=Math[_0x1bc5e6(0x13b)](_0x2de998/_0x25817b),_0x4a9834=_0x2de998%_0x25817b,_0x798314=_0x42aca6[_0x4a9834],_0x4d7f13=_0x3488d2[_0x3c24b0];_0x4d7f13&&_0x798314&&(this[_0x1bc5e6(0x153)][_0x2de998]={'lat':_0x4d7f13,'lng':_0x798314,'val':_0x39746b}),_0x2de998++;}}this[_0x1bc5e6(0x153)]=this['json']['filter'](_0x54582c=>_0x54582c!==undefined);}[a3_0x1255da(0x136)](){const _0x10bb61=a3_0x1255da;return this[_0x10bb61(0x153)];}[a3_0x1255da(0x134)](_0x4759dc){const _0x68eb12=a3_0x1255da;this[_0x68eb12(0x153)]=_0x4759dc,this[_0x68eb12(0x150)]=new Map(),this[_0x68eb12(0x153)][_0x68eb12(0x129)](_0x1fb37c=>{const _0x2e12de=_0x68eb12;this[_0x2e12de(0x150)]['set'](_0x1fb37c['lng']+'-'+_0x1fb37c[_0x2e12de(0x12b)],_0x1fb37c['val']);});}['getBreaks'](){const _0x186e43=a3_0x1255da,_0x5ae6fa=Math['max'](...this[_0x186e43(0x153)]['map'](_0x4cb449=>_0x4cb449[_0x186e43(0x152)])),_0x16d164=Math[_0x186e43(0x11a)](...this[_0x186e43(0x153)]['map'](_0x7e9865=>_0x7e9865[_0x186e43(0x152)])),_0x229071=[];for(let _0x1998eb=_0x16d164-0x1;_0x1998eb<_0x5ae6fa+0x1;_0x1998eb++){_0x229071['push'](_0x1998eb);}return _0x229071;}[a3_0x1255da(0x12c)](){const _0x31f728=a3_0x1255da,_0x4e02fa=this['json']['map'](_0x43d3af=>[_0x43d3af['lng'],_0x43d3af[_0x31f728(0x12b)]]),_0xf6f983=a3_0x447ddd[_0x31f728(0x165)](_0x4e02fa),_0xf9d8ab=this[_0x31f728(0x150)];return _0xf6f983[_0x31f728(0x137)]['forEach'](_0xccf1fe=>{const _0x4e33fc=_0x31f728;_0xccf1fe['properties']={'z':_0xf9d8ab[_0x4e33fc(0x164)](_0xccf1fe[_0x4e33fc(0x14e)]['coordinates'][0x0]+'-'+_0xccf1fe['geometry'][_0x4e33fc(0x14c)][0x1])||0x0};}),_0xf6f983;}[a3_0x1255da(0x144)](_0x479347=[]){const _0x3d81c8=a3_0x1255da;_0x479347[_0x3d81c8(0x119)]===0x0&&(_0x479347=this[_0x3d81c8(0x15a)]());const _0x7148c2=this['getGridPoints']();return a3_0x447ddd[_0x3d81c8(0x15d)](_0x7148c2,_0x479347,{'zProperty':'z'});}[a3_0x1255da(0x130)](_0x4044da=[]){const _0xb6eb29=a3_0x1255da;_0x4044da['length']===0x0&&(_0x4044da=this['getBreaks']());const _0x4b85c5=this[_0xb6eb29(0x12c)]();return a3_0x447ddd[_0xb6eb29(0x11e)](_0x4b85c5,_0x4044da,{'zProperty':'z'});}[a3_0x1255da(0x122)](_0x290a5f,_0x4bfb48,_0x4a7073){const _0x1facf7=a3_0x1255da;let _0x236f93=_0x1facf7(0x15b);for(let _0x4adb69=0x0;_0x4adb69<_0x4bfb48[_0x1facf7(0x119)]-0x1;_0x4adb69++){_0x4adb69<_0x4bfb48[_0x1facf7(0x119)]-0x1&&(_0x4bfb48[_0x4adb69]+'-'+_0x4bfb48[_0x4adb69+0x1]===_0x290a5f&&(typeof _0x4a7073[_0x4adb69]=='string'?_0x236f93=_0x4a7073[_0x4adb69]:_0x236f93=_0x1facf7(0x13c)+_0x4a7073[_0x4adb69][0x0]+','+_0x4a7073[_0x4adb69][0x1]+','+_0x4a7073[_0x4adb69][0x2]+','+(_0x4a7073[_0x4adb69][0x3]||_0x4a7073[_0x4adb69][0x3]===0x0?_0x4a7073[_0x4adb69][0x3]:0x1)+')'));}return _0x236f93;}[a3_0x1255da(0x156)](_0x48f8ac=[]){const _0x2ce628=a3_0x1255da,_0x4d6259=this[_0x2ce628(0x148)](_0x48f8ac);let _0x390de1=[];const {values:_0xf6f4c1,nx:_0x19edbe,ny:_0x3f15af}=_0x4d6259;_0x48f8ac=_0x4d6259[_0x2ce628(0x124)];if(!_0xf6f4c1)return{'type':_0x2ce628(0x141),'features':[]};const _0x13433e=contours()[_0x2ce628(0x123)]([_0x19edbe,_0x3f15af]);for(let _0x134c4c=0x0;_0x134c4c<_0x48f8ac['length'];_0x134c4c++){const _0x270e92=_0x48f8ac[_0x134c4c];if(_0x270e92<this[_0x2ce628(0x160)]||_0x270e92>this['maxVal'])continue;const _0x1fe71f=_0x13433e[_0x2ce628(0x14a)](_0xf6f4c1,_0x270e92);if(!_0x1fe71f||!_0x1fe71f['coordinates'])continue;for(const _0x1c5b7e of _0x1fe71f[_0x2ce628(0x14c)]){let _0xce3e5f=[];if(Array[_0x2ce628(0x114)](_0x1c5b7e)&&_0x1c5b7e[_0x2ce628(0x119)]>0x0&&Array[_0x2ce628(0x114)](_0x1c5b7e[0x0])&&typeof _0x1c5b7e[0x0][0x0]==='number')_0xce3e5f=[_0x1c5b7e];else{if(Array['isArray'](_0x1c5b7e))_0xce3e5f=_0x1c5b7e;else continue;}for(const _0x4b3ff3 of _0xce3e5f){const _0x3ad8a1=_0x4b3ff3[_0x2ce628(0x139)](_0x3387c1=>{const _0x6af77d=_0x2ce628,_0xe8b49b=_0x3387c1[0x0],_0x4d4a6f=_0x3387c1[0x1];if(_0xe8b49b==null||_0x4d4a6f==null||Number['isNaN'](_0xe8b49b)||Number[_0x6af77d(0x115)](_0x4d4a6f))return null;const _0x5d9a53=a3_0x53cded(this[_0x6af77d(0x14b)])['plus'](a3_0x53cded(_0xe8b49b)['times'](this[_0x6af77d(0x13f)]))[_0x6af77d(0x11b)](),_0x10073c=a3_0x53cded(this[_0x6af77d(0x151)])[_0x6af77d(0x157)](a3_0x53cded(_0x4d4a6f)[_0x6af77d(0x11f)](this[_0x6af77d(0x155)]))[_0x6af77d(0x11b)]();return[_0x5d9a53,_0x10073c];})[_0x2ce628(0x14d)](_0x1fde8e=>_0x1fde8e!==null),_0x52fb29=_0x3ad8a1['filter']((_0xc21086,_0x503f6c,_0x48eda8)=>{if(_0x503f6c===0x0)return!![];const _0x2920ef=_0x48eda8[_0x503f6c-0x1];return!(_0xc21086[0x0]===_0x2920ef[0x0]&&_0xc21086[0x1]===_0x2920ef[0x1]);});if(_0x52fb29[_0x2ce628(0x119)]<0x3)continue;const _0x4dcd21=_0x52fb29[0x0],_0x322535=_0x52fb29[_0x52fb29[_0x2ce628(0x119)]-0x1];(_0x4dcd21[0x0]!==_0x322535[0x0]||_0x4dcd21[0x1]!==_0x322535[0x1])&&_0x52fb29[_0x2ce628(0x13e)]([_0x4dcd21[0x0],_0x4dcd21[0x1]]),_0x390de1['push']({'type':_0x2ce628(0x146),'properties':{'z':_0x270e92},'geometry':{'type':_0x2ce628(0x145),'coordinates':[_0x52fb29]}});}}}return _0x390de1=this[_0x2ce628(0x118)](_0x390de1),{'type':_0x2ce628(0x141),'features':_0x390de1};}['getColorFast'](_0x5b6d40,_0x2c9f4d,_0x5afd5a){const _0x3cfc4f=a3_0x1255da;let _0x20537d=_0x3cfc4f(0x15b);const _0x561aa6=_0x2c9f4d[_0x3cfc4f(0x126)](_0x5b6d40);if(typeof _0x5afd5a[_0x561aa6]==_0x3cfc4f(0x154))_0x20537d=_0x5afd5a[_0x561aa6];else _0x561aa6!==-0x1&&(_0x20537d=_0x3cfc4f(0x13c)+_0x5afd5a[_0x561aa6][0x0]+','+_0x5afd5a[_0x561aa6][0x1]+','+_0x5afd5a[_0x561aa6][0x2]+','+(_0x5afd5a[_0x561aa6][0x3]||_0x5afd5a[_0x561aa6][0x3]===0x0?_0x5afd5a[_0x561aa6][0x3]:0x1)+')');return _0x20537d;}[a3_0x1255da(0x140)]=(_0x3c3514,_0x4f41db)=>{const _0x484c89=a3_0x1255da,_0x3bab74=[],_0x2ee38f=Math[_0x484c89(0x125)](0x1,Math[_0x484c89(0x11d)](_0x3c3514[_0x484c89(0x119)]/_0x4f41db));for(let _0x24dda5=0x0;_0x24dda5<_0x4f41db;_0x24dda5++){_0x3bab74[_0x484c89(0x13e)](_0x3c3514[_0x484c89(0x143)](_0x24dda5*_0x2ee38f,(_0x24dda5+0x1)*_0x2ee38f));}return _0x3bab74;};[a3_0x1255da(0x12e)]=async(_0x127cdc,_0x47ec3b,_0x166f39)=>{const _0xb4ec96=a3_0x1255da,_0x4d2c8d=(navigator[_0xb4ec96(0x13d)]>0x8?0x8:navigator[_0xb4ec96(0x13d)])||0x4,_0x1119da=Math[_0xb4ec96(0x11a)](_0x4d2c8d,Math[_0xb4ec96(0x125)](0x1,_0x127cdc[_0xb4ec96(0x137)][_0xb4ec96(0x119)])),_0x2507ad=this[_0xb4ec96(0x140)](_0x127cdc[_0xb4ec96(0x137)],_0x1119da),_0x235fa5=[],_0x57d927=_0x2507ad[_0xb4ec96(0x139)](_0x49e2fb=>{const _0x21732b=_0xb4ec96,_0x5c8ee1=new Worker(_0x166f39,{'type':_0x21732b(0x161)});return _0x235fa5[_0x21732b(0x13e)](_0x5c8ee1),new Promise(_0x26729f=>{const _0x3a4290=_0x21732b;_0x5c8ee1[_0x3a4290(0x13a)]=_0x562e73=>{const _0x2201a9=_0x3a4290;_0x26729f(_0x562e73[_0x2201a9(0x149)]['features']);},_0x5c8ee1[_0x3a4290(0x166)]=_0x592034=>{const _0x22300f=_0x3a4290;console[_0x22300f(0x112)](_0x592034);debugger;},_0x5c8ee1[_0x3a4290(0x120)]({'isoChunk':_0x49e2fb,'gansuFeatures':_0x47ec3b[_0x3a4290(0x137)]});});}),_0xc80cdf=await Promise[_0xb4ec96(0x132)](_0x57d927);_0x235fa5['forEach'](_0x4da5f6=>_0x4da5f6['terminate']());const _0x465cb9=_0xc80cdf[_0xb4ec96(0x127)]();return a3_0x447ddd[_0xb4ec96(0x159)](_0x465cb9);};[a3_0x1255da(0x128)]=async(_0x5c6664=[],_0x79997a)=>{const _0x390a29=a3_0x1255da,_0x1992ce=this[_0x390a29(0x148)](_0x5c6664);let _0x512eb4=[];const {values:_0x803d2a,nx:_0x3a6bc9,ny:_0x21ee23}=_0x1992ce;_0x5c6664=_0x1992ce[_0x390a29(0x124)];if(!_0x803d2a)return{'type':_0x390a29(0x141),'features':[]};const _0x5f3502=[],_0x3c9a44=(navigator[_0x390a29(0x13d)]>0x8?0x8:navigator['hardwareConcurrency'])||0x4,_0x1b8cc1=Math['min'](_0x3c9a44,Math[_0x390a29(0x125)](0x1,_0x5c6664['length'])),_0x297515=this[_0x390a29(0x140)](_0x5c6664,_0x1b8cc1),_0x5f4760=_0x297515[_0x390a29(0x139)](_0x572729=>{const _0x256ca4=_0x390a29,_0x1f9055=new Worker(_0x79997a,{'type':'module'});return _0x5f3502[_0x256ca4(0x13e)](_0x1f9055),new Promise(_0x2c9db8=>{const _0x1ea556=_0x256ca4;_0x1f9055[_0x1ea556(0x13a)]=_0x393903=>{const _0x28d7a3=_0x1ea556;_0x2c9db8(_0x393903[_0x28d7a3(0x149)][_0x28d7a3(0x137)]);},_0x1f9055[_0x1ea556(0x166)]=_0x475e69=>{const _0x30e55c=_0x1ea556;console[_0x30e55c(0x112)](_0x475e69);debugger;},_0x1f9055[_0x1ea556(0x120)]({'breaks':_0x572729,'values':_0x803d2a,'nx':_0x3a6bc9,'ny':_0x21ee23,'minVal':this[_0x1ea556(0x160)],'maxVal':this[_0x1ea556(0x142)],'minLng':this[_0x1ea556(0x14b)],'minLat':this[_0x1ea556(0x151)],'gjLng':this[_0x1ea556(0x13f)],'gjLat':this[_0x1ea556(0x155)]});});}),_0x459421=await Promise[_0x390a29(0x132)](_0x5f4760);return _0x5f3502[_0x390a29(0x129)](_0xa383d2=>_0xa383d2[_0x390a29(0x116)]()),_0x459421[_0x390a29(0x129)](_0x4f3e01=>{const _0x444c60=_0x390a29;_0x512eb4[_0x444c60(0x13e)](..._0x4f3e01);}),_0x512eb4=this[_0x390a29(0x118)](_0x512eb4),{'type':'FeatureCollection','features':_0x512eb4};};['getIsoBandsFastBase']=(_0x50ed5e=[])=>{const _0x299417=a3_0x1255da;if(this[_0x299417(0x153)][_0x299417(0x119)]===0x0)return{'type':'FeatureCollection','features':[]};if(_0x50ed5e[_0x299417(0x119)]===0x0)_0x50ed5e=this[_0x299417(0x15a)]();const _0xa8b2c2=this[_0x299417(0x153)][_0x299417(0x139)](_0x513319=>_0x513319[_0x299417(0x152)]),_0x132a3f=this[_0x299417(0x135)],_0x214253=this['latLineNum'];return{'values':_0xa8b2c2,'breaks':_0x50ed5e,'nx':_0x132a3f,'ny':_0x214253};};['sortFeaturesByArea']=_0x922f8=>{const _0x541730=a3_0x1255da;return _0x922f8[_0x541730(0x139)](_0x5b2ef3=>{const _0x40920e=_0x541730;try{const _0x1441e3=a3_0x447ddd['area'](_0x5b2ef3)||0x0;_0x5b2ef3[_0x40920e(0x138)]={..._0x5b2ef3[_0x40920e(0x138)]||{},'__area':_0x1441e3};}catch{_0x5b2ef3['properties']={..._0x5b2ef3[_0x40920e(0x138)]||{},'__area':0x0};}return _0x5b2ef3;})[_0x541730(0x15f)]((_0x4c8fc7,_0x4cafb5)=>_0x4cafb5[_0x541730(0x138)][_0x541730(0x14f)]-_0x4c8fc7[_0x541730(0x138)][_0x541730(0x14f)])['filter'](_0x7da7b5=>_0x7da7b5[_0x541730(0x138)]&&_0x541730(0x14f)in _0x7da7b5[_0x541730(0x138)]&&_0x7da7b5['properties'][_0x541730(0x14f)]!==0x0)[_0x541730(0x139)](_0x4f3f7e=>{const _0x21bfd9=_0x541730;if(_0x4f3f7e[_0x21bfd9(0x138)]&&_0x21bfd9(0x14f)in _0x4f3f7e['properties']){const {__area:_0x1065d2,..._0x4694ea}=_0x4f3f7e[_0x21bfd9(0x138)];_0x4f3f7e[_0x21bfd9(0x138)]=_0x4694ea;}return _0x4f3f7e;});};}export default _readFileDiamond4;
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "m4-w-fast",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.js"
12
+ },
13
+ "./dist/intersect.worker": "./dist/intersect.worker.js",
14
+ "./dist/intersect.worker.js": "./dist/intersect.worker.js",
15
+ "./dist/isoBands.worker.js": "./dist/isoBands.worker.js",
16
+ "./dist/isoBands.worker": "./dist/isoBands.worker.js"
17
+ },
18
+ "scripts": {
19
+ "build:types": "tsc -p tsconfig.build.json",
20
+ "obfuscate": "javascript-obfuscator dist --output dist",
21
+ "build": "npm run build:types && npm run obfuscate",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "author": "wangrl",
25
+ "license": "ISC",
26
+ "type": "module",
27
+ "bin": {
28
+ "w-m4-fast": "dist/index.js"
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "package.json",
33
+ "README.md"
34
+ ],
35
+ "keywords": [
36
+ "m4",
37
+ "turf"
38
+ ],
39
+ "publishConfig": {
40
+ "registry": "https://registry.npmjs.org/"
41
+ },
42
+ "peerDependencies": {
43
+ "@turf/turf": "^6.5.0",
44
+ "big.js": "^7",
45
+ "d3-contour": "^4"
46
+ },
47
+ "dependencies": {
48
+ "@turf/turf": "^6.5.0",
49
+ "big.js": "^7",
50
+ "d3-contour": "^4"
51
+ },
52
+ "devDependencies": {
53
+ "@tsconfig/node20": "^20.1.2",
54
+ "@types/big.js": "^6.2.2",
55
+ "@types/d3-contour": "^3.0.6",
56
+ "@types/geojson": "latest",
57
+ "esbuild": "^0.25.11",
58
+ "javascript-obfuscator": "^4.1.1",
59
+ "typescript": "latest"
60
+ }
61
+ }