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
package/docs/demos/api-index.js
CHANGED
|
@@ -7,27 +7,24 @@
|
|
|
7
7
|
* 源码或文档改过之后重跑一遍;`node docs/steps/check-doc-coverage.mjs` 会对账。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/** { members:
|
|
11
|
-
export const API_SUMMARY = {"members":
|
|
10
|
+
/** { members: 249, methods: 246, properties: 3, options: 92, sections: 16 } */
|
|
11
|
+
export const API_SUMMARY = {"members":249,"methods":246,"properties":3,"options":92,"sections":16}
|
|
12
12
|
|
|
13
13
|
/** 实例成员,按 docs/GisView.md「参数速查」的分组排 */
|
|
14
14
|
export const API_SECTIONS = [
|
|
15
15
|
{
|
|
16
16
|
title: "配置与数据",
|
|
17
17
|
items: [
|
|
18
|
-
{ name: "updateOptions", kind: "method", params: "options: GisViewOptions 要合并的配置(按顶层键浅合并:写 points / lines / channels 就是整份换数据,写 label / pointStyle 就是整份换这一类配置);replace: boolean 传 true 时整份替换而不是合并,没写的键回到内置默认", returns: "this", doc: "合并配置(replace 为 true 时整体替换)", examples: [{"group":"配置与数据","code":"// updateOptions(options, replace?):合并配置;replace 传 true 整份替换(没写的键回到内置默认)\nview.updateOptions({ showGrid: false, zoomStep: 1.6 })\nview.updateOptions({ points: nextPoints, lines: nextLines }, true)\n","from":"header"}] },
|
|
18
|
+
{ name: "updateOptions", kind: "method", params: "options: GisViewOptions 要合并的配置(按顶层键浅合并:写 points / lines / channels 就是整份换数据,写 label / pointStyle 就是整份换这一类配置);replace: boolean 传 true 时整份替换而不是合并,没写的键回到内置默认", returns: "this", doc: "合并配置(replace 为 true 时整体替换)", examples: [{"group":"配置与数据","code":"// updateOptions(options, replace?):合并配置;replace 传 true 整份替换(没写的键回到内置默认)\nview.updateOptions({ showGrid: false, zoomStep: 1.6 })\nview.updateOptions({ points: nextPoints, lines: nextLines }, true)\n","from":"header"},{"group":"相机与视图","code":"// getEffects() / updateOptions({ effects }):全局动画配置(effects: false = 一处关掉),写法与 options.effects 一致\nview.updateOptions({ effects: false })\nview.updateOptions({ effects: { line: { size: 10, speed: 60 }, point: { radius: 30 } } })\nconst effects = view.getEffects()\n","from":"header"}] },
|
|
19
19
|
{ name: "updatePointStyle", kind: "method", params: "patch: GisViewPointStyle | null 要改的点样式字段:按字段合并(只动给出来的键,其余保持 —— updatePointStyle({ color: '#f60' }) 不会把 size 碰掉);写 null 清掉整份全局点样式(等于 updateOptions({ pointStyle: null })),写别的非对象值本次忽略并报一句 onWarning;不认识的字段名照样点名。要与 updateOptions 一起下发时直接写 pointStyle(整份语义)", returns: "this", doc: "改全局点 / 线样式的某几个字段(字段级合并,不写的保持原来的那一份):updateOptions({ pointStyle }) 是整份换(没写的字段等于回到内置默认),这两个只动给出来的键 —— 面板上拖大小 / 换调色板一个键一条,不会把样式表里别的配置碰掉;传 null 清掉整份全局样式,写错的字段名走 onWarning 点名。只改尺寸链(size / sizeScale)或配色链(color / strokeColor / strokeWidth / opacity)时引擎走「逐要素只重算这条链」的窄路,逐点自己定死了这一项的要素连槽位都不重写,见「大数据量」", examples: [{"group":"配置与数据","code":"// updatePointStyle(patch):按字段合并全局点样式;写 null 清掉整份\nview.updatePointStyle({ color: '#f60', size: 9 })\nview.updatePointStyle(null)\n","from":"header"}] },
|
|
20
20
|
{ name: "updateLineStyle", kind: "method", params: "patch: GisViewLineStyle | null 线的一份,口径与 updatePointStyle 完全一致", returns: "this", doc: "改全局点 / 线样式的某几个字段(字段级合并,不写的保持原来的那一份):updateOptions({ pointStyle }) 是整份换(没写的字段等于回到内置默认),这两个只动给出来的键 —— 面板上拖大小 / 换调色板一个键一条,不会把样式表里别的配置碰掉;传 null 清掉整份全局样式,写错的字段名走 onWarning 点名。只改尺寸链(size / sizeScale)或配色链(color / strokeColor / strokeWidth / opacity)时引擎走「逐要素只重算这条链」的窄路,逐点自己定死了这一项的要素连槽位都不重写,见「大数据量」", examples: [{"group":"配置与数据","code":"// updateLineStyle(patch):与 updatePointStyle 同一套\nview.updateLineStyle({ width: 3, color: '#1e88e5' })\n","from":"header"}] },
|
|
21
21
|
{ name: "getOptions", kind: "method", params: "无", returns: "GisViewOptions", doc: "当前配置与数据的副本", examples: [{"group":"配置与数据","code":"// getOptions() / getData():整份配置 / 整份数据(读到的就是组件内部那一份,只读)\nconst options = view.getOptions()\nconst { points, lines, channels } = view.getData()\n","from":"header"}] },
|
|
22
22
|
{ name: "getData", kind: "method", params: "无", returns: "GisViewData", doc: "当前数据副本(点与线两列,含拖拽点之后的最新坐标);通道声明不在这一份里 —— 读整份配置与数据用 getOptions()(getOptions().channels)、存档 / 回灌用 exportData({ format: 'input' })", examples: [{"group":"配置与数据","code":"// getOptions() / getData():整份配置 / 整份数据(读到的就是组件内部那一份,只读)\nconst options = view.getOptions()\nconst { points, lines, channels } = view.getData()\n","from":"header"}] },
|
|
23
|
-
{ name: "updateData", kind: "method", params: "整份换数据:points?: GisViewPoint[] 新的节点数组(不传就不动);lines?: GisViewLine[] 新的线路数组(不传就不动);channels?: GisViewChannel[] 给了就连通道声明一起换(切场景一次换完、只发一条 dataChange
|
|
24
|
-
{ name: "updateChannels", kind: "method", params: "channels?: GisViewChannel[] 通道声明的替换值(回线怎么分组、骨架拐点在哪);省略等于清空。场站与回线数据一个都不动,引擎按新声明重排一遍。与 updateChannel(id, patch) 的分工:那一条按 id 给某一条打补丁(定向),这一条是全换;声明里的 lineIds 同样是成员整表 —— 与 groups 冲突时按它收窄(与 updateChannel 的补丁同一份口径);声明里没写分组 id 时引擎按「单组用通道 id、多组 通道id::1 / 通道id::2…」补,并把最终分组(含拐点路径)与对齐后的成员表写回数据副本;认不出的成员 id、重名的分组 id(写回前按调用方的声明查)各报一句 onWarning", returns: "this", doc: "整份替换通道声明(回线怎么分组、骨架拐点在哪),场站与回线数据不动;与 updateChannel(id, patch)(按 id 只改一条)一对。声明里没写分组 id 时引擎按「单组用通道 id、多组 通道id::1 / 通道id::2…」补,并把最终分组(含拐点路径)与对齐后的成员表写回数据副本;认不出的成员 id、重名的分组 id 各报一句 onWarning", examples: [{"group":"配置与数据","code":"// updateChannels(channels):只换通道声明(回线怎么分组、骨架拐点在哪);不传等于清空\nview.updateChannels([{ id: 'c1', name: '二号通道', lineIds: ['l1', 'l2'] }])\nview.updateChannels()\n","from":"header"},{"group":"配置与数据","code":"// updateChannels(channels):整份换通道声明(与 updateChannel 的分工:这条全换、点不出某一条)\nview.updateChannels([{ id: 'c1', lineIds: ['l1', 'l2'] }, { id: 'c2', from: 'a', to: 'b' }])\n","from":"header"}] },
|
|
25
|
-
{ name: "updatePoints", kind: "method", params: "points: GisViewPoint[] 整份节点的替换值(省略等于清空)", returns: "this", doc: "只替换点或线数据", examples: [{"group":"配置与数据","code":"// updatePoints(points) / updateLines(lines):整份替换节点 / 线路(省略等于清空)\nview.updatePoints([{ id: 'a', x: 0, y: 0 }, { id: 'b', x: 400, y: 200 }])\nview.updateLines([{ id: 'l1', from: 'a', to: 'b' }])\n","from":"header"}] },
|
|
26
|
-
{ name: "updateLines", kind: "method", params: "lines: GisViewLine[] 整份线路的替换值(省略等于清空)", returns: "this", doc: "只替换点或线数据", examples: [{"group":"配置与数据","code":"// updatePoints(points) / updateLines(lines):整份替换节点 / 线路(省略等于清空)\nview.updatePoints([{ id: 'a', x: 0, y: 0 }, { id: 'b', x: 400, y: 200 }])\nview.updateLines([{ id: 'l1', from: 'a', to: 'b' }])\n","from":"header"}] },
|
|
23
|
+
{ name: "updateData", kind: "method", params: "整份换数据:points?: GisViewPoint[] 新的节点数组(不传就不动);lines?: GisViewLine[] 新的线路数组(不传就不动);channels?: GisViewChannel[] 给了就连通道声明一起换(切场景一次换完、只发一条 dataChange)。也收单对象写法 updateData({ points, lines, channels })(只换给出的那几列;只换通道声明写 updateData({ channels }));接口字段先在调用方映射成这三列,见「动态换数据与加载完成」", returns: "this", doc: "整份换数据:只给两个参数时换点与线(通道不动);给 channels 时连通道一起换(切场景一次换完、只发一条 onDataChange);也收单对象写法 updateData({ points, lines, channels }),只换给出的那几列 —— 只换通道声明写 updateData({ channels }),只换节点 / 线路写 updateData({ points }) / updateData({ lines })。接口字段先在调用方映射成这三列,见「动态换数据与加载完成」", examples: [{"group":"配置与数据","code":"// updateData(points, lines, channels?):整份换数据,不传的那一列不动\nview.updateData(nextPoints, nextLines) // 只换点与线\nview.updateData(nextPoints, nextLines, nextChannels) // 切场景一次换完,只发一条 dataChange\nview.updateData({ lines: nextLines, channels: nextChannels }) // 单对象写法:只换给出的那几列\n","from":"header"},{"group":"配置与数据","code":"// 只换一列也走 updateData 的单对象写法(没给的那几列不动)\nview.updateData({ channels: [{ id: 'c1', name: '二号通道', lineIds: ['l1', 'l2'] }] })\nview.updateData({ channels: [] }) // 清空通道声明\nview.updateData({ points: [{ id: 'a', x: 0, y: 0 }, { id: 'b', x: 400, y: 200 }] })\nview.updateData({ lines: [{ id: 'l1', from: 'a', to: 'b' }] })\n","from":"header"}] },
|
|
27
24
|
{ name: "importData", kind: "method", params: "input: GisViewDocumentInput:标准文档(format: 'gis-view')/ 与创建入参同构的数据对象(points / lines / channels / labelStates / view / filter,给哪列出哪列)/ 节点数组;options 可以把某一列(points / lines / channels / labelStates / view / filter)显式点上,checkKeys: false 不点名多余的顶层键", returns: "GisViewImportResult", doc: "整份喂回一份数据 / 一份标准文档(exportData 的五种格式都认,最标准的是 format: 'full' 那一份):顶层出哪一列就应用哪一列(points / lines / channels / labelStates / view / filter),没出的列一个都不动;只给通道(不带点线)时单独换通道声明,只给 labelStates 时只动标签状态(整份语义)。返回 { ok, reason, applied, counts, warnings },见「标准数据文档(full):接收 == 导出」", examples: [{"group":"配置与数据","code":"// importData(input, options?):标准文档 / 与创建入参同构的对象 / 节点数组都能灌\nview.importData({ format: 'gis-view', points: nextPoints, lines: nextLines, channels: nextChannels })\nview.importData(nextPoints) // 只灌节点数组\nview.importData({ points: nextPoints, view: { x: 10, y: 20, scale: 8 } }) // 连视角一起\nconst imported = view.importData(doc, { checkKeys: false }) // → { ok, reason, applied, counts, warnings }\n","from":"header"}] },
|
|
28
|
-
{ name: "updatePoint", kind: "method", params: "id: string | number 节点 id;patch: Partial<GisViewPoint> 要合并的字段(写 x / y 就是移动,写 null 摘掉这一项;写 visible: false 把这一条从图上收起、写 visible: true 排回来 —— 这一条要连绑定线 / 锚定通道一起重排,因此走整份重推一次,batch() 里一批只推一次)", returns: "this", doc: "定向更新一个节点 / 线路 /
|
|
29
|
-
{ name: "updateLine", kind: "method", params: "id 线路 id;patch: GisViewLinePatch 要合并的字段(path / from / to / color / width / labels… 都能改),还能写三个「分组指令」:groupId(或 groupIndex,可配 channelId)把这条回线挪到目标分组 —— groupId: 'newGroup' 单独拆一组、其余按现有分组 id 并组,走的是 moveChannelLine 那一套;三个字段只是指令,不会写进线路数据、不会出现在 updateLine 的载荷里,挪组成功会先发一条 channelGroups 变更(只给指令时这次调用就只发它);拐点写在 path 上(整条折线,含首尾端点 —— 只写中间拐点用 setLineWaypoints(id, 中间拐点)),通道里的回线几何由通道骨架推导(path 写了也会被覆盖,改它走 setLineWaypoints / setChannelPath)", returns: "this", doc: "定向更新一个节点 / 线路 /
|
|
30
|
-
{ name: "updateChannel", kind: "method", params: "id 通道 id(也认下标);patch: Partial<GisViewChannel> 要合并的通道声明字段(lineIds / groups / path / width / nodeWidth…)。补丁里的 lineIds 是这条通道成员的整表 —— 增删线路就是改它:写回声明前与 groups 调和(不在表里的成员从各组剔掉、空组去掉,新成员补进第一组,组剔完回「整条通道一组」);写完把引擎算出的最终声明({ id, lineIds, path })写回数据副本,并补一条 channelGroups 变更(排在 updateChannel 那条之前)。成员表里认不出的 id、找不到的通道、没给补丁的调用各报一句 onWarning。linePatches?: GisViewChannelLinePatch | GisViewChannelLinePatch[] 第三段:要一起下发的成员回线补丁,一条或一批 { id | index, ...字段 }(定位与 updateLine 的 id 同一套解析;其余字段与 updateLine 的补丁完全同一套,含 groupId / groupIndex / channelId 三个分组指令)—— 声明先落、再逐条走 updateLine,整次调用只发一条 batch 数据变更、历史里只算一步;它只改成员回线自己的样式 / 信息与分组归属,不靠它改成员表;不属于这条通道的成员表(lineIds + 各组 lineIds)的条目跳过并报一句 onWarning(同一个条目只提醒一次),认不出来的条目也点名;第三段里认不出的成员 id 带得起定义(from / to 两端可解析、可用的 path、或通道自己声明了两端)会当场建一条回线并挂进通道(走 addLines 那条路),给不出定义才跳过。lineIds?: string | number | Array<string | number> 第四段:单独成参数的成员整表(与第三段必须成对给)—— 表里有、数据里没有的当场建,表里有的逐条改,表里没有了的旧成员直接从数据里删掉(走 removeLines 同一条路,视图跟着少;要只移出、留数据用 removeChannelLines);空表不当清空用、只给 lineIds 不给线路数组时报一句什么都不做;与第二段的 patch.lineIds 同时写且不一样时以第四段为准(报一句)。成员表缩小时,被移出通道、又不在别的通道上的回线各报一句 onWarning(第二段的 patch.lineIds 走这条:数据留着;它仍然照常绘制,要删用 removeLines)。不传第四段时只改 id 匹配的成员、数量不动", returns: "this", doc: "定向更新一个节点 / 线路 /
|
|
25
|
+
{ name: "updatePoint", kind: "method", params: "id: string | number 节点 id;patch: Partial<GisViewPoint> 要合并的字段(写 x / y 就是移动,写 null 摘掉这一项;写 visible: false 把这一条从图上收起、写 visible: true 排回来 —— 这一条要连绑定线 / 锚定通道一起重排,因此走整份重推一次,batch() 里一批只推一次)", returns: "this", doc: "定向更新一个节点 / 线路 / 通道并重渲染:单项字段(尺寸、图标、颜色、线宽、通道宽度 / 名称等)直接写补丁;只重排受影响的那一小片(节点 → 绑定线与锚定通道(尺寸 / 图标换过时,锚定通道的宽度一起按新尺寸重排,见「通道与多回线」),线路 → 这一条,通道 → 它的分组与成员),其余要素与缓存一个字节都不动;节点的 visible: false / 改回来会走一次整份重排(这一条要连绑定线、锚定通道与拾取索引一起退场 / 排回去,定向更新那条路落不下;同一个 batch() 里改一批只重排一次);updateLine 的补丁里还能写 groupId / groupIndex(可配 channelId)顺带把这条回线挪到目标分组,updateChannel 写 groups / lineIds 会顺带改分组并补一条 channelGroups 变更(见「通道分组」);updateChannel 还能给第三段 linePatches(一条或一批 { id | index, ...字段 })把「通道声明 + 成员回线各自的字段 / 分组」一次下发 —— 声明先落、再逐条走 updateLine,整次调用只发一条 batch 数据变更、历史里只算一步(见「通道分组」与「逐方法示例」);第三段里认不出的成员 id 带得起定义(from / to 两端可解析、可用的 path、或通道自己声明了两端)会当场建一条回线并挂进通道,给不出定义才跳过点名;updateLine 的拐点写在 path 上(整条折线,含首尾端点 —— 只写中间拐点用 setLineWaypoints(id, coordinates)),通道里的回线几何由通道骨架推导(path 写了也会被覆盖),改它走 setLineWaypoints / setChannelPath", examples: [{"group":"配置与数据","code":"// updatePoint(id, patch):合并一个节点的字段;visible 翻面会连绑定线 / 锚定通道一起重排\nview.updatePoint('a', { x: 120, y: 40 })\nview.updatePoint('a', { name: '甲站(改)', status: 2 })\nview.updatePoint('a', { visible: false }) // 从图上收起;写回 true 排回来\n","from":"header"},{"group":"定向改一个要素(一次只动一条)","code":"// updatePoint(id, patch):只写要改的字段(size / symbol / color…)\nview.updatePoint('a', { size: 12 })\nview.updatePoint('a', { symbol: { kind: 'square' } })\nview.updatePoint('a', { symbol: 'https://example.com/pin.png' })\nview.updatePoint('a', { symbol: null }) // 回到内置圆\nview.updatePoint('a', { color: '#ff6b35' })\n","from":"header"}] },
|
|
26
|
+
{ name: "updateLine", kind: "method", params: "id 线路 id;patch: GisViewLinePatch 要合并的字段(path / from / to / color / width / labels… 都能改),还能写三个「分组指令」:groupId(或 groupIndex,可配 channelId)把这条回线挪到目标分组 —— groupId: 'newGroup' 单独拆一组、其余按现有分组 id 并组,走的是 moveChannelLine 那一套;三个字段只是指令,不会写进线路数据、不会出现在 updateLine 的载荷里,挪组成功会先发一条 channelGroups 变更(只给指令时这次调用就只发它);拐点写在 path 上(整条折线,含首尾端点 —— 只写中间拐点用 setLineWaypoints(id, 中间拐点)),通道里的回线几何由通道骨架推导(path 写了也会被覆盖,改它走 setLineWaypoints / setChannelPath)", returns: "this", doc: "定向更新一个节点 / 线路 / 通道并重渲染:单项字段(尺寸、图标、颜色、线宽、通道宽度 / 名称等)直接写补丁;只重排受影响的那一小片(节点 → 绑定线与锚定通道(尺寸 / 图标换过时,锚定通道的宽度一起按新尺寸重排,见「通道与多回线」),线路 → 这一条,通道 → 它的分组与成员),其余要素与缓存一个字节都不动;节点的 visible: false / 改回来会走一次整份重排(这一条要连绑定线、锚定通道与拾取索引一起退场 / 排回去,定向更新那条路落不下;同一个 batch() 里改一批只重排一次);updateLine 的补丁里还能写 groupId / groupIndex(可配 channelId)顺带把这条回线挪到目标分组,updateChannel 写 groups / lineIds 会顺带改分组并补一条 channelGroups 变更(见「通道分组」);updateChannel 还能给第三段 linePatches(一条或一批 { id | index, ...字段 })把「通道声明 + 成员回线各自的字段 / 分组」一次下发 —— 声明先落、再逐条走 updateLine,整次调用只发一条 batch 数据变更、历史里只算一步(见「通道分组」与「逐方法示例」);第三段里认不出的成员 id 带得起定义(from / to 两端可解析、可用的 path、或通道自己声明了两端)会当场建一条回线并挂进通道,给不出定义才跳过点名;updateLine 的拐点写在 path 上(整条折线,含首尾端点 —— 只写中间拐点用 setLineWaypoints(id, coordinates)),通道里的回线几何由通道骨架推导(path 写了也会被覆盖),改它走 setLineWaypoints / setChannelPath", examples: [{"group":"配置与数据","code":"// updateLine(id, patch):合并一条线路的字段;还能写 groupId / groupIndex(可配 channelId)顺带挪组\nview.updateLine('l1', { color: '#f00', width: 3 })\nview.updateLine('l1', { path: [[0, 0], [200, 120], [400, 200]] }) // 拐点写 path:整条折线(含首尾端点)\nview.updateLine('l1', { name: '一线', from: 'a', to: 'b' }) // 属性与端点一起改,只发一条 updateLines\nview.updateLine('l1', { groupId: 'newGroup' }) // 单独拆一组(只给指令时只发 channelGroups)\nview.updateLine('l1', { groupIndex: 0, channelId: 'c1' }) // 挪进指定通道的第 0 组","from":"header"},{"group":"定向改一个要素(一次只动一条)","code":"// updateLine(id, patch) / setLineWaypoints(id, coordinates)\nview.updateLine('l1', { width: 3 })\nview.updateLine('l1', { color: '#f00' })\nview.setLineWaypoints('l1', [[100, 40], [200, 120]]) // 中间拐点(不含首尾两端)\nview.setLineWaypoints('l1', [120, 80]) // 只留一个拐点\nview.setLineWaypoints('l1', []) // 拉直\n","from":"header"}] },
|
|
27
|
+
{ name: "updateChannel", kind: "method", params: "id 通道 id(也认下标);patch: Partial<GisViewChannel> 要合并的通道声明字段(lineIds / groups / path / width / nodeWidth…)。补丁里的 lineIds 是这条通道成员的整表 —— 增删线路就是改它:写回声明前与 groups 调和(不在表里的成员从各组剔掉、空组去掉,新成员补进第一组,组剔完回「整条通道一组」);写完把引擎算出的最终声明({ id, lineIds, path })写回数据副本,并补一条 channelGroups 变更(排在 updateChannel 那条之前)。成员表里认不出的 id、找不到的通道、没给补丁的调用各报一句 onWarning。linePatches?: GisViewChannelLinePatch | GisViewChannelLinePatch[] 第三段:要一起下发的成员回线补丁,一条或一批 { id | index, ...字段 }(定位与 updateLine 的 id 同一套解析;其余字段与 updateLine 的补丁完全同一套,含 groupId / groupIndex / channelId 三个分组指令)—— 声明先落、再逐条走 updateLine,整次调用只发一条 batch 数据变更、历史里只算一步;它只改成员回线自己的样式 / 信息与分组归属,不靠它改成员表;不属于这条通道的成员表(lineIds + 各组 lineIds)的条目跳过并报一句 onWarning(同一个条目只提醒一次),认不出来的条目也点名;第三段里认不出的成员 id 带得起定义(from / to 两端可解析、可用的 path、或通道自己声明了两端)会当场建一条回线并挂进通道(走 addLines 那条路),给不出定义才跳过。lineIds?: string | number | Array<string | number> 第四段:单独成参数的成员整表(与第三段必须成对给)—— 表里有、数据里没有的当场建,表里有的逐条改,表里没有了的旧成员直接从数据里删掉(走 removeLines 同一条路,视图跟着少;要只移出、留数据用 removeChannelLines);空表不当清空用、只给 lineIds 不给线路数组时报一句什么都不做;与第二段的 patch.lineIds 同时写且不一样时以第四段为准(报一句)。成员表缩小时,被移出通道、又不在别的通道上的回线各报一句 onWarning(第二段的 patch.lineIds 走这条:数据留着;它仍然照常绘制,要删用 removeLines)。不传第四段时只改 id 匹配的成员、数量不动", returns: "this", doc: "定向更新一个节点 / 线路 / 通道并重渲染:单项字段(尺寸、图标、颜色、线宽、通道宽度 / 名称等)直接写补丁;只重排受影响的那一小片(节点 → 绑定线与锚定通道(尺寸 / 图标换过时,锚定通道的宽度一起按新尺寸重排,见「通道与多回线」),线路 → 这一条,通道 → 它的分组与成员),其余要素与缓存一个字节都不动;节点的 visible: false / 改回来会走一次整份重排(这一条要连绑定线、锚定通道与拾取索引一起退场 / 排回去,定向更新那条路落不下;同一个 batch() 里改一批只重排一次);updateLine 的补丁里还能写 groupId / groupIndex(可配 channelId)顺带把这条回线挪到目标分组,updateChannel 写 groups / lineIds 会顺带改分组并补一条 channelGroups 变更(见「通道分组」);updateChannel 还能给第三段 linePatches(一条或一批 { id | index, ...字段 })把「通道声明 + 成员回线各自的字段 / 分组」一次下发 —— 声明先落、再逐条走 updateLine,整次调用只发一条 batch 数据变更、历史里只算一步(见「通道分组」与「逐方法示例」);第三段里认不出的成员 id 带得起定义(from / to 两端可解析、可用的 path、或通道自己声明了两端)会当场建一条回线并挂进通道,给不出定义才跳过点名;updateLine 的拐点写在 path 上(整条折线,含首尾端点 —— 只写中间拐点用 setLineWaypoints(id, coordinates)),通道里的回线几何由通道骨架推导(path 写了也会被覆盖),改它走 setLineWaypoints / setChannelPath", examples: [{"group":"配置与数据","code":"// updateChannel(id, patch):改通道声明;写 groups / lineIds 会顺带改分组并补一条 channelGroups\nview.updateChannel('c1', { name: '东干线', width: 24 })\nview.updateChannel('c1', { lineIds: ['l1', 'l2'] }) // 换成员:lineIds 是整表(增删都在这一份里;有 groups 时会与分组声明调和)\n","from":"header"},{"group":"配置与数据","code":"// updateChannel(id, patch, linePatches, lineIds?):第三段一次把「通道声明 + 成员回线各自的字段 / 分组」下发\nview.updateChannel('c1', { name: '东干线', lineIds: ['l1', 'l2'] }, [\n { id: 'l1', width: 3, color: '#ff8800' }, // 每条:id 或 index 定位,其余字段与 updateLine 同一套\n { id: 'l2', color: '#00ccff', groupId: 'newGroup' } // 第三段里也能带分组指令\n])\nview.updateChannel('c1', { name: '东干线' }, { id: 'l1', width: 4 }) // 只改一条:单条写法(不是数组)\nview.updateChannel('c1', { lineIds: ['l1', 'l2', 'l3'] }, [{ id: 'l3', from: 'a', to: 'b' }])\n // 新 id + 两端:当场建一条回线并挂进 c1(表单整份覆盖成员表常这么用)\n","from":"header"},{"group":"配置与数据","code":"// updateChannel(id, patch, linePatches, lineIds):第四段 lineIds 是整表对齐 —— 与线路数组一起给,多了建、少了删\nview.updateChannel('c1', { name: '东干线' }, [\n { id: 'l1', name: '一线', from: 'a', to: 'b' },\n { id: 'l2', name: '二线', from: 'a', to: 'b' }\n], ['l1', 'l2']) // 表里没有了的旧成员直接从数据里删掉(要只移出用 removeChannelLines)\nview.updateChannel('c1', {}, [{ id: 'l1', width: 4 }]) // 只传线路数组:只改成员回线的字段,数量不动\n","from":"header"},{"group":"配置与数据","code":"// 整份换通道声明(与 updateChannel 的分工:这条全换、点不出某一条)\nview.updateData({ channels: [{ id: 'c1', lineIds: ['l1', 'l2'] }, { id: 'c2', from: 'a', to: 'b' }] })\n","from":"header"},{"group":"定向改一个要素(一次只动一条)","code":"// updateChannel(id, patch):宽度 / 取宽系数 / 内收 / 切点内收\nview.updateChannel('c1', { width: 24 })\nview.updateChannel('c1', { nodeWidth: 0 }) // 关掉「按两端节点尺寸取宽」,改用 width\nview.updateChannel('c1', { nodeWidth: 1 })\nview.updateChannel('c1', { inset: 2 })\nview.updateChannel('c1', { tangentInset: 0 }) // 0 = 切点落在节点边上;null 回默认\n","from":"header"},{"group":"定向改一个要素(一次只动一条)","code":"// updateChannel(id, { name }) / setChannelLineWidth(id, width) / setChannelColors(id, colors)\nview.updateChannel('c1', { name: '东干线' })\nview.updateChannel('c1', { name: null }) // 摘掉名称\nview.setChannelLineWidth('c1', 3)\nview.setChannelColors('c1', ['#f00', '#0f0']) // 不够时按顺序循环取\nview.setChannelColors('c1', '#2f6fd0') // 只给一个 = 整条通道一个色\n","from":"header"}] },
|
|
31
28
|
{ name: "patchPoints", kind: "method", params: "entries: GisViewUpdateItemEntry<GisViewPoint> | 数组 要改的节点(写 { id: 'a', name: 'A' } 用 id 定位、{ index: 3, x: 10 } 用下标定位,其余字段就是这一条的补丁);patch?: Partial<GisViewPoint> 可选:对上面每一批定位统一补一份字段(patchPoints(['a','b'], { status: 1 }))", returns: "GisViewUpdateItemsOutcome<GisViewPoint>", doc: "批量打补丁(只动点到的这几条,不换整份数据):patchPoints([{ id: 'a', name: 'A' }, { index: 3, x: 10 }]) 一次改几条(id / index 之外的字段就是这一条的补丁),或者 patchPoints(['a', 'b'], { status: 1 }) 把同一份补丁盖到一批定位上('a' / { index: 2 } 都认)。认不出来的进 skipped、不影响其余条目;返回 { ok, reason, indexes, items, count, skipped },只记一条历史、只发一条 updatePoints / updateLines 数据变更 —— 十万级批量改不必逐条付事件与历史的代价,见「批量更新(batch)」", examples: [{"group":"配置与数据","code":"// patchPoints(entries, patch?):批量打补丁 —— 每条自带补丁,或一批定位 + 一份公共补丁\nview.patchPoints([{ id: 'a', name: 'A' }, { index: 1, x: 10 }])\nview.patchPoints(['a', 'b'], { status: 1 }) // → { ok, indexes, items, count, skipped }\n","from":"header"}] },
|
|
32
29
|
{ name: "patchLines", kind: "method", params: "同 patchPoints,定位的是线路", returns: "GisViewUpdateItemsOutcome<GisViewLine>", doc: "批量打补丁(只动点到的这几条,不换整份数据):patchPoints([{ id: 'a', name: 'A' }, { index: 3, x: 10 }]) 一次改几条(id / index 之外的字段就是这一条的补丁),或者 patchPoints(['a', 'b'], { status: 1 }) 把同一份补丁盖到一批定位上('a' / { index: 2 } 都认)。认不出来的进 skipped、不影响其余条目;返回 { ok, reason, indexes, items, count, skipped },只记一条历史、只发一条 updatePoints / updateLines 数据变更 —— 十万级批量改不必逐条付事件与历史的代价,见「批量更新(batch)」", examples: [{"group":"配置与数据","code":"// patchLines(entries, patch?):同 patchPoints,定位的是线路\nview.patchLines([{ id: 'l1', width: 4 }, { id: 'l2', color: '#0f0' }])\nview.patchLines(['l1', 'l2'], { color: '#f00' })\n","from":"header"}] },
|
|
33
30
|
{ name: "updateBackground", kind: "method", params: "background?: GisViewBackground 新的背景层(底色 / 图片 / GeoJSON);不传等于清掉", returns: "this", doc: "替换背景层", examples: [{"group":"配置与数据","code":"// updateBackground(background?):换背景层(底色 / 图片 / GeoJSON);不传等于清掉\nview.updateBackground({ color: '#0d1b2a', image: { src: '/basemap.png' } })\nview.updateBackground()\n","from":"header"}] },
|
|
@@ -71,8 +68,7 @@ export const API_SECTIONS = [
|
|
|
71
68
|
{ name: "getRendererInfo", kind: "method", params: "无", returns: "GisViewRendererInfo", doc: "渲染后端读数:{ requested, backend, webgl2, webgpu, fallback, message } —— 请求的是哪种模式、实际用哪个后端(当前只可能是 'webgl2')、WebGPU 探不探得到(status / reason / adapter)、为什么回退;renderer: 'webgl2' 时 webgpu 与 fallback 都是 null。见「渲染后端(WebGPU 开关)」", examples: [{"group":"相机与视图","code":"// getStats() / getRendererInfo():帧与绘制读数 / 渲染后端信息\nconst stats = view.getStats()\nconst rendererInfo = view.getRendererInfo()\n","from":"header"}] },
|
|
72
69
|
{ name: "getQuality", kind: "method", params: "无", returns: "GisViewQualityState", doc: "读当前画质读数 { mode, name, level, glow, ornament, scale, budgetMs, frameMs } / 换一档('high' / 'balanced' / 'lean' / 'fast' / 'auto' 或 { mode, budgetMs, minScale }),换完发一条 onQualityChange,见「画质」", examples: [{"group":"相机与视图","code":"// getQuality() / setQuality(next):画质档位('high' / 'balanced' / 'lean' / 'fast' / 'auto',或 { mode, budgetMs, minScale })\nview.setQuality('lean')\nview.setQuality({ mode: 'balanced', budgetMs: 8 })\nconst quality = view.getQuality()\n","from":"header"}] },
|
|
73
70
|
{ name: "setQuality", kind: "method", params: "next: GisViewQualityOptions 新档位:'high' / 'balanced' / 'lean' / 'fast' / 'auto',或 { mode, budgetMs, minScale }", returns: "GisViewQualityState", doc: "读当前画质读数 { mode, name, level, glow, ornament, scale, budgetMs, frameMs } / 换一档('high' / 'balanced' / 'lean' / 'fast' / 'auto' 或 { mode, budgetMs, minScale }),换完发一条 onQualityChange,见「画质」", examples: [{"group":"相机与视图","code":"// getQuality() / setQuality(next):画质档位('high' / 'balanced' / 'lean' / 'fast' / 'auto',或 { mode, budgetMs, minScale })\nview.setQuality('lean')\nview.setQuality({ mode: 'balanced', budgetMs: 8 })\nconst quality = view.getQuality()\n","from":"header"}] },
|
|
74
|
-
{ name: "getEffects", kind: "method", params: "无", returns: "GisViewEffectsReadout:{ enabled, respectReducedMotion, line, point },enabled 是运行时口径(数据里逐条配了 effect 时也是 true)", doc: "换 / 读动画效果的全局配置(false 就是一处关掉):getEffects() 给 { enabled, respectReducedMotion, line, point },其中 enabled 是运行时口径(只在数据里逐条配了 effect 时也是 true),见「动画效果(effects)」", examples: [{"group":"相机与视图","code":"// getEffects() /
|
|
75
|
-
{ name: "setEffects", kind: "method", params: "next: GisViewEffectsInput 与 options.effects 同一套写法(false = 一处关掉)", returns: "this", doc: "换 / 读动画效果的全局配置(false 就是一处关掉):getEffects() 给 { enabled, respectReducedMotion, line, point },其中 enabled 是运行时口径(只在数据里逐条配了 effect 时也是 true),见「动画效果(effects)」", examples: [{"group":"相机与视图","code":"// getEffects() / setEffects(next):全局动画配置(false = 一处关掉),写法与 options.effects 一致\nview.setEffects(false)\nview.setEffects({ line: { size: 10, speed: 60 }, point: { radius: 30 } })\nconst effects = view.getEffects()\n","from":"header"}] },
|
|
71
|
+
{ name: "getEffects", kind: "method", params: "无", returns: "GisViewEffectsReadout:{ enabled, respectReducedMotion, line, point },enabled 是运行时口径(数据里逐条配了 effect 时也是 true)", doc: "换 / 读动画效果的全局配置(effects: false 就是一处关掉):getEffects() 给 { enabled, respectReducedMotion, line, point },其中 enabled 是运行时口径(只在数据里逐条配了 effect 时也是 true),见「动画效果(effects)」", examples: [{"group":"相机与视图","code":"// getEffects() / updateOptions({ effects }):全局动画配置(effects: false = 一处关掉),写法与 options.effects 一致\nview.updateOptions({ effects: false })\nview.updateOptions({ effects: { line: { size: 10, speed: 60 }, point: { radius: 30 } } })\nconst effects = view.getEffects()\n","from":"header"}] },
|
|
76
72
|
{ name: "getLineEffects", kind: "method", params: "无", returns: "GisViewLineEffectReadout[]:这一帧算过位置的动点 { lineIndex, slot, x, y, angle, total, size }(世界坐标 + 朝向),没动的时候是空表", doc: "这一帧动点的读数 { lineIndex, slot, x, y, angle, total, size }(世界坐标 + 朝向 + 所在线路 + 沿线总长):自建覆盖层(跟着图标走的标签 / 提示)与读数面板用它,没动的时候是空表", examples: [{"group":"相机与视图","code":"// getLineEffects() / getPointEffects():这一帧动点 / 涟漪的读数(没配时是空表)\nconst movers = view.getLineEffects()\nconst ripples = view.getPointEffects()\n","from":"header"}] },
|
|
77
73
|
{ name: "getPointEffects", kind: "method", params: "无", returns: "GisViewPointEffectReadout[]:这一帧涟漪的读数 { index, x, y, color, radius, count, period, from }(世界坐标 + 颜色 + 圈数 + 周期),没配涟漪时是空表", doc: "这一帧涟漪的读数 { index, x, y, color, radius, count, period, from }(世界坐标 + 颜色 + 圈数 + 周期):自建覆盖层与自测用它;拖动就地挪过圈之后读到的就是挪完的位置,没配涟漪那些节点不在表里", examples: [{"group":"相机与视图","code":"// getLineEffects() / getPointEffects():这一帧动点 / 涟漪的读数(没配时是空表)\nconst movers = view.getLineEffects()\nconst ripples = view.getPointEffects()\n","from":"header"}] },
|
|
78
74
|
{ name: "getPrebake", kind: "method", params: "无", returns: "GisViewPrebakeReadout | null:这次配了哪些符号 / 颜色 / 尺寸 / 逐组合", doc: "预热读数(这次配了哪些符号 / 颜色 / 尺寸 / 逐组合,没配是 null)/ 按当前配置再烤一遍并返回组合条数,见「贴图符号预热(prebake)」", examples: [{"group":"相机与视图","code":"// getPrebake() / runPrebake() / getSymbolCombos():贴图预热的读数 / 重跑 / 这份数据的组合清单\nconst prebake = view.getPrebake()\nview.runPrebake()\nconst combos = view.getSymbolCombos()","from":"header"}] },
|
|
@@ -106,9 +102,8 @@ export const API_SECTIONS = [
|
|
|
106
102
|
{ name: "getContextAt", kind: "method", params: "x / y 画布 CSS 像素;options?: GisViewContextAtOptions:selection: false 不整理选中集、lngLat: false 不换算经纬度(dragover / 自绘十字线这类每帧来的场合用它省分配)", returns: "GisViewContextAtResult;给了选项时是 GisViewContextAtLightResult(没要的那几项不再生成)", doc: "一个屏幕点(画布 CSS 像素)上的全部读数:screen / world / lngLat / hit / kind('point' / 'line' / 'channel')/ selection / selectedItems。自定义右键菜单一次取全,空白处 hit 与 kind 为 null、坐标照样给", examples: [{"group":"坐标、拾取与读数","code":"//(pick / getContextAt / nearestPointsAt 这些吃画布像素的方法先用这一对转;自动处理 canvas rect 与宿主缩放)\nconst [sx, sy] = view.clientToScreen(event.clientX, event.clientY)\nconst [fixedX, fixedY] = view.screenToClient(320, 200) // 摆 position: fixed 的浮层 / 菜单\n","from":"header"},{"group":"坐标、拾取与读数","code":"// getContextAt(x, y, options?):右键菜单那种「这儿是什么」的全量读数\nconst context = view.getContextAt(320, 200)\nconst lightContext = view.getContextAt(320, 200, { selection: false, lngLat: false }) // 每帧来的场合省分配\n","from":"header"}] },
|
|
107
103
|
{ name: "nearestPointsAt", kind: "method", params: "x / y 画布 CSS 像素;options?: GisViewNearestOptions:limit(最多几个,缺省 1)、maxDistance(屏幕像素上限,缺省不限)、withScreen: true 补屏幕坐标", returns: "GisViewNearestPoint[],按距离从近到远:{ index, item, x, y, radius, distance, distancePx, screen? };内部走点网格,十万级数据也只碰光标附近的单元格", doc: "/** * 落点附近最近的若干个可见节点。", examples: [{"group":"坐标、拾取与读数","code":"//(pick / getContextAt / nearestPointsAt 这些吃画布像素的方法先用这一对转;自动处理 canvas rect 与宿主缩放)\nconst [sx, sy] = view.clientToScreen(event.clientX, event.clientY)\nconst [fixedX, fixedY] = view.screenToClient(320, 200) // 摆 position: fixed 的浮层 / 菜单\n","from":"header"},{"group":"坐标、拾取与读数","code":"// nearestPointsAt(x, y, options?) / nearestLineAt(x, y, options?):离光标最近的节点 / 线路\nconst nearPoints = view.nearestPointsAt(320, 200, { limit: 3, withScreen: true })\nconst nearLine = view.nearestLineAt(320, 200, { maxDistance: 60 }) // 落点比例在 nearLine.position\n","from":"header"}] },
|
|
108
104
|
{ name: "nearestLineAt", kind: "method", params: "x / y 画布 CSS 像素;options?: GisViewNearestLineOptions:maxDistance(屏幕像素,缺省 40,超出算没命中)、editableOnly: true 只看允许加拐点的线、withScreen: true 补屏幕坐标", returns: "GisViewNearestLine | null:{ index, item, path, distance, distancePx, position, channelId?, groupId?, channelIndex?, screen? },position 是落点投到线上的沿线比例(0~1),加拐点 / 挂装饰直接当 position 用;附近没线返回 null", doc: "/** * 落点附近最近的一条可见线路。", examples: [{"group":"坐标、拾取与读数","code":"// nearestPointsAt(x, y, options?) / nearestLineAt(x, y, options?):离光标最近的节点 / 线路\nconst nearPoints = view.nearestPointsAt(320, 200, { limit: 3, withScreen: true })\nconst nearLine = view.nearestLineAt(320, 200, { maxDistance: 60 }) // 落点比例在 nearLine.position\n","from":"header"}] },
|
|
109
|
-
{ name: "setDropPreview", kind: "method", params: "preview: GisViewDropPreviewInput | null:kind('point' / 'line' / 'channel' / 'waypoint' / 'decoration' / 'label',缺省按 item 推断)、screen(画布 CSS 像素)或 world(世界坐标)至少给一个、item 是准备落地的那一份字段(与 addPoint / addLine 同一份)、from(line / channel 的起点);传 null
|
|
110
|
-
{ name: "getDropPreview", kind: "method", params: "无", returns: "GisViewDropPreview | null:当前拖拽落点预览的读数,没有预览时 null", doc: "/** * 拖拽落点预览。", examples: [{"group":"坐标、拾取与读数","code":"// setDropPreview(preview) / getDropPreview()
|
|
111
|
-
{ name: "clearDropPreview", kind: "method", params: "无", returns: "this(与 setDropPreview(null) 同一条路)", doc: "/** * 拖拽落点预览。", examples: [{"group":"坐标、拾取与读数","code":"// setDropPreview(preview) / getDropPreview() / clearDropPreview():拖拽落点预览\nview.setDropPreview({ kind: 'point', screen: [320, 200], item: { name: '新站' } })\nconst preview = view.getDropPreview()\nview.clearDropPreview()\n","from":"header"}] },
|
|
105
|
+
{ name: "setDropPreview", kind: "method", params: "preview: GisViewDropPreviewInput | null:kind('point' / 'line' / 'channel' / 'waypoint' / 'decoration' / 'label',缺省按 item 推断)、screen(画布 CSS 像素)或 world(世界坐标)至少给一个、item 是准备落地的那一份字段(与 addPoint / addLine 同一份)、from(line / channel 的起点);传 null 清掉预览", returns: "GisViewDropPreview | null 解析后的读数 { kind, screen, world, size, styleSize, radius, color, strokeColor, strokeWidth, opacity, symbol, width, dashed }:走的是与真实要素完全相同的样式链(规则 -> 全局样式 -> 这一份字段),styleSize 与落地后 getPointStyle().size 是同一个数(size 是这一刻画出来的宽度,不悬停 / 不选中时两者相同)", doc: "/** * 拖拽落点预览。", examples: [{"group":"坐标、拾取与读数","code":"// setDropPreview(preview) / getDropPreview():拖拽落点预览(setDropPreview(null) 清掉)\nview.setDropPreview({ kind: 'point', screen: [320, 200], item: { name: '新站' } })\nconst preview = view.getDropPreview()\nview.setDropPreview(null)\n","from":"header"}] },
|
|
106
|
+
{ name: "getDropPreview", kind: "method", params: "无", returns: "GisViewDropPreview | null:当前拖拽落点预览的读数,没有预览时 null", doc: "/** * 拖拽落点预览。", examples: [{"group":"坐标、拾取与读数","code":"// setDropPreview(preview) / getDropPreview():拖拽落点预览(setDropPreview(null) 清掉)\nview.setDropPreview({ kind: 'point', screen: [320, 200], item: { name: '新站' } })\nconst preview = view.getDropPreview()\nview.setDropPreview(null)\n","from":"header"}] },
|
|
112
107
|
{ name: "getPoint", kind: "method", params: "ref: GisViewFeatureRef 节点定位:id、下标、{ id } / { index }", returns: "GisViewPointInfo | null", doc: "按 id / 下标 / { id } / { index } 取一个节点:拾取载荷(item / x / y / layer / layerRank)之外再给一份屏幕半径 radius;找不到返回 null。自建读数面板、右键菜单用它,省掉「自己遍历 getData() + 算投影」那一段", examples: [{"group":"坐标、拾取与读数","code":"// getPoint(ref) / getLine(ref) / getChannel(ref):一个要素的几何读数\nconst pointInfo = view.getPoint('a')\nconst lineInfo = view.getLine('l1')\nconst channelInfo = view.getChannel('c1')\n","from":"header"}] },
|
|
113
108
|
{ name: "getPointStyle", kind: "method", params: "index: number 节点下标", returns: "GisViewPointStyleSnapshot | null:节点解析后的样式快照 { index, size, symbol, zIndex },size / symbol 取样式链(节点自身 > 规则 > pointStyle)定下来的那一份,含 sizeScale、不含悬停 / 选中样式与热力倍率;落点预览的读数与它同源", doc: "/** * 节点解析之后的样式快照(size / symbol / zIndex,含 sizeScale、不含状态样式与热力倍率)。", examples: [{"group":"坐标、拾取与读数","code":"// getPointStyle(index):节点解析后的样式快照(样式链定下来的那一份)\nconst pointStyle = view.getPointStyle(0)\n","from":"header"}] },
|
|
114
109
|
{ name: "getLine", kind: "method", params: "ref 线路定位(同上)", returns: "GisViewLineInfo | null", doc: "取一条线路:拾取载荷 + path / bounds / color / width(与 listLines() 的一项同一份口径),通道回线还带 channelId / groupId / channelIndex;找不到返回 null", examples: [{"group":"坐标、拾取与读数","code":"// getPoint(ref) / getLine(ref) / getChannel(ref):一个要素的几何读数\nconst pointInfo = view.getPoint('a')\nconst lineInfo = view.getLine('l1')\nconst channelInfo = view.getChannel('c1')\n","from":"header"}] },
|
|
@@ -119,6 +114,13 @@ export const API_SECTIONS = [
|
|
|
119
114
|
{ name: "getVisibleData", kind: "method", params: "无", returns: "GisViewData", doc: "过滤之后的数据副本(points / lines)", examples: [{"group":"坐标、拾取与读数","code":"// getVisibleData() / isPointVisible(index):筛选之后的整份数据 / 某个节点在不在图上\nconst visibleData = view.getVisibleData()\nconst shown = view.isPointVisible(0)\n","from":"header"}] },
|
|
120
115
|
{ name: "getMovedPoints", kind: "method", params: "无", returns: "GisViewMovedPoint[]:相对上次对账位置变过的节点(index / id / x / y / item),按 id 去重;被删掉的记录不在里面(顺手清掉)", doc: "位置对账:相对上次对账(建视图 / 整份换数据 / 上一次 clearMovedPoints)位置变过的节点,按 id 去重、一趟扫出 [{ index, id, x, y, item }] —— 拖动 / updatePoint / patchPoints / 撤销都算,removePoints 删掉的记录顺手清掉,见「节点位置对账」", examples: [{"group":"坐标、拾取与读数","code":"// getMovedPoints() / clearMovedPoints(refs?):位置对账 —— 相对上次对账哪些节点搬过位置\nconst movedPoints = view.getMovedPoints() // [{ index, id, x, y, item }]\nview.clearMovedPoints(movedPoints.map(one => one.id)) // 发完接口对账这批;不传 = 全部对账\n","from":"header"}] },
|
|
121
116
|
{ name: "clearMovedPoints", kind: "method", params: "refs?: GisViewFeatureRef | GisViewFeatureRef[] 记成新基准的节点(id / 下标 / { id } / { index },写法与 removePoints 一致);不传 / null 全部对账,空数组无操作", returns: "this", doc: "位置对账:把当前坐标记成新基准(发完接口告诉组件「这些已经同步过了」):不传 / null 全部对账,传一个或一批(写法与 removePoints 一致)只清这些,认不出来的跳过并记一条提醒;返回实例本身", examples: [{"group":"坐标、拾取与读数","code":"// getMovedPoints() / clearMovedPoints(refs?):位置对账 —— 相对上次对账哪些节点搬过位置\nconst movedPoints = view.getMovedPoints() // [{ index, id, x, y, item }]\nview.clearMovedPoints(movedPoints.map(one => one.id)) // 发完接口对账这批;不传 = 全部对账\n","from":"header"}] },
|
|
117
|
+
{ name: "getChangedChannels", kind: "method", params: "options?: GisViewChangedChannelOptions:reasons?: GisViewChangedChannelReason[] 只返回这些原因([] = 空表);ignoreGroups?: boolean 忽略分组新增 / 删除 / 重排,只比较共有分组的拐点", returns: "GisViewChangedChannel[]:相对上次通道对账变了哪些通道,每项给 { index, id, item, groups, groupsChanged, waypointsChanged, membersChanged, endpointsChanged, visibilityChanged, fieldsChanged, fields, reasons };筛选后 *Changed 标记与 fields 同步收窄,读本身不改基准", doc: "通道变化对账:相对上次对账(建视图 / 整份换通道声明 / 上一次 clearChangedChannels)成员、分组、拐点、端点、可见性或其余声明字段变过的通道。每项带当前 groups 快照、六个 *Changed 标记、fields 与 reasons;新加通道只补账不报变化,删掉的通道(含 removeLines 连带删除)从账本清掉。options.reasons 只取指定原因(空数组直接返回空表),options.ignoreGroups 忽略分组新增 / 删除 / 重排、仍报已有分组的拐点变化。节点拖动只改坐标、不改 from / to,因此不算端点变化;拖 / 加 / 删分组拐点会进 waypoints,见「通道变化对账」", examples: [{"group":"拐点与通道","code":"// getChangedChannels(options?) / clearChangedChannels(refs?):通道变化对账\nview.updateChannel('c1', { name: '东干线' })\nview.addChannelGroupWaypoint('c1', 'c1', [200, 120]) // 拐点变化入账(单组通道的组 id 就是通道 id)\nconst changedChannels = view.getChangedChannels() // [{ index, id, item, groups, reasons, … }]\nconsole.log(changedChannels[0]?.reasons) // ['waypoints'] / ['members'] / ['visibility']…\nconst waypointOnly = view.getChangedChannels({ reasons: ['waypoints'], ignoreGroups: true })\nview.clearChangedChannels('c1') // 发完接口对账这一条;不传 = 全部对账\n","from":"header"}] },
|
|
118
|
+
{ name: "clearChangedChannels", kind: "method", params: "refs?: GisViewFeatureRef | GisViewFeatureRef[] 记成新基准的通道(id / 下标 / { id } / { index },写法与 removePoints 一致);不传 / null 全部对账,空数组无操作", returns: "this", doc: "通道变化对账:把当前声明记成新基准(发完接口告诉组件「这些已经同步过了」):不传 / null 全部对账,传一个或一批(写法与 removePoints 一致)只清这些,认不出来的跳过并记一条提醒;返回实例本身", examples: [{"group":"拐点与通道","code":"// getChangedChannels(options?) / clearChangedChannels(refs?):通道变化对账\nview.updateChannel('c1', { name: '东干线' })\nview.addChannelGroupWaypoint('c1', 'c1', [200, 120]) // 拐点变化入账(单组通道的组 id 就是通道 id)\nconst changedChannels = view.getChangedChannels() // [{ index, id, item, groups, reasons, … }]\nconsole.log(changedChannels[0]?.reasons) // ['waypoints'] / ['members'] / ['visibility']…\nconst waypointOnly = view.getChangedChannels({ reasons: ['waypoints'], ignoreGroups: true })\nview.clearChangedChannels('c1') // 发完接口对账这一条;不传 = 全部对账\n","from":"header"}] },
|
|
119
|
+
{ name: "getChangedLines", kind: "method", params: "options?: GisViewChangedLineOptions:reasons?: GisViewChangedLineReason[] 只返回 path / endpoints / visibility / fields 中的指定原因([] = 空表)", returns: "GisViewChangedLine[]:相对上次线路对账变了哪些线路,每项给 { index, id, item, path, start, end, from, to, visible, pathChanged, endpointsChanged, visibilityChanged, fieldsChanged, fields, reasons };新加只补账、删除清账,读本身不改基准", doc: "线路变化对账:相对上次对账(建视图 / 整份换线路 / 上一次 clearChangedLines)path / start / end、from / to、可见性或其余声明字段变过的线路。每项带 { index, id, item, path, start, end, from, to, visible, pathChanged, endpointsChanged, visibilityChanged, fieldsChanged, fields, reasons };options.reasons 可写 path / endpoints / visibility / fields。新加线路只补账不报,删除线路(含 removeChannel 连带删除)同步清账;通道骨架变化不算线路变化,见「线路变化对账」", examples: [{"group":"拐点与通道","code":"// getChangedLines(options?) / clearChangedLines(refs?):只有节点和线路时也能独立对账\nview.updateLine('l1', { name: '东联络线' })\nconst changedLines = view.getChangedLines() // [{ index, id, item, path, from, to, reasons, … }]\nconsole.log(changedLines[0]?.reasons) // ['fields'] / ['path'] / ['endpoints'] / ['visibility']\nconst pathOnly = view.getChangedLines({ reasons: ['path'] })\nview.clearChangedLines('l1') // 发完接口对账这一条;不传 = 全部对账\n","from":"header"}] },
|
|
120
|
+
{ name: "clearChangedLines", kind: "method", params: "refs?: GisViewFeatureRef | GisViewFeatureRef[] 记成新基准的线路(写法与 removePoints 一致);不传 / null 全部对账,空数组无操作", returns: "this", doc: "线路变化对账:不传 / null 全部对账,传一个或一批(写法与 removePoints 一致)只清这些,空数组无操作;认不出来的跳过并记一条提醒,返回实例本身", examples: [{"group":"拐点与通道","code":"// getChangedLines(options?) / clearChangedLines(refs?):只有节点和线路时也能独立对账\nview.updateLine('l1', { name: '东联络线' })\nconst changedLines = view.getChangedLines() // [{ index, id, item, path, from, to, reasons, … }]\nconsole.log(changedLines[0]?.reasons) // ['fields'] / ['path'] / ['endpoints'] / ['visibility']\nconst pathOnly = view.getChangedLines({ reasons: ['path'] })\nview.clearChangedLines('l1') // 发完接口对账这一条;不传 = 全部对账\n","from":"header"}] },
|
|
121
|
+
{ name: "setFeatureVisible", kind: "method", params: "kind: GisViewVisibilityKind('point' / 'line' / 'channel');refs: GisViewVisibilityRefs 单个 / 一批 id 或下标,也认 'selection'(通道按选中回线的归属取整条);visible: boolean", returns: "GisViewSetVisibilityOutcome:{ ok, reason, kind, visible, indexes, ids, items, skipped };只改数据的 visible,整次调用一条历史、一条 batch 数据变更", doc: "统一隐藏 / 显示节点、线路或通道:只改数据里的 visible,不删要素,分组 / 拐点 / 编辑状态都保留。kind 收 point / line / channel,refs 收单个或一批 id / 下标 / { id } / { index },也认 'selection'(通道按选中回线的归属取整条);hideFeatures / showFeatures 是 false / true 的快捷写法。整次调用收成一条历史与一条 batch 数据变更,返回 { ok, reason, kind, visible, indexes, ids, items, skipped };认不出的引用逐条进 skipped,不影响其余条目", examples: [{"group":"配置与数据","code":"// setFeatureVisible(kind, refs, visible) / hideFeatures(kind, refs) / showFeatures(kind, refs):只改 visible,不删数据\nconst hiddenChannel = view.hideFeatures('channel', 'c1') // 'point' / 'line' / 'channel',refs 单个 / 数组 / 'selection'\nview.showFeatures('channel', 'c1') // 成员回线、分组、拐点原样回来\nview.setFeatureVisible('point', ['a', 'b'], false) // 一批节点一次收起(一条历史、一条 batch)\nconsole.log(hiddenChannel.ok, hiddenChannel.indexes, hiddenChannel.skipped)\n","from":"header"}] },
|
|
122
|
+
{ name: "hideFeatures", kind: "method", params: "同上,等价于 setFeatureVisible(kind, refs, false)", returns: "同上", doc: "统一隐藏 / 显示节点、线路或通道:只改数据里的 visible,不删要素,分组 / 拐点 / 编辑状态都保留。kind 收 point / line / channel,refs 收单个或一批 id / 下标 / { id } / { index },也认 'selection'(通道按选中回线的归属取整条);hideFeatures / showFeatures 是 false / true 的快捷写法。整次调用收成一条历史与一条 batch 数据变更,返回 { ok, reason, kind, visible, indexes, ids, items, skipped };认不出的引用逐条进 skipped,不影响其余条目", examples: [{"group":"配置与数据","code":"// setFeatureVisible(kind, refs, visible) / hideFeatures(kind, refs) / showFeatures(kind, refs):只改 visible,不删数据\nconst hiddenChannel = view.hideFeatures('channel', 'c1') // 'point' / 'line' / 'channel',refs 单个 / 数组 / 'selection'\nview.showFeatures('channel', 'c1') // 成员回线、分组、拐点原样回来\nview.setFeatureVisible('point', ['a', 'b'], false) // 一批节点一次收起(一条历史、一条 batch)\nconsole.log(hiddenChannel.ok, hiddenChannel.indexes, hiddenChannel.skipped)\n","from":"header"}] },
|
|
123
|
+
{ name: "showFeatures", kind: "method", params: "同上,等价于 setFeatureVisible(kind, refs, true)(隐藏后原样恢复)", returns: "同上", doc: "统一隐藏 / 显示节点、线路或通道:只改数据里的 visible,不删要素,分组 / 拐点 / 编辑状态都保留。kind 收 point / line / channel,refs 收单个或一批 id / 下标 / { id } / { index },也认 'selection'(通道按选中回线的归属取整条);hideFeatures / showFeatures 是 false / true 的快捷写法。整次调用收成一条历史与一条 batch 数据变更,返回 { ok, reason, kind, visible, indexes, ids, items, skipped };认不出的引用逐条进 skipped,不影响其余条目", examples: [{"group":"配置与数据","code":"// setFeatureVisible(kind, refs, visible) / hideFeatures(kind, refs) / showFeatures(kind, refs):只改 visible,不删数据\nconst hiddenChannel = view.hideFeatures('channel', 'c1') // 'point' / 'line' / 'channel',refs 单个 / 数组 / 'selection'\nview.showFeatures('channel', 'c1') // 成员回线、分组、拐点原样回来\nview.setFeatureVisible('point', ['a', 'b'], false) // 一批节点一次收起(一条历史、一条 batch)\nconsole.log(hiddenChannel.ok, hiddenChannel.indexes, hiddenChannel.skipped)\n","from":"header"}] },
|
|
122
124
|
{ name: "isPointVisible", kind: "method", params: "index: number 节点下标", returns: "boolean。在不在图上(被筛选 / visible: false 或发散渲染还没铺到的都算 false)", doc: "某个下标的节点当前在不在图上:被筛选 / visible: false 隐藏掉的不算,初始化发散渲染还没排到的那部分也不算", examples: [{"group":"坐标、拾取与读数","code":"// getVisibleData() / isPointVisible(index):筛选之后的整份数据 / 某个节点在不在图上\nconst visibleData = view.getVisibleData()\nconst shown = view.isPointVisible(0)\n","from":"header"}] },
|
|
123
125
|
{ name: "getElementBounds", kind: "method", params: "keys: GisViewFeatureKey[] 要素定位数组({ type, id } / { type, index } / 裸 id)", returns: "GisViewBounds | null", doc: "一批要素 GisViewFeatureKey[]({ type: 'point' | 'line', index },getSelections() 的结果可以直接传)的世界包围盒 { minX, minY, maxX, maxY };一个都没对上返回 null(数据已经换过)", examples: [{"group":"坐标、拾取与读数","code":"// getElementBounds(keys) / getViewState():一批要素的包围盒 / 一次取全视图读数\nconst box = view.getElementBounds(view.getSelections())\nconst state = view.getViewState()","from":"header"}] },
|
|
124
126
|
{ name: "getViewState", kind: "method", params: "无", returns: "GisViewViewState", doc: "一次取全的读数快照:camera / viewport / viewRect / layoutReady / selection / selectionIds / filter / filterResult / pointer / stats,自建状态栏与「布局铺好了没」的判断用它", examples: [{"group":"坐标、拾取与读数","code":"// getElementBounds(keys) / getViewState():一批要素的包围盒 / 一次取全视图读数\nconst box = view.getElementBounds(view.getSelections())\nconst state = view.getViewState()","from":"header"}] },
|
|
@@ -127,12 +129,11 @@ export const API_SECTIONS = [
|
|
|
127
129
|
{
|
|
128
130
|
title: "选中、复制与合并",
|
|
129
131
|
items: [
|
|
130
|
-
{ name: "
|
|
131
|
-
{ name: "
|
|
132
|
-
{ name: "deselect", kind: "method", params: "refs?: GisViewSelectionRefs 要取消的东西(写法与 selectFeatures 一致:节点 / 通道 / 线路 / 混合一批);不传 / null 等于取消全部(= select(null)),空数组是「没有目标」什么都不做", returns: "this", doc: "取消选中:写法与 selectFeatures 完全一样,把这些从当前选中集里去掉、其余选中原样留着;不传 / null 等于取消全部(也就是 select(null)),空数组是「没有目标」什么都不做,见「取消选中(deselect / select(null))」", examples: [{"group":"选中、复制与合并","code":"// deselect(refs?):取消选中(写法与 select 一致;不传 / null 全清,空数组什么都不做)\nview.deselect('a')\nview.deselect(['a', 'b'])\nview.deselect()\n","from":"header"}] },
|
|
132
|
+
{ name: "selectFeatures", kind: "method", params: "refs: GisViewSelectionRefs 要选中的东西:id / id 数组(多选)/ { type, index } / 通道写法 / 拾取载荷 / 搜索命中,传 null / 空数组等于清空;options?: GisViewSelectOptions 只有 mode('replace' 缺省 / 'add' / 'toggle' / 'remove')", returns: "this", doc: "接口选中(换一份选中集;selectFeatures(null) / 空数组就是清空):refs 认 id、id 数组、{ type, index }、通道写法({ type: 'channel', channelId } / { channelId, groupId } / { channelId, lineIds })以及拾取载荷与搜索命中;options.mode 给 'replace'(缺省,换一份)/ 'add' / 'toggle'(在就取消、不在就选上)/ 'remove',见「接口选中(selectFeatures)与读回选中」", examples: [{"group":"选中、复制与合并","code":"// selectFeatures(refs, options?):接口选中(与点击选中走同一份 state)\nview.selectFeatures('a') // 选中一个\nview.selectFeatures(['a', 'b']) // 一批\nview.selectFeatures('a', { mode: 'add' }) // mode:replace(缺省)/ add / toggle / remove\nview.selectFeatures([{ type: 'line', index: 0 }], { mode: 'toggle' })\nview.selectFeatures(null) // 清空(空数组同义)\n","from":"header"}] },
|
|
133
|
+
{ name: "deselect", kind: "method", params: "refs?: GisViewSelectionRefs 要取消的东西(写法与 selectFeatures 一致:节点 / 通道 / 线路 / 混合一批);不传 / null 等于取消全部(= selectFeatures(null)),空数组是「没有目标」什么都不做", returns: "this", doc: "取消选中:写法与 selectFeatures 完全一样,把这些从当前选中集里去掉、其余选中原样留着;不传 / null 等于取消全部(也就是 selectFeatures(null)),空数组是「没有目标」什么都不做,见「取消选中(deselect / selectFeatures(null))」", examples: [{"group":"选中、复制与合并","code":"// deselect(refs?):取消选中(写法与 selectFeatures 一致;不传 / null 全清,空数组什么都不做)\nview.deselect('a')\nview.deselect(['a', 'b'])\nview.deselect()\n","from":"header"}] },
|
|
133
134
|
{ name: "getSelections", kind: "method", params: "无", returns: "GisViewPickResult[]", doc: "读回选中结果 [{ type, index, item, … }](按选中顺序):要 id 列表 / 个数 / 包围盒看 getSelectionData()", examples: [{"group":"选中、复制与合并","code":"// getSelections() / getSelectionData() / isSelected(ref):读回选中\nconst picks = view.getSelections()\nconst selection = view.getSelectionData() // { ids, count, points, lines, channels, bounds, … }\nconst selected = view.isSelected('a')\n","from":"header"}] },
|
|
134
135
|
{ name: "isSelected", kind: "method", params: "ref: GisViewFeatureRef | GisViewFeatureKey | GisViewSelectionRefObject 要素定位(id / 下标 / { id } / { index } / { type, index } / { item })", returns: "boolean", doc: "这个要素在不在当前选中集里:isSelected('node-0')(id)/ isSelected({ type: 'line', index: 12 })(也可以只写下标,按 id 认不出来时当下标),返回 true / false。面板上高亮「当前这一行」时不必自己比对 getSelections();选中集变化时缓存一份键集合(见「接口选中」),十万级选中下这一问也是常数级", examples: [{"group":"选中、复制与合并","code":"// getSelections() / getSelectionData() / isSelected(ref):读回选中\nconst picks = view.getSelections()\nconst selection = view.getSelectionData() // { ids, count, points, lines, channels, bounds, … }\nconst selected = view.isSelected('a')\n","from":"header"}] },
|
|
135
|
-
{ name: "getSelectionData", kind: "method", params: "无", returns: "GisViewSelectionData:{ ids, count, pointCount, lineCount, channelCount, points, lines, channels, items, pointIndexes, lineIndexes, bounds }(bounds 是世界包围盒,空选中时 null)", doc: "选中集一次取全:读数(ids / count / pointCount / lineCount / channelCount)加要素本身(points / lines / channels(按通道去重,与 getData() 同一批对象)),另有 items(与 getSelections() 同一份)、pointIndexes / lineIndexes 与 bounds(世界包围盒,空选中时 null),见「接口选中(
|
|
136
|
+
{ name: "getSelectionData", kind: "method", params: "无", returns: "GisViewSelectionData:{ ids, count, pointCount, lineCount, channelCount, points, lines, channels, items, pointIndexes, lineIndexes, bounds }(bounds 是世界包围盒,空选中时 null)", doc: "选中集一次取全:读数(ids / count / pointCount / lineCount / channelCount)加要素本身(points / lines / channels(按通道去重,与 getData() 同一批对象)),另有 items(与 getSelections() 同一份)、pointIndexes / lineIndexes 与 bounds(世界包围盒,空选中时 null),见「接口选中(selectFeatures)与读回选中」", examples: [{"group":"选中、复制与合并","code":"// getSelections() / getSelectionData() / isSelected(ref):读回选中\nconst picks = view.getSelections()\nconst selection = view.getSelectionData() // { ids, count, points, lines, channels, bounds, … }\nconst selected = view.isSelected('a')\n","from":"header"}] },
|
|
136
137
|
{ name: "selectInBox", kind: "method", params: "box: GisViewRect 画布 CSS 像素矩形 { x, y, width, height }(与手动框选同一套坐标);options?: GisViewSelectInBoxOptions:selectionKinds 临时覆盖这一次的类型过滤('point' / 'line' / 'channel'、数组、'all' / true / false / null),originalEvent 原样带进 onSelect;第二段也兼容旧的 Event 写法", returns: "this", doc: "按画布 CSS 像素矩形框选,等价于 Shift + 拖动(跟随 shortcuts.boxSelect);options.selectionKinds 可只覆盖这一次的节点 / 线路 / 通道类型过滤", examples: [{"group":"选中、复制与合并","code":"// selectInBox(box, options?):用矩形框选(画布 CSS 像素,与手动框选同一套判定)\nview.selectInBox({ x: 40, y: 40, width: 320, height: 200 })\nview.selectInBox({ x: 40, y: 40, width: 320, height: 200 }, { selectionKinds: ['line', 'channel'] })\n","from":"header"}] },
|
|
137
138
|
{ name: "beginCopyPoint", kind: "method", params: "options: GisViewCopyStartOptions:id / index(复制哪个节点)、label(历史里这一步的名字)、style(草稿样式)", returns: "GisViewPointCopyPayload | null", doc: "开始复制一个节点:给 id / index 直接出预览(commit: true 出预览即落地,follow: true 跟随鼠标,autoCommit: false 停在预览态),不给来源就是「先点按钮再选节点」模式,见「节点复制」", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.beginCopyPoint({ id: 'a' }) // 出复制预览(跟着鼠标走)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 改预览节点的数据\nview.commitPointCopy() // 落地\nview.cancelPointCopy() // 取消\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
|
|
138
139
|
{ name: "commitPointCopy", kind: "method", params: "无", returns: "GisViewPointCopyPayload | null", doc: "落地 / 取消预览中的复制(返回 end / cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.beginCopyPoint({ id: 'a' }) // 出复制预览(跟着鼠标走)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 改预览节点的数据\nview.commitPointCopy() // 落地\nview.cancelPointCopy() // 取消\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
|
|
@@ -149,12 +150,11 @@ export const API_SECTIONS = [
|
|
|
149
150
|
{ name: "getPointClipboard", kind: "method", params: "无", returns: "GisViewClipboardItem | null", doc: "剪贴板:copyPointToClipboard 默认收当前选中的全部节点(只有没选中才回落到光标下的那个),copyPointsToClipboard 只认给定 / 选中的一批;Ctrl+V 时单节点且没有内部线路 / 通道仍走原预览,多节点或带线路 / 通道走整组落地,pastePoints 强制整组(单节点也走批量载荷)。getPointClipboard() 读 count / sources / items / lines / channels / anchor 快照,见「节点复制」", examples: [{"group":"选中、复制与合并","code":"// copyPoint(source?) / copyPoints(sources?, options?) / copySelectedPoints(options?) / copyPointToClipboard(sources?, options?) / copyPointsToClipboard(sources?, options?) / pastePoint(options?) / pastePoints(options?) / getPointClipboard()\nconst copyItem = view.copyPoint('a') // 一步到位,落在原位置旁边\nconst batchCopy = view.copyPoints(['a', 'b'], { select: true }) // 只复制这两个节点(不带未选中的线路 / 通道)\nconst selectedCopy = view.copySelectedPoints({ coordinate: [120, 80] }) // 复制当前选中集:节点 + 选中线路 / 通道\nview.copySelectedPoints({ withLines: true, withChannels: true }) // 恢复旧口径:来源内部线路 / 通道全带\nview.copyPoints(['a', 'b'], { lineIndexes: [0], channelIndexes: [1] }) // 再显式点名线路 / 通道\nview.copyPointToClipboard('a') // 收进剪贴板(默认整个选中集,Ctrl+C 的接口写法)\nview.copyPointsToClipboard(['a', 'b', 'c']) // 只把给定的一批收进剪贴板\nview.pastePoint({ screen: [320, 200] }) // 粘到光标处(Ctrl+V 的接口写法)\nview.pastePoint({ coordinate: [120, 80], offset: [40, 0] })\nconst pastedBatch = view.pastePoints({ coordinate: [160, 100] }) // 强制整组落地(单节点也走批量路)\nconsole.log(batchCopy.count, batchCopy.lines.length, selectedCopy.indexes, pastedBatch?.count)\nconst clipboard = view.getPointClipboard()\n","from":"header"}] },
|
|
150
151
|
{ name: "mergePoints", kind: "method", params: "source: GisViewPointRef 被并入的节点(并完就没了)、target: GisViewPointRef 接收的节点、options?: { originalEvent?: Event | null; item?: GisViewPoint }:item 可以给一份已经改好的合并结果(确认阶段改过 payload.item 之后就是它)", returns: "GisViewMergeOutcome", doc: "把来源节点并进目标节点(接口调用,不做确认):来源 / 目标收 id、下标或 { id } / { index },节点数据按 merge.createItem 合并(缺省目标优先、尺寸取双方最大、图标优先目标),改线路绑定、删自环 / 零长线 / 自环通道、把撞成同一条的通道合成一条,返回 { ok, item, linesChanged, removedLines, removedChannels, mergedChannels };并不了返回 ok: false 并另发一条失败事件,见「节点合并」", examples: [{"group":"选中、复制与合并","code":"// mergePoints(source, target, options?):把 source 并进 target(接口调用,不做确认)\nconst merged = view.mergePoints('a', 'b')\nconst mergedCustom = view.mergePoints('a', 'b', { item: { name: '合并结果', size: 12 } })\n","from":"header"}] },
|
|
151
152
|
{ name: "mergeSelectedPoints", kind: "method", params: "options: GisViewMergeSelectedOptions:target 指定并到哪一个(不给就自动挑绑定线路最多的);sources 直接给来源(不依赖选中集);item 是最终节点补丁或 (context) => 补丁(上下文含 item / merged / source / target / sourceIndex / targetIndex / merge / view;坐标与 id 仍按 target 保留);force: true 越过 mergeable: false;label / originalEvent", returns: "GisViewMergeSelectedOutcome", doc: "框选 / 多选之后一步把选中的节点并到一个目标上(接口调用):target 不指定就自动挑绑定线路最多的那一个(一样多取画得大的、再取下标小的),来源默认是除目标之外的选中节点、也可以用 sources(id / 下标 / { id } / { index },单个或数组)直接给 —— 这时不用先选中;mergeable: false 默认跳过(force: true 越过)、label 改这一步历史的标签。多个来源合成一步历史(数据变更收成一条 batch),返回 { phase: 'mergeSelected', ok, reason, target, merged, skipped, sourcesMerged, linesChanged, removedLines, removedChannels, mergedChannels, channelsChanged },见「节点合并」", examples: [{"group":"选中、复制与合并","code":"// mergeSelectedPoints(options?):框选 / 多选之后一次并完(目标缺省挑绑定线路最多的那个)\nconst mergedAll = view.mergeSelectedPoints()\nview.mergeSelectedPoints({ target: 'b', sources: ['a', 'c'], force: true })\n","from":"header"}] },
|
|
152
|
-
{ name: "
|
|
153
|
-
{ name: "
|
|
154
|
-
{ name: "
|
|
155
|
-
{ name: "
|
|
156
|
-
{ name: "
|
|
157
|
-
{ name: "revertPointMerge", kind: "method", params: "options?: { originalEvent?: Event | null; silent?: boolean }:silent: true 时不再补发一条 cancel 载荷", returns: "GisViewPointMergePayload | null", doc: "读 / 裁决 / 收尾当前待确认的合并(把一个节点拖到另一个节点上之后):resolvePointMerge(true, { keep, item }) / confirmPointMerge({ keep, item }) 推进到 confirm 阶段 —— keep 选保留碰撞目标(缺省)还是拖动的来源,item 改写最终节点的信息与样式,位置 / id 始终取保留端;resolvePointMerge(false) / cancelPointMerge() 让拖动的节点回原位。pending / confirm / getPointMerge() 的载荷带 impact(受影响线路条数、具体 lineIds 与通道读数;lineCount 按线路去重,linesChanged / removedLines 与落地结果同口径)。自己接管数据落地时用 commitPointMerge() 收状态、revertPointMerge() 还原(silent: true 不补发 cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// getPointMerge() / resolvePointMerge(confirmed?, options?) / confirmPointMerge(options?) / cancelPointMerge() / commitPointMerge() / revertPointMerge()\nconst pendingMerge = view.getPointMerge() // 待确认的那一份载荷(没有就是 null)\nconsole.log(pendingMerge?.impact?.lineCount) // 这次合并会影响几条线路(改写 + 删除,按线路去重)\nconsole.log(pendingMerge?.impact?.lineIds) // 具体是哪几条(没有 id 时是 lines 下标)\nview.resolvePointMerge(true) // 确认(false = 取消)\nview.resolvePointMerge(true, { keep: 'source', item: { name: '合并结果', size: 18 } })\nview.confirmPointMerge({ keep: 'target', item: { color: '#2f6fd0', strokeColor: '#ffffff' } })\nview.cancelPointMerge() // 取消的别名(拖动的节点回原位,数据不动)\nview.commitPointMerge() // 自己接管数据时收尾\nview.revertPointMerge() // 反悔(silent: true 时不补发 cancel 载荷)\n","from":"header"}] },
|
|
153
|
+
{ name: "splitPoint", kind: "method", params: "source: GisViewPointRef 要拆的节点;parts: GisViewSplitPointPart[] 至少两份,每份可直接写节点字段或放进 item,并用 lines / channels / channelFrom / channelTo 分配线路与通道端点;options?: GisViewSplitPointOptions:keepSourceId(缺省 true,第一份沿用来源 id)/ label", returns: "GisViewSplitPointOutcome:{ ok, reason, source, items, indexes, pointIds, linesChanged, removedLines, removedLineIds, removedLineIndexes, channelsChanged, removedChannels, removedChannelIds, skipped, changes };changes 可直接作为后端事务输入", doc: "mergePoints 的逆操作:把一个节点拆成两份或更多(第一份接在原下标上、缺省沿用原 id,其余追加到末尾),按每份的 item / 顶层字段生成新节点,按 lines 分配线路、按 channels / channelFrom / channelTo 分配受影响通道的两端。没显式分配的线路跟第一份;没显式分配的通道端点跟它第一条被分配过的成员回线。线路的 from / to 与和来源坐标重合的 start / end / path 顶点改到对应新节点;拆完后的自环 / 零长度线路与两端落到同一份的通道删掉,成员全没了的通道也删掉。整次调用只记一条历史、只发一条 splitPoint 数据变更,返回的 changes 可直接作为后端事务输入;至少两份、坐标必须有效、线路不能重复分配,写错时 ok: false 并在 reason 说明", examples: [{"group":"选中、复制与合并","code":"// splitPoint(source, parts, options?):把一个节点拆成多份(mergePoints 的逆操作)\nconst splitResult = view.splitPoint('a', [\n { x: 0, y: 0, name: '甲站(主)' }, // 第一份沿用原下标 / id\n { x: 80, y: 40, name: '甲站(东)', lines: ['l1'] } // 显式分给第二份;未分配的线路跟第一份\n], { label: '拆分甲站' })\nconsole.log(splitResult.pointIds, splitResult.linesChanged, splitResult.changes)\n","from":"header"}] },
|
|
154
|
+
{ name: "getPointMerge", kind: "method", params: "无(载荷带 impact:lineCount / linesChanged / removedLines / lineIds / removedLineIds 与通道读数,确认前就能估算影响)", returns: "GisViewPointMergePayload | null", doc: "读 / 裁决 / 收尾当前待确认的合并(把一个节点拖到另一个节点上之后):resolvePointMerge(true, { keep, item }) 推进到 confirm 阶段 —— keep 选保留碰撞目标(缺省)还是拖动的来源,item 改写最终节点的信息与样式,位置 / id 始终取保留端;resolvePointMerge(false) 让拖动的节点回原位。pending / confirm / getPointMerge() 的载荷带 impact(受影响线路条数、具体 lineIds 与通道读数;lineCount 按线路去重,linesChanged / removedLines 与落地结果同口径)。自己接管数据落地时用 commitPointMerge() 收状态、revertPointMerge() 还原(silent: true 不补发 cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// getPointMerge() / resolvePointMerge(confirmed?, options?) / commitPointMerge() / revertPointMerge()\nconst pendingMerge = view.getPointMerge() // 待确认的那一份载荷(没有就是 null)\nconsole.log(pendingMerge?.impact?.lineCount) // 这次合并会影响几条线路(改写 + 删除,按线路去重)\nconsole.log(pendingMerge?.impact?.lineIds) // 具体是哪几条(没有 id 时是 lines 下标)\nview.resolvePointMerge(true) // 确认(false = 取消)\nview.resolvePointMerge(true, { keep: 'source', item: { name: '合并结果', size: 18 } })\nview.resolvePointMerge(true, { keep: 'target', item: { color: '#2f6fd0', strokeColor: '#ffffff' } })\nview.resolvePointMerge(false) // 取消(拖动的节点回原位,数据不动)\nview.commitPointMerge() // 自己接管数据时收尾\nview.revertPointMerge() // 反悔(silent: true 时不补发 cancel 载荷)\n","from":"header"}] },
|
|
155
|
+
{ name: "resolvePointMerge", kind: "method", params: "confirmed?: boolean(缺省 true = 确认,false = 取消);options?: GisViewPointMergeConfirmOptions:keep 选 'target'(缺省,保留碰撞目标)/ 'source'(保留拖动的来源),item 是最终节点字段补丁(名称 / 分区 / 颜色 / 尺寸 / 图标 / 描边等;位置与 id 始终取保留端)", returns: "GisViewPointMergePayload | null", doc: "读 / 裁决 / 收尾当前待确认的合并(把一个节点拖到另一个节点上之后):resolvePointMerge(true, { keep, item }) 推进到 confirm 阶段 —— keep 选保留碰撞目标(缺省)还是拖动的来源,item 改写最终节点的信息与样式,位置 / id 始终取保留端;resolvePointMerge(false) 让拖动的节点回原位。pending / confirm / getPointMerge() 的载荷带 impact(受影响线路条数、具体 lineIds 与通道读数;lineCount 按线路去重,linesChanged / removedLines 与落地结果同口径)。自己接管数据落地时用 commitPointMerge() 收状态、revertPointMerge() 还原(silent: true 不补发 cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// getPointMerge() / resolvePointMerge(confirmed?, options?) / commitPointMerge() / revertPointMerge()\nconst pendingMerge = view.getPointMerge() // 待确认的那一份载荷(没有就是 null)\nconsole.log(pendingMerge?.impact?.lineCount) // 这次合并会影响几条线路(改写 + 删除,按线路去重)\nconsole.log(pendingMerge?.impact?.lineIds) // 具体是哪几条(没有 id 时是 lines 下标)\nview.resolvePointMerge(true) // 确认(false = 取消)\nview.resolvePointMerge(true, { keep: 'source', item: { name: '合并结果', size: 18 } })\nview.resolvePointMerge(true, { keep: 'target', item: { color: '#2f6fd0', strokeColor: '#ffffff' } })\nview.resolvePointMerge(false) // 取消(拖动的节点回原位,数据不动)\nview.commitPointMerge() // 自己接管数据时收尾\nview.revertPointMerge() // 反悔(silent: true 时不补发 cancel 载荷)\n","from":"header"}] },
|
|
156
|
+
{ name: "commitPointMerge", kind: "method", params: "无", returns: "boolean", doc: "读 / 裁决 / 收尾当前待确认的合并(把一个节点拖到另一个节点上之后):resolvePointMerge(true, { keep, item }) 推进到 confirm 阶段 —— keep 选保留碰撞目标(缺省)还是拖动的来源,item 改写最终节点的信息与样式,位置 / id 始终取保留端;resolvePointMerge(false) 让拖动的节点回原位。pending / confirm / getPointMerge() 的载荷带 impact(受影响线路条数、具体 lineIds 与通道读数;lineCount 按线路去重,linesChanged / removedLines 与落地结果同口径)。自己接管数据落地时用 commitPointMerge() 收状态、revertPointMerge() 还原(silent: true 不补发 cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// getPointMerge() / resolvePointMerge(confirmed?, options?) / commitPointMerge() / revertPointMerge()\nconst pendingMerge = view.getPointMerge() // 待确认的那一份载荷(没有就是 null)\nconsole.log(pendingMerge?.impact?.lineCount) // 这次合并会影响几条线路(改写 + 删除,按线路去重)\nconsole.log(pendingMerge?.impact?.lineIds) // 具体是哪几条(没有 id 时是 lines 下标)\nview.resolvePointMerge(true) // 确认(false = 取消)\nview.resolvePointMerge(true, { keep: 'source', item: { name: '合并结果', size: 18 } })\nview.resolvePointMerge(true, { keep: 'target', item: { color: '#2f6fd0', strokeColor: '#ffffff' } })\nview.resolvePointMerge(false) // 取消(拖动的节点回原位,数据不动)\nview.commitPointMerge() // 自己接管数据时收尾\nview.revertPointMerge() // 反悔(silent: true 时不补发 cancel 载荷)\n","from":"header"}] },
|
|
157
|
+
{ name: "revertPointMerge", kind: "method", params: "options?: { originalEvent?: Event | null; silent?: boolean }:silent: true 时不再补发一条 cancel 载荷", returns: "GisViewPointMergePayload | null", doc: "读 / 裁决 / 收尾当前待确认的合并(把一个节点拖到另一个节点上之后):resolvePointMerge(true, { keep, item }) 推进到 confirm 阶段 —— keep 选保留碰撞目标(缺省)还是拖动的来源,item 改写最终节点的信息与样式,位置 / id 始终取保留端;resolvePointMerge(false) 让拖动的节点回原位。pending / confirm / getPointMerge() 的载荷带 impact(受影响线路条数、具体 lineIds 与通道读数;lineCount 按线路去重,linesChanged / removedLines 与落地结果同口径)。自己接管数据落地时用 commitPointMerge() 收状态、revertPointMerge() 还原(silent: true 不补发 cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// getPointMerge() / resolvePointMerge(confirmed?, options?) / commitPointMerge() / revertPointMerge()\nconst pendingMerge = view.getPointMerge() // 待确认的那一份载荷(没有就是 null)\nconsole.log(pendingMerge?.impact?.lineCount) // 这次合并会影响几条线路(改写 + 删除,按线路去重)\nconsole.log(pendingMerge?.impact?.lineIds) // 具体是哪几条(没有 id 时是 lines 下标)\nview.resolvePointMerge(true) // 确认(false = 取消)\nview.resolvePointMerge(true, { keep: 'source', item: { name: '合并结果', size: 18 } })\nview.resolvePointMerge(true, { keep: 'target', item: { color: '#2f6fd0', strokeColor: '#ffffff' } })\nview.resolvePointMerge(false) // 取消(拖动的节点回原位,数据不动)\nview.commitPointMerge() // 自己接管数据时收尾\nview.revertPointMerge() // 反悔(silent: true 时不补发 cancel 载荷)\n","from":"header"}] },
|
|
158
158
|
{ name: "removePoints", kind: "method", params: "refs: | GisViewFeatureRef | 数组 | 'all' | 'selection' | 'visible' 要删哪些节点;options?: { reason?: string } 记进事件载荷的删除原因", returns: "GisViewRemovePointsOutcome", doc: "移除节点(接口调用):'a' / { index: 2 } / 数组都收,绑在它上面的线路一并删掉、声明了它当端点的整条通道(含成员回线)跟着删,返回 { ok, indexes, items, removedLines, removedChannels }", examples: [{"group":"选中、复制与合并","code":"// removePoints(refs, options?):删节点 —— 一个、多个、按条件都认(绑在它上面的线路 / 通道一起删)\nview.removePoints('a') // 一个(id)\nview.removePoints(['a', 'b']) // 多个(id 数组)\nview.removePoints({ index: 2 }) // 按下标\nview.removePoints([{ id: 'a' }, { index: 1 }]) // 混合一批\nview.removePoints('selection') // 删选中的\nview.removePoints('visible') // 删当前可见的\nview.removePoints('all') // 全删\nview.removePoints('a', { reason: '误建' }) // 原因会带进数据变更载荷\n","from":"header"}] },
|
|
159
159
|
{ name: "removeSelected", kind: "method", params: "options?: { reason?: string } 同上", returns: "GisViewRemoveSelectedOutcome", doc: "移除当前选中的那一批(工具栏「删除选中」同一条路):选中的节点连同绑在它们身上的线路一起删、剩下的选中回线也删掉,删完清空选中;返回 { ok, reason, pointIndexes, lineIndexes, pointIds, lineIds, points, lines, removedChannels }(lineIds 里也含「因为节点被删而连带走掉」的线路),没有选中东西时 ok: false 并带回原因。一次调用只落一条历史、只发一条 removeSelected 数据变更", examples: [{"group":"选中、复制与合并","code":"// removeSelected(options?):删「当前选中的东西」(节点 / 线路 / 拐点按各自口径)\nview.removeSelected()\nview.removeSelected({ reason: '按 Delete 确认' })\n","from":"header"}] },
|
|
160
160
|
{ name: "requestRemove", kind: "method", params: "options?: { originalEvent?: Event | null } 原样带进载荷(键盘触发时是那一次 keydown)", returns: "GisViewRemoveOutcome", doc: "发起一次删除(Delete 键同一条路):把选中的拐点 / 线路 / 节点与它们的连带影响摊成一份载荷交给 onRemove / 'remove',停在 pending 等裁决(确认方式见 remove.confirm),没有可删的东西时返回 { phase: 'empty', ok: false, reason },见「删除(remove)」", examples: [{"group":"选中、复制与合并","code":"// requestRemove(options?) / getRemoveRequest() / resolveRemove(scope?) / cancelRemove():先出载荷、再裁决\nconst removePayload = view.requestRemove() // 发一条 phase: 'pending' 的 onRemove 载荷\nconst pendingRemove = view.getRemoveRequest() // 从外面拿这一份(没有就是 null)\nview.resolveRemove('channels') // 按范围确认:'lines' / 'groups' / 'channels'\nview.resolveRemove() // 按载荷里的 scope 确认\nview.cancelRemove() // 取消(数据一个字节都不动)","from":"header"}] },
|
|
@@ -189,20 +189,21 @@ export const API_SECTIONS = [
|
|
|
189
189
|
{ name: "addChannelGroupWaypoint", kind: "method", params: "channelId 通道 id;groupId 分组 id;coordinate 新拐点世界坐标", returns: "this", doc: "给某个分组加拐点、把这一组单独拉走:不给坐标就按默认位置放一个(第 n 组沿法线往外让 n 档),其余分组一根拐点都不动,见「分组拐点」", examples: [{"group":"拐点与通道","code":"// addChannelGroupWaypoint(channelId, groupId, coordinate) / removeChannelGroupWaypoint(channelId, groupId, pathIndex)\nview.addChannelGroupWaypoint('c1', 'c1::2', [200, 120])\nview.removeChannelGroupWaypoint('c1', 'c1::2', 1)\n","from":"header"}] },
|
|
190
190
|
{ name: "removeChannelGroupWaypoint", kind: "method", params: "channelId / groupId / pathIndex 要删的骨架顶点下标", returns: "this", doc: "删掉某个分组的拐点(缺省删最后一个)", examples: [{"group":"拐点与通道","code":"// addChannelGroupWaypoint(channelId, groupId, coordinate) / removeChannelGroupWaypoint(channelId, groupId, pathIndex)\nview.addChannelGroupWaypoint('c1', 'c1::2', [200, 120])\nview.removeChannelGroupWaypoint('c1', 'c1::2', 1)\n","from":"header"}] },
|
|
191
191
|
{ name: "runChannelAction", kind: "method", params: "actionId: GisViewChannelActionId 动作名('select-group' / 'deselect-group' / 'add-waypoint' / 'remove-waypoint' / 'split' / 'merge',见 getChannelContext().actions);options?: GisViewChannelActionOptions 动作自己的参数(groupId / lineId / coordinate…)", returns: "GisViewChannelContext | null", doc: "执行右键交互框里的动作:select-group / deselect-group / add-waypoint / remove-waypoint / split / merge(options 带 channelId / groupId / coordinate / pathIndex / size),返回执行之后的上下文", examples: [{"group":"拐点与通道","code":"// setCurrentChannelGroup(channelId, groupId) / runChannelAction(actionId, options?):当前分组与动作\nview.setCurrentChannelGroup('c1', 'c1::2')\nview.setCurrentChannelGroup('c1', null) // 不选中\nview.runChannelAction('select-group', { groupId: 'c1::2' })\nview.runChannelAction('split', { lineId: 'l2' })\n","from":"header"}] },
|
|
192
|
-
{ name: "beginAddChannel", kind: "method", params: "options?: GisViewChannelDraftOptions 草稿配置:kind / circuits / autoCommit / continuous / chain / name / lineId / lineProps / linePropsByMember / lineItems(第二段)/ channelProps / handoff(交接模式)/ select(点中的节点顺手选中,走 onSelect 那一套)", returns: "this(只负责那条示例假通道,真正新增走 addChannel)", doc: "进入「新增通道」:点第一个节点当起点,一条线跟随光标,点第二个节点出方案;options 支持 kind('channel' 新建通道 / 'line' 新建独立线路,缺省 'channel')/ circuits(一次加几条,缺省 1)/ autoCommit / continuous / chain / name / lineId / lineProps / lineItems(第二段,连同线路一起新建)/ channelProps / handoff(交接模式:ready 发完收起草稿,自己调 addChannel 落地)/ select(点中的节点顺手选中),见「新增通道」", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({
|
|
193
|
-
{ name: "getAddChannelDraft", kind: "method", params: "无", returns: "GisViewChannelDraftPayload | null", doc: "当前新增通道草稿(两个节点的信息与可选方案),没有草稿时为 null", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({
|
|
194
|
-
{ name: "
|
|
195
|
-
{ name: "
|
|
196
|
-
{ name: "
|
|
197
|
-
{ name: "
|
|
192
|
+
{ name: "beginAddChannel", kind: "method", params: "options?: GisViewChannelDraftOptions 草稿配置:kind / circuits / autoCommit / continuous / chain / name / lineId / lineProps / linePropsByMember / lineItems(第二段)/ routing / path(中间拐点)/ channelProps / channelDraftStyle(本次草稿的预览样式)/ handoff(交接模式)/ select(点中的节点顺手选中,走 onSelect 那一套)", returns: "this(只负责那条示例假通道,真正新增走 addChannel)", doc: "进入「新增通道」:点第一个节点当起点,一条线跟随光标,点第二个节点出方案;options 支持 kind('channel' 新建通道 / 'line' 新建独立线路,缺省 'channel')/ circuits(一次加几条,缺省 1)/ autoCommit / continuous / chain / name / lineId / lineProps / lineItems(第二段,连同线路一起新建)/ routing('straight' / 'orthogonal')/ path(中间拐点)/ channelProps / channelDraftStyle(本次草稿的预览样式)/ handoff(交接模式:ready 发完收起草稿,自己调 addChannel 落地)/ select(点中的节点顺手选中),见「新增通道」", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\n kind: 'channel',\n circuits: 3,\n channelDraftStyle: {\n color: '#2f6fd0', width: 2.5, arrow: true, arrowSize: 14, arrowPositions: [0, 0.5, 1],\n circuitSpacing: 12, opacity: 0.9\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\nview.commitAddChannel() // 两个节点选完后落地(resolution 缺省用推荐方案)\nview.commitAddChannel({ type: 'joinGroup', groupId: 'c1::2' }) // 指定方案\nview.continueAddChannel({ kind: 'line' }) // 连续模式下开下一段(也能换这一段加什么)\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
|
|
193
|
+
{ name: "getAddChannelDraft", kind: "method", params: "无", returns: "GisViewChannelDraftPayload | null", doc: "当前新增通道草稿(两个节点的信息与可选方案),没有草稿时为 null", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\n kind: 'channel',\n circuits: 3,\n channelDraftStyle: {\n color: '#2f6fd0', width: 2.5, arrow: true, arrowSize: 14, arrowPositions: [0, 0.5, 1],\n circuitSpacing: 12, opacity: 0.9\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\nview.commitAddChannel() // 两个节点选完后落地(resolution 缺省用推荐方案)\nview.commitAddChannel({ type: 'joinGroup', groupId: 'c1::2' }) // 指定方案\nview.continueAddChannel({ kind: 'line' }) // 连续模式下开下一段(也能换这一段加什么)\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
|
|
194
|
+
{ name: "updateAddChannelStyle", kind: "method", params: "patch?: GisViewChannelDraftStyle | null 字段级合并的预览样式(箭头位置 / 多回线间距 / 自绘等);传 null 回到全局 channelDraftStyle", returns: "this", doc: "字段级合并当前草稿的预览样式(color / width / dot / dotColor / arrow / arrowSize / arrowPositions / arrowReverse / arrowColor / circuitSpacing / opacity / customDraw);传 null 回到全局 channelDraftStyle,没有草稿时什么也不做", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\n kind: 'channel',\n circuits: 3,\n channelDraftStyle: {\n color: '#2f6fd0', width: 2.5, arrow: true, arrowSize: 14, arrowPositions: [0, 0.5, 1],\n circuitSpacing: 12, opacity: 0.9\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\nview.commitAddChannel() // 两个节点选完后落地(resolution 缺省用推荐方案)\nview.commitAddChannel({ type: 'joinGroup', groupId: 'c1::2' }) // 指定方案\nview.continueAddChannel({ kind: 'line' }) // 连续模式下开下一段(也能换这一段加什么)\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
|
|
195
|
+
{ name: "continueAddChannel", kind: "method", params: "options?: GisViewChannelDraftOptions 开下一段草稿(写法与 beginAddChannel 一致,不传就沿用这一段原来的)", returns: "this", doc: "开下一段草稿:连续模式落地时内部自动调(发 phase: 'restart'),也可以手动调;草稿已经退出时按 options 重新进来", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\n kind: 'channel',\n circuits: 3,\n channelDraftStyle: {\n color: '#2f6fd0', width: 2.5, arrow: true, arrowSize: 14, arrowPositions: [0, 0.5, 1],\n circuitSpacing: 12, opacity: 0.9\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\nview.commitAddChannel() // 两个节点选完后落地(resolution 缺省用推荐方案)\nview.commitAddChannel({ type: 'joinGroup', groupId: 'c1::2' }) // 指定方案\nview.continueAddChannel({ kind: 'line' }) // 连续模式下开下一段(也能换这一段加什么)\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
|
|
196
|
+
{ name: "cancelAddChannel", kind: "method", params: "无", returns: "this(收掉草稿并补一条 phase: 'cancel')", doc: "取消新增通道(草稿期间按 Esc 等价,会补一条 phase: 'cancel')", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\n kind: 'channel',\n circuits: 3,\n channelDraftStyle: {\n color: '#2f6fd0', width: 2.5, arrow: true, arrowSize: 14, arrowPositions: [0, 0.5, 1],\n circuitSpacing: 12, opacity: 0.9\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\nview.commitAddChannel() // 两个节点选完后落地(resolution 缺省用推荐方案)\nview.commitAddChannel({ type: 'joinGroup', groupId: 'c1::2' }) // 指定方案\nview.continueAddChannel({ kind: 'line' }) // 连续模式下开下一段(也能换这一段加什么)\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
|
|
197
|
+
{ name: "endAddChannel", kind: "method", params: "无", returns: "this(静默收掉视图上的示例假通道 / 线路,数据不动、不补事件)", doc: "结束新增通道:静默收掉视图上的示例假通道 / 线路(不补 cancel 事件),数据一个字节都不改 —— 结束事件里决定「不新建了」就用它", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\n kind: 'channel',\n circuits: 3,\n channelDraftStyle: {\n color: '#2f6fd0', width: 2.5, arrow: true, arrowSize: 14, arrowPositions: [0, 0.5, 1],\n circuitSpacing: 12, opacity: 0.9\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\nview.commitAddChannel() // 两个节点选完后落地(resolution 缺省用推荐方案)\nview.commitAddChannel({ type: 'joinGroup', groupId: 'c1::2' }) // 指定方案\nview.continueAddChannel({ kind: 'line' }) // 连续模式下开下一段(也能换这一段加什么)\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
|
|
198
|
+
{ name: "commitAddChannel", kind: "method", params: "resolution?: GisViewChannelAddResolution 落地方式('channel' / 'line',缺省看草稿);options?: GisViewChannelAddInput 要覆盖的字段(name / circuits / colors / lineWidth / routing / path…)", returns: "GisViewChannelAddResult", doc: "", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?) / commitAddChannel(resolution?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\n kind: 'channel',\n circuits: 3,\n channelDraftStyle: {\n color: '#2f6fd0', width: 2.5, arrow: true, arrowSize: 14, arrowPositions: [0, 0.5, 1],\n circuitSpacing: 12, opacity: 0.9\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\nview.commitAddChannel() // 两个节点选完后落地(resolution 缺省用推荐方案)\nview.commitAddChannel({ type: 'joinGroup', groupId: 'c1::2' }) // 指定方案\nview.continueAddChannel({ kind: 'line' }) // 连续模式下开下一段(也能换这一段加什么)\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
|
|
198
199
|
{ name: "getChannelAddOptions", kind: "method", params: "from / to 两端节点 id;count?: number 回数(缺省 1);kind?: 'channel' | 'line'(缺省 'channel')", returns: "GisViewChannelAddPlan | null", doc: "两个节点之间的新增方案:新通道 / 新分组 / 并进某一组 / 无法添加;count 是这一次要加的回数(余量按它判),kind: 'line' 时方案表为空(独立线路不挑方案)", examples: [{"group":"拐点与通道","code":"// getChannelAddOptions(from, to, count?, kind?):两个节点之间能怎么加(界面拿它让用户选)\nconst plan = view.getChannelAddOptions('a', 'b', 2)\nconst linePlan = view.getChannelAddOptions('a', 'b', 1, 'line')\n","from":"header"}] },
|
|
199
200
|
{ name: "getChannelBetween", kind: "method", params: "from / to 两端节点 id", returns: "GisViewChannelBetween | null", doc: "两个节点之间的通道读数(只读):有通道时 hasChannel: true,channelId / channelIndex / groupCount / currentGroupId 与 groups / group / channel(id / name / lineIds / 分组明细)都给全;没有通道时 hasChannel: false、channel: null、groups: [],端点认不出来返回 null —— 与 getChannelAddOptions 的读数同一份,界面做「这两个点之间已经有通道 / 有几组」的判断用它,不必算方案表", examples: [{"group":"拐点与通道","code":"// getChannelBetween(from, to):只要通道读数 —— 有没有通道 / 几组 / 当前哪组(不做方案判断,端点认不出返回 null)\nconst between = view.getChannelBetween('a', 'b')\nif (between?.hasChannel) {\n console.log(between.channelId, between.groupCount, between.groups.map(group => group.id), between.currentGroupId)\n}\n","from":"header"}] },
|
|
200
|
-
{ name: "addChannel", kind: "method", params: "channel: GisViewChannelAddSpec 通道信息 { from, to, name?, id?, lineData?, group? }(后两个是第二 / 第三段写在对象上的别名);lineData?: GisViewChannelLineData 线路数组(Partial<GisViewLine> / string / number 的一条或一批,按每项 id 建 lineIds);group?: GisViewChannelAddGroup | GisViewChannelAddGroup[] 可选分组信息 { id?, lineIds?, path? }。旧写法 addChannel(input, lineItems?)(GisViewChannelAddInput:circuits / resolution / channelId / groupId / groupIndex / kind
|
|
201
|
+
{ name: "addChannel", kind: "method", params: "channel: GisViewChannelAddSpec 通道信息 { from, to, name?, id?, lineData?, group? }(后两个是第二 / 第三段写在对象上的别名);lineData?: GisViewChannelLineData 线路数组(Partial<GisViewLine> / string / number 的一条或一批,按每项 id 建 lineIds);group?: GisViewChannelAddGroup | GisViewChannelAddGroup[] 可选分组信息 { id?, lineIds?, path? }。旧写法 addChannel(input, lineItems?)(GisViewChannelAddInput:circuits / resolution / channelId / groupId / groupIndex / kind / routing / path 那套)照样认;path 是中间拐点,独立线路落地成完整折线、通道只写骨架拐点", returns: "GisViewChannelAddResult(channelLineIds 是落地后通道的完整成员表,独立线路为 null)", doc: "程序化新增通道(新签名,只新建):第一段通道信息(from / to / name / id / path 等通道字段),第二段线路数组 line_data —— 一条或一批(字符串 / 数字按 id 认),按每项 id 建 lineIds,第三段可选分组信息({ id?, lineIds?, path? },单个 / 一组一个)—— 第二段 / 第三段显式给了才走这条新路;两个节点之间已经有通道时整条失败(reason 指路下面两条)。旧写法 addChannel(input, lineItems?)(带 circuits / resolution / channelId / groupId / groupIndex / kind,或只写 { from, to })照样认:按方案表新建或并进已有通道,第二段 lineItems 给了几条就建几条", examples: [{"group":"拐点与通道","code":"// addChannel(spec, lineData?, group?) / addChannels(input, options?) / addChannelGroups(channelId, groups, options?) / addLine(input):程序化新增\nconst channelAdd = view.addChannel({ from: 'a', to: 'b', name: '二号通道', path: [[200, 120]] }, [{ id: 'm-1' }, { id: 'm-2' }])\nconst manyChannels = view.addChannels([{ from: 'a', to: 'b', circuits: 1 }, { from: 'b', to: 'a', circuits: 2, kind: 'line' }])\nconst manyGroups = view.addChannelGroups('c1', [\n { id: 'c1::4', path: [[130, 70]], lineData: [{ id: 'm-7' }, { id: 'm-8' }] },\n { path: [[150, 90]], lines: ['m-9'] }\n])\nconsole.log(manyGroups.count, manyGroups.lineIds, manyGroups.groupIds)\nconst lineAdd = view.addLine({ from: 'a', to: 'b', name: '三回' })","from":"header"}] },
|
|
201
202
|
{ name: "addChannelGroupLines", kind: "method", params: "channelId 目标通道 id;lineData?: GisViewChannelLineData 这次新建的线路数组(按每项 id 建回线);group?: GisViewChannelAddGroup 新分组信息 { id?, path? }(缺省 ${通道 id}::N、不带拐点)", returns: "GisViewChannelAddResult", doc: "给已有通道新加一组回线(原 addChannel 的 newGroup 那一支):第二段线路数组 line_data 按每项 id 建回线,groupInfo({ id?, path? })给新分组的 id 与中间拐点,缺省 ${通道 id}::N、不带拐点;通道 / 线路认不出来时 ok: false + reason", examples: [{"group":"拐点与通道","code":"// 已经有通道时用拆出来的两条(语义直说,不用自己拼 resolution)\nview.addChannelGroupLines('c1', [{ id: 'm-5' }], { id: 'c1::3' }) // 新加一组\nview.joinChannelGroupLines('c1', 'c1::2', [{ id: 'm-6' }]) // 并进某一组(序号 1 也认)\nconsole.log(joined.channelLineIds) // 更新后这条通道的完整成员表(lineIds)\n","from":"code"}] },
|
|
202
203
|
{ name: "addChannelGroups", kind: "method", params: "channelId 目标通道 id;groups: GisViewChannelAddGroupInput | GisViewChannelAddGroupInput[] 每项 { id?, path?, lineData? | lines? | lineItems? }(线路数据与 addChannel 第二段同一份写法);options?: { emit?: boolean; label?: string } emit: false 只落地不通知", returns: "GisViewAddChannelGroupsResult", doc: "给已有通道一次新加多组回线:groups 每项 { id?, path?, lineData | lines | lineItems },线路数据与 addChannel 第二段同一份写法;逐组落地但只记一步历史、只发一条 addChannelGroups 数据变更,返回 { ok, reason, count, results, lineIds, groupIds, groups },options.emit: false 只落地不通知", examples: [{"group":"拐点与通道","code":"// addChannel(spec, lineData?, group?) / addChannels(input, options?) / addChannelGroups(channelId, groups, options?) / addLine(input):程序化新增\nconst channelAdd = view.addChannel({ from: 'a', to: 'b', name: '二号通道', path: [[200, 120]] }, [{ id: 'm-1' }, { id: 'm-2' }])\nconst manyChannels = view.addChannels([{ from: 'a', to: 'b', circuits: 1 }, { from: 'b', to: 'a', circuits: 2, kind: 'line' }])\nconst manyGroups = view.addChannelGroups('c1', [\n { id: 'c1::4', path: [[130, 70]], lineData: [{ id: 'm-7' }, { id: 'm-8' }] },\n { path: [[150, 90]], lines: ['m-9'] }\n])\nconsole.log(manyGroups.count, manyGroups.lineIds, manyGroups.groupIds)\nconst lineAdd = view.addLine({ from: 'a', to: 'b', name: '三回' })","from":"header"}] },
|
|
203
204
|
{ name: "joinChannelGroupLines", kind: "method", params: "channelId 目标通道 id;groupId?: string | number 并进哪一组(认分组 id 也认序号,从 0 起;不传挑第一个还有余量的分组);lineData?: GisViewChannelLineData 这次新建的线路数组", returns: "GisViewChannelAddResult", doc: "把新回线并进已有通道的某一组(原 addChannel 的 joinGroup 那一支):第二段线路数组 line_data,groupId 认分组 id 也认序号(从 0 起、按声明顺序),不传就挑第一个还有余量的分组", examples: [{"group":"拐点与通道","code":"// 已经有通道时用拆出来的两条(语义直说,不用自己拼 resolution)\nview.addChannelGroupLines('c1', [{ id: 'm-5' }], { id: 'c1::3' }) // 新加一组\nview.joinChannelGroupLines('c1', 'c1::2', [{ id: 'm-6' }]) // 并进某一组(序号 1 也认)\nconsole.log(joined.channelLineIds) // 更新后这条通道的完整成员表(lineIds)\n","from":"code"}] },
|
|
204
|
-
{ name: "addChannels", kind: "method", params: "input: GisViewChannelAddInput | GisViewChannelAddInput[] 一条或一批声明(每条与 addChannel
|
|
205
|
-
{ name: "addLine", kind: "method", params: "input: GisViewChannelAddInput 同上(等价 addChannel({ ...input, kind: 'line' })
|
|
205
|
+
{ name: "addChannels", kind: "method", params: "input: GisViewChannelAddInput | GisViewChannelAddInput[] 一条或一批声明(每条与 addChannel 同一套写法;routing: 'orthogonal' 自动正交折线,path 是中间拐点,独立线路落地成完整 path、通道只写骨架);options?: { emit?: boolean } emit: false 只改数据不发 dataChange", returns: "GisViewAddChannelsResult", doc: "addChannel 的批量版:一次新增多条通道 / 独立线路(每条是新签名或旧写法,逐条各自认;每项的 routing / path 走同一套解析,path 是中间拐点),逐条落地但只重排一次场景、只记一步历史、只发一条 addChannels 数据变更;返回 { ok, count, results, lineIds, channelIds, items },失败条目在各自的 reason 里说明原因、不影响其余条目,options.emit: false 时不发 onDataChange,见「动态换数据与加载完成」", examples: [{"group":"拐点与通道","code":"// addChannel(spec, lineData?, group?) / addChannels(input, options?) / addChannelGroups(channelId, groups, options?) / addLine(input):程序化新增\nconst channelAdd = view.addChannel({ from: 'a', to: 'b', name: '二号通道', path: [[200, 120]] }, [{ id: 'm-1' }, { id: 'm-2' }])\nconst manyChannels = view.addChannels([{ from: 'a', to: 'b', circuits: 1 }, { from: 'b', to: 'a', circuits: 2, kind: 'line' }])\nconst manyGroups = view.addChannelGroups('c1', [\n { id: 'c1::4', path: [[130, 70]], lineData: [{ id: 'm-7' }, { id: 'm-8' }] },\n { path: [[150, 90]], lines: ['m-9'] }\n])\nconsole.log(manyGroups.count, manyGroups.lineIds, manyGroups.groupIds)\nconst lineAdd = view.addLine({ from: 'a', to: 'b', name: '三回' })","from":"header"}] },
|
|
206
|
+
{ name: "addLine", kind: "method", params: "input: GisViewChannelAddInput 同上(等价 addChannel({ ...input, kind: 'line' });routing: 'orthogonal' 自动正交折线,path 是中间拐点,落地成含两端的完整折线);第二段 GisViewChannelLineData 与 addChannel 的线路数组同一份 —— 每项可以只写一个 id(裸字符串 / 数字按 { id } 收)、写对象给逐条字段,不写就按 from-to-序号 自动编号", returns: "GisViewChannelAddResult", doc: "/** * 程序化新增独立线路(不挂通道)。", examples: [{"group":"拐点与通道","code":"// addChannel(spec, lineData?, group?) / addChannels(input, options?) / addChannelGroups(channelId, groups, options?) / addLine(input):程序化新增\nconst channelAdd = view.addChannel({ from: 'a', to: 'b', name: '二号通道', path: [[200, 120]] }, [{ id: 'm-1' }, { id: 'm-2' }])\nconst manyChannels = view.addChannels([{ from: 'a', to: 'b', circuits: 1 }, { from: 'b', to: 'a', circuits: 2, kind: 'line' }])\nconst manyGroups = view.addChannelGroups('c1', [\n { id: 'c1::4', path: [[130, 70]], lineData: [{ id: 'm-7' }, { id: 'm-8' }] },\n { path: [[150, 90]], lines: ['m-9'] }\n])\nconsole.log(manyGroups.count, manyGroups.lineIds, manyGroups.groupIds)\nconst lineAdd = view.addLine({ from: 'a', to: 'b', name: '三回' })","from":"header"}] },
|
|
206
207
|
{ name: "removeLine", kind: "method", params: "lineId: string | number 要删的线路 id", returns: "GisViewRemoveLineResult", doc: "移除一条线路(撤销刚落地的新增线路):挂在通道上的回线会从通道声明里一起摘掉,通道空了整条删掉,返回 { ok, line, lineId, index, channelId, removedChannel }", examples: [{"group":"拐点与通道","code":"// removeLine(lineId) / removeLines(lineIds) / removeChannel(channelId):删线路 / 删多条 / 删整条通道\nview.removeLine('l1')\nview.removeLines(['l1', 'l2'])\nview.removeLines('l1') // 单条也认\nview.removeChannel('c1')","from":"header"}] },
|
|
207
208
|
{ name: "removeLines", kind: "method", params: "lineIds: string | number | 数组 一次删多条", returns: "GisViewRemoveLinesResult", doc: "一次移除多条线路(传数组或单条 id):通道声明与分组跟着收拾、删空的通道整条走,返回 { ok, lineIds, indexes, lines, entries, removedChannels }", examples: [{"group":"拐点与通道","code":"// removeLine(lineId) / removeLines(lineIds) / removeChannel(channelId):删线路 / 删多条 / 删整条通道\nview.removeLine('l1')\nview.removeLines(['l1', 'l2'])\nview.removeLines('l1') // 单条也认\nview.removeChannel('c1')","from":"header"}] },
|
|
208
209
|
{ name: "removeChannel", kind: "method", params: "channelId 通道 id", returns: "GisViewRemoveChannelResult", doc: "移除整条通道:它名下的回线一条条摘掉,返回 { ok, channelId, lineIds, lines, removedChannel }", examples: [{"group":"拐点与通道","code":"// removeLine(lineId) / removeLines(lineIds) / removeChannel(channelId):删线路 / 删多条 / 删整条通道\nview.removeLine('l1')\nview.removeLines(['l1', 'l2'])\nview.removeLines('l1') // 单条也认\nview.removeChannel('c1')","from":"header"}] },
|
|
@@ -211,26 +212,26 @@ export const API_SECTIONS = [
|
|
|
211
212
|
{
|
|
212
213
|
title: "细粒度改一个要素(一次只动一条)",
|
|
213
214
|
items: [
|
|
214
|
-
{ name: "
|
|
215
|
-
{ name: "
|
|
216
|
-
{ name: "
|
|
217
|
-
{ name: "
|
|
218
|
-
{ name: "
|
|
219
|
-
{ name: "
|
|
220
|
-
{ name: "
|
|
221
|
-
{ name: "
|
|
222
|
-
{ name: "
|
|
223
|
-
{ name: "
|
|
224
|
-
{ name: "
|
|
225
|
-
{ name: "
|
|
226
|
-
{ name: "
|
|
227
|
-
{ name: "
|
|
228
|
-
{ name: "
|
|
229
|
-
{ name: "
|
|
230
|
-
{ name: "
|
|
231
|
-
{ name: "setChannelLineWidth", kind: "method", params: "id 通道 id;lineWidth: number 新的回线线宽(成员回线 + 通道声明一起改,一次 batch、只发一条数据变更)", returns: "this", doc: "只改一条通道的回线线宽 / 逐回线颜色 / 骨架拐点:前两个把成员回线连同通道声明一起改(一次 batch,只发一条数据变更、只落一步历史),颜色不够时按顺序循环取、只给一个就整条通道一个色(改单条回线的颜色用
|
|
232
|
-
{ name: "setChannelColors", kind: "method", params: "id 通道 id;colors: string | string[] 逐回线颜色(不够时按顺序循环取;只给一个就整条通道一个色;改单条回线颜色用
|
|
233
|
-
{ name: "setChannelPath", kind: "method", params: "id 通道 id;coordinates: GisViewCoordinate | GisViewCoordinate[] 新的骨架中间拐点(不含首尾两端;传空数组 = 拉直、传单个坐标 = 只留一个拐点;两端由节点坐标补齐,与通道数据里的 path 同义);分过组的通道写第一组的声明(groups[].path 优先于顶层 path;「第一组」跳过 lineIds 空的分组声明),要改别的组用 updateChannel(id, { groups })", returns: "this", doc: "只改一条通道的回线线宽 / 逐回线颜色 / 骨架拐点:前两个把成员回线连同通道声明一起改(一次 batch,只发一条数据变更、只落一步历史),颜色不够时按顺序循环取、只给一个就整条通道一个色(改单条回线的颜色用
|
|
215
|
+
{ name: "movePoint", kind: "method", params: "id 节点定位;coordinate: GisViewCoordinate 新坐标 [x, y] / { x, y },或分开写 x: number / y: number", returns: "this", doc: "挪一个节点:{ x, y } / [x, y] / 两个数字都认;绑在它身上的线路端点与以它为锚点的通道骨架跟着重排(与拖动落地同一条路)", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// movePoint(id, coordinate) / movePoint(id, x, y)\nview.movePoint('a', { x: 120, y: 80 })\nview.movePoint('a', [120, 80])\nview.movePoint('a', 120, 80)\n","from":"header"},{"group":"定向改一个要素(一次只动一条)","code":"// movePoint(id, coordinate) / movePoint(id, x, y)\nview.movePoint('a', { x: 120, y: 80 })\nview.movePoint('a', [120, 80])\nview.movePoint('a', 120, 80)\n","from":"header"}] },
|
|
216
|
+
{ name: "setLineWaypoints", kind: "method", params: "id 线路定位;coordinates: GisViewCoordinate | GisViewCoordinate[] 新的中间拐点(不含首尾端点;传空数组 = 拉直;传单个坐标 = 只留一个拐点)", returns: "this", doc: "整份换一条线路的拐点:只写中间拐点(不含首尾两端;传单个坐标 = 只留一个拐点,空数组 = 拉直)。两端按节点 / start / end 补齐(绑了 from / to 时两端始终按节点坐标走),存回 lines[].path 的是「首尾端点 + 中间顶点」那一份;只插一个用 addWaypoint(id, coordinate),删一个用 removeWaypoint(id, pathIndex);通道里的回线改的是它所在分组的骨架(与 setChannelPath 同一份声明)", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// updateLine(id, patch) / setLineWaypoints(id, coordinates)\nview.updateLine('l1', { width: 3 })\nview.updateLine('l1', { color: '#f00' })\nview.setLineWaypoints('l1', [[100, 40], [200, 120]]) // 中间拐点(不含首尾两端)\nview.setLineWaypoints('l1', [120, 80]) // 只留一个拐点\nview.setLineWaypoints('l1', []) // 拉直\n","from":"header"}] },
|
|
217
|
+
{ name: "getLineDecorations", kind: "method", params: "id 线路定位", returns: "GisViewLineDecoration[]", doc: "线路上标记(图片 / SVG 装饰)的读写:get 给副本(要素没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 decorations 的顺序数(返回改动的那一条,要素或下标找不到时给 null 并记一条 warning);四个写方法各只发一条数据变更、只落一步历史", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// getLineDecorations(id) / setLineDecorations(id, list) / addLineDecoration(id, decoration)","from":"header"}] },
|
|
218
|
+
{ name: "setLineDecorations", kind: "method", params: "id 线路定位;decorations: GisViewLineDecoration[] 整份替换(空数组 = 全摘掉)", returns: "this", doc: "线路上标记(图片 / SVG 装饰)的读写:get 给副本(要素没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 decorations 的顺序数(返回改动的那一条,要素或下标找不到时给 null 并记一条 warning);四个写方法各只发一条数据变更、只落一步历史", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// getLineDecorations(id) / setLineDecorations(id, list) / addLineDecoration(id, decoration)","from":"header"}] },
|
|
219
|
+
{ name: "addLineDecoration", kind: "method", params: "id 线路定位;decoration: GisViewLineDecoration 要追加的标记(symbol 必填,position / anchor / parallel / size…)", returns: "GisViewLineDecoration | null", doc: "线路上标记(图片 / SVG 装饰)的读写:get 给副本(要素没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 decorations 的顺序数(返回改动的那一条,要素或下标找不到时给 null 并记一条 warning);四个写方法各只发一条数据变更、只落一步历史", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// getLineDecorations(id) / setLineDecorations(id, list) / addLineDecoration(id, decoration)","from":"header"}] },
|
|
220
|
+
{ name: "updateLineDecoration", kind: "method", params: "id 线路定位;decorationIndex: number 第几个标记(按 decorations 顺序,从 0 数);patch: Partial<GisViewLineDecoration> 要合并的字段", returns: "GisViewLineDecoration | null", doc: "线路上标记(图片 / SVG 装饰)的读写:get 给副本(要素没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 decorations 的顺序数(返回改动的那一条,要素或下标找不到时给 null 并记一条 warning);四个写方法各只发一条数据变更、只落一步历史", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// updateLineDecoration(id, index, patch) / removeLineDecoration(id, index)\nconst decorations = view.getLineDecorations('l1')\nview.setLineDecorations('l1', [{ position: 0.5, symbol: 'square', size: 12 }])\nview.addLineDecoration('l1', { position: '75%', symbol: 'square', size: 16 })\nview.updateLineDecoration('l1', 0, { size: 20, color: '#f60' })\nview.removeLineDecoration('l1', 0)\nview.setLineDecorations('l1', []) // 全摘掉\n","from":"header"}] },
|
|
221
|
+
{ name: "removeLineDecoration", kind: "method", params: "id 线路定位;decorationIndex 要摘掉的下标", returns: "GisViewLineDecoration | null", doc: "线路上标记(图片 / SVG 装饰)的读写:get 给副本(要素没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 decorations 的顺序数(返回改动的那一条,要素或下标找不到时给 null 并记一条 warning);四个写方法各只发一条数据变更、只落一步历史", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// updateLineDecoration(id, index, patch) / removeLineDecoration(id, index)\nconst decorations = view.getLineDecorations('l1')\nview.setLineDecorations('l1', [{ position: 0.5, symbol: 'square', size: 12 }])\nview.addLineDecoration('l1', { position: '75%', symbol: 'square', size: 16 })\nview.updateLineDecoration('l1', 0, { size: 20, color: '#f60' })\nview.removeLineDecoration('l1', 0)\nview.setLineDecorations('l1', []) // 全摘掉\n","from":"header"}] },
|
|
222
|
+
{ name: "getPointDecorations", kind: "method", params: "id 节点定位", returns: "GisViewPointDecoration[]:节点没找到时给空数组,返回的是副本", doc: "节点上标记(图片 / SVG 装饰)的读写:get 给副本(节点没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 points[].decorations 的顺序数(返回改动的那一条,节点或下标找不到时给 null);四个写方法各只发一条数据变更、只落一步历史。节点装饰可写屏幕像素偏移(offset 或 distance + direction)、固定世界坐标(anchor: 'fixed' / at),并可用 connector 从节点中心画连接线", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// getPointDecorations(id) / setPointDecorations(id, list) / addPointDecoration(id, decoration)","from":"header"}] },
|
|
223
|
+
{ name: "setPointDecorations", kind: "method", params: "id 节点定位;decorations: GisViewPointDecoration[] 整份替换(空数组 = 全摘掉)", returns: "this", doc: "节点上标记(图片 / SVG 装饰)的读写:get 给副本(节点没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 points[].decorations 的顺序数(返回改动的那一条,节点或下标找不到时给 null);四个写方法各只发一条数据变更、只落一步历史。节点装饰可写屏幕像素偏移(offset 或 distance + direction)、固定世界坐标(anchor: 'fixed' / at),并可用 connector 从节点中心画连接线", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// getPointDecorations(id) / setPointDecorations(id, list) / addPointDecoration(id, decoration)","from":"header"}] },
|
|
224
|
+
{ name: "addPointDecoration", kind: "method", params: "id 节点定位;decoration: GisViewPointDecoration 要追加的标记(symbol 必填,offset / distance / direction / at / connector / size…)", returns: "GisViewPointDecoration | null", doc: "节点上标记(图片 / SVG 装饰)的读写:get 给副本(节点没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 points[].decorations 的顺序数(返回改动的那一条,节点或下标找不到时给 null);四个写方法各只发一条数据变更、只落一步历史。节点装饰可写屏幕像素偏移(offset 或 distance + direction)、固定世界坐标(anchor: 'fixed' / at),并可用 connector 从节点中心画连接线", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// getPointDecorations(id) / setPointDecorations(id, list) / addPointDecoration(id, decoration)","from":"header"}] },
|
|
225
|
+
{ name: "updatePointDecoration", kind: "method", params: "id 节点定位;decorationIndex: number 第几个标记(按 points[].decorations 顺序,从 0 数);patch: Partial<GisViewPointDecoration> 要合并的字段", returns: "GisViewPointDecoration | null", doc: "节点上标记(图片 / SVG 装饰)的读写:get 给副本(节点没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 points[].decorations 的顺序数(返回改动的那一条,节点或下标找不到时给 null);四个写方法各只发一条数据变更、只落一步历史。节点装饰可写屏幕像素偏移(offset 或 distance + direction)、固定世界坐标(anchor: 'fixed' / at),并可用 connector 从节点中心画连接线", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// updatePointDecoration(id, index, patch) / removePointDecoration(id, index)\nconst pointDecorations = view.getPointDecorations('node-0')\nview.setPointDecorations('node-0', [{ symbol: 'square', size: 14, offset: [0, -24] }])\nview.addPointDecoration('node-0', {\n symbol: 'star',\n size: 20,\n direction: 45,\n distance: 32,\n connector: { color: '#7fa9dc', width: 1.2, dashed: true }\n})\nview.updatePointDecoration('node-0', 0, { size: 24, color: '#ff6644' })\nview.removePointDecoration('node-0', 0)\nview.setPointDecorations('node-0', []) // 全摘掉\n","from":"header"}] },
|
|
226
|
+
{ name: "removePointDecoration", kind: "method", params: "id 节点定位;decorationIndex 要摘掉的下标", returns: "GisViewPointDecoration | null", doc: "节点上标记(图片 / SVG 装饰)的读写:get 给副本(节点没找到给空数组),set 整份换(空数组 = 全摘掉),add 追加在末尾并返回加进去的那一条,update / remove 按 points[].decorations 的顺序数(返回改动的那一条,节点或下标找不到时给 null);四个写方法各只发一条数据变更、只落一步历史。节点装饰可写屏幕像素偏移(offset 或 distance + direction)、固定世界坐标(anchor: 'fixed' / at),并可用 connector 从节点中心画连接线", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// updatePointDecoration(id, index, patch) / removePointDecoration(id, index)\nconst pointDecorations = view.getPointDecorations('node-0')\nview.setPointDecorations('node-0', [{ symbol: 'square', size: 14, offset: [0, -24] }])\nview.addPointDecoration('node-0', {\n symbol: 'star',\n size: 20,\n direction: 45,\n distance: 32,\n connector: { color: '#7fa9dc', width: 1.2, dashed: true }\n})\nview.updatePointDecoration('node-0', 0, { size: 24, color: '#ff6644' })\nview.removePointDecoration('node-0', 0)\nview.setPointDecorations('node-0', []) // 全摘掉\n","from":"header"}] },
|
|
227
|
+
{ name: "beginDecorationDraft", kind: "method", params: "options?: GisViewDecorationDraftOptions:target('line' 缺省 / 'point' / 'both')、symbol(缺省 'circle')、size(缺省 18)、color / strokeColor / strokeWidth / opacity / shadow、parallel(缺省 false)、scope('line' 缺省 / 'group' / 'channel')、maxDistance(屏幕像素,缺省 14)、maxPerLine / maxPerPoint(0 / 缺省 = 不限)、allowedLines / allowedChannels / allowedGroups / allowedPoints、节点侧 placement(位置来源:'offset' 缺省 / 'fixed' / 'pointer')、anchor(落地关系:'follow' 保存相对节点的屏幕偏移 / 'fixed' 保存世界坐标;缺省 offset → follow、fixed / pointer → fixed)、offset / distance(缺省 28)/ direction(0 度向上、顺时针)/ at(仅 placement: 'fixed' 时作为世界坐标来源)/ angle / connector、allowDuplicate(缺省 true)/ duplicateStrategy('offset' 缺省 / 'reject')/ duplicateDistance(缺省 8)、originalEvent", returns: "GisViewDecorationDraftPayload | null:start 载荷(字段与 onDecorationDraft 同一份)", doc: "动态装饰器草稿:target 取 'line'(缺省)/ 'point' / 'both',指针移到线路 / 回线或节点上就画临时装饰,移出立即收掉;both 按屏幕距离取更近者、等距优先节点,最近目标被白名单或上限拦住时尝试另一类。线路按 scope(line 单条 / group 同组 / channel 整条通道,非通道线退回单条)展开;节点侧 placement 只选位置来源(offset 相对偏移 / fixed 固定坐标 / pointer 鼠标位置),anchor 再选落地关系(follow 保存相对节点的屏幕偏移 / fixed 保存世界坐标),两者可自由组合,缺省按 offset → follow、fixed / pointer → fixed 推导。allowedLines / allowedChannels / allowedGroups / allowedPoints 与 maxPerLine / maxPerPoint 在悬浮与提交两处拦截,allowDuplicate: false 时按 duplicateDistance 检测同位置重复,duplicateStrategy 选 offset 自动避让或 reject 直接拦住。左键在目标上松开发 ready,空白处不发;get 取当前载荷,update 边交互边改图标 / 大小 / 方向 / 范围 / 位置来源 / 落地关系;commit 把线路与节点目标放在同一个 batch 里写入(一次 dataChange、一条历史),cancel 只清假装饰(Esc / 右键等价),数据与历史一个字节不动", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// beginDecorationDraft(options?) / getDecorationDraft() / updateDecorationDraft(patch?)","from":"header"}] },
|
|
228
|
+
{ name: "getDecorationDraft", kind: "method", params: "无", returns: "GisViewDecorationDraftPayload | null:当前草稿读数,没有草稿时 null", doc: "动态装饰器草稿:target 取 'line'(缺省)/ 'point' / 'both',指针移到线路 / 回线或节点上就画临时装饰,移出立即收掉;both 按屏幕距离取更近者、等距优先节点,最近目标被白名单或上限拦住时尝试另一类。线路按 scope(line 单条 / group 同组 / channel 整条通道,非通道线退回单条)展开;节点侧 placement 只选位置来源(offset 相对偏移 / fixed 固定坐标 / pointer 鼠标位置),anchor 再选落地关系(follow 保存相对节点的屏幕偏移 / fixed 保存世界坐标),两者可自由组合,缺省按 offset → follow、fixed / pointer → fixed 推导。allowedLines / allowedChannels / allowedGroups / allowedPoints 与 maxPerLine / maxPerPoint 在悬浮与提交两处拦截,allowDuplicate: false 时按 duplicateDistance 检测同位置重复,duplicateStrategy 选 offset 自动避让或 reject 直接拦住。左键在目标上松开发 ready,空白处不发;get 取当前载荷,update 边交互边改图标 / 大小 / 方向 / 范围 / 位置来源 / 落地关系;commit 把线路与节点目标放在同一个 batch 里写入(一次 dataChange、一条历史),cancel 只清假装饰(Esc / 右键等价),数据与历史一个字节不动", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// beginDecorationDraft(options?) / getDecorationDraft() / updateDecorationDraft(patch?)","from":"header"}] },
|
|
229
|
+
{ name: "updateDecorationDraft", kind: "method", params: "patch?: Partial<GisViewDecorationDraftOptions> 只合并给出的图标 / 大小 / 方向 / 范围 / 命中距离 / 命中类型 / 节点位置来源与落地关系 / 白名单 / 重复策略", returns: "GisViewDecorationDraftPayload | null:update 载荷;没有草稿时 null", doc: "动态装饰器草稿:target 取 'line'(缺省)/ 'point' / 'both',指针移到线路 / 回线或节点上就画临时装饰,移出立即收掉;both 按屏幕距离取更近者、等距优先节点,最近目标被白名单或上限拦住时尝试另一类。线路按 scope(line 单条 / group 同组 / channel 整条通道,非通道线退回单条)展开;节点侧 placement 只选位置来源(offset 相对偏移 / fixed 固定坐标 / pointer 鼠标位置),anchor 再选落地关系(follow 保存相对节点的屏幕偏移 / fixed 保存世界坐标),两者可自由组合,缺省按 offset → follow、fixed / pointer → fixed 推导。allowedLines / allowedChannels / allowedGroups / allowedPoints 与 maxPerLine / maxPerPoint 在悬浮与提交两处拦截,allowDuplicate: false 时按 duplicateDistance 检测同位置重复,duplicateStrategy 选 offset 自动避让或 reject 直接拦住。左键在目标上松开发 ready,空白处不发;get 取当前载荷,update 边交互边改图标 / 大小 / 方向 / 范围 / 位置来源 / 落地关系;commit 把线路与节点目标放在同一个 batch 里写入(一次 dataChange、一条历史),cancel 只清假装饰(Esc / 右键等价),数据与历史一个字节不动", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// beginDecorationDraft(options?) / getDecorationDraft() / updateDecorationDraft(patch?)","from":"header"}] },
|
|
230
|
+
{ name: "commitDecorationDraft", kind: "method", params: "overrides?: Partial<GisViewDecorationDraftOptions> & { position?: number } 提交前临时覆盖(position 是沿线比例 0~1)", returns: "GisViewDecorationCommitResult:{ ok, reason?, count, targets, decorations, pointTargets, pointDecorations, draft? };没有目标 / 超限 / 不在白名单 / 重复时 ok: false,数据不动", doc: "动态装饰器草稿:target 取 'line'(缺省)/ 'point' / 'both',指针移到线路 / 回线或节点上就画临时装饰,移出立即收掉;both 按屏幕距离取更近者、等距优先节点,最近目标被白名单或上限拦住时尝试另一类。线路按 scope(line 单条 / group 同组 / channel 整条通道,非通道线退回单条)展开;节点侧 placement 只选位置来源(offset 相对偏移 / fixed 固定坐标 / pointer 鼠标位置),anchor 再选落地关系(follow 保存相对节点的屏幕偏移 / fixed 保存世界坐标),两者可自由组合,缺省按 offset → follow、fixed / pointer → fixed 推导。allowedLines / allowedChannels / allowedGroups / allowedPoints 与 maxPerLine / maxPerPoint 在悬浮与提交两处拦截,allowDuplicate: false 时按 duplicateDistance 检测同位置重复,duplicateStrategy 选 offset 自动避让或 reject 直接拦住。左键在目标上松开发 ready,空白处不发;get 取当前载荷,update 边交互边改图标 / 大小 / 方向 / 范围 / 位置来源 / 落地关系;commit 把线路与节点目标放在同一个 batch 里写入(一次 dataChange、一条历史),cancel 只清假装饰(Esc / 右键等价),数据与历史一个字节不动", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// commitDecorationDraft(overrides?) / cancelDecorationDraft(options?)\nview.beginDecorationDraft({ target: 'line', symbol: 'square', size: 20, parallel: true, scope: 'channel' })\nview.updateDecorationDraft({ symbol: 'circle', size: 24, parallel: false, scope: 'group' })\nview.updateDecorationDraft({ target: 'point', placement: 'offset', anchor: 'fixed', direction: 90, distance: 36, connector: true })\nview.updateDecorationDraft({ target: 'both', allowedPoints: ['node-0', 'node-1'], maxPerPoint: 2 })\nview.updateDecorationDraft({ allowDuplicate: false, duplicateStrategy: 'offset', duplicateDistance: 8 })\nconst currentDraft = view.getDecorationDraft() // phase / hitKind / targets / pointTargets / position...\nconst committedDraft = view.commitDecorationDraft({ position: 0.5 })\nif (!committedDraft.ok) console.warn(committedDraft.reason)\nview.cancelDecorationDraft() // 没有草稿时是空操作,数据不动\n","from":"header"}] },
|
|
231
|
+
{ name: "cancelDecorationDraft", kind: "method", params: "options?: { originalEvent?: Event | null } 取消原因 / 原始事件", returns: "GisViewDecorationDraftPayload | null:cancel 载荷;没有草稿时 null,数据与历史不动", doc: "动态装饰器草稿:target 取 'line'(缺省)/ 'point' / 'both',指针移到线路 / 回线或节点上就画临时装饰,移出立即收掉;both 按屏幕距离取更近者、等距优先节点,最近目标被白名单或上限拦住时尝试另一类。线路按 scope(line 单条 / group 同组 / channel 整条通道,非通道线退回单条)展开;节点侧 placement 只选位置来源(offset 相对偏移 / fixed 固定坐标 / pointer 鼠标位置),anchor 再选落地关系(follow 保存相对节点的屏幕偏移 / fixed 保存世界坐标),两者可自由组合,缺省按 offset → follow、fixed / pointer → fixed 推导。allowedLines / allowedChannels / allowedGroups / allowedPoints 与 maxPerLine / maxPerPoint 在悬浮与提交两处拦截,allowDuplicate: false 时按 duplicateDistance 检测同位置重复,duplicateStrategy 选 offset 自动避让或 reject 直接拦住。左键在目标上松开发 ready,空白处不发;get 取当前载荷,update 边交互边改图标 / 大小 / 方向 / 范围 / 位置来源 / 落地关系;commit 把线路与节点目标放在同一个 batch 里写入(一次 dataChange、一条历史),cancel 只清假装饰(Esc / 右键等价),数据与历史一个字节不动", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// commitDecorationDraft(overrides?) / cancelDecorationDraft(options?)\nview.beginDecorationDraft({ target: 'line', symbol: 'square', size: 20, parallel: true, scope: 'channel' })\nview.updateDecorationDraft({ symbol: 'circle', size: 24, parallel: false, scope: 'group' })\nview.updateDecorationDraft({ target: 'point', placement: 'offset', anchor: 'fixed', direction: 90, distance: 36, connector: true })\nview.updateDecorationDraft({ target: 'both', allowedPoints: ['node-0', 'node-1'], maxPerPoint: 2 })\nview.updateDecorationDraft({ allowDuplicate: false, duplicateStrategy: 'offset', duplicateDistance: 8 })\nconst currentDraft = view.getDecorationDraft() // phase / hitKind / targets / pointTargets / position...\nconst committedDraft = view.commitDecorationDraft({ position: 0.5 })\nif (!committedDraft.ok) console.warn(committedDraft.reason)\nview.cancelDecorationDraft() // 没有草稿时是空操作,数据不动\n","from":"header"}] },
|
|
232
|
+
{ name: "setChannelLineWidth", kind: "method", params: "id 通道 id;lineWidth: number 新的回线线宽(成员回线 + 通道声明一起改,一次 batch、只发一条数据变更)", returns: "this", doc: "只改一条通道的回线线宽 / 逐回线颜色 / 骨架拐点:前两个把成员回线连同通道声明一起改(一次 batch,只发一条数据变更、只落一步历史),颜色不够时按顺序循环取、只给一个就整条通道一个色(改单条回线的颜色用 updateLine(id, { color }),不必走整条通道的批量写法);colors 传字符串或字符串数组,setChannelPath 只写中间拐点(两端由节点坐标补齐);分过组的通道写第一组的声明(groups[].path 优先于顶层 path;「第一组」跳过 lineIds 空的分组声明 —— 引擎会把这种组整组丢掉),要改别的组用 updateChannel(id, { groups })", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// updateChannel(id, { name }) / setChannelLineWidth(id, width) / setChannelColors(id, colors)\nview.updateChannel('c1', { name: '东干线' })\nview.updateChannel('c1', { name: null }) // 摘掉名称\nview.setChannelLineWidth('c1', 3)\nview.setChannelColors('c1', ['#f00', '#0f0']) // 不够时按顺序循环取\nview.setChannelColors('c1', '#2f6fd0') // 只给一个 = 整条通道一个色\n","from":"header"}] },
|
|
233
|
+
{ name: "setChannelColors", kind: "method", params: "id 通道 id;colors: string | string[] 逐回线颜色(不够时按顺序循环取;只给一个就整条通道一个色;改单条回线颜色用 updateLine(id, { color }))", returns: "this", doc: "只改一条通道的回线线宽 / 逐回线颜色 / 骨架拐点:前两个把成员回线连同通道声明一起改(一次 batch,只发一条数据变更、只落一步历史),颜色不够时按顺序循环取、只给一个就整条通道一个色(改单条回线的颜色用 updateLine(id, { color }),不必走整条通道的批量写法);colors 传字符串或字符串数组,setChannelPath 只写中间拐点(两端由节点坐标补齐);分过组的通道写第一组的声明(groups[].path 优先于顶层 path;「第一组」跳过 lineIds 空的分组声明 —— 引擎会把这种组整组丢掉),要改别的组用 updateChannel(id, { groups })", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// updateChannel(id, { name }) / setChannelLineWidth(id, width) / setChannelColors(id, colors)\nview.updateChannel('c1', { name: '东干线' })\nview.updateChannel('c1', { name: null }) // 摘掉名称\nview.setChannelLineWidth('c1', 3)\nview.setChannelColors('c1', ['#f00', '#0f0']) // 不够时按顺序循环取\nview.setChannelColors('c1', '#2f6fd0') // 只给一个 = 整条通道一个色\n","from":"header"}] },
|
|
234
|
+
{ name: "setChannelPath", kind: "method", params: "id 通道 id;coordinates: GisViewCoordinate | GisViewCoordinate[] 新的骨架中间拐点(不含首尾两端;传空数组 = 拉直、传单个坐标 = 只留一个拐点;两端由节点坐标补齐,与通道数据里的 path 同义);分过组的通道写第一组的声明(groups[].path 优先于顶层 path;「第一组」跳过 lineIds 空的分组声明),要改别的组用 updateChannel(id, { groups })", returns: "this", doc: "只改一条通道的回线线宽 / 逐回线颜色 / 骨架拐点:前两个把成员回线连同通道声明一起改(一次 batch,只发一条数据变更、只落一步历史),颜色不够时按顺序循环取、只给一个就整条通道一个色(改单条回线的颜色用 updateLine(id, { color }),不必走整条通道的批量写法);colors 传字符串或字符串数组,setChannelPath 只写中间拐点(两端由节点坐标补齐);分过组的通道写第一组的声明(groups[].path 优先于顶层 path;「第一组」跳过 lineIds 空的分组声明 —— 引擎会把这种组整组丢掉),要改别的组用 updateChannel(id, { groups })", examples: [{"group":"定向改一个要素(一次只动一条)","code":"// setChannelPath(id, coordinates):整份换骨架拐点(只写中间拐点,两端由节点坐标补齐)\nview.setChannelPath('c1', [[100, 40], [200, 120]]) // 中间拐点(不含首尾两端)\nview.setChannelPath('c1', [120, 80]) // 只留一个拐点\nview.setChannelPath('c1', []) // 拉直","from":"header"}] },
|
|
234
235
|
]
|
|
235
236
|
},
|
|
236
237
|
{
|
|
@@ -259,28 +260,43 @@ export const API_SECTIONS = [
|
|
|
259
260
|
{ name: "resetLabels", kind: "method", params: "kind?: 'point' | 'line'(缺省两类都复位)", returns: "number", doc: "恢复一条 / 一类(缺省两类都恢复)标签的默认:偏移与全部覆盖一起清掉,返回清掉了几条状态", examples: [{"group":"标签","code":"// setLabelStates(states) / resetLabel(kind, ref, labelId?) / resetLabels(kind?)\nview.setLabelStates(labelStates) // 整份灌回来(持久化那一份)\nview.resetLabel('point', 'a')\nview.resetLabel('line', 'l1', 'tag')\nview.resetLabels() // 两类都复位\nview.resetLabels('line')","from":"header"}] },
|
|
260
261
|
]
|
|
261
262
|
},
|
|
263
|
+
{
|
|
264
|
+
title: "扩展图形",
|
|
265
|
+
items: [
|
|
266
|
+
{ name: "addGraphic", kind: "method", params: "graphic: GisViewGraphic 一个扩展图形(type / x / y / width / height 与对应的 d / src / canvas;id 已存在时按更新覆盖)", returns: "GisViewGraphic | null:归一化后的读数;参数无效时为 null 并走 onWarning", doc: "新增扩展图形(SVG 路径 / 图片 / Canvas):世界坐标锚点、屏幕像素尺寸、可选 scaleWithView;id 已存在时按更新覆盖,返回归一化后的图形读数(批量返回数组)。只动图形层 DOM,不重排场景,见「扩展图形(graphic)」", examples: [{"group":"扩展图形","code":"// addGraphic(graphic) / addGraphics(list) / updateGraphic(id, patch) / removeGraphic(id) / clearGraphics() / getGraphic(id) / getGraphics()","from":"header"}] },
|
|
267
|
+
{ name: "addGraphics", kind: "method", params: "list: GisViewGraphic | GisViewGraphic[] 一条或一批(无效条目单独跳过)", returns: "GisViewGraphic[]:实际加进去的读数", doc: "新增扩展图形(SVG 路径 / 图片 / Canvas):世界坐标锚点、屏幕像素尺寸、可选 scaleWithView;id 已存在时按更新覆盖,返回归一化后的图形读数(批量返回数组)。只动图形层 DOM,不重排场景,见「扩展图形(graphic)」", examples: [{"group":"扩展图形","code":"// addGraphic(graphic) / addGraphics(list) / updateGraphic(id, patch) / removeGraphic(id) / clearGraphics() / getGraphic(id) / getGraphics()","from":"header"}] },
|
|
268
|
+
{ name: "updateGraphic", kind: "method", params: "id: string | number 图形 id;patch: Partial<GisViewGraphic> 要合并的字段(style.width / style.height / style.fill 等也认)", returns: "GisViewGraphic | null:改后的读数;id 不存在或结果无效时为 null", doc: "改一个扩展图形的字段(写法与创建一致,style.width / style.height 也认),返回改后的读数;id 不存在返回 null", examples: [{"group":"扩展图形","code":"// addGraphic(graphic) / addGraphics(list) / updateGraphic(id, patch) / removeGraphic(id) / clearGraphics() / getGraphic(id) / getGraphics()","from":"header"}] },
|
|
269
|
+
{ name: "removeGraphic", kind: "method", params: "id: string | number 图形 id", returns: "GisViewGraphic | null:删掉的那一条;id 不存在时为 null", doc: "按 id 删一条 / 清空整层,分别返回删掉的读数与清掉的条数;节点 / 线路 / 标签 / 数据 / 历史都不受影响", examples: [{"group":"扩展图形","code":"// addGraphic(graphic) / addGraphics(list) / updateGraphic(id, patch) / removeGraphic(id) / clearGraphics() / getGraphic(id) / getGraphics()","from":"header"}] },
|
|
270
|
+
{ name: "clearGraphics", kind: "method", params: "无", returns: "number:清掉的条数(只清图形层,不碰要素数据)", doc: "按 id 删一条 / 清空整层,分别返回删掉的读数与清掉的条数;节点 / 线路 / 标签 / 数据 / 历史都不受影响", examples: [{"group":"扩展图形","code":"// addGraphic(graphic) / addGraphics(list) / updateGraphic(id, patch) / removeGraphic(id) / clearGraphics() / getGraphic(id) / getGraphics()","from":"header"}] },
|
|
271
|
+
{ name: "getGraphic", kind: "method", params: "id: string | number 图形 id", returns: "GisViewGraphic | null:副本,没有时 null", doc: "读一条(副本,没有时 null)/ 读全部(按 zIndex、再按加入顺序)", examples: [{"group":"扩展图形","code":"// addGraphic(graphic) / addGraphics(list) / updateGraphic(id, patch) / removeGraphic(id) / clearGraphics() / getGraphic(id) / getGraphics()","from":"header"}] },
|
|
272
|
+
{ name: "getGraphics", kind: "method", params: "无", returns: "GisViewGraphic[]:按 zIndex、再按加入顺序排的副本数组", doc: "读一条(副本,没有时 null)/ 读全部(按 zIndex、再按加入顺序)", examples: [{"group":"扩展图形","code":"// addGraphic(graphic) / addGraphics(list) / updateGraphic(id, patch) / removeGraphic(id) / clearGraphics() / getGraphic(id) / getGraphics()","from":"header"}] },
|
|
273
|
+
]
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
title: "WebGL 自定义层",
|
|
277
|
+
items: [
|
|
278
|
+
{ name: "requestRender", kind: "method", params: "无", returns: "this:请求下一帧;层内部画动画时也可以在 draw 里调用", doc: "请求重画一帧:WebGL 自定义层的数据源变了、组件自己不知道时调用;返回实例本身", examples: [{"group":"WebGL 自定义层","code":"// requestRender() / addWebGLLayer(layer) / updateWebGLLayer / removeWebGLLayer / clearWebGLLayers / getWebGLLayers\nconst offGlow = view.addWebGLLayer({\n id: 'glow', order: 10,\n draw({ gl, canvas, viewport, project, requestRender }) {\n const [x, y] = project(120, 40) // 世界坐标 -> 画布 CSS 像素\n gl.enable(gl.BLEND)\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)\n // 这里直接用 gl 画自己的缓冲区 / shader;canvas.width / height 是设备像素\n requestRender() // 需要连续动画时在层内继续排下一帧\n }\n})\nview.updateWebGLLayer('glow', { enabled: false }) // 暂停这一层\nview.updateWebGLLayer('glow', { enabled: true, order: 20 })\nview.getWebGLLayers() // [{ id, order, enabled, draw }, ...]\nview.requestRender() // 外部数据变了,主动重画一帧\noffGlow() // 卸载 addWebGLLayer 返回的函数\nview.clearWebGLLayers() // 清空全部自定义层","from":"header"}] },
|
|
279
|
+
{ name: "addWebGLLayer", kind: "method", params: "layer: GisViewWebGLLayer:id(同 id 覆盖)、order(小的先画,同 order 保持加入顺序)、enabled、draw(context);context 给 gl / canvas / viewport / camera / frame / project / unproject / requestRender", returns: "() => void:卸载函数", doc: "加一个 WebGL 自定义层(同 id 覆盖),返回卸载函数;draw 拿 gl / canvas / viewport / camera / frame / project / unproject / requestRender,在内置内容之后绘制", examples: [{"group":"WebGL 自定义层","code":"// requestRender() / addWebGLLayer(layer) / updateWebGLLayer / removeWebGLLayer / clearWebGLLayers / getWebGLLayers\nconst offGlow = view.addWebGLLayer({\n id: 'glow', order: 10,\n draw({ gl, canvas, viewport, project, requestRender }) {\n const [x, y] = project(120, 40) // 世界坐标 -> 画布 CSS 像素\n gl.enable(gl.BLEND)\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)\n // 这里直接用 gl 画自己的缓冲区 / shader;canvas.width / height 是设备像素\n requestRender() // 需要连续动画时在层内继续排下一帧\n }\n})\nview.updateWebGLLayer('glow', { enabled: false }) // 暂停这一层\nview.updateWebGLLayer('glow', { enabled: true, order: 20 })\nview.getWebGLLayers() // [{ id, order, enabled, draw }, ...]\nview.requestRender() // 外部数据变了,主动重画一帧\noffGlow() // 卸载 addWebGLLayer 返回的函数\nview.clearWebGLLayers() // 清空全部自定义层","from":"header"}] },
|
|
280
|
+
{ name: "updateWebGLLayer", kind: "method", params: "id 层 id;patch: Partial<GisViewWebGLLayer> 要改的 order / enabled / draw", returns: "GisViewWebGLLayer | null:改后的读数;id 不存在时 null", doc: "改 / 删 / 清空 / 读自定义层;order 小的先画,同 order 保持加入顺序,enabled: false 跳过,层不参与拾取与导出", examples: [{"group":"WebGL 自定义层","code":"// requestRender() / addWebGLLayer(layer) / updateWebGLLayer / removeWebGLLayer / clearWebGLLayers / getWebGLLayers\nconst offGlow = view.addWebGLLayer({\n id: 'glow', order: 10,\n draw({ gl, canvas, viewport, project, requestRender }) {\n const [x, y] = project(120, 40) // 世界坐标 -> 画布 CSS 像素\n gl.enable(gl.BLEND)\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)\n // 这里直接用 gl 画自己的缓冲区 / shader;canvas.width / height 是设备像素\n requestRender() // 需要连续动画时在层内继续排下一帧\n }\n})\nview.updateWebGLLayer('glow', { enabled: false }) // 暂停这一层\nview.updateWebGLLayer('glow', { enabled: true, order: 20 })\nview.getWebGLLayers() // [{ id, order, enabled, draw }, ...]\nview.requestRender() // 外部数据变了,主动重画一帧\noffGlow() // 卸载 addWebGLLayer 返回的函数\nview.clearWebGLLayers() // 清空全部自定义层","from":"header"}] },
|
|
281
|
+
{ name: "removeWebGLLayer", kind: "method", params: "id 层 id", returns: "GisViewWebGLLayer | null:删掉的读数;id 不存在时 null", doc: "改 / 删 / 清空 / 读自定义层;order 小的先画,同 order 保持加入顺序,enabled: false 跳过,层不参与拾取与导出", examples: [{"group":"WebGL 自定义层","code":"// requestRender() / addWebGLLayer(layer) / updateWebGLLayer / removeWebGLLayer / clearWebGLLayers / getWebGLLayers\nconst offGlow = view.addWebGLLayer({\n id: 'glow', order: 10,\n draw({ gl, canvas, viewport, project, requestRender }) {\n const [x, y] = project(120, 40) // 世界坐标 -> 画布 CSS 像素\n gl.enable(gl.BLEND)\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)\n // 这里直接用 gl 画自己的缓冲区 / shader;canvas.width / height 是设备像素\n requestRender() // 需要连续动画时在层内继续排下一帧\n }\n})\nview.updateWebGLLayer('glow', { enabled: false }) // 暂停这一层\nview.updateWebGLLayer('glow', { enabled: true, order: 20 })\nview.getWebGLLayers() // [{ id, order, enabled, draw }, ...]\nview.requestRender() // 外部数据变了,主动重画一帧\noffGlow() // 卸载 addWebGLLayer 返回的函数\nview.clearWebGLLayers() // 清空全部自定义层","from":"header"}] },
|
|
282
|
+
{ name: "clearWebGLLayers", kind: "method", params: "无", returns: "number:清掉的层数", doc: "改 / 删 / 清空 / 读自定义层;order 小的先画,同 order 保持加入顺序,enabled: false 跳过,层不参与拾取与导出", examples: [{"group":"WebGL 自定义层","code":"// requestRender() / addWebGLLayer(layer) / updateWebGLLayer / removeWebGLLayer / clearWebGLLayers / getWebGLLayers\nconst offGlow = view.addWebGLLayer({\n id: 'glow', order: 10,\n draw({ gl, canvas, viewport, project, requestRender }) {\n const [x, y] = project(120, 40) // 世界坐标 -> 画布 CSS 像素\n gl.enable(gl.BLEND)\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)\n // 这里直接用 gl 画自己的缓冲区 / shader;canvas.width / height 是设备像素\n requestRender() // 需要连续动画时在层内继续排下一帧\n }\n})\nview.updateWebGLLayer('glow', { enabled: false }) // 暂停这一层\nview.updateWebGLLayer('glow', { enabled: true, order: 20 })\nview.getWebGLLayers() // [{ id, order, enabled, draw }, ...]\nview.requestRender() // 外部数据变了,主动重画一帧\noffGlow() // 卸载 addWebGLLayer 返回的函数\nview.clearWebGLLayers() // 清空全部自定义层","from":"header"}] },
|
|
283
|
+
{ name: "getWebGLLayers", kind: "method", params: "无", returns: "GisViewWebGLLayer[]:按 order 排好的副本", doc: "改 / 删 / 清空 / 读自定义层;order 小的先画,同 order 保持加入顺序,enabled: false 跳过,层不参与拾取与导出", examples: [{"group":"WebGL 自定义层","code":"// requestRender() / addWebGLLayer(layer) / updateWebGLLayer / removeWebGLLayer / clearWebGLLayers / getWebGLLayers\nconst offGlow = view.addWebGLLayer({\n id: 'glow', order: 10,\n draw({ gl, canvas, viewport, project, requestRender }) {\n const [x, y] = project(120, 40) // 世界坐标 -> 画布 CSS 像素\n gl.enable(gl.BLEND)\n gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)\n // 这里直接用 gl 画自己的缓冲区 / shader;canvas.width / height 是设备像素\n requestRender() // 需要连续动画时在层内继续排下一帧\n }\n})\nview.updateWebGLLayer('glow', { enabled: false }) // 暂停这一层\nview.updateWebGLLayer('glow', { enabled: true, order: 20 })\nview.getWebGLLayers() // [{ id, order, enabled, draw }, ...]\nview.requestRender() // 外部数据变了,主动重画一帧\noffGlow() // 卸载 addWebGLLayer 返回的函数\nview.clearWebGLLayers() // 清空全部自定义层","from":"header"}] },
|
|
284
|
+
]
|
|
285
|
+
},
|
|
262
286
|
{
|
|
263
287
|
title: "导出",
|
|
264
288
|
items: [
|
|
265
|
-
{ name: "exportData", kind: "method", params: "options: GisViewExportDataOptions:format('view' 缺省 / 'input'
|
|
266
|
-
{ name: "exportViewportData", kind: "method", params: "同 exportData(format / parts / labels / box / extra),另有 margin: number(视口外扩多少屏幕 CSS 像素,缺省 0)与 rect: GisViewBounds(直接给世界矩形替掉视口);points / lines / channels 不认", returns: "GisViewExportViewportResult(format: 'full' 时是 GisViewDocument + viewRect / margin)", doc: "视口内的那一撮数据:范围按 getViewRect() 筛(节点按中心、线路按包围盒、通道按成员回线,分组一起走),其余口径与 exportData 完全同写;margin 是屏幕 CSS 像素的外扩、rect 直接给世界矩形,返回多带 viewRect / margin 两条读数,见「导出数据」", examples: [{"group":"导出","code":"// exportViewportData(options?):只导视口里的(margin 是外扩的屏幕像素,rect 直接给世界矩形)\nconst inViewport = view.exportViewportData({ margin: 40 })\nview.exportViewportData({ rect: view.getViewRect(), parts: ['station', 'channel'] })\n","from":"header"}] },
|
|
267
|
-
{ name: "exportStationData", kind: "method", params: "options: GisViewExportStationDataOptions 节点记录口径的筛选(points 选哪些、labels 带不带标签、extra)", returns: "GisViewExportStationDataResult", doc: "节点按 new.json 的 station_data 口径导出(另带 show_station_list / show_station_data 与四至范围,box: false / showStation: false 可关)", examples: [{"group":"导出","code":"// exportStationData / exportPointData / exportLineData / exportChannelData / exportParallelGroups\nconst stationData = view.exportStationData()\nconst pointData = view.exportPointData()\nconst lineData = view.exportLineData()\nconst channelData = view.exportChannelData()\nconst parallelData = view.exportParallelGroups({ all: true })\n","from":"header"}] },
|
|
268
|
-
{ name: "exportPointData", kind: "method", params: "options: GisViewExportFilterOptions(points / labels / extra)", returns: "GisViewExportPointDataResult", doc: "节点按 test.json 的 point_data 口径导出(同一份数据换一套列名,带 zone_id / zone_name)", examples: [{"group":"导出","code":"// exportStationData / exportPointData / exportLineData / exportChannelData / exportParallelGroups\nconst stationData = view.exportStationData()\nconst pointData = view.exportPointData()\nconst lineData = view.exportLineData()\nconst channelData = view.exportChannelData()\nconst parallelData = view.exportParallelGroups({ all: true })\n","from":"header"}] },
|
|
269
|
-
{ name: "exportLineData", kind: "method", params: "options: GisViewExportFilterOptions(lines / labels / extra)", returns: "GisViewExportLineDataResult", doc: "线路按 test.json 的 line_data 口径导出:通道回线带上 channel_id / channel_name / parallel_group_id 与 index(第几回),coords_list 是当下画出来的折线", examples: [{"group":"导出","code":"// exportStationData / exportPointData / exportLineData / exportChannelData / exportParallelGroups\nconst stationData = view.exportStationData()\nconst pointData = view.exportPointData()\nconst lineData = view.exportLineData()\nconst channelData = view.exportChannelData()\nconst parallelData = view.exportParallelGroups({ all: true })\n","from":"header"}] },
|
|
270
|
-
{ name: "exportChannelData", kind: "method", params: "options 同上(channels / labels)", returns: "GisViewExportChannelDataResult", doc: "通道按 new.json 的 channel_data 口径导出:一条通道一行、回线在 line_data 里、路由在 coords 里;options.lines 可以只要其中几条回线", examples: [{"group":"导出","code":"// exportStationData / exportPointData / exportLineData / exportChannelData / exportParallelGroups\nconst stationData = view.exportStationData()\nconst pointData = view.exportPointData()\nconst lineData = view.exportLineData()\nconst channelData = view.exportChannelData()\nconst parallelData = view.exportParallelGroups({ all: true })\n","from":"header"}] },
|
|
271
|
-
{ name: "exportParallelGroups", kind: "method", params: "options?: GisViewExportParallelGroupsOptions(all: true 连没编辑过的也算、extra)", returns: "GisViewExportParallelGroupsResult", doc: "拐点分组按 test.json 的 parallel_groups 口径导出(与通道数据分开):缺省只出加过 / 拖过拐点的,all: true 连没编辑过的一起列,channels 可以只留某几条通道 / 分组", examples: [{"group":"导出","code":"// exportStationData / exportPointData / exportLineData / exportChannelData / exportParallelGroups\nconst stationData = view.exportStationData()\nconst pointData = view.exportPointData()\nconst lineData = view.exportLineData()\nconst channelData = view.exportChannelData()\nconst parallelData = view.exportParallelGroups({ all: true })\n","from":"header"}] },
|
|
289
|
+
{ name: "exportData", kind: "method", params: "options: GisViewExportDataOptions:scope('all' 缺省 / 'viewport' / 'selection',也认 visible / view / selected)、format('view' 缺省 / 'input' / 'new' / 'test' / 'full')、parts(只导 points / lines / channels / parallelGroups 里的哪几份)、points / lines / channels(只导指定要素)、withLines: false(selection 不要两端都在集合里的线路)、labels、extra。format: 'full' / 'input' 返回可直接回灌的数据,不夹带 scope / counts 读数", returns: "GisViewExportDataResult | GisViewDocument(format: 'full')", doc: "统一导出入口:scope 选范围('all' 缺省 / 'viewport' / 'selection',也认 visible / view / selected),parts 选分项,format 选口径。format: 'view'(缺省)给 { points, lines, channels, parallelGroups }、'new' 给 new.json 口径、'test' 给 test.json 口径、'input' 给与 createGisView 入参同构的回灌口径、'full' 给标准文档;format 也可以是注册过的自定义名字。points / lines / channels 可以只要一部分,解不出的引用进 warnings,format 写错(或没注册)抛异常,见「导出数据」与「自定义导出格式」", examples: [{"group":"导出","code":"// exportData(options?):统一入口 —— scope 选范围(all / viewport / selection),parts 选分项,format 选口径\nconst viewFormat = view.exportData() // 全量 + view 口径(缺省)\nconst inViewport = view.exportData({ scope: 'viewport', margin: 24 }) // 视口内,可外扩 24 屏幕像素\nconst picked = view.exportData({ scope: 'selection', parts: ['station', 'channel'], withLines: true })\nconst fullDoc = view.exportData({ format: 'full' }) // 标准数据文档:整份喂回 createGisView / importData 就回到这一屏\nconst testFormat = view.exportData({ format: 'test', parts: ['line', 'waypoint'] })\nconst onlyPoints = view.exportData({ points: ['a', 'b'], labels: false, extra: { exported_at: Date.now() } })\n","from":"header"},{"group":"导出","code":"// exportSelection(options?) / exportData({ scope: 'selection' }):导出选中的那几个\nconst exportedSelection = await view.exportSelection({ withLines: true, scale: 2 })\nview.exportSelection({ points: ['a', 1], format: 'data', withLines: false })\nconst selectionData = view.exportData({ scope: 'selection', parts: ['station', 'channel'] })","from":"header"}] },
|
|
272
290
|
{ name: "exportImage", kind: "method", params: "options?: GisViewExportImageOptions:type('image/png' / 'image/jpeg')、quality(JPEG 0 ~ 1)、scale(导出倍数)、background(底色)、transparent", returns: "Promise<string>", doc: "导出当前画面(含标签)为图片,返回 data URL,见「导出图片」", examples: [{"group":"导出","code":"// exportImage(options?):导出图片(Promise<dataURL>;type: 'svg' 走矢量导出)\nconst imageUrl = await view.exportImage({ scale: 2, background: '#ffffff' })\nawait view.exportImage({ type: 'image/jpeg', quality: 0.9, download: '场景.jpg' }) // 也可以直接下载\n","from":"header"}] },
|
|
273
|
-
{ name: "exportSelection", kind: "method", params: "options?: GisViewExportSelectionOptions:format / type / quality / scale / padding(只导选中要素那一块)", returns: "Promise<GisViewExportSelectionResult>", doc: "把选中的节点(可选带上两端都在集合里的线路)单独导成图片 / 数据:points 不给就用选中集,withLines / format / padding 见「导出选中的节点」;返回 { ok, reason, points, lines, counts, box, pointIndexes, lineIndexes, image },出图时临时藏起别的要素与相机、出完还原", examples: [{"group":"导出","code":"// exportSelection(options?) /
|
|
274
|
-
{ name: "exportSelectionData", kind: "method", params: "options?: GisViewExportSelectionDataOptions:parts(points / lines / channels / parallelGroups 要哪几份,缺省四份都出)、labels", returns: "GisViewExportSelectionDataResult", doc: "同一批选中换成业务表口径分项导出:选中口径与 exportSelection 一致,出的却是 points / channels / lines / parallelGroups(parts 多选,选通道 / 线路自动带上拐点);一个节点都没解析出来时返回 { ok: false, reason },不抛异常,见「导出选中的数据(分项)」", examples: [{"group":"导出","code":"// exportSelection(options?) / exportSelectionData(options?):导出选中的那几个\nconst exportedSelection = await view.exportSelection({ withLines: true, scale: 2 })\nview.exportSelection({ points: ['a', 1], format: 'data', withLines: false })\nconst selectionData = view.exportSelectionData({ parts: ['station', 'channel'] })","from":"header"}] },
|
|
291
|
+
{ name: "exportSelection", kind: "method", params: "options?: GisViewExportSelectionOptions:format / type / quality / scale / padding(只导选中要素那一块)", returns: "Promise<GisViewExportSelectionResult>", doc: "把选中的节点(可选带上两端都在集合里的线路)单独导成图片 / 数据:points 不给就用选中集,withLines / format / padding 见「导出选中的节点」;返回 { ok, reason, points, lines, counts, box, pointIndexes, lineIndexes, image },出图时临时藏起别的要素与相机、出完还原", examples: [{"group":"导出","code":"// exportSelection(options?) / exportData({ scope: 'selection' }):导出选中的那几个\nconst exportedSelection = await view.exportSelection({ withLines: true, scale: 2 })\nview.exportSelection({ points: ['a', 1], format: 'data', withLines: false })\nconst selectionData = view.exportData({ scope: 'selection', parts: ['station', 'channel'] })","from":"header"}] },
|
|
275
292
|
]
|
|
276
293
|
},
|
|
277
294
|
{
|
|
278
295
|
title: "筛选",
|
|
279
296
|
items: [
|
|
280
|
-
{ name: "setFilter", kind: "method", params: "filter: GisViewFilterInput | null 筛选条件:完整格式 { points, lines, cascade, worker };只筛节点时可以简写成节点条件本身;传 null 等于清空", returns: "this", doc: "
|
|
281
|
-
{ name: "
|
|
282
|
-
{ name: "
|
|
283
|
-
{ name: "getFilterResult", kind: "method", params: "无", returns: "GisViewFilterResult | null", doc: "当前条件与最近一次结果:隐藏的点 / 线下标、可见数量、是否用了 Worker、耗时", examples: [{"group":"筛选","code":"// clearFilter() / getFilter() / getFilterResult():清空 / 当前条件(副本)/ 最近一次结果\nview.clearFilter()\nconst filter = view.getFilter()\nconst filterResult = view.getFilterResult() // { hiddenPoints, hiddenLines, visiblePoints, visibleLines, worker, durationMs }","from":"header"}] },
|
|
297
|
+
{ name: "setFilter", kind: "method", params: "filter: GisViewFilterInput | null 筛选条件:完整格式 { points, lines, cascade, worker };只筛节点时可以简写成节点条件本身;传 null 等于清空", returns: "this", doc: "设置或清空筛选条件(传 null 清空):完整格式 { points, lines, cascade, worker },只筛节点时可以简写成节点条件本身;见「筛选」", examples: [{"group":"筛选","code":"// setFilter(filter):设筛选条件(只筛节点可以写简写);传 null 等于清空\nview.setFilter({ vn_kv: { gte: 525 } })\nview.setFilter({ points: { station_type: 'coal' }, lines: { vn_kv: { gte: 525 } }, cascade: 'binding' })\nview.setFilter(null)\n","from":"header"}] },
|
|
298
|
+
{ name: "getFilter", kind: "method", params: "无", returns: "GisViewFilter | null", doc: "当前条件与最近一次结果:隐藏的点 / 线下标、可见数量、是否用了 Worker、耗时", examples: [{"group":"筛选","code":"// getFilter() / getFilterResult():当前条件(副本)/ 最近一次结果\nview.setFilter(null)\nconst filter = view.getFilter()\nconst filterResult = view.getFilterResult() // { hiddenPoints, hiddenLines, visiblePoints, visibleLines, worker, durationMs }","from":"header"}] },
|
|
299
|
+
{ name: "getFilterResult", kind: "method", params: "无", returns: "GisViewFilterResult | null", doc: "当前条件与最近一次结果:隐藏的点 / 线下标、可见数量、是否用了 Worker、耗时", examples: [{"group":"筛选","code":"// getFilter() / getFilterResult():当前条件(副本)/ 最近一次结果\nview.setFilter(null)\nconst filter = view.getFilter()\nconst filterResult = view.getFilterResult() // { hiddenPoints, hiddenLines, visiblePoints, visibleLines, worker, durationMs }","from":"header"}] },
|
|
284
300
|
]
|
|
285
301
|
},
|
|
286
302
|
{
|
|
@@ -289,7 +305,7 @@ export const API_SECTIONS = [
|
|
|
289
305
|
{ name: "on", kind: "method", params: "name: GisViewEventName | '*' 事件名('dataChange' / 'labelClick'… 或 '*' 订阅全部);handler: (payload, name?) => void 回调,载荷字段见「事件」一节的表", returns: "() => void 取消订阅", doc: "订阅事件(与 options 里的回调同一条,可以挂多条):返回取消订阅的函数;'*' 订阅全部事件,回调拿到 (载荷, 事件名),见「事件订阅」", examples: [{"group":"事件、开关与历史","code":"// on(name, handler) / once(name, handler) / off(name, handler?):订阅('*' 订阅全部)\nconst offData = view.on('dataChange', payload => sync(payload))\nview.on('*', (payload, name) => log(name, payload))\nview.once('dataRendered', payload => { loading = false })\nview.off('dataChange') // 摘掉这个事件的全部回调\nview.off('dataChange', sync) // 只摘掉这一个(返回摘掉几条)\n","from":"header"}] },
|
|
290
306
|
{ name: "once", kind: "method", params: "同上,只触发一次(回调跑完自动摘掉)", returns: "() => void 取消订阅", doc: "订阅事件(与 options 里的回调同一条,可以挂多条):返回取消订阅的函数;'*' 订阅全部事件,回调拿到 (载荷, 事件名),见「事件订阅」", examples: [{"group":"事件、开关与历史","code":"// on(name, handler) / once(name, handler) / off(name, handler?):订阅('*' 订阅全部)\nconst offData = view.on('dataChange', payload => sync(payload))\nview.on('*', (payload, name) => log(name, payload))\nview.once('dataRendered', payload => { loading = false })\nview.off('dataChange') // 摘掉这个事件的全部回调\nview.off('dataChange', sync) // 只摘掉这一个(返回摘掉几条)\n","from":"header"}] },
|
|
291
307
|
{ name: "off", kind: "method", params: "name 事件名;handler? 只摘掉这一个回调(不传 = 摘掉这个事件的全部)", returns: "number 摘掉几条", doc: "取消订阅:不传 handler 就摘掉这个事件的全部订阅,返回摘掉几条", examples: [{"group":"事件、开关与历史","code":"// on(name, handler) / once(name, handler) / off(name, handler?):订阅('*' 订阅全部)\nconst offData = view.on('dataChange', payload => sync(payload))\nview.on('*', (payload, name) => log(name, payload))\nview.once('dataRendered', payload => { loading = false })\nview.off('dataChange') // 摘掉这个事件的全部回调\nview.off('dataChange', sync) // 只摘掉这一个(返回摘掉几条)\n","from":"header"}] },
|
|
292
|
-
{ name: "use", kind: "method", params: "plugin: GisViewPlugin(view => hook,与 options.plugins 的写法一致):立即执行一次,返回卸载函数 —— 调它跑插件自己的 destroy(重复调用只清一次,实例销毁之后也安全)", returns: "() => void 卸载", doc: "运行时挂一个插件(写法与 options.plugins 里的一项一致):调用即执行,返回幂等的卸载函数(跑插件自己的 destroy),见「插件」", examples: [{"group":"事件、开关与历史","code":"// use(plugin):运行时挂插件(立即执行一次,返回卸载函数)\nconst dispose = view.use(view => ({ destroy() { /*
|
|
308
|
+
{ name: "use", kind: "method", params: "plugin: GisViewPlugin((view, context) => hook,与 options.plugins 的写法一致):立即执行一次,返回卸载函数 —— 调它跑插件自己的 destroy(重复调用只清一次,实例销毁之后也安全)", returns: "() => void 卸载", doc: "运行时挂一个插件(写法与 options.plugins 里的一项一致):调用即执行,返回幂等的卸载函数(跑插件自己的 destroy),见「插件」", examples: [{"group":"事件、开关与历史","code":"// use(plugin):运行时挂插件(立即执行一次,返回卸载函数)\nconst dispose = view.use((view, context) => ({ destroy() { /* 插件自己的清理;context.apiVersion 当前为 1 */ } }))\ndispose()\n","from":"header"}] },
|
|
293
309
|
{ name: "getFeatures", kind: "method", params: "无", returns: "GisViewFeatureState", doc: "读当前生效的功能开关(跟随详细配置的也解析成 true / false)/ 换一份(预设名 / 开关表 / true / false),换完立刻生效并发一条 onFeatureChange", examples: [{"group":"事件、开关与历史","code":"// getFeatures() / setFeatures(next):功能开关的读 / 写(预设名 / 开关表 / 布尔值)\nconst features = view.getFeatures()\nview.setFeatures('view') // 'edit' / 'view' / 'static'\nview.setFeatures({ drag: false }) // 单个开关\nview.setFeatures(true) // 全开\n","from":"header"}] },
|
|
294
310
|
{ name: "setFeatures", kind: "method", params: "next: GisViewFeaturesInput 预设名('edit' / 'view' / 'static')、开关表或布尔值", returns: "this", doc: "读当前生效的功能开关(跟随详细配置的也解析成 true / false)/ 换一份(预设名 / 开关表 / true / false),换完立刻生效并发一条 onFeatureChange", examples: [{"group":"事件、开关与历史","code":"// getFeatures() / setFeatures(next):功能开关的读 / 写(预设名 / 开关表 / 布尔值)\nconst features = view.getFeatures()\nview.setFeatures('view') // 'edit' / 'view' / 'static'\nview.setFeatures({ drag: false }) // 单个开关\nview.setFeatures(true) // 全开\n","from":"header"}] },
|
|
295
311
|
{ name: "undo", kind: "method", params: "无", returns: "GisViewHistoryStepResult | null", doc: "撤销 / 重做一步:返回 { type, label, canUndo, canRedo },历史没开或没得撤销 / 重做时返回 null", examples: [{"group":"事件、开关与历史","code":"// undo() / redo() / canUndo() / canRedo():撤销 / 重做(历史的开关在 options.history)\nview.undo()\nview.redo()\nconst canGoBack = view.canUndo()\nconst canGoForward = view.canRedo()\n","from":"header"}] },
|
|
@@ -305,8 +321,8 @@ export const API_SECTIONS = [
|
|
|
305
321
|
title: "自定义图元",
|
|
306
322
|
items: [
|
|
307
323
|
{ name: "registerSymbol", kind: "method", params: "name: string 数据的 symbol 字段里要写的名字(同名覆盖);painter: GisViewSymbolPainter 画笔 (context, info) => void,读数见 GisViewSymbolPainterInfo,可选 painter.aspect 定宽高比", returns: "() => void 幂等的注销函数", doc: "注册一个自定义图元:名字写进数据的 symbol 字段,画法交给一支画笔((context, info) => void,见「自定义图元」);注册(或换一支画笔)之后已经在用这个名字的点当场重解析一遍,返回幂等的注销函数", examples: [{"group":"自定义图元","code":"// 注册一种「三角形」图元:数据里 symbol: '三角' 的点就用它画\nconst off = view.registerSymbol('三角', (context, info) => {\n context.fillStyle = info.color\n context.strokeStyle = info.strokeColor\n context.lineWidth = info.strokeWidth * info.scale\n const half = info.width / 2\n context.beginPath()\n context.moveTo(half, context.lineWidth / 2)\n context.lineTo(info.width - context.lineWidth / 2, info.height - context.lineWidth / 2)\n context.lineTo(context.lineWidth / 2, info.height - context.lineWidth / 2)\n context.closePath()\n context.fill()\n if (info.strokeWidth > 0) context.stroke()\n})\n","from":"code"}] },
|
|
308
|
-
{ name: "unregisterSymbol", kind: "method", params: "name: string 注册时用的名字", returns: "boolean 之前是否注册着", doc: "注销一个自定义图元(返回它之前是否注册着):还在用这个名字的点退回圆(名字从此按贴图地址解释)", examples: [{"group":"自定义图元","code":"// 注册过之后:新增的点、改图标都能直接用这个名字\nview.addPoint({ id: 'c', x: 120, y: 0, size: 22, symbol: '三角' })\nview.
|
|
309
|
-
{ name: "listSymbols", kind: "method", params: "无", returns: "string[] 注册过的名字", doc: "现在注册着哪些自定义图元的名字(按注册顺序)", examples: [{"group":"自定义图元","code":"// 注册过之后:新增的点、改图标都能直接用这个名字\nview.addPoint({ id: 'c', x: 120, y: 0, size: 22, symbol: '三角' })\nview.
|
|
324
|
+
{ name: "unregisterSymbol", kind: "method", params: "name: string 注册时用的名字", returns: "boolean 之前是否注册着", doc: "注销一个自定义图元(返回它之前是否注册着):还在用这个名字的点退回圆(名字从此按贴图地址解释)", examples: [{"group":"自定义图元","code":"// 注册过之后:新增的点、改图标都能直接用这个名字\nview.addPoint({ id: 'c', x: 120, y: 0, size: 22, symbol: '三角' })\nview.updatePoint('a', { symbol: '三角' }) // 换一个已经在画面上的点的图标:当场重解析\nview.listSymbols() // ['三角']\nview.unregisterSymbol('三角') // 直接注销(返回 true / false)\noff() // 注册时返回的注销函数:幂等,重复调用只清一次","from":"code"}] },
|
|
325
|
+
{ name: "listSymbols", kind: "method", params: "无", returns: "string[] 注册过的名字", doc: "现在注册着哪些自定义图元的名字(按注册顺序)", examples: [{"group":"自定义图元","code":"// 注册过之后:新增的点、改图标都能直接用这个名字\nview.addPoint({ id: 'c', x: 120, y: 0, size: 22, symbol: '三角' })\nview.updatePoint('a', { symbol: '三角' }) // 换一个已经在画面上的点的图标:当场重解析\nview.listSymbols() // ['三角']\nview.unregisterSymbol('三角') // 直接注销(返回 true / false)\noff() // 注册时返回的注销函数:幂等,重复调用只清一次","from":"code"}] },
|
|
310
326
|
]
|
|
311
327
|
},
|
|
312
328
|
{
|
|
@@ -332,6 +348,7 @@ export const API_OPTIONS = [
|
|
|
332
348
|
{ name: "features", type: "GisViewFeaturesInput", defaultValue: "无(缺省全关)", doc: "功能开关:预设名('edit' 全开 / 'view' 打开查看类 / 'static' 与缺省一致(全关))、开关表或布尔值。什么都不写时只剩画布与数据:没写的开关跟随各自的详细配置(interactive / clickable / draggable / boxSelect / copy.enabled…),详细配置也没写就是关(提示 / 标签 / 鹰眼图配了才有),写了 true / false 就是强制打开 / 关闭;想一次打开一批就用 'view'(能平移缩放、能悬停选中看提示但改不动数据)或 'edit'(等价 features: true)。运行时用 setFeatures() 换、getFeatures() 读,见「功能开关」" },
|
|
333
349
|
{ name: "history", type: "GisViewHistoryOptions", defaultValue: "关", doc: "历史(撤销 / 重做):true 用缺省上限 50 条,{ limit } 自定义(0 表示不限),不配就是关。打开之后 Ctrl+Z 撤销、Ctrl+Shift+Z / Ctrl+Y 重做,接口是 undo() / redo() / canUndo() / canRedo(),见「历史」" },
|
|
334
350
|
{ name: "quality", type: "GisViewQualityOptions | GisViewQualityMode | boolean", defaultValue: "'high'", doc: "画质档位(自动档按渲染耗时与整帧间隔两路信号升降):'high' 全开 / 'balanced' 关光晕 / 'lean' 连装饰一起关 / 'fast' 再降到 0.75 倍渲染分辨率,'auto'(也可以直接写 true)按这两路信号自己升降,对象写法 { mode, budgetMs, minScale } 能换预算与分辨率下限。只改「画哪些批次 + 多大分辨率」,不重排场景、不动数据,见「画质」" },
|
|
351
|
+
{ name: "denseMode", type: "GisViewDenseModeInput", defaultValue: "'auto'", doc: "大数据展示模式:'auto' 按可见节点数、屏幕密度与数据总量自动进入密集档,'on' / 'off'(或 true / false)强制开关;对象写法可换 visibleThreshold / densityThreshold / pointThreshold 三档阈值。进入后标签自动走避让 / 截断,线路动点与节点涟漪暂停;读数看 getStats().dense,见「大数据展示模式(denseMode)」" },
|
|
335
352
|
{ name: "points", type: "GisViewPoint[]", defaultValue: "[]", doc: "点数据,x / y 为世界坐标(经纬度、投影米或任意平面坐标)" },
|
|
336
353
|
{ name: "lines", type: "GisViewLine[]", defaultValue: "[]", doc: "线数据,start / end 支持 { x, y } 或 [x, y],折线用 path,端点可用 from / to 绑定点 id" },
|
|
337
354
|
{ name: "channels", type: "GisViewChannel[]", defaultValue: "[]", doc: "通道:把若干条线路组织成并行敷设的多回线走廊,回线几何由骨架折线按偏移推导;两端可用 from / to 绑在节点上" },
|
|
@@ -341,22 +358,25 @@ export const API_OPTIONS = [
|
|
|
341
358
|
{ name: "channelTangentInset", type: "number | null", defaultValue: "null", doc: "两端切点往节点里收多少 CSS 像素:缺省(null)按成员回线里最粗那条的线宽收,线因此不会从节点边缘探出去;0 表示切点正好落在节点边上,负数外收(切点往节点外让、回线整段比节点宽);单个通道可用 tangentInset 覆盖;内收两侧合计最多收掉节点宽度的 40%,外收单侧最多让出 50%" },
|
|
342
359
|
{ name: "channelMaxGroups", type: "number", defaultValue: "0", doc: "一条通道最多几个分组(0 表示不限):新增通道时用来判断还能不能变成新分组,见「新增通道」" },
|
|
343
360
|
{ name: "channelGroupMaxLines", type: "number", defaultValue: "0", doc: "一个分组最多几条回线(0 表示不限):新增通道时用来判断还能不能并进某一组,见「新增通道」" },
|
|
344
|
-
{ name: "channelDraftStyle", type: "GisViewChannelDraftStyle", defaultValue: "蓝色 2px +
|
|
361
|
+
{ name: "channelDraftStyle", type: "GisViewChannelDraftStyle", defaultValue: "蓝色 2px + 两端圆点,箭头关闭", doc: "新增通道草稿预览的全局样式:color / width / dot / dotColor / arrow / arrowSize / arrowPositions / arrowReverse / arrowColor / circuitSpacing / opacity / customDraw;beginAddChannel({ channelDraftStyle }) 可按这一次草稿覆盖,updateAddChannelStyle(patch) 可在草稿期间增量修改" },
|
|
362
|
+
{ name: "webglLayers", type: "GisViewWebGLLayer[]", defaultValue: "[]", doc: "WebGL 自定义绘制层:每层提供 draw({ gl, canvas, viewport, camera, frame, project, unproject, requestRender }),在内置内容之后按 order 绘制;运行时也可用 addWebGLLayer / updateWebGLLayer / removeWebGLLayer 维护" },
|
|
345
363
|
{ name: "background", type: "GisViewBackground", defaultValue: "浅色底", doc: "背景层,支持底色、图片与 GeoJSON" },
|
|
346
364
|
{ name: "pointStyle", type: "GisViewPointStyle", defaultValue: "见下", doc: "点的默认样式,可被单个点覆盖;运行时按字段合并用 updatePointStyle(patch)(updateOptions({ pointStyle }) 是整份换)" },
|
|
347
365
|
{ name: "lineStyle", type: "GisViewLineStyle", defaultValue: "见下", doc: "线的默认样式,可被单条线覆盖;运行时按字段合并用 updateLineStyle(patch)" },
|
|
348
366
|
{ name: "pointRules", type: "GisViewPointRule[] / GisViewLineRule[]", defaultValue: "[]", doc: "批量样式规则:按属性给点 / 线批量配色、改大小、换符号,见「批量样式规则」" },
|
|
349
367
|
{ name: "lineRules", type: "GisViewPointRule[] / GisViewLineRule[]", defaultValue: "[]", doc: "批量样式规则:按属性给点 / 线批量配色、改大小、换符号,见「批量样式规则」" },
|
|
350
368
|
{ name: "heatmap", type: "GisViewHeatmap | null", defaultValue: "无", doc: "热力图:按业务字段的数值到渐变色带上取颜色,并可按同一个值缩放节点大小 / 线宽,作用对象可选节点 / 线路 / 通道;不配(或 null)就是关的,见「热力图」" },
|
|
351
|
-
{ name: "effects", type: "GisViewEffectsInput", defaultValue: "关", doc: "动画效果(全局缺省):线路上的跑动图标(line,ECharts lines.effect 那一类)与节点上的扩散涟漪(point,effectScatter 那一类),逐要素用 points[].effect / lines[].effect 覆盖;没配就是关的,但「只在数据里逐条配了 effect」的场景照样会动。false 或 { enabled: false } 是一处关掉(谁都别动);运行时有
|
|
369
|
+
{ name: "effects", type: "GisViewEffectsInput", defaultValue: "关", doc: "动画效果(全局缺省):线路上的跑动图标(line,ECharts lines.effect 那一类)与节点上的扩散涟漪(point,effectScatter 那一类),逐要素用 points[].effect / lines[].effect 覆盖;没配就是关的,但「只在数据里逐条配了 effect」的场景照样会动。false 或 { enabled: false } 是一处关掉(谁都别动);运行时有 updateOptions({ effects }) / getEffects() / getLineEffects(),见「动画效果(effects)」" },
|
|
352
370
|
{ name: "lineDirection", type: "GisViewLineDirectionInput", defaultValue: "关(null)", doc: "线路方向箭头(全局缺省):沿线摆一串静态箭头,朝向跟着线路切向走(起点 / from 那一端 → 终点,reverse 指回上游),按弧长等分、缺省每条线只在中点一个;逐条线路用 lines[].direction 覆盖,写法与 effects 同构(true 用全局、对象逐字段覆盖、false / null 关掉),见「线路方向箭头(lineDirection)」" },
|
|
353
371
|
{ name: "prebake", type: "GisViewPrebakeOptions | true", defaultValue: "关", doc: "贴图符号预热:把「这次画面会出现什么」提前告诉组件 —— 两种写法:combos 逐组合(精确,getSymbolCombos() 收出来的那份)/ symbols × pointColors × sizes 与 lineColors × 线路动画图标 全排列(省事,颜色与尺寸由同一个字段决定时会多烤很多)—— 第一帧之前就烤好,画到它们时命中的是现成的贴图(省掉解码 + 光栅化那一下);组合数与数据量无关,不配就是从前那条按需路径。读数 getPrebake() / getSymbolCombos()、手动再烤一遍 runPrebake(),见「贴图符号预热(prebake)」" },
|
|
354
372
|
{ name: "label", type: "GisViewLabelOptions | GisViewLabelOptions[]", defaultValue: "无", doc: "节点标签:内容 / 位置 / 显隐 / 避让 / 拖动与编辑都可配,写数组就是同一个节点上多条标签,与 lineLabel 共用一套避让网格,见「节点标签」" },
|
|
355
373
|
{ name: "labelOptimize", type: "boolean", defaultValue: "false", doc: "标签显示优化开关:缺省关 = 强制显示(不避让、不按 maxCount 截断、不设 scanLimit / 扫描预算,节点 / 线路的每个可见要素该出现的标签一条不少);写 true 与从前一致 —— 避让 / 换落点 / 数量上限 / 候选上限全部生效。标签订得密、数据量大(十万级)时建议打开,见「标签显示优化开关」" },
|
|
374
|
+
{ name: "labelRender", type: "'auto' | 'dom'", defaultValue: "'auto'", doc: "纯文本标签的容器渲染方式:auto 在强制显示档(labelOptimize 未开且未进密集档)下,同一层纯文本标签达到 1024 条时改画到一张 Canvas,不再逐条建 div;HTML / 元素内容 / 可拖拽 / 可编辑 / 超出 Canvas 样式能力的标签仍走 DOM。dom 始终逐条建 .gis-view__label。只影响容器,不改内容、锚点、显隐与 html 解析,见「标签容器渲染(labelRender)」" },
|
|
356
375
|
{ name: "lineLabel", type: "GisViewLineLabelOptions | GisViewLineLabelOptions[]", defaultValue: "无", doc: "线路标签:位置沿线走(比例 / 百分比 / 绝对距离),内容、避让、显隐都可配,与节点标签共用一套避让网格;写数组就是同一条线上多条标签,见「线路标签」" },
|
|
357
376
|
{ name: "labelStates", type: "GisViewLabelState[]", defaultValue: "无", doc: "标签的运行时状态(getLabelStates() 的那一份:拖出来的偏移、改过的内容与样式、运行时加的标签、隐藏覆盖):创建时喂回来就回显,等价于创建之后调 setLabelStates(states);updateOptions({ labelStates }) 同样认。exportData({ format: 'input' }) 的结果里就叫 labelStates,存档 → 回灌直接接上" },
|
|
377
|
+
{ name: "graphics", type: "GisViewGraphic[]", defaultValue: "无", doc: "与节点无关的扩展图形:按世界坐标放 SVG 路径 / 图片 / Canvas,支持锚点、偏移、旋转、透明度、zIndex 与 scaleWithView;位于画布之上、标签之下,运行时用 addGraphic / addGraphics / updateGraphic / removeGraphic / clearGraphics 增删改,见「扩展图形(graphic)」" },
|
|
358
378
|
{ name: "tooltip", type: "GisViewTooltipOptions", defaultValue: "无", doc: "悬停提示:点 / 线 / 通道分别配置内容,见「悬浮提示」" },
|
|
359
|
-
{ name: "minimap", type: "GisViewMinimapOptions | null", defaultValue: "无", doc: "内置鹰眼图:位置、尺寸、节点 / 线路 / 视口框三份样式与交互都可配,extent 决定小图按数据范围还是「数据 ∪ 底图」铺(默认 auto,GeoJSON 底图不会缩成一个点),zoomable 打开后小图自身可整体放大缩小(空白处拖动可以平移小图或直接框选让主图显示过去,每格倍率 zoomStep),通道还能只画一根;小图同样支持规则(pointRules / lineRules,缺省沿用主图规则的颜色与层级),可以只画某几层(levels)、关掉分层叠画(layered)、按三组系数给节点与线路定尺寸(整体倍数 pointSizeScale / lineWidthScale、跟随小图倍数 pointZoomScale / lineZoomScale(只在小图自身倍数 ≠ 1 时起作用)、跟随主视图地图倍数 pointMapZoomScale / lineMapZoomScale),视口框与框选矩形的颜色 / 背景 / 边框 / 圆角也能配(boxStyle / selectStyle),extent 还能直接写死一份世界范围、容器可加 className / style、draw
|
|
379
|
+
{ name: "minimap", type: "GisViewMinimapOptions | null", defaultValue: "无", doc: "内置鹰眼图:位置、尺寸、节点 / 线路 / 视口框三份样式与交互都可配,extent 决定小图按数据范围还是「数据 ∪ 底图」铺(默认 auto,GeoJSON 底图不会缩成一个点),zoomable 打开后小图自身可整体放大缩小(空白处拖动可以平移小图或直接框选让主图显示过去,每格倍率 zoomStep),通道还能只画一根;小图同样支持规则(pointRules / lineRules,缺省沿用主图规则的颜色与层级),可以只画某几层(levels)、关掉分层叠画(layered)、按三组系数给节点与线路定尺寸(整体倍数 pointSizeScale / lineWidthScale、跟随小图倍数 pointZoomScale / lineZoomScale(只在小图自身倍数 ≠ 1 时起作用)、跟随主视图地图倍数 pointMapZoomScale / lineMapZoomScale),视口框与框选矩形的颜色 / 背景 / 边框 / 圆角也能配(boxStyle / selectStyle),extent 还能直接写死一份世界范围、容器可加 className / style、layers 按 placement 分数据前 / 数据后、段内按 order 拆出多层自绘内容(旧 draw 钩子仍兼容并排在最后)、onInteraction 在手势结束时给出类型 / 世界坐标 / 相机、maxPixelRatio 限制备份倍率上限,不配则不产生任何 DOM,见「鹰眼图」" },
|
|
360
380
|
{ name: "filter", type: "GisViewFilterInput | null", defaultValue: "无", doc: "初始筛选条件,等价于创建之后调用 setFilter,见「筛选」" },
|
|
361
381
|
{ name: "filterWorker", type: "boolean | GisViewFilterWorkerOptions", defaultValue: "{ threshold: 20000 }", doc: "筛选是否用 Web Worker 计算:默认点 + 线总数超过阈值才用,false 表示始终同步算" },
|
|
362
382
|
{ name: "searchWorker", type: "boolean | GisViewSearchWorkerOptions", defaultValue: "{ threshold: 20000 }", doc: "[异步搜索](14-视图与筛选.md#搜索与定位)是否用 Web Worker 计算:默认点 + 线总数超过阈值才用,false 表示 searchAsync 也同步算;同步的 search 一直在主线程算,不受这一项影响" },
|
|
@@ -379,8 +399,9 @@ export const API_OPTIONS = [
|
|
|
379
399
|
{ name: "selectionKinds", type: "GisViewSelectionKindsInput", defaultValue: "无(框选只收节点;Ctrl 多选收节点 / 线路 / 通道)", doc: "框选与 Ctrl / 多选点击的类型过滤:'point' 节点、'line' 通道外的独立线路、'channel' 通道回线;可写数组任意组合,'all' / true 全开,false / null 全关。通道回线只归 channel 管,通道外的线路只归 line 管;通道回线仍按 channelSelectMode 摊开。不写时保留旧口径;普通单选与 select / selectFeatures 不受它限制。运行时走 updateOptions({ selectionKinds }),见「框选」与「选择类型过滤」" },
|
|
380
400
|
{ name: "selectionBoxStyle", type: "GisViewSelectionBoxStyle", defaultValue: "蓝底 0.16 透明 + 1px 蓝框", doc: "框选矩形的填充与边框:fill、fillOpacity、stroke、strokeWidth" },
|
|
381
401
|
{ name: "selectionOnTop", type: "boolean", defaultValue: "true", doc: "选中的节点 / 拖动中的整组 / 待确认合并的目标节点,以及选中线路所在的整条通道,是否画在所有要素之上(与 zIndex 无关),见「选中 / 拖动的层级」" },
|
|
382
|
-
{ name: "channelSelectMode", type: "'line' | 'group' | 'channel'", defaultValue: "'line'", doc: "通道选中模式:点中通道里的一条回线时选中什么 —— 'line' 只选这一条、'group' 连它所在的分组一起、'channel'
|
|
383
|
-
{ name: "
|
|
402
|
+
{ name: "channelSelectMode", type: "'line' | 'group' | 'channel'", defaultValue: "'line'", doc: "通道选中模式:点中通道里的一条回线时选中什么 —— 'line' 只选这一条、'group' 连它所在的分组一起、'channel' 整条通道(所有分组的回线);通道以外的线路永远只选自己。普通点选与 Ctrl / ⌘ + 点击加点共用这一档高亮范围;Ctrl / ⌘ + 点击在 group / channel 下按整批取反;切换走 updateOptions({ channelSelectMode }),只重画一帧、不重排场景,见「通道选中模式」" },
|
|
403
|
+
{ name: "channelWaypointDragMode", type: "'parallel' | 'vertex'", defaultValue: "'parallel'", doc: "分组拐点拖动模式:'parallel' 沿用共用骨架 + 平行偏移(和原有逻辑一致),'vertex' 只平移当前分组同一 pathIndex 的拐点,其他拐点与分组不动;普通线路始终只动自己。vertex 的结果写进 groups[].waypointOffsets,切换走 updateOptions({ channelWaypointDragMode }),下一次拖动生效,见「分组拐点拖动模式」" },
|
|
404
|
+
{ name: "waypointEditable", type: "boolean", defaultValue: "false", doc: "是否允许编辑线路拐点(按住加点快捷键 shortcuts.addWaypoint(默认 Ctrl / ⌘)+ 点击添加、拖动移动、双击或删除快捷键删除),单条线可用 waypointEditable 覆盖;缺省关,写 waypointEditable: true 或 features: { waypoint: true } 才开。false(以及 features: { waypoint: false })会同时关闭新增、移动与删除,没有只关其中一项的细分开关;shortcuts.addWaypoint 仍只决定加点的组合键" },
|
|
384
405
|
{ name: "waypointVisibility", type: "'selected' | 'always'", defaultValue: "'selected'", doc: "拐点显示时机:selected 只显示选中线路(以及刚加过拐点的线路)的拐点,always 全部显示" },
|
|
385
406
|
{ name: "waypointStyle", type: "GisViewPointStyle", defaultValue: "无", doc: "拐点(线路 path 的中间顶点)的默认 / 选中样式,支持配置:字段与节点样式同款;缺省是白底蓝圈的 9px 圆点,waypointSelectStyle 没配时选中拐点用内置强调环,见「线路拐点」的「拐点样式」小节" },
|
|
386
407
|
{ name: "waypointSelectStyle", type: "GisViewPointStyle", defaultValue: "无", doc: "拐点(线路 path 的中间顶点)的默认 / 选中样式,支持配置:字段与节点样式同款;缺省是白底蓝圈的 9px 圆点,waypointSelectStyle 没配时选中拐点用内置强调环,见「线路拐点」的「拐点样式」小节" },
|
|
@@ -396,7 +417,7 @@ export const API_OPTIONS = [
|
|
|
396
417
|
{ name: "shortcuts", type: "GisViewShortcuts", defaultValue: "见「快捷键」", doc: "所有快捷键都可自定义:框选 / 多选 / 加点 / 复制 / 粘贴 / 取消 / 删除 / 适应视图,没写的动作沿用默认值,写 false 等于关掉这个动作的快捷键" },
|
|
397
418
|
{ name: "copy", type: "GisViewCopyOptions", defaultValue: "缺省关", doc: "复制节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、offset 落点偏移(默认 [28, 24] 像素)、autoCommit(交互入口落地前是否自动确认:不写就是落地,false 停在预览态等 commitPointCopy() / 载荷里的 payload.commit())、idPrefix(默认 copy-)、createId / createItem 定制复制品,见「节点复制」" },
|
|
398
419
|
{ name: "remove", type: "GisViewRemoveOptions", defaultValue: "缺省关", doc: "删除选中的拐点 / 线路 / 节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、scope(confirm() 不带参数时的缺省范围:'lines' 只删选中的回线 / 'groups' 连所在分组 / 'channels' 连整条通道,缺省 'lines')、confirm(不写停在 pending 等使用方裁决 / false 直接删 / 函数自行裁决,支持 Promise)。Delete 键与 requestRemove() 都先出一份「要删什么、连带什么」的载荷,确认之后才动数据;删节点会连挂在它身上的线路与被它锚定的通道一起删,见「删除(remove)」" },
|
|
399
|
-
{ name: "merge", type: "GisViewMergeOptions", defaultValue: "缺省关", doc: "合并节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、distance
|
|
420
|
+
{ name: "merge", type: "GisViewMergeOptions", defaultValue: "缺省关", doc: "合并节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、trigger 触发时机('collision' 两个节点半径相碰 / 'center' 拖动节点中心进入目标节点区域)、distance 额外像素容差、confirm(不写停在 pending 等使用方裁决 / false 直接合并 / 函数自行裁决)、channelGroups('keep' 各自保留分组 / 'merge' 合成一个分组)、createItem 定制合并结果,见「节点合并」" },
|
|
400
421
|
{ name: "minScale", type: "number", defaultValue: "0.002 / 20000", doc: "缩放范围(像素 / 世界单位)" },
|
|
401
422
|
{ name: "maxScale", type: "number", defaultValue: "0.002 / 20000", doc: "缩放范围(像素 / 世界单位)" },
|
|
402
423
|
{ name: "fitPadding", type: "number", defaultValue: "48", doc: "适应视图时四周留白(CSS 像素);留白比画布还大时按「内容至少留 48px」反过来压留白,不会把内容挤成一个点" },
|
|
@@ -405,7 +426,7 @@ export const API_OPTIONS = [
|
|
|
405
426
|
{ name: "progressiveInit", type: "boolean", defaultValue: "true", doc: "大数据(2 万点以上)初始化是否从视图中心向外发散渲染:首帧只排中心附近的一批,剩下的分帧往外补,见「大数据量」" },
|
|
406
427
|
{ name: "statsInterval", type: "number", defaultValue: "250", doc: "onStats 的最小间隔(毫秒),0 表示每帧都发" },
|
|
407
428
|
{ name: "renderEmitInterval", type: "number", defaultValue: "400", doc: "onRender 的节流间隔(毫秒),0 与 onStats 同拍(再配上 statsInterval: 0 就是每帧一条)" },
|
|
408
|
-
{ name: "plugins", type: "GisViewPlugin[]", defaultValue: "[]", doc: "插件:view => hook,返回的 destroy 在实例销毁时倒序回调,见「插件」" },
|
|
429
|
+
{ name: "plugins", type: "GisViewPlugin[]", defaultValue: "[]", doc: "插件:(view, context) => hook,返回的 destroy 在实例销毁时倒序回调,见「插件」" },
|
|
409
430
|
{ name: "zoomStep", type: "number", defaultValue: "1.4", doc: "zoomIn() / zoomOut() 的步进倍率" },
|
|
410
431
|
{ name: "width", type: "number | string", defaultValue: "容器尺寸", doc: "画布尺寸,数字按 CSS 像素处理" },
|
|
411
432
|
{ name: "height", type: "number | string", defaultValue: "容器尺寸", doc: "画布尺寸,数字按 CSS 像素处理" },
|