gis-view-webgl2 0.1.0 → 0.1.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.
Files changed (87) hide show
  1. package/README.md +40 -8
  2. package/dist/gis-view.css +1 -1
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +1036 -249
  5. package/dist/index.js +1 -1
  6. package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +194 -0
  7. package/docs/GisView.md +9 -8
  8. package/docs/GisView/345/256/236/347/216/260/345/216/237/347/220/206.md +2 -2
  9. package/docs/ai/06-/344/274/232/350/257/235/347/264/242/345/274/225/344/270/216/345/244/215/346/237/245/346/226/271/346/263/225.md +172 -0
  10. package/docs/api/index.html +545 -59
  11. package/docs/demos/BackendSyncDemo.vue +10 -8
  12. package/docs/demos/BasicDemo.vue +101 -101
  13. package/docs/demos/BatchAddDemo.vue +5 -5
  14. package/docs/demos/ChannelDemo.vue +617 -10
  15. package/docs/demos/ConnectDemo.vue +392 -0
  16. package/docs/demos/CopyMergeDemo.vue +980 -929
  17. package/docs/demos/DecorationDraftDemo.vue +1300 -0
  18. package/docs/demos/DemoShell.vue +569 -240
  19. package/docs/demos/DragDropDemo.vue +11 -11
  20. package/docs/demos/EffectsDemo.vue +6 -6
  21. package/docs/demos/EventDemo.vue +327 -327
  22. package/docs/demos/ExtensionDemo.vue +458 -0
  23. package/docs/demos/GisViewDemo.vue +61 -48
  24. package/docs/demos/GraphicDemo.vue +338 -0
  25. package/docs/demos/LabelDemo.vue +553 -497
  26. package/docs/demos/MinimapDemo.vue +358 -0
  27. package/docs/demos/PerfDemo.vue +29 -0
  28. package/docs/demos/SearchFilterDemo.vue +412 -0
  29. package/docs/demos/StyleDemo.vue +121 -121
  30. package/docs/demos/api-index.js +98 -77
  31. package/docs/demos/demos.js +159 -135
  32. package/docs/demos/shared/demoData.js +107 -107
  33. package/docs/demos/shared/demoStyle.css +249 -249
  34. package/docs/demos/shared/fakeBackend.js +93 -6
  35. package/docs/format/03-/346/213/220/347/202/271/350/243/205/351/245/260/344/270/216/346/240/267/345/274/217.md +28 -8
  36. package/docs/format/04-/351/200/232/351/201/223/344/270/216/346/240/207/347/255/276.md +5 -4
  37. package/docs/format/06-/345/257/274/345/205/245/345/257/274/345/207/272/344/270/216/346/240/207/345/207/206/346/226/207/346/241/243.md +8 -6
  38. package/docs/format/07-/344/272/213/344/273/266/350/275/275/350/215/267/344/270/216/347/244/272/344/276/213/346/225/260/346/215/256.md +6 -6
  39. package/docs/guide/sample-document.html +4 -4
  40. package/docs/index.html +180 -9
  41. package/docs/internals/11-/350/246/206/347/233/226/345/261/202/346/240/207/347/255/276/344/270/216/346/217/220/347/244/272.md +1 -1
  42. package/docs/internals/13-/351/271/260/347/234/274/345/233/276.md +3 -2
  43. package/docs/internals/15-03-/351/200/220/350/275/256/350/256/260/345/275/225-/346/200/247/350/203/275/344/270/216/344/277/256/345/244/215-/344/270/213.md +16 -0
  44. package/docs/internals/16-03-/344/274/230/345/214/226/344/270/216/345/217/226/350/210/215-/344/270/213.md +11 -0
  45. package/docs/internals/17-/350/260/203/350/257/225/344/270/216/346/211/251/345/261/225/345/273/272/350/256/256.md +1 -1
  46. package/docs/manual/02-/345/235/220/346/240/207/344/270/216/346/225/260/346/215/256.md +18 -4
  47. package/docs/manual/03-/351/205/215/347/275/256/351/241/271.md +110 -25
  48. package/docs/manual/04-/344/272/213/344/273/266/344/270/216/345/233/236/350/260/203.md +13 -8
  49. package/docs/manual/06-/346/225/260/346/215/256/344/270/216/345/234/272/346/231/257/346/233/264/346/226/260.md +111 -10
  50. package/docs/manual/07-/346/214/207/351/222/210/344/270/216/350/246/201/347/264/240/347/274/226/350/276/221.md +47 -9
  51. package/docs/manual/08-/351/200/211/344/270/255/344/270/216/346/213/220/347/202/271.md +17 -15
  52. package/docs/manual/09-/351/200/232/351/201/223/344/270/216/345/244/232/345/233/236/347/272/277.md +61 -11
  53. package/docs/manual/10-/351/200/232/351/201/223/347/274/226/350/276/221/344/270/216/346/226/260/345/242/236.md +74 -7
  54. package/docs/manual/11-/346/240/267/345/274/217/344/270/216/350/247/204/345/210/231.md +3 -2
  55. package/docs/manual/12-/346/240/207/347/255/276/344/270/216/350/243/205/351/245/260.md +260 -3
  56. package/docs/manual/13-/345/212/250/346/225/210/344/270/216/345/233/276/345/205/203.md +6 -5
  57. package/docs/manual/14-/350/247/206/345/233/276/344/270/216/347/255/233/351/200/211.md +27 -14
  58. package/docs/manual/15-/345/257/274/345/207/272/344/270/216/351/233/206/346/210/220.md +142 -49
  59. package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md +31 -29
  60. package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +55 -39
  61. package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +189 -64
  62. package/docs/manual/19-/350/257/273/346/225/260/344/270/216/346/213/226/346/213/275/351/242/204/350/247/210.md +4 -4
  63. package/docs/manual/20-/346/200/247/350/203/275/344/270/216/345/244/247/346/225/260/346/215/256.md +42 -2
  64. package/docs/manual/21-/350/257/264/346/230/216/344/270/216/345/270/270/350/247/201/351/227/256/351/242/230.md +22 -6
  65. package/docs/playground/index.html +5 -5
  66. package/docs/steps/README.md +14 -10
  67. package/docs/steps/check-doc-truth.mjs +1 -1
  68. package/docs/steps/selftest-actions.html +10 -10
  69. package/docs/steps/selftest-data.html +96 -14
  70. package/docs/steps/selftest-decoration.html +577 -0
  71. package/docs/steps/selftest-demo.html +6 -5
  72. package/docs/steps/selftest-demos.html +2201 -1612
  73. package/docs/steps/selftest-docs.html +89 -16
  74. package/docs/steps/selftest-effects.html +5 -5
  75. package/docs/steps/selftest-features.html +757 -86
  76. package/docs/steps/selftest-full.html +583 -583
  77. package/docs/steps/selftest-labels.html +1034 -652
  78. package/docs/steps/selftest-perf.html +1899 -1844
  79. package/docs/steps/selftest-scale.html +117 -7
  80. package/docs/steps/selftest-select.html +24 -17
  81. package/docs/steps/step-10-full.js +1 -1
  82. package/docs//346/216/245/345/217/243/345/215/217/350/256/256.md +167 -17
  83. package/docs//346/225/260/346/215/256/346/240/274/345/274/217.md +1 -1
  84. package/package.json +43 -43
  85. package/docs/demos/HistoryDemo.vue +0 -230
  86. package/docs/demos/InterfaceDemo.vue +0 -309
  87. package/docs/demos/SampleDemo.vue +0 -283
