m4-w-fast 1.0.0 → 1.0.2
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 +27 -2
- package/dist/index.js +9 -1
- package/dist/intersect.worker.js +9 -1
- package/dist/isoBands.worker.js +1 -1
- package/dist/readFile.d.ts +15 -6
- package/dist/readFile.js +1 -1
- package/package.json +15 -13
package/README.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# m4文件绘图程序
|
|
2
2
|
|
|
3
|
+
### 更新说明
|
|
4
|
+
- v1.0.1: 修复了安装在vite环境打包时woker不正常工作的问题
|
|
5
|
+
- v1.0.2: 新增了一个可以单独获取某一个break的等值面方法 `getIsoBandsByLayerBreak(breaks: number[], break: number)`
|
|
6
|
+
- **注意: 这个方法只用于取单等值面, 如果你需要获取所有等值面, 还是用 `getIsoBandsFast` 或者 `getIsoBandsFastByWorker` 方法**
|
|
7
|
+
|
|
3
8
|
### 使用
|
|
4
9
|
|
|
5
10
|
1. 安装这个库
|
|
@@ -52,8 +57,8 @@ import * as L from 'leaflet'
|
|
|
52
57
|
import 'leaflet/dist/leaflet.css'
|
|
53
58
|
import ReadFileM4Fast from 'm4-w-fast'
|
|
54
59
|
import { getIsoWorkerUrl, getIntersectWorkerUrl } from 'm4-w-fast/worker-urls'
|
|
55
|
-
import isoWorkerUrl from 'm4-w-fast/
|
|
56
|
-
import intersectWorkerUrl from 'm4-w-fast/
|
|
60
|
+
import isoWorkerUrl from 'm4-w-fast/isoBands.worker.js?url'
|
|
61
|
+
import intersectWorkerUrl from 'm4-w-fast/intersect.worker.js?url'
|
|
57
62
|
|
|
58
63
|
import geojson from './620000.json'
|
|
59
64
|
import type { FeatureCollection } from 'geojson'
|
|
@@ -93,5 +98,25 @@ const init = async() => {
|
|
|
93
98
|
}
|
|
94
99
|
```
|
|
95
100
|
|
|
101
|
+
3. 获取某一个break的等值面示例
|
|
102
|
+
```typescript
|
|
103
|
+
clearMap()
|
|
104
|
+
const oneIsoBand = read.getIsoBandsByLayerBreak(lLevel.value, level)
|
|
105
|
+
const geo = L.geoJson(oneIsoBand, {
|
|
106
|
+
style(feature) {
|
|
107
|
+
if (!feature) return {}
|
|
108
|
+
const z = feature.properties.z
|
|
109
|
+
const rgba = read!.getColorFast(z, lLevel.value, lColor.value)
|
|
110
|
+
return {
|
|
111
|
+
opacity: 1,
|
|
112
|
+
stroke: false,
|
|
113
|
+
fillColor: rgba,
|
|
114
|
+
fillOpacity: 1
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}).addTo(map!)
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
|
|
96
121
|
#### @author: wangrl
|
|
97
122
|
#### 维护随缘
|