@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.
- package/.gitattributes +11 -0
- package/.gitconfig +3 -0
- package/.husky/pre-commit +1 -0
- package/.prettierignore +5 -0
- package/.vscode/settings.json +25 -0
- package/LICENSE.md +203 -203
- package/README.md +202 -167
- package/Source/Cesium.d.ts +2692 -2691
- package/Source/VectorTileLOD.js +720 -532
- package/Source/VectorTileRenderList.js +70 -70
- package/Source/VectorTileset.js +473 -447
- package/Source/layers/BackgroundRenderLayer.js +91 -89
- package/Source/layers/FillRenderLayer.js +18 -18
- package/Source/layers/IRenderLayer.js +160 -152
- package/Source/layers/LineRenderLayer.js +104 -94
- package/Source/layers/SymbolRenderLayer.js +30 -31
- package/Source/layers/index.js +23 -16
- package/Source/layers/registerRenderLayer.js +24 -24
- package/Source/layers/visualizers/FillLayerVisualizer.js +542 -426
- package/Source/layers/visualizers/ILayerVisualizer.js +90 -94
- package/Source/layers/visualizers/LineLayerVisualizer.js +702 -571
- package/Source/layers/visualizers/SymbolLayerVisualizer.js +514 -244
- package/Source/sources/GeoJSONSource.js +53 -46
- package/Source/sources/ISource.js +39 -39
- package/Source/sources/VectorSource.js +94 -52
- package/Source/sources/granularitySettings.js +23 -20
- package/Source/sources/index.js +6 -11
- package/Source/sources/registerSource.js +17 -19
- package/Source/style/StyleLayer.js +43 -43
- package/Source/style/StyleLayerProperties.js +44 -43
- package/Source/style/index.js +2 -2
- package/Source/symbol/SymbolPlacements.js +117 -88
- package/Source/workers/VectorTileWorker.js +41 -0
- package/Source/workers/ellipsoid.js +47 -0
- package/Source/workers/processTileTask.js +329 -0
- package/Source/workers/styleEvaluator.js +168 -0
- package/benchmark.html +148 -0
- package/dist/cvt-gl-worker.js +9274 -0
- package/dist/cvt-gl-worker.js.map +1 -0
- package/dist/cvt-gl.js +2570 -2001
- package/dist/cvt-gl.js.map +1 -1
- package/dist/cvt-gl.min.js +3 -3
- package/dist/cvt-gl.min.js.map +1 -1
- package/eslint.config.mjs +58 -0
- package/index.js +9 -6
- package/mlt.html +26 -25
- package/package.json +64 -41
- package/prettier.config.mjs +30 -0
- package/vite.config.mjs +43 -0
- package/vite.worker.config.mjs +31 -0
- package/worker.html +26 -0
|
@@ -1,94 +1,90 @@
|
|
|
1
|
-
import { VectorTileFeature } from
|
|
2
|
-
import { IRenderLayer } from
|
|
3
|
-
import { VectorTileset } from
|
|
4
|
-
import { VectorTileLOD } from
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 图层渲染器基类,负责瓦片内指定类型图层的合批几何体、批次表、绘图命令(DrawCommand)的构建,以及图层DrawCommand浅拷贝副本(shallow clone)的分配
|
|
8
|
-
* @see FillLayerVisualizer
|
|
9
|
-
* @see LineLayerVisualizer
|
|
10
|
-
* @see SymbolLayerVisualizer
|
|
11
|
-
*/
|
|
12
|
-
export class ILayerVisualizer {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
+
}
|