@mesh3d/cesium-vectortile-gl 0.4.4 → 0.4.6

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.
Files changed (51) hide show
  1. package/.gitattributes +11 -0
  2. package/.gitconfig +3 -0
  3. package/.husky/pre-commit +1 -0
  4. package/.prettierignore +5 -0
  5. package/.vscode/settings.json +25 -0
  6. package/LICENSE.md +203 -203
  7. package/README.md +202 -167
  8. package/Source/Cesium.d.ts +2692 -2691
  9. package/Source/VectorTileLOD.js +720 -532
  10. package/Source/VectorTileRenderList.js +70 -70
  11. package/Source/VectorTileset.js +473 -447
  12. package/Source/layers/BackgroundRenderLayer.js +91 -89
  13. package/Source/layers/FillRenderLayer.js +18 -18
  14. package/Source/layers/IRenderLayer.js +160 -152
  15. package/Source/layers/LineRenderLayer.js +104 -94
  16. package/Source/layers/SymbolRenderLayer.js +30 -31
  17. package/Source/layers/index.js +23 -16
  18. package/Source/layers/registerRenderLayer.js +24 -24
  19. package/Source/layers/visualizers/FillLayerVisualizer.js +542 -426
  20. package/Source/layers/visualizers/ILayerVisualizer.js +90 -94
  21. package/Source/layers/visualizers/LineLayerVisualizer.js +702 -571
  22. package/Source/layers/visualizers/SymbolLayerVisualizer.js +514 -244
  23. package/Source/sources/GeoJSONSource.js +53 -46
  24. package/Source/sources/ISource.js +39 -39
  25. package/Source/sources/VectorSource.js +94 -52
  26. package/Source/sources/granularitySettings.js +23 -20
  27. package/Source/sources/index.js +6 -11
  28. package/Source/sources/registerSource.js +17 -19
  29. package/Source/style/StyleLayer.js +43 -43
  30. package/Source/style/StyleLayerProperties.js +44 -43
  31. package/Source/style/index.js +2 -2
  32. package/Source/symbol/SymbolPlacements.js +117 -88
  33. package/Source/workers/VectorTileWorker.js +41 -0
  34. package/Source/workers/ellipsoid.js +47 -0
  35. package/Source/workers/processTileTask.js +329 -0
  36. package/Source/workers/styleEvaluator.js +168 -0
  37. package/benchmark.html +148 -0
  38. package/dist/cvt-gl-worker.js +9274 -0
  39. package/dist/cvt-gl-worker.js.map +1 -0
  40. package/dist/cvt-gl.js +2570 -2001
  41. package/dist/cvt-gl.js.map +1 -1
  42. package/dist/cvt-gl.min.js +3 -3
  43. package/dist/cvt-gl.min.js.map +1 -1
  44. package/eslint.config.mjs +58 -0
  45. package/index.js +9 -6
  46. package/mlt.html +26 -25
  47. package/package.json +64 -41
  48. package/prettier.config.mjs +30 -0
  49. package/vite.config.mjs +43 -0
  50. package/vite.worker.config.mjs +31 -0
  51. package/worker.html +26 -0
