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.
- package/README.md +40 -8
- package/dist/gis-view.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1036 -249
- package/dist/index.js +1 -1
- package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +194 -0
- package/docs/GisView.md +9 -8
- package/docs/GisView/345/256/236/347/216/260/345/216/237/347/220/206.md +2 -2
- 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
- package/docs/api/index.html +545 -59
- package/docs/demos/BackendSyncDemo.vue +10 -8
- package/docs/demos/BasicDemo.vue +101 -101
- package/docs/demos/BatchAddDemo.vue +5 -5
- package/docs/demos/ChannelDemo.vue +617 -10
- package/docs/demos/ConnectDemo.vue +392 -0
- package/docs/demos/CopyMergeDemo.vue +980 -929
- package/docs/demos/DecorationDraftDemo.vue +1300 -0
- package/docs/demos/DemoShell.vue +569 -240
- package/docs/demos/DragDropDemo.vue +11 -11
- package/docs/demos/EffectsDemo.vue +6 -6
- package/docs/demos/EventDemo.vue +327 -327
- package/docs/demos/ExtensionDemo.vue +458 -0
- package/docs/demos/GisViewDemo.vue +61 -48
- package/docs/demos/GraphicDemo.vue +338 -0
- package/docs/demos/LabelDemo.vue +553 -497
- package/docs/demos/MinimapDemo.vue +358 -0
- package/docs/demos/PerfDemo.vue +29 -0
- package/docs/demos/SearchFilterDemo.vue +412 -0
- package/docs/demos/StyleDemo.vue +121 -121
- package/docs/demos/api-index.js +98 -77
- package/docs/demos/demos.js +159 -135
- package/docs/demos/shared/demoData.js +107 -107
- package/docs/demos/shared/demoStyle.css +249 -249
- package/docs/demos/shared/fakeBackend.js +93 -6
- 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
- package/docs/format/04-/351/200/232/351/201/223/344/270/216/346/240/207/347/255/276.md +5 -4
- 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
- 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
- package/docs/guide/sample-document.html +4 -4
- package/docs/index.html +180 -9
- 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
- package/docs/internals/13-/351/271/260/347/234/274/345/233/276.md +3 -2
- 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
- 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
- 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
- package/docs/manual/02-/345/235/220/346/240/207/344/270/216/346/225/260/346/215/256.md +18 -4
- package/docs/manual/03-/351/205/215/347/275/256/351/241/271.md +110 -25
- package/docs/manual/04-/344/272/213/344/273/266/344/270/216/345/233/236/350/260/203.md +13 -8
- 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
- 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
- package/docs/manual/08-/351/200/211/344/270/255/344/270/216/346/213/220/347/202/271.md +17 -15
- 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
- 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
- package/docs/manual/11-/346/240/267/345/274/217/344/270/216/350/247/204/345/210/231.md +3 -2
- package/docs/manual/12-/346/240/207/347/255/276/344/270/216/350/243/205/351/245/260.md +260 -3
- package/docs/manual/13-/345/212/250/346/225/210/344/270/216/345/233/276/345/205/203.md +6 -5
- package/docs/manual/14-/350/247/206/345/233/276/344/270/216/347/255/233/351/200/211.md +27 -14
- package/docs/manual/15-/345/257/274/345/207/272/344/270/216/351/233/206/346/210/220.md +142 -49
- 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
- package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +55 -39
- package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +189 -64
- 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
- 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
- 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
- package/docs/playground/index.html +5 -5
- package/docs/steps/README.md +14 -10
- package/docs/steps/check-doc-truth.mjs +1 -1
- package/docs/steps/selftest-actions.html +10 -10
- package/docs/steps/selftest-data.html +96 -14
- package/docs/steps/selftest-decoration.html +577 -0
- package/docs/steps/selftest-demo.html +6 -5
- package/docs/steps/selftest-demos.html +2201 -1612
- package/docs/steps/selftest-docs.html +89 -16
- package/docs/steps/selftest-effects.html +5 -5
- package/docs/steps/selftest-features.html +757 -86
- package/docs/steps/selftest-full.html +583 -583
- package/docs/steps/selftest-labels.html +1034 -652
- package/docs/steps/selftest-perf.html +1899 -1844
- package/docs/steps/selftest-scale.html +117 -7
- package/docs/steps/selftest-select.html +24 -17
- package/docs/steps/step-10-full.js +1 -1
- package/docs//346/216/245/345/217/243/345/215/217/350/256/256.md +167 -17
- package/docs//346/225/260/346/215/256/346/240/274/345/274/217.md +1 -1
- package/package.json +43 -43
- package/docs/demos/HistoryDemo.vue +0 -230
- package/docs/demos/InterfaceDemo.vue +0 -309
- package/docs/demos/SampleDemo.vue +0 -283
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<section class="dv-demo">
|
|
3
|
-
<div class="dv-stage">
|
|
4
|
-
<div ref="container" class="dv-canvas"></div>
|
|
5
|
-
<div class="dv-toolbar">
|
|
6
|
-
<button type="button" @click="fit">适应全部</button>
|
|
7
|
-
<button type="button" @click="mount(currentId)">重新读文件</button>
|
|
8
|
-
</div>
|
|
9
|
-
</div>
|
|
10
|
-
<aside class="dv-panel">
|
|
11
|
-
<div class="dv-group">
|
|
12
|
-
<h3>样本文件</h3>
|
|
13
|
-
<div class="dv-chips">
|
|
14
|
-
<button
|
|
15
|
-
v-for="item in SAMPLES"
|
|
16
|
-
:key="item.id"
|
|
17
|
-
type="button"
|
|
18
|
-
class="dv-chip"
|
|
19
|
-
:class="{ 'dv-chip--active': item.id === currentId }"
|
|
20
|
-
@click="mount(item.id)"
|
|
21
|
-
>{{ item.title }}</button>
|
|
22
|
-
</div>
|
|
23
|
-
<p class="dv-hint">{{ current.blurb }}</p>
|
|
24
|
-
<p class="dv-readout">仓库根目录 {{ current.file }}(与 new.json / test.json 同级)</p>
|
|
25
|
-
</div>
|
|
26
|
-
<div class="dv-group">
|
|
27
|
-
<h3>文件里有什么</h3>
|
|
28
|
-
<p class="dv-readout">节点 {{ readouts.points }} · 线路 {{ readouts.lines }} · 通道 {{ readouts.channels }}<br>拐点 {{ readouts.waypoints }} · 标记 {{ readouts.decorations }} · 标签状态 {{ readouts.labelStates }} · 画布上的标签 {{ readouts.domLabels }}</p>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="dv-group">
|
|
31
|
-
<h3>导出 / 回灌</h3>
|
|
32
|
-
<div class="dv-row">
|
|
33
|
-
<button type="button" class="dv-button" @click="compareExport">与文件对一遍</button>
|
|
34
|
-
<button type="button" class="dv-button dv-button--primary" @click="rebuildFromExport">按导出重建</button>
|
|
35
|
-
</div>
|
|
36
|
-
<p class="dv-readout">{{ readouts.exportText }}</p>
|
|
37
|
-
<p class="dv-hint">数据支持的格式与导出口径是同一套写法:普通样本按 exportData({ format: 'input' }) 逐字节对,标准文档那一份按 exportData({ format: 'full' }) 对,而且「导出 → 回灌 → 再导出」两份必须一模一样。</p>
|
|
38
|
-
</div>
|
|
39
|
-
<div class="dv-group">
|
|
40
|
-
<h3>试一下</h3>
|
|
41
|
-
<p class="dv-hint">拖节点、拖拐点(Ctrl + 点击线路插一个)、拖标签、滚轮缩放,再看「与文件对一遍」——编辑结果(拐点 / 偏移 / 标签状态)会立刻出现在导出的那一份里。</p>
|
|
42
|
-
</div>
|
|
43
|
-
</aside>
|
|
44
|
-
</section>
|
|
45
|
-
</template>
|
|
46
|
-
|
|
47
|
-
<script setup>
|
|
48
|
-
/**
|
|
49
|
-
* 完整样本:仓库根目录的四份 sample-*.json 原样喂给 createGisView,看的是「一份数据里能装多少东西」——
|
|
50
|
-
* 标签(内容 / 八向位置 / 像素偏移 / 内联样式 / className / html)、拐点(lines[].path 与通道骨架)、
|
|
51
|
-
* 标记(decorations 的四种定位与四种符号)、分组(channels[].groups)、偏移与逐要素颜色样式,
|
|
52
|
-
* 外加一列 labelStates(拖过 / 改过 / 运行时加的标签)。
|
|
53
|
-
*
|
|
54
|
-
* 面板上的「与文件对一遍」把 exportData({ format: 'input' }) 的结果与文件逐字节比一次:
|
|
55
|
-
* 数据支持的格式与导出的格式是同一套,所以「存档 → 重建」两步就能完整回显;
|
|
56
|
-
* 编辑过之后这里会报出差异,差异本身正是要被存档的那部分(拐点、偏移、标签状态都在导出里)。
|
|
57
|
-
*/
|
|
58
|
-
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
|
|
59
|
-
import { createGisView } from '../../src/index.js'
|
|
60
|
-
import './shared/demoStyle.css'
|
|
61
|
-
|
|
62
|
-
/** 四份样本:前三份各看一类字段,sample-full.json 把多拐点 / 多标签 / 多分组摆在同一份里 */
|
|
63
|
-
const SAMPLES = [
|
|
64
|
-
{
|
|
65
|
-
id: 'labels',
|
|
66
|
-
title: '标签与样式',
|
|
67
|
-
file: 'sample-labels.json',
|
|
68
|
-
url: () => import('../../sample-labels.json?url'),
|
|
69
|
-
blurb: '10 个节点 / 14 条线路:八向标签、沿线标签(比例 / 百分比 / 距离三种位置)、旧式单条写法、field 取字段、html、className、逐点符号与描边;labelStates 里是拖过与改过的那几条。'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
id: 'waypoints',
|
|
73
|
-
title: '拐点与标记',
|
|
74
|
-
file: 'sample-waypoints.json',
|
|
75
|
-
url: () => import('../../sample-waypoints.json?url'),
|
|
76
|
-
blurb: '9 条折线(1 ~ 3 个拐点)+ 1 条通道骨架:装饰覆盖比例 / 百分比 / 距离 / 世界坐标四种定位与圆 / 方 / SVG / 图片四种符号,parallel、阴影、透明度都摆了一份。'
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
id: 'channels',
|
|
80
|
-
title: '通道与分组',
|
|
81
|
-
file: 'sample-channels.json',
|
|
82
|
-
url: () => import('../../sample-channels.json?url'),
|
|
83
|
-
blurb: '3 条通道:4 回线拆成两组(groups 各带自己的拐点)、按两端节点取宽的 2 回线、单回线各一条;逐回颜色与线宽写在回线上,通道声明与导出对得上。'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
id: 'full',
|
|
87
|
-
title: '全字段齐全',
|
|
88
|
-
file: 'sample-full.json',
|
|
89
|
-
url: () => import('../../sample-full.json?url'),
|
|
90
|
-
blurb: '10 点 / 22 线 / 3 通道一份摆齐:5 条线路带 3 ~ 4 个拐点、同一节点 4 条标签 / 同一线路 3 条标签、6 回通道拆 3 组(每组 2 个骨架拐点)、23 个标记、6 条标签状态。'
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
id: 'document',
|
|
94
|
-
title: '标准文档(整份)',
|
|
95
|
-
file: 'sample-document.json',
|
|
96
|
-
url: () => import('../../sample-document.json?url'),
|
|
97
|
-
blurb: '全字段那一份的标准文档写法:顶层 format / version / points / lines / channels / labelStates / view / filter 八列齐全,标着 format: \'gis-view\',整份原样喂给 createGisView 就能回显 —— 相机、筛选、标签状态与拐点一个都不少(node scripts/build-sample-document.mjs 生成)。'
|
|
98
|
-
}
|
|
99
|
-
]
|
|
100
|
-
|
|
101
|
-
const emit = defineEmits(['notice'])
|
|
102
|
-
const container = ref(null)
|
|
103
|
-
const currentId = ref('labels')
|
|
104
|
-
const readouts = ref({
|
|
105
|
-
points: 0,
|
|
106
|
-
lines: 0,
|
|
107
|
-
channels: 0,
|
|
108
|
-
waypoints: 0,
|
|
109
|
-
decorations: 0,
|
|
110
|
-
labelStates: 0,
|
|
111
|
-
domLabels: 0,
|
|
112
|
-
exportText: '还没有对过账'
|
|
113
|
-
})
|
|
114
|
-
const current = computed(() => SAMPLES.find(item => item.id === currentId.value) ?? SAMPLES[0])
|
|
115
|
-
let view = null
|
|
116
|
-
let loaded = null
|
|
117
|
-
let domTimer = 0
|
|
118
|
-
|
|
119
|
-
/** 读文件:样本与 new.json / test.json 一样是静态文件,走 URL 导入(打包之后拿到的也是正确地址) */
|
|
120
|
-
const readSample = async (spec) => {
|
|
121
|
-
const module = await spec.url()
|
|
122
|
-
const response = await fetch(module.default)
|
|
123
|
-
if (!response.ok) {
|
|
124
|
-
throw new Error(`${spec.file} 读取失败:HTTP ${response.status}`)
|
|
125
|
-
}
|
|
126
|
-
return response.json()
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* 建视图:样本的四个字段原样进 options —— points / lines / channels / labelStates 与
|
|
131
|
-
* createGisView 的入参是同一套写法,不需要任何映射,这正是「数据格式与导出口径一致」要的效果。
|
|
132
|
-
*/
|
|
133
|
-
const buildOptions = (data) => ({
|
|
134
|
-
// 标准文档那一份(format: 'gis-view')整份进 options:points / lines / channels / labelStates
|
|
135
|
-
// 与 view.camera 一次到位,不需要在 demo 里拆字段 —— 这正是「接收的格式与导出的格式同一份」要的效果
|
|
136
|
-
...(data.format === 'gis-view' ? data : {}),
|
|
137
|
-
points: data.points,
|
|
138
|
-
lines: data.lines,
|
|
139
|
-
channels: data.channels,
|
|
140
|
-
labelStates: data.labelStates,
|
|
141
|
-
// 拐点默认只在选中时露出:这份演示就是来看拐点的,全打开
|
|
142
|
-
waypointEditable: true,
|
|
143
|
-
waypointVisibility: 'always',
|
|
144
|
-
// 功能开关缺省全关:这一页要能平移缩放、悬停选中、编辑拐点,逐项打开(查看类 + 拐点)
|
|
145
|
-
features: { pan: true, zoom: true, hover: true, select: true, contextMenu: true, keyboard: true, waypoint: true },
|
|
146
|
-
// 标准文档自带相机(view.camera):让它落地;普通样本没有相机,照旧适应数据范围
|
|
147
|
-
fitOnInit: data.format !== 'gis-view',
|
|
148
|
-
fitPadding: 70,
|
|
149
|
-
showGrid: false,
|
|
150
|
-
onWarning: (message) => {
|
|
151
|
-
readouts.value = { ...readouts.value, exportText: `warning:${message}` }
|
|
152
|
-
}
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
const countDecorations = () => (view?.getData().lines ?? []).reduce((total, line) => total + (Array.isArray(line.decorations) ? line.decorations.length : 0), 0)
|
|
156
|
-
|
|
157
|
-
/** 读数:数据里的条数 + 画布上真画出来的标签数量 */
|
|
158
|
-
const refresh = () => {
|
|
159
|
-
if (!view) {
|
|
160
|
-
return
|
|
161
|
-
}
|
|
162
|
-
readouts.value = {
|
|
163
|
-
...readouts.value,
|
|
164
|
-
points: view.getData().points.length,
|
|
165
|
-
lines: view.getData().lines.length,
|
|
166
|
-
channels: view.getOptions().channels.length,
|
|
167
|
-
waypoints: view.getWaypoints().length,
|
|
168
|
-
decorations: countDecorations(),
|
|
169
|
-
labelStates: view.getLabelStates().length
|
|
170
|
-
}
|
|
171
|
-
// 标签由覆盖层画:建视图那一帧之后才有 DOM,等一下再数
|
|
172
|
-
clearTimeout(domTimer)
|
|
173
|
-
domTimer = setTimeout(() => {
|
|
174
|
-
readouts.value = { ...readouts.value, domLabels: container.value?.querySelectorAll('.gis-view__label').length ?? 0 }
|
|
175
|
-
}, 260)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/** 换样本 / 重新读文件:读回 JSON 之后整份重建(样本之间字段差得远,重建比增量更新更直观) */
|
|
179
|
-
const mount = async (id) => {
|
|
180
|
-
currentId.value = id
|
|
181
|
-
const spec = SAMPLES.find(item => item.id === id) ?? SAMPLES[0]
|
|
182
|
-
let data = null
|
|
183
|
-
try {
|
|
184
|
-
data = await readSample(spec)
|
|
185
|
-
}
|
|
186
|
-
catch (error) {
|
|
187
|
-
readouts.value = { ...readouts.value, exportText: String(error?.message ?? error) }
|
|
188
|
-
return
|
|
189
|
-
}
|
|
190
|
-
loaded = data
|
|
191
|
-
view?.destroy()
|
|
192
|
-
view = createGisView(container.value, buildOptions(data))
|
|
193
|
-
refresh()
|
|
194
|
-
readouts.value = { ...readouts.value, exportText: `已按 ${spec.file} 建视图,点「与文件对一遍」看导出口径` }
|
|
195
|
-
emit('notice', `${spec.title}:${data.points.length} 点 / ${data.lines.length} 线 / ${data.channels.length} 通道`)
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/** 与文件对账:没动过数据时应该逐字节一致;拖过拐点 / 标签之后再点,报出来的差异就是要存档的编辑结果 */
|
|
199
|
-
const compareExport = () => {
|
|
200
|
-
if (!view || !loaded) {
|
|
201
|
-
return
|
|
202
|
-
}
|
|
203
|
-
// 标准文档那一份:整份(含相机 / 筛选 / 标签状态)对一次,再把导出的那一份灌回一个新实例、再导出一次
|
|
204
|
-
// ——「导出 → 回灌 → 再导出」逐字节相同,才算「接收的格式与导出的格式是同一份」
|
|
205
|
-
if (loaded.format === 'gis-view') {
|
|
206
|
-
const exported = view.exportData({ format: 'full' })
|
|
207
|
-
// 探针画布要挂进文档并给尺寸:相机落位与视口大小有关(0 宽的容器里 initialView 会等布局)
|
|
208
|
-
const probeHost = document.createElement('div')
|
|
209
|
-
probeHost.style.cssText = 'position:fixed;left:-9999px;top:0;width:520px;height:320px'
|
|
210
|
-
document.body.appendChild(probeHost)
|
|
211
|
-
const probe = createGisView(probeHost, exported)
|
|
212
|
-
const again = probe.exportData({ format: 'full' })
|
|
213
|
-
probe.destroy()
|
|
214
|
-
probeHost.remove()
|
|
215
|
-
const samePoints = JSON.stringify(exported.points) === JSON.stringify(loaded.points)
|
|
216
|
-
const sameLines = JSON.stringify(exported.lines) === JSON.stringify(loaded.lines)
|
|
217
|
-
const sameChannels = JSON.stringify(exported.channels) === JSON.stringify(loaded.channels)
|
|
218
|
-
const stable = JSON.stringify(again) === JSON.stringify(exported)
|
|
219
|
-
const sameStates = exported.labelStates.length === loaded.labelStates.length
|
|
220
|
-
readouts.value = {
|
|
221
|
-
...readouts.value,
|
|
222
|
-
exportText: `${samePoints && sameLines && sameChannels && sameStates ? '与文件一致' : '与文件有出入(拖过之后就会这样)'}:${exported.points.length} 点 / ${exported.lines.length} 线 / ${exported.channels.length} 通道 / ${exported.labelStates.length} 条标签状态;导出 → 回灌 → 再导出${stable ? '逐字节相同' : '对不上'}`
|
|
223
|
-
}
|
|
224
|
-
return
|
|
225
|
-
}
|
|
226
|
-
const exported = view.exportData({ format: 'input' })
|
|
227
|
-
const same = (list, source) => JSON.stringify(list) === JSON.stringify(source)
|
|
228
|
-
const samePoints = same(exported.points, loaded.points)
|
|
229
|
-
const sameLines = same(exported.lines, loaded.lines)
|
|
230
|
-
const sameChannels = same(exported.channels, loaded.channels)
|
|
231
|
-
const sameStates = exported.labelStates.length === loaded.labelStates.length
|
|
232
|
-
const matched = samePoints && sameLines && sameChannels && sameStates
|
|
233
|
-
readouts.value = {
|
|
234
|
-
...readouts.value,
|
|
235
|
-
exportText: matched
|
|
236
|
-
? `与文件逐字节一致:${exported.counts.points} 点 / ${exported.counts.lines} 线 / ${exported.counts.channels} 通道 / ${exported.counts.labelStates} 条标签状态,导出结果可以原样当输入喂回来`
|
|
237
|
-
: `与文件有出入(points ${samePoints ? '一致' : '变了'}、lines ${sameLines ? '一致' : '变了'}、channels ${sameChannels ? '一致' : '变了'}、标签状态 ${exported.labelStates.length} 条)—— 拖过节点 / 拐点 / 标签之后就会这样,差异本身就是要存档的编辑结果`
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
/** 存档 → 重建:导出的 input 口径整份喂给新实例,拐点 / 分组 / 偏移 / 运行时加的标签一起回显 */
|
|
242
|
-
const rebuildFromExport = () => {
|
|
243
|
-
if (!view) {
|
|
244
|
-
return
|
|
245
|
-
}
|
|
246
|
-
// 标准文档:整份导出喂回 createGisView(含相机 / 筛选 / 标签状态),两边的导数应该一模一样
|
|
247
|
-
if (loaded?.format === 'gis-view') {
|
|
248
|
-
const exported = view.exportData({ format: 'full' })
|
|
249
|
-
view.destroy()
|
|
250
|
-
view = createGisView(container.value, buildOptions(exported))
|
|
251
|
-
refresh()
|
|
252
|
-
const stable = JSON.stringify(view.exportData({ format: 'full' })) === JSON.stringify(exported)
|
|
253
|
-
readouts.value = {
|
|
254
|
-
...readouts.value,
|
|
255
|
-
exportText: `已用导出的标准文档重建:${exported.points.length} 点 / ${exported.lines.length} 线 / ${exported.channels.length} 通道 / ${exported.labelStates.length} 条标签状态;重建后再导出${stable ? '与重建前逐字节相同' : '对不上'}`
|
|
256
|
-
}
|
|
257
|
-
return
|
|
258
|
-
}
|
|
259
|
-
const exported = view.exportData({ format: 'input' })
|
|
260
|
-
const snapshot = { points: exported.points, lines: exported.lines, channels: exported.channels, labelStates: exported.labelStates }
|
|
261
|
-
view.destroy()
|
|
262
|
-
view = createGisView(container.value, buildOptions(snapshot))
|
|
263
|
-
refresh()
|
|
264
|
-
readouts.value = {
|
|
265
|
-
...readouts.value,
|
|
266
|
-
exportText: `已用导出的 input 口径重建:${snapshot.points.length} 点 / ${snapshot.lines.length} 线 / ${snapshot.channels.length} 通道 / ${snapshot.labelStates.length} 条标签状态`
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const fit = () => {
|
|
271
|
-
view?.fitView(70)
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
onMounted(() => {
|
|
275
|
-
mount(currentId.value)
|
|
276
|
-
})
|
|
277
|
-
|
|
278
|
-
onBeforeUnmount(() => {
|
|
279
|
-
clearTimeout(domTimer)
|
|
280
|
-
view?.destroy()
|
|
281
|
-
view = null
|
|
282
|
-
})
|
|
283
|
-
</script>
|