@@ -1,25 +1,25 @@
1
- <script setup>
2
- /**
3
- * 样式与规则演示:同一份数据,换几套规则看画面怎么变。
4
- *
5
- * 规则就是「条件 + 样式」的数组(`pointRules` / `lineRules`),改完交给 updateOptions 立刻重排;
6
- * 演示里还对比了两种优先级:规则样式 < 要素自身字段(逐点样式),
1
+ <script setup>
2
+ /**
3
+ * 样式与规则演示:同一份数据,换几套规则看画面怎么变。
4
+ *
5
+ * 规则就是「条件 + 样式」的数组(`pointRules` / `lineRules`),改完交给 updateOptions 立刻重排;
6
+ * 演示里还对比了两种优先级:规则样式 < 要素自身字段(逐点样式),
7
7
  * 以及选中高亮(pointSelectStyle / lineSelectStyle)压在最上面。
8
- */
9
- import { onBeforeUnmount, onMounted, ref } from 'vue'
10
- import { createGisView } from '../../src/index.js'
11
- import { buildDemoData, VOLTAGE_COLORS } from './shared/demoData.js'
12
- import './shared/demoStyle.css'
13
-
14
- const emit = defineEmits(['notice'])
15
- const container = ref(null)
16
- const dataset = buildDemoData({ count: 24 })
17
- let view = null
18
-
19
- const preset = ref('voltage')
20
- const pointSize = ref(7)
21
- const lineWidth = ref(1.6)
22
- const perPointStyle = ref(false)
8
+ */
9
+ import { onBeforeUnmount, onMounted, ref } from 'vue'
10
+ import { createGisView } from '../../src/index.js'
11
+ import { buildDemoData, VOLTAGE_COLORS } from './shared/demoData.js'
12
+ import './shared/demoStyle.css'
13
+
14
+ const emit = defineEmits(['notice'])
15
+ const container = ref(null)
16
+ const dataset = buildDemoData({ count: 24 })
17
+ let view = null
18
+
19
+ const preset = ref('voltage')
20
+ const pointSize = ref(7)
21
+ const lineWidth = ref(1.6)
22
+ const perPointStyle = ref(false)
23
23
  const highlightOn = ref(true)
24
24
  const applyMs = ref('—')
25
25
  const ruleText = ref('—')
@@ -33,44 +33,44 @@ const selectText = ref('未选中:点一下节点或线路看高亮')
33
33
  const selectHighlight = () => (highlightOn.value
34
34
  ? { color: '#ffd166', sizeScale: 1.5, strokeColor: '#12233a', strokeWidth: 2 }
35
35
  : false)
36
-
37
- /** 三套预设:按电压上色 / 按负载上色 / 单色 */
38
- const buildPointRules = () => {
39
- if (preset.value === 'load') {
40
- return [
41
- { name: '重载', when: { max_loading_rate: { gte: 1.1 } }, style: { color: '#ff7a45', strokeColor: '#7a2d10', strokeWidth: 2, size: pointSize.value + 3 } },
42
- { name: '正常', when: { max_loading_rate: { gte: 0.7, lt: 1.1 } }, style: { color: '#ffd166', strokeColor: '#6d5a1e', strokeWidth: 1.6, size: pointSize.value } },
43
- { name: '轻载', when: { max_loading_rate: { lt: 0.7 } }, style: { color: '#4fd1a5', strokeColor: '#1d5c46', strokeWidth: 1.6, size: pointSize.value - 1 } }
44
- ]
45
- }
46
- if (preset.value === 'mono') {
47
- return [{ name: '统一', when: { field: 'id', op: 'exists' }, style: { color: '#ffffff', strokeColor: '#4c8dff', strokeWidth: 1.5, size: pointSize.value } }]
48
- }
49
- return [
50
- { name: '1050 kV', when: { vn_kv: { gte: 1050 } }, style: { color: VOLTAGE_COLORS[1050], strokeColor: '#5c1338', strokeWidth: 2.2, size: pointSize.value + 3, zIndex: 4 } },
51
- { name: '525 kV', when: { vn_kv: { gte: 525, lt: 1050 } }, style: { color: VOLTAGE_COLORS[525], strokeColor: '#2f1b5c', strokeWidth: 2, size: pointSize.value + 1, zIndex: 3 } },
52
- { name: '230 kV', when: { vn_kv: { gte: 230, lt: 525 } }, style: { color: VOLTAGE_COLORS[230], strokeColor: '#123a5c', strokeWidth: 1.6, size: pointSize.value, zIndex: 2 } },
53
- { name: '其它', when: { vn_kv: { lt: 230 } }, style: { color: VOLTAGE_COLORS[15.7], strokeColor: '#12402f', strokeWidth: 1.4, size: pointSize.value - 1, zIndex: 1 } }
54
- ]
55
- }
56
-
57
- const buildLineRules = () => (preset.value === 'load'
58
- ? [{ name: '线路重载', when: { max_loading_rate: { gte: 1 } }, style: { color: '#ff9f68', width: lineWidth.value + 1.4 } }]
59
- : [])
60
-
61
- /** 逐点样式:数据里自己写了 color / size 的节点直接压过规则(每 6 个一个金节点) */
62
- const pointsWithOwnStyle = () => (perPointStyle.value
63
- ? dataset.points.map((point, index) => (index % 6 === 0 ? { ...point, color: '#ffd15c', size: 15, selectStyle: { color: '#ff7a45' } } : point))
64
- : dataset.points)
65
-
66
- const buildOptions = () => ({
67
- points: pointsWithOwnStyle(),
68
- lines: dataset.lines,
69
- channels: dataset.channels,
70
- pointStyle: { size: pointSize.value, color: '#ffffff', strokeColor: '#4c8dff', strokeWidth: 1.5 },
71
- lineStyle: { width: lineWidth.value, color: 'rgba(120, 168, 226, 0.5)' },
72
- pointRules: buildPointRules(),
73
- lineRules: buildLineRules(),
36
+
37
+ /** 三套预设:按电压上色 / 按负载上色 / 单色 */
38
+ const buildPointRules = () => {
39
+ if (preset.value === 'load') {
40
+ return [
41
+ { name: '重载', when: { max_loading_rate: { gte: 1.1 } }, style: { color: '#ff7a45', strokeColor: '#7a2d10', strokeWidth: 2, size: pointSize.value + 3 } },
42
+ { name: '正常', when: { max_loading_rate: { gte: 0.7, lt: 1.1 } }, style: { color: '#ffd166', strokeColor: '#6d5a1e', strokeWidth: 1.6, size: pointSize.value } },
43
+ { name: '轻载', when: { max_loading_rate: { lt: 0.7 } }, style: { color: '#4fd1a5', strokeColor: '#1d5c46', strokeWidth: 1.6, size: pointSize.value - 1 } }
44
+ ]
45
+ }
46
+ if (preset.value === 'mono') {
47
+ return [{ name: '统一', when: { field: 'id', op: 'exists' }, style: { color: '#ffffff', strokeColor: '#4c8dff', strokeWidth: 1.5, size: pointSize.value } }]
48
+ }
49
+ return [
50
+ { name: '1050 kV', when: { vn_kv: { gte: 1050 } }, style: { color: VOLTAGE_COLORS[1050], strokeColor: '#5c1338', strokeWidth: 2.2, size: pointSize.value + 3, zIndex: 4 } },
51
+ { name: '525 kV', when: { vn_kv: { gte: 525, lt: 1050 } }, style: { color: VOLTAGE_COLORS[525], strokeColor: '#2f1b5c', strokeWidth: 2, size: pointSize.value + 1, zIndex: 3 } },
52
+ { name: '230 kV', when: { vn_kv: { gte: 230, lt: 525 } }, style: { color: VOLTAGE_COLORS[230], strokeColor: '#123a5c', strokeWidth: 1.6, size: pointSize.value, zIndex: 2 } },
53
+ { name: '其它', when: { vn_kv: { lt: 230 } }, style: { color: VOLTAGE_COLORS[15.7], strokeColor: '#12402f', strokeWidth: 1.4, size: pointSize.value - 1, zIndex: 1 } }
54
+ ]
55
+ }
56
+
57
+ const buildLineRules = () => (preset.value === 'load'
58
+ ? [{ name: '线路重载', when: { max_loading_rate: { gte: 1 } }, style: { color: '#ff9f68', width: lineWidth.value + 1.4 } }]
59
+ : [])
60
+
61
+ /** 逐点样式:数据里自己写了 color / size 的节点直接压过规则(每 6 个一个金节点) */
62
+ const pointsWithOwnStyle = () => (perPointStyle.value
63
+ ? dataset.points.map((point, index) => (index % 6 === 0 ? { ...point, color: '#ffd15c', size: 15, selectStyle: { color: '#ff7a45' } } : point))
64
+ : dataset.points)
65
+
66
+ const buildOptions = () => ({
67
+ points: pointsWithOwnStyle(),
68
+ lines: dataset.lines,
69
+ channels: dataset.channels,
70
+ pointStyle: { size: pointSize.value, color: '#ffffff', strokeColor: '#4c8dff', strokeWidth: 1.5 },
71
+ lineStyle: { width: lineWidth.value, color: 'rgba(120, 168, 226, 0.5)' },
72
+ pointRules: buildPointRules(),
73
+ lineRules: buildLineRules(),
74
74
  pointSelectStyle: selectHighlight(),
75
75
  lineSelectStyle: selectHighlight(),
76
76
  waypointSelectStyle: selectHighlight(),
@@ -81,10 +81,10 @@ const buildOptions = () => ({
81
81
  label: { content: '{vn_kv} kV', position: 'top', gap: 7, maxCount: 30, style: { color: '#27405f', fontSize: '11px' } },
82
82
  // 标签按优化档显示(限数 + 避让),见 docs/GisView.md 的「标签显示优化开关」
83
83
  labelOptimize: true,
84
- onReady: () => {
85
- emit('notice', `${dataset.points.length} 个节点,规则预设「${preset.value}」`)
86
- syncRules()
87
- },
84
+ onReady: () => {
85
+ emit('notice', `${dataset.points.length} 个节点,规则预设「${preset.value}」`)
86
+ syncRules()
87
+ },
88
88
  /**
89
89
  * 读数接 onSelectChange 而不是 onSelect:前者对「点选、框选、API select()」都会发,
90
90
  * 后者只代表画布上的那一次点击 —— 用接口选中时读数也不会停在「未选中」。
@@ -96,11 +96,11 @@ const buildOptions = () => ({
96
96
  : '未选中:点一下节点或线路看高亮'
97
97
  }
98
98
  })
99
-
100
- const syncRules = () => {
101
- ruleText.value = `节点规则 ${buildPointRules().length} 条 · 线路规则 ${buildLineRules().length} 条`
102
- }
103
-
99
+
100
+ const syncRules = () => {
101
+ ruleText.value = `节点规则 ${buildPointRules().length} 条 · 线路规则 ${buildLineRules().length} 条`
102
+ }
103
+
104
104
  /**
105
105
  * 改规则 / 尺寸 / 高亮:只发样式类配置(不重发 points / lines),
106
106
  * 一次 updateOptions 落到引擎的「重解析 + 槽位覆盖」快路径,顺带报一下这一趟的耗时。
@@ -125,60 +125,60 @@ const applyPerPointStyle = () => {
125
125
  view?.updateOptions({ points: pointsWithOwnStyle() })
126
126
  syncRules()
127
127
  }
128
-
129
- onMounted(() => {
130
- view = createGisView(container.value, buildOptions())
131
- })
132
-
133
- onBeforeUnmount(() => {
134
- view?.destroy()
135
- view = null
136
- })
137
- </script><template>
138
- <section class="dv-demo">
139
- <div class="dv-stage">
140
- <div ref="container" class="dv-canvas"></div>
141
- <div class="dv-toolbar">
142
- <button type="button" class="dv-button" @click="view?.fitView(60)">适应全部</button>
143
- </div>
144
- </div>
145
- <aside class="dv-panel">
146
- <div class="dv-group">
147
- <h3>规则预设</h3>
148
- <div class="dv-row">
149
- <label>预设
150
- <select v-model="preset" @change="applyRules">
151
- <option value="voltage">按电压上色(带分层 zIndex)</option>
152
- <option value="load">按负载率上色</option>
153
- <option value="mono">单色</option>
154
- </select>
155
- </label>
156
- </div>
157
- <div class="dv-row">
158
- <label>节点尺寸 <input v-model.number="pointSize" type="range" min="3" max="16" step="1" @change="applyRules" /></label>
159
- <label>线宽 <input v-model.number="lineWidth" type="range" min="0.6" max="6" step="0.2" @change="applyRules" /></label>
160
- </div>
161
- <div class="dv-row">
128
+
129
+ onMounted(() => {
130
+ view = createGisView(container.value, buildOptions())
131
+ })
132
+
133
+ onBeforeUnmount(() => {
134
+ view?.destroy()
135
+ view = null
136
+ })
137
+ </script><template>
138
+ <section class="dv-demo">
139
+ <div class="dv-stage">
140
+ <div ref="container" class="dv-canvas"></div>
141
+ <div class="dv-toolbar">
142
+ <button type="button" class="dv-button" @click="view?.fitView(60)">适应全部</button>
143
+ </div>
144
+ </div>
145
+ <aside class="dv-panel">
146
+ <div class="dv-group">
147
+ <h3>规则预设</h3>
148
+ <div class="dv-row">
149
+ <label>预设
150
+ <select v-model="preset" @change="applyRules">
151
+ <option value="voltage">按电压上色(带分层 zIndex)</option>
152
+ <option value="load">按负载率上色</option>
153
+ <option value="mono">单色</option>
154
+ </select>
155
+ </label>
156
+ </div>
157
+ <div class="dv-row">
158
+ <label>节点尺寸 <input v-model.number="pointSize" type="range" min="3" max="16" step="1" @change="applyRules" /></label>
159
+ <label>线宽 <input v-model.number="lineWidth" type="range" min="0.6" max="6" step="0.2" @change="applyRules" /></label>
160
+ </div>
161
+ <div class="dv-row">
162
162
  <label><input v-model="perPointStyle" type="checkbox" @change="applyPerPointStyle" /> 逐点样式(数据里自己写 color / size)</label>
163
- </div>
164
- <div class="dv-row">
165
- <label><input v-model="highlightOn" type="checkbox" @change="applyRules" /> 选中高亮</label>
166
- </div>
163
+ </div>
164
+ <div class="dv-row">
165
+ <label><input v-model="highlightOn" type="checkbox" @change="applyRules" /> 选中高亮</label>
166
+ </div>
167
167
  <p class="dv-readout">{{ ruleText }}</p>
168
168
  <p class="dv-readout">最近一次重排:{{ applyMs }}</p>
169
169
  <p class="dv-readout">{{ selectText }}</p>
170
- </div>
171
- <div class="dv-group">
172
- <h3>优先级</h3>
173
- <p class="dv-hint">
174
- 规则命中之后,要素自己写的字段(逐点样式)压过规则;选中的高亮又压在两者之上。
175
- 勾上「逐点样式」看每 6 个一个金节点,点一下它看高亮。
176
- </p>
177
- </div>
178
- <div class="dv-group">
179
- <h3>试一下</h3>
180
- <p class="dv-hint">先把预设切到「按电压上色」再切「按负载率」,同一份数据两种读法;调尺寸 / 线宽只改样式,不动数据与相机。</p>
181
- </div>
182
- </aside>
183
- </section>
184
- </template>
170
+ </div>
171
+ <div class="dv-group">
172
+ <h3>优先级</h3>
173
+ <p class="dv-hint">
174
+ 规则命中之后,要素自己写的字段(逐点样式)压过规则;选中的高亮又压在两者之上。
175
+ 勾上「逐点样式」看每 6 个一个金节点,点一下它看高亮。
176
+ </p>
177
+ </div>
178
+ <div class="dv-group">
179
+ <h3>试一下</h3>
180
+ <p class="dv-hint">先把预设切到「按电压上色」再切「按负载率」,同一份数据两种读法;调尺寸 / 线宽只改样式,不动数据与相机。</p>
181
+ </div>
182
+ </aside>
183
+ </section>
184
+ </template>