@@ -1,94 +1,90 @@
1
- import { VectorTileFeature } from "@mapbox/vector-tile";
2
- import { IRenderLayer } from "../IRenderLayer";
3
- import { VectorTileset } from "../../VectorTileset";
4
- import { VectorTileLOD } from "../../VectorTileLOD";
5
-
6
- /**
7
- * 图层渲染器基类,负责瓦片内指定类型图层的合批几何体、批次表、绘图命令(DrawCommand)的构建,以及图层DrawCommand浅拷贝副本(shallow clone)的分配
8
- * @see FillLayerVisualizer
9
- * @see LineLayerVisualizer
10
- * @see SymbolLayerVisualizer
11
- */
12
- export class ILayerVisualizer {
13
- /**
14
- * 构造图层渲染器实例。图层渲染器负责瓦片内指定类型图层的合批几何体、批次表、绘图命令(DrawCommand)的构建,以及图层DrawCommand浅拷贝副本(shallow clone)的分配。
15
- * 注意:构造函数仅供VectorTileLOD调用,请勿在其他模块直接调用
16
- * @param {VectorTileLOD} tile
17
- * @param {IRenderLayer[]} [layers]
18
- * @inner
19
- * @see FillLayerVisualizer
20
- * @see LineLayerVisualizer
21
- * @see SymbolLayerVisualizer
22
- */
23
- constructor(tile, layers = []) {
24
- /**
25
- * @type {VectorTileLOD}
26
- */
27
- this.tile = tile
28
- /**
29
- * @type {IRenderLayer[]}
30
- */
31
- this.layers = layers
32
- /**
33
- * 图层渲染器状态
34
- * @type {'none'|'done'|'error'}
35
- */
36
- this.state = 'none'
37
- this.commandList = []
38
- }
39
-
40
- /**
41
- * 添加图层:将图层及其过滤后的要素添加到图层渲染器,子类实现该方法,完成图层存储、要素转换等合批构建需要的准备工作
42
- * @param {VectorTileFeature[]} features
43
- * @param {IRenderLayer} renderLayer
44
- * @param {Cesium.frameState} frameState
45
- * @param {VectorTileset} tileset
46
- */
47
- addLayer(features, renderLayer, frameState, tileset) {
48
-
49
- }
50
-
51
- /**
52
- * 设置渲染器及图层的状态
53
- * @param {'none'|'done'|'error'} state
54
- */
55
- setState(state) {
56
- for (const layer of this.layers) {
57
- layer.state = state
58
- }
59
- this.state = state
60
- }
61
-
62
- /**
63
- * 更新渲染器:子类实现该方法,完成合批几何体、批次表、绘图命令(DrawCommand)的构建,以及图层DrawCommand浅拷贝副本(shallow clone)的分配等工作
64
- * @param {*} frameState
65
- * @param {*} tileset
66
- */
67
- update(frameState, tileset) {
68
-
69
- }
70
-
71
- render(frameState) {
72
- const commandList = this.commandList
73
- if (commandList && commandList.length) {
74
- for (const command of commandList) {
75
- frameState.commandList.push(command)
76
- }
77
- }
78
- }
79
-
80
- /**
81
- * 销毁图层渲染器对象,释放资源
82
- */
83
- destroy() {
84
- this.tile = null
85
- this.layers.length = 0
86
- this.isDestroyed = function returnTrue() {
87
- return true
88
- }
89
- }
90
-
91
- isDestroyed() {
92
- return false
93
- }
94
- }
1
+ import { VectorTileFeature } from '@mapbox/vector-tile'
2
+ import { IRenderLayer } from '../IRenderLayer'
3
+ import { VectorTileset } from '../../VectorTileset'
4
+ import { VectorTileLOD } from '../../VectorTileLOD'
5
+
6
+ /**
7
+ * 图层渲染器基类,负责瓦片内指定类型图层的合批几何体、批次表、绘图命令(DrawCommand)的构建,以及图层DrawCommand浅拷贝副本(shallow clone)的分配
8
+ * @see FillLayerVisualizer
9
+ * @see LineLayerVisualizer
10
+ * @see SymbolLayerVisualizer
11
+ */
12
+ export class ILayerVisualizer {
13
+ /**
14
+ * 构造图层渲染器实例。图层渲染器负责瓦片内指定类型图层的合批几何体、批次表、绘图命令(DrawCommand)的构建,以及图层DrawCommand浅拷贝副本(shallow clone)的分配。
15
+ * 注意:构造函数仅供VectorTileLOD调用,请勿在其他模块直接调用
16
+ * @param {VectorTileLOD} tile
17
+ * @param {IRenderLayer[]} [layers]
18
+ * @inner
19
+ * @see FillLayerVisualizer
20
+ * @see LineLayerVisualizer
21
+ * @see SymbolLayerVisualizer
22
+ */
23
+ constructor(tile, layers = []) {
24
+ /**
25
+ * @type {VectorTileLOD}
26
+ */
27
+ this.tile = tile
28
+ /**
29
+ * @type {IRenderLayer[]}
30
+ */
31
+ this.layers = layers
32
+ /**
33
+ * 图层渲染器状态
34
+ * @type {'none'|'done'|'error'}
35
+ */
36
+ this.state = 'none'
37
+ this.commandList = []
38
+ }
39
+
40
+ /**
41
+ * 添加图层:将图层及其过滤后的要素添加到图层渲染器,子类实现该方法,完成图层存储、要素转换等合批构建需要的准备工作
42
+ * @param {VectorTileFeature[]} features
43
+ * @param {IRenderLayer} renderLayer
44
+ * @param {Cesium.frameState} frameState
45
+ * @param {VectorTileset} tileset
46
+ */
47
+ addLayer(features, renderLayer, frameState, tileset) {}
48
+
49
+ /**
50
+ * 设置渲染器及图层的状态
51
+ * @param {'none'|'done'|'error'} state
52
+ */
53
+ setState(state) {
54
+ for (const layer of this.layers) {
55
+ layer.state = state
56
+ }
57
+ this.state = state
58
+ }
59
+
60
+ /**
61
+ * 更新渲染器:子类实现该方法,完成合批几何体、批次表、绘图命令(DrawCommand)的构建,以及图层DrawCommand浅拷贝副本(shallow clone)的分配等工作
62
+ * @param {*} frameState
63
+ * @param {*} tileset
64
+ */
65
+ update(frameState, tileset) {}
66
+
67
+ render(frameState) {
68
+ const commandList = this.commandList
69
+ if (commandList && commandList.length) {
70
+ for (const command of commandList) {
71
+ frameState.commandList.push(command)
72
+ }
73
+ }
74
+ }
75
+
76
+ /**
77
+ * 销毁图层渲染器对象,释放资源
78
+ */
79
+ destroy() {
80
+ this.tile = null
81
+ this.layers.length = 0
82
+ this.isDestroyed = function returnTrue() {
83
+ return true
84
+ }
85
+ }
86
+
87
+ isDestroyed() {
88
+ return false
89
+ }
90
+ }