gis-view-webgl2 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +14 -11
  2. package/dist/gis-view.css +1 -1
  3. package/dist/index.cjs +1 -1
  4. package/dist/index.d.ts +445 -241
  5. package/dist/index.js +1 -1
  6. package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +65 -498
  7. package/docs/GisView.md +1 -1
  8. package/docs/GisView/345/256/236/347/216/260/345/216/237/347/220/206.md +1 -1
  9. package/docs/ai/06-/344/274/232/350/257/235/347/264/242/345/274/225/344/270/216/345/244/215/346/237/245/346/226/271/346/263/225.md +114 -478
  10. package/docs/demos/BasicDemo.vue +144 -27
  11. package/docs/demos/BatchAddDemo.vue +133 -7
  12. package/docs/demos/ChannelDemo.vue +61 -0
  13. package/docs/demos/ConnectDemo.vue +164 -33
  14. package/docs/demos/CopyMergeDemo.vue +144 -42
  15. package/docs/demos/EventDemo.vue +29 -24
  16. package/docs/demos/LabelDemo.vue +5 -5
  17. package/docs/demos/api-index.js +53 -41
  18. package/docs/demos/gis-view-demo/GisViewDemoCardHeader.vue +1 -1
  19. package/docs/demos/gis-view-demo/GisViewDemoStage.vue +1 -1
  20. package/docs/demos/gis-view-demo/panels/DataPanels.vue +1 -1
  21. package/docs/demos/gis-view-demo/useGisViewDemo.js +31 -33
  22. package/docs/format/02-/350/212/202/347/202/271/344/270/216/347/272/277/350/267/257.md +1 -0
  23. package/docs/format/04-/351/200/232/351/201/223/344/270/216/346/240/207/347/255/276.md +3 -0
  24. 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 +8 -7
  25. package/docs/from0/05-/347/233/270/346/234/272/344/270/216/344/272/244/344/272/222.md +1 -1
  26. package/docs/from0/07-/351/200/232/351/201/223/345/210/206/347/273/204/344/270/216/345/244/232/345/233/236/347/272/277.md +26 -10
  27. package/docs/index.html +136 -13
  28. package/docs/internals/15-04-/351/200/220/350/275/256/350/256/260/345/275/225-/347/203/255/345/212/233/345/233/276/344/270/216/346/200/247/350/203/275.md +10 -0
  29. package/docs/manual/02-/345/235/220/346/240/207/344/270/216/346/225/260/346/215/256.md +1 -1
  30. package/docs/manual/03-/351/205/215/347/275/256/351/241/271.md +82 -14
  31. package/docs/manual/04-/344/272/213/344/273/266/344/270/216/345/233/236/350/260/203.md +23 -17
  32. package/docs/manual/05-/347/224/273/350/264/250/344/270/216/346/211/271/351/207/217/346/233/264/346/226/260.md +65 -0
  33. 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 +9 -10
  34. 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 +100 -40
  35. package/docs/manual/08-/351/200/211/344/270/255/344/270/216/346/213/220/347/202/271.md +11 -7
  36. package/docs/manual/09-/351/200/232/351/201/223/344/270/216/345/244/232/345/233/236/347/272/277.md +66 -6
  37. 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 +226 -493
  38. package/docs/manual/12-/346/240/207/347/255/276/344/270/216/350/243/205/351/245/260.md +28 -5
  39. package/docs/manual/14-/350/247/206/345/233/276/344/270/216/347/255/233/351/200/211.md +46 -14
  40. package/docs/manual/15-/345/257/274/345/207/272/344/270/216/351/233/206/346/210/220.md +5 -2
  41. package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md +34 -29
  42. package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +30 -22
  43. package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +168 -81
  44. 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 +1 -1
  45. package/docs/manual/20-/346/200/247/350/203/275/344/270/216/345/244/247/346/225/260/346/215/256.md +5 -3
  46. 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 +9 -6
  47. package/docs/steps/README.md +201 -120
  48. package/docs/steps/bench-scale.html +1 -1
  49. package/docs/steps/index.html +222 -6
  50. package/docs/steps/selftest-actions.html +26 -25
  51. package/docs/steps/selftest-data.html +1 -1
  52. package/docs/steps/selftest-demos.html +290 -16
  53. package/docs/steps/selftest-docs.html +17 -6
  54. package/docs/steps/selftest-features.html +594 -54
  55. package/docs/steps/selftest-full.html +3 -3
  56. package/docs/steps/selftest-labels.html +82 -1
  57. package/docs/steps/selftest-perf.html +62 -7
  58. package/docs/steps/selftest-select.html +71 -6
  59. package/docs/steps/step-05-pick.js +4 -8
  60. package/docs/steps/step-07-channels.js +3 -5
  61. package/docs/steps/step-08-labels.js +3 -3
  62. package/docs/steps/step-10-full.js +3 -3
  63. package/docs/steps/step-12-events.js +41 -24
  64. package/docs//344/273/2160/345/210/260/345/256/214/346/225/264/347/232/204/345/256/236/347/216/260.md +1 -0
  65. package/package.json +1 -1
  66. package/docs/ai/01-/350/265/267/346/272/220/344/270/216/350/277/231/344/273/275/346/261/207/346/200/273/347/232/204/347/224/261/346/235/245.md +0 -29
  67. package/docs/ai/02-/346/214/211/345/206/205/345/256/271/345/210/206/347/261/273-/350/277/231/344/270/200/350/267/257/351/203/275/345/234/250/346/224/271/344/273/200/344/271/210.md +0 -66
  68. package/docs/ai/03-/351/207/215/350/246/201/351/227/256/347/255/224/351/200/211/357/274/210/344/270/200/357/274/211/357/274/232/351/200/211/345/236/213/351/200/232/351/201/223/344/270/216/346/240/267/345/274/217.md +0 -178
  69. package/docs/ai/04-/351/207/215/350/246/201/351/227/256/347/255/224/351/200/211/357/274/210/344/272/214/357/274/211/357/274/232/344/272/244/344/272/222/346/200/247/350/203/275/344/270/216/346/225/260/346/215/256.md +0 -140
  70. package/docs/ai/05-/351/207/215/350/246/201/351/227/256/347/255/224/351/200/211/357/274/210/344/270/211/357/274/211/357/274/232/345/256/277/344/270/273/346/227/201/346/224/257/344/270/216/346/224/266/345/217/243.md +0 -43
@@ -7,8 +7,8 @@
7
7
  * 源码或文档改过之后重跑一遍;`node docs/steps/check-doc-coverage.mjs` 会对账。
8
8
  */
9
9
 
10
- /** { members: 265, methods: 260, properties: 5, options: 96, sections: 16 } */
11
- export const API_SUMMARY = {"members":265,"methods":260,"properties":5,"options":96,"sections":16}
10
+ /** { members: 273, methods: 268, properties: 5, options: 100, sections: 16 } */
11
+ export const API_SUMMARY = {"members":273,"methods":268,"properties":5,"options":100,"sections":16}
12
12
 
13
13
  /** 实例成员,按 docs/GisView.md「参数速查」的分组排 */
14
14
  export const API_SECTIONS = [
@@ -30,12 +30,12 @@ export const API_SECTIONS = [
30
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"}] },
31
31
  { name: "getResolvedBackground", kind: "method", params: "无", returns: "GisViewResolvedBackground", doc: "引擎解析后的背景层:{ color, image: { quad, texture, source, opacity }, geoJson: { regions, labels, bounds, rawBounds, fillBuckets, strokeGroups, pointGroups } },自建缩略图 / 图例 / 取真实范围都用它", examples: [{"group":"配置与数据","code":"// getResolvedBackground() / getBackgroundLabels():背景层解析后的读数 / GeoJSON 区域文字的清单\nconst background = view.getResolvedBackground()\nconst backgroundLabels = view.getBackgroundLabels()\n","from":"header"}] },
32
32
  { name: "getBackgroundLabels", kind: "method", params: "无", returns: "GisViewResolvedBackgroundLabel[] | null", doc: "背景 GeoJSON 的区域文字(世界坐标 + 字号 / 颜色 / 偏移),自建覆盖层用", examples: [{"group":"配置与数据","code":"// getResolvedBackground() / getBackgroundLabels():背景层解析后的读数 / GeoJSON 区域文字的清单\nconst background = view.getResolvedBackground()\nconst backgroundLabels = view.getBackgroundLabels()\n","from":"header"}] },
33
- { name: "batch", kind: "method", params: "fn: () => T 这一批里要做的改动(内部调 updatePoint / updateLine / updateData 都收成一条);options.label?: string 给这一步历史起名", returns: "fn 的返回值", doc: "批量更新:回调里对 updatePoint / updateLine / updateData 的连续改动收成一条 onDataChange(type: 'batch',changes 按调用顺序列出每一步)与一步历史,options.label 给这一步起名;收尾时筛选只重算一次、标签重排 / 提示框 / 鹰眼图各补一次(onFilter 也只发一条),可以嵌套(只有最外层收尾),见「批量更新」", examples: [{"group":"配置与数据","code":"// batch(fn, options?):一批改动收成一条数据变更、历史里一步\nview.batch(() => {\n view.updatePoint('a', { x: 10 })\n view.updateLine('l1', { width: 2 })\n}, { label: '挪站并加粗' })\n","from":"header"}] },
33
+ { name: "batch", kind: "method", params: "fn: () => T 这一批里要做的增删改 / 分组操作(内部调 patchPoints / patchLines / updateChannel、removePoints / removeLines / removeChannel、splitChannelGroups / removeChannelGroup 等都会收成一条);options.label?: string 给这一步历史起名", returns: "fn 的返回值", doc: "批量增删改:回调里的连续改动(patchPoints / patchLines / updateChannel、removePoints / removeLines / removeChannel、分组拆分 / 删除 / 新增等)收成一条 onDataChange(type: 'batch',changes 按调用顺序列出每一步)与一步历史,options.label 给这一步起名;收尾时筛选只重算一次、标签重排 / 提示框 / 鹰眼图各补一次(onFilter 也只发一条),可以嵌套(只有最外层收尾),见「批量更新」", examples: [{"group":"配置与数据","code":"// batch(fn, options?):一批改动收成一条数据变更、历史里一步\nview.batch(() => {\n view.updatePoint('a', { x: 10 })\n view.updateLine('l1', { width: 2 })\n}, { label: '挪站并加粗' })\n","from":"header"}] },
34
34
  { name: "resize", kind: "method", params: "无(改过祖先 transform: scale / 容器尺寸后手动同步一次;CSS zoom 会自动感知)", returns: "this", doc: "手动同步尺寸 / 重新应用配置并重绘(refresh({ reflow: false }) 只重画一帧,不重解析数据与配置);容器尺寸或祖先的 transform: scale 变过之后要调一次 resize() 同步(CSS zoom 会自己感知)", examples: [{"group":"配置与数据","code":"// resize():容器尺寸变过(祖先 transform: scale、display 切换)之后手动同步一次\nwindow.addEventListener('resize', () => view.resize())\n","from":"header"}] },
35
35
  { name: "refresh", kind: "method", params: "options?: { reflow?: boolean } 传 false 只重画一帧(跳过整份重解析:数据没变、只想重画时用);不传或 true 走整份重建", returns: "this", doc: "手动同步尺寸 / 重新应用配置并重绘(refresh({ reflow: false }) 只重画一帧,不重解析数据与配置);容器尺寸或祖先的 transform: scale 变过之后要调一次 resize() 同步(CSS zoom 会自己感知)", examples: [{"group":"配置与数据","code":"// refresh(options?):整份重建;refresh({ reflow: false }) 只重画一帧\nview.refresh()\nview.refresh({ reflow: false })\n","from":"header"}] },
36
36
  { name: "whenRendered", kind: "method", params: "等下一帧画完(Promise):兑现那一帧的载荷(frame 是帧序号,type / changes / counts 说明这一帧带上了哪几次数据变更);引擎下一次渲染结束时兑现,视图销毁时兑现 null", returns: "Promise<GisViewDataRenderedPayload | null>", doc: "/** * 等下一帧画完(Promise)。", examples: [{"group":"配置与数据","code":"// whenRendered():等下一帧画完(载荷是这一帧的读数:frame / type / changes / counts)\nconst frame = await view.whenRendered()\n","from":"header"}] },
37
37
  { name: "whenDataRendered", kind: "method", params: "等「刚换的这一份数据画出来」(Promise):有挂起的数据变更时与 whenRendered 同一条路;没有挂起的变更时立刻兑现 null。view.updateData(payload); await view.whenDataRendered(); loading = false 是收 loading 的标准写法", returns: "Promise<GisViewDataRenderedPayload | null>", doc: "/** * 等「刚换的这一份数据画出来」(Promise)。", examples: [{"group":"配置与数据","code":"// whenDataRendered():等「刚换的这份数据画完」—— 收 loading 遮罩的标准写法\nview.updateData(nextPoints, nextLines)\nawait view.whenDataRendered()\n","from":"header"}] },
38
- { name: "snapshotScene", kind: "method", params: "options?: GisViewSceneSnapshotOptions 快照选项(要哪些读数 / 哪些数据)", returns: "GisViewSceneSnapshot | null", doc: "当前画面的矢量快照(屏幕坐标的线 / 点 / 标签 / 背景 / 网格):{ width, height, background, backgroundImage, grid, regions, lines, points, backgroundPoints, decorations, waypoints, raised, labels },options.background: false 丢背景、options.backgroundColor 只换底色、options.labels 原样带进去,见「导出图片」", examples: [{"group":"配置与数据","code":"// snapshotScene(options?):一次取全画布读数 / 数据快照(矢量导出、单测都用它)\nconst snapshot = view.snapshotScene()\nconst white = view.snapshotScene({ background: '#ffffff' })\n","from":"header"}] },
38
+ { name: "snapshotScene", kind: "method", params: "options?: GisViewSceneSnapshotOptions 快照选项(要哪些读数 / 哪些数据)", returns: "GisViewSceneSnapshot | null", doc: "当前画面的矢量快照(屏幕坐标的线 / 点 / 标签 / 背景 / 网格):{ width, height, background, backgroundImage, grid, regions, lines, raisedLines, points, backgroundPoints, decorations, waypoints, raised, labels };raisedLines 是抬层的选中线路 / 通道,导出时排在普通节点之后、raised 端点节点之前。options.background: false 丢背景、options.backgroundColor 只换底色、options.labels 原样带进去,见「导出图片」", examples: [{"group":"配置与数据","code":"// snapshotScene(options?):一次取全画布读数 / 数据快照(矢量导出、单测都用它;raisedLines 是抬层线路)\nconst snapshot = view.snapshotScene()\nconst white = view.snapshotScene({ background: '#ffffff' })\n","from":"header"}] },
39
39
  { name: "destroy", kind: "method", params: "无", returns: "无", doc: "销毁引擎并移除根节点", examples: [{"group":"配置与数据","code":"// destroy():卸载(事件、观察器、WebGL 上下文一起清)\nview.destroy()","from":"header"}] },
40
40
  ]
41
41
  },
@@ -50,15 +50,20 @@ export const API_SECTIONS = [
50
50
  { name: "zoomBy", kind: "method", params: "factor: number 缩放倍数(> 1 放大、< 1 缩小);origin?: [number, number] 缩放中心(画布 CSS 像素,缺省画布中心)", returns: "this", doc: "相对缩放,origin 为画布 CSS 像素锚点(缺省视口中心)", examples: [{"group":"相机与视图","code":"// zoomBy(factor, origin?):按倍数缩放;origin 是画布 CSS 像素的缩放中心\nview.zoomBy(1.5)\nview.zoomBy(0.5, [320, 200])\n","from":"header"}] },
51
51
  { name: "zoomTo", kind: "method", params: "scale: number 目标缩放值(世界单位 → CSS 像素的比例);origin?: [x, y] 缩放中心", returns: "this", doc: "直接设成指定比例(像素 / 世界单位)", examples: [{"group":"相机与视图","code":"// zoomTo(scale, origin?):直接给目标比例(世界单位 → CSS 像素)\nview.zoomTo(12)\n","from":"header"}] },
52
52
  { name: "zoomToBounds", kind: "method", params: "bounds: GisViewBounds 要装进画面的世界矩形 [minX, minY, maxX, maxY](也认 { minX, minY, maxX, maxY });padding?: number 四周留白", returns: "this", doc: "把一段世界坐标矩形适应到视图内,退化成一点时只居中不改比例", examples: [{"group":"相机与视图","code":"// zoomToBounds(bounds, padding?):把世界矩形装进画面(数组与对象写法都认)\nview.zoomToBounds([0, 0, 400, 200], 40)\nview.zoomToBounds({ minX: 116, minY: 39, maxX: 117, maxY: 40 })\n","from":"header"}] },
53
- { name: "focusOn", kind: "method", params: "target: GisViewFocusTargets 要对准的东西:id / { type: 'point' | 'line' | 'channel' | 'group', id | index } / { channelId }(整条通道)/ { type: 'group', channelId?, groupId } / [x, y] 坐标 / 矩形 / { lngLat } / { center },或者一批(数组取整体包围盒)。字符串按「先节点、再线路」,裸字符串不能表示通道;同 id 用显式 type 消歧,分组必须用 type: 'group'(groupId 全局唯一时可省略 channelId)。缺省只居中、比例一点不动;options.zoom: true 才按解析出的真实范围适配,四类目标共用这一条、没有额外放大倍率;scale 优先级高于 zoom,maxZoom 只给单点 / 单线这类零面积目标补最小范围。options?: GisViewFocusOptions:zoom: true 显式适配、scale 直接给比例、center: true 显式只居中(与缺省一致)、padding 要四周留白(CSS 像素,缺省 40)、maxZoom 限制这次适配的最大比例、select 顺带选中(true 选这次目标,也可另给一批写法)、mode 决定怎么并进当前选中集。目标认不出来或参数非法时什么都不做", returns: "this(相机更新后发 onCameraChange;select 生效时另发 onSelect / onSelectChange)", doc: "把视角移到目标上:单条(搜索命中 / 要素 id / { type: 'point' | 'line' | 'channel', id | index } / { channelId } 整条通道 / { type: 'group', channelId?, groupId } / 坐标 / 矩形 / { lngLat })或一批(数组取整体包围盒 —— 搜到三个节点就是这三个点的中心当屏幕中心);字符串先节点后线路,裸字符串不表示通道,同 id 用 type 消歧,分组必须显式写 type: 'group'(全局唯一 groupId 可省略通道)。缺省只居中、比例一点不动;options.zoom: true 才按解析出的真实范围适配(节点 / 线路 / 通道 / 分组共用这一条,不额外放大),scale 优先级高于 zoom。options 还认 center: true(显式只居中,与缺省一致)、padding、maxZoom、select(顺带选中这批,mode 决定怎么并进当前选中集)", examples: [{"group":"相机与视图","code":"// focusOn(target, options?):对准一个或多个目标(id / 显式类型 / 坐标 / 矩形 / 搜索命中 / 一批)\nview.focusOn('a') // 缺省只居中,比例不动\nview.focusOn('a', { zoom: true, maxZoom: 8 }) // 显式按范围适配\nview.focusOn(['a', 'b'], { zoom: true, padding: 60, select: true })\nview.focusOn({ type: 'point', id: 'a' }) // 节点与线路同 id 时显式消歧\nview.focusOn({ type: 'line', id: 'a' })\nview.focusOn({ type: 'channel', channelId: 'c1' }) // 通道也可以直接写 { channelId: 'c1' }\nview.focusOn({ type: 'group', channelId: 'c1', groupId: 'c1::2' })\nview.focusOn({ type: 'group', groupId: 'global-group' }) // groupId 全局唯一时可省略通道\nview.focusOn([120, 80], { center: true }) // 显式只居中(与缺省一致)\nview.focusOn({ lngLat: [116.4, 39.9] })\n","from":"header"}] },
54
- { name: "flyTo", kind: "method", params: "目标与世界坐标解析、zoom / scale / center / padding / maxZoom / select / mode 均与 focusOn 同义。options?: GisViewFlyOptions 另认 duration(毫秒,缺省 450;<= 0 立即落位)与 easing('linear' / 'ease-in' / 'ease-out' / 'ease-in-out',缺省 'ease-in-out',也可给自定义 (progress) => eased)。中心线性、比例按对数插值;系统 prefers-reduced-motion: reduce 时立即落位。再次 flyTo、用户拖拽 / 滚轮、setCamera / centerOn / zoom* / fitView / resetView / applyInitialView 都会停在当前帧", returns: "this(相机变化时发 onCameraChange;select 生效时另发选中事件)", doc: "平滑飞到与 focusOn 相同的目标:目标写法与 zoom / scale / center / padding / maxZoom / select / mode 完全同义,另认 duration(毫秒,缺省 450)与 easing(linear / ease-in / ease-out / ease-in-out 或 (progress) => progress)。中心线性插值、比例按对数插值;duration <= 0 或系统要求减少动态效果时立即落位。再次飞行、用户拖拽 / 滚轮或任何程序化改相机都会停在当前帧,不补跳到终点", examples: [{"group":"相机与视图","code":"// flyTo(target, options?):与 focusOn 同一套目标解析,平滑飞过去\nview.flyTo(hit, { zoom: true, duration: 600, easing: 'ease-in-out' })\nview.flyTo(['station-1', 'station-2'], { select: true, duration: 0 }) // 立即落位\nview.flyTo({ center: [120, 80], scale: 12, easing: progress => progress * progress })\n","from":"header"}] },
53
+ { name: "focusOn", kind: "method", params: "target: GisViewFocusTargets 要对准的东西:id / { type: 'point' | 'line' | 'channel' | 'group', id | index } / { channelId }(整条通道)/ { type: 'group', channelId?, groupId } / [x, y] 坐标 / 矩形 / { lngLat } / { center },或者一批(数组取整体包围盒)。字符串按「先节点、再线路」,裸字符串不能表示通道;同 id 用显式 type 消歧,分组必须用 type: 'group'(groupId 全局唯一时可省略 channelId)。缺省只居中、比例一点不动;options.zoom: true 才按解析出的真实范围适配,四类目标共用这一条、没有额外放大倍率;scale 优先级高于 zoom,maxZoom 只给单点 / 单线这类零面积目标补最小范围。options?: GisViewFocusOptions:zoom: true 显式适配、scale 直接给比例、padding 要四周留白(CSS 像素,缺省 40)、maxZoom 限制这次适配的最大比例、select 顺带选中(true 选这次目标,也可另给一批写法)、mode 决定怎么并进当前选中集。目标认不出来或参数非法时什么都不做", returns: "this(相机更新后发 onCameraChange;select 生效时另发 onSelect / onSelectChange)", doc: "把视角移到目标上:单条(搜索命中 / 要素 id / { type: 'point' | 'line' | 'channel', id | index } / { channelId } 整条通道 / { type: 'group', channelId?, groupId } / 坐标 / 矩形 / { lngLat })或一批(数组取整体包围盒 —— 搜到三个节点就是这三个点的中心当屏幕中心);字符串先节点后线路,裸字符串不表示通道,同 id 用 type 消歧,分组必须显式写 type: 'group'(全局唯一 groupId 可省略通道)。缺省只居中、比例一点不动;options.zoom: true 才按解析出的真实范围适配(节点 / 线路 / 通道 / 分组共用这一条,不额外放大),scale 优先级高于 zoom。options 还认 padding、maxZoom、select(顺带选中这批,mode 决定怎么并进当前选中集)", examples: [{"group":"相机与视图","code":"// focusOn(target, options?):对准一个或多个目标(id / 显式类型 / 坐标 / 矩形 / 搜索命中 / 一批)\nview.focusOn('a') // 缺省只居中,比例不动\nview.focusOn('a', { zoom: true, maxZoom: 8 }) // 显式按范围适配\nview.focusOn(['a', 'b'], { zoom: true, padding: 60, select: true })\nview.focusOn({ type: 'point', id: 'a' }) // 节点与线路同 id 时显式消歧\nview.focusOn({ type: 'line', id: 'a' })\nview.focusOn({ type: 'channel', channelId: 'c1' }) // 通道也可以直接写 { channelId: 'c1' }\nview.focusOn({ type: 'group', channelId: 'c1', groupId: 'c1::2' })\nview.focusOn({ type: 'group', groupId: 'global-group' }) // groupId 全局唯一时可省略通道\nview.focusOn([120, 80]) // 缺省只居中、比例不动\nview.focusOn({ lngLat: [116.4, 39.9] })\n","from":"header"}] },
54
+ { name: "flyTo", kind: "method", params: "目标与世界坐标解析、zoom / scale / padding / maxZoom / select / mode 均与 focusOn 同义。options?: GisViewFlyOptions 另认 duration(毫秒,缺省 450;<= 0 立即落位)与 easing('linear' / 'ease-in' / 'ease-out' / 'ease-in-out',缺省 'ease-in-out',也可给自定义 (progress) => eased)。中心线性、比例按对数插值;系统 prefers-reduced-motion: reduce 时立即落位。再次 flyTo、用户拖拽 / 滚轮、setCamera / centerOn / zoom* / fitView / resetView / applyInitialView 都会停在当前帧", returns: "this(相机变化时发 onCameraChange;select 生效时另发选中事件)", doc: "平滑飞到与 focusOn 相同的目标:目标写法与 zoom / scale / padding / maxZoom / select / mode 完全同义,另认 duration(毫秒,缺省 450)与 easing(linear / ease-in / ease-out / ease-in-out 或 (progress) => progress)。中心线性插值、比例按对数插值;duration <= 0 或系统要求减少动态效果时立即落位。再次飞行、用户拖拽 / 滚轮或任何程序化改相机都会停在当前帧,不补跳到终点", examples: [{"group":"相机与视图","code":"// flyTo(target, options?):与 focusOn 同一套目标解析,平滑飞过去\nview.flyTo(hit, { zoom: true, duration: 600, easing: 'ease-in-out' })\nview.flyTo(['station-1', 'station-2'], { select: true, duration: 0 }) // 立即落位\nview.flyTo({ center: [120, 80], scale: 12, easing: progress => progress * progress })\n","from":"header"}] },
55
55
  { name: "flyToCamera", kind: "method", params: "camera: GisViewCameraTarget 直接给相机目标 { center?, scale? }:没写 center / scale 的那一项沿用当前相机,不经过要素解析,也不改选中与数据;options?: GisViewFlyCameraOptions 的 duration / easing 与 flyTo 同义。中心 / 比例插值、减少动态效果、用户手势取消都走同一条相机动画", returns: "this(相机变化时发 onCameraChange;目标非法时保持当前相机)", doc: "直接飞到相机目标 { center?, scale? }:不写的那一项沿用当前相机,不经过要素解析、也不改选中与数据;duration / easing 与 flyTo 同义,参数非法时保持当前相机", examples: [{"group":"相机与视图","code":"// flyToCamera(camera, options?):直接飞相机目标;没写的 center / scale 沿用当前相机\nview.flyToCamera({ center: [120, 80], scale: 3 }, { duration: 600, easing: 'ease-out' })\nview.flyToCamera({ scale: 5 }, { duration: 0 }) // 中心不动,比例立即落到 5\nview.flyToCamera({ center: [116.4, 39.9] }) // 比例沿用当前相机\n","from":"header"}] },
56
56
  { name: "search", kind: "method", params: "input: string | GisViewSearchOptions 关键字,或 { keyword, scope, fields, limit } 这类选项。scope 可选 'points' / 'lines' / 'channels' / 'groups',也认与 focusOn 一致的单数别名 'point' / 'line' / 'channel' / 'group' 及数组;省略或写错时四类全搜。limit 对每一类分别计数。返回的 groups / hits 带分组命中(channelIndex / groupId / groupIndex,item 是轻量快照)—— 只返回结果、不动视角,要定位就自己调 focusOn(result.hits, …)", returns: "GisViewSearchResult:keyword / scope / points / lines / channels / groups / hits / total / truncated / durationMs", doc: "按关键字搜索节点 / 线路 / 通道 / 通道分组并返回命中:scope 认复数的 points / lines / channels / groups,也认与 focusOn 一致的单数别名 point / line / channel / group;结果分 points / lines / channels / groups 四类,分组命中带 channelIndex / groupId / groupIndex,可直接交给 focusOn / selectFeatures。不动视角:要不要聚焦由调用方自己调 focusOn,见「搜索与定位」", examples: [{"group":"相机与视图","code":"// search(input) / searchAsync(input):搜索(只返回结果、不动视角)\nconst hits = view.search('甲站')\nconst scoped = view.search({ keyword: '甲', scope: ['points', 'channels', 'groups'], limit: 10 })\nconst groupHits = view.search({ keyword: 'c1::2', scope: 'group' }) // 单数别名与 focusOn 一致\nview.focusOn(groupHits.groups[0], { zoom: true, select: true }) // 按整组范围适配并选中成员回线\nview.focusOn(hits.hits, { zoom: true, maxZoom: 8 }) // 命中集直接丢给 focusOn\nconst asyncHits = await view.searchAsync('甲站') // 大表走 Worker;stale 说明这一份不作数了\n","from":"header"}] },
57
57
  { name: "searchAsync", kind: "method", params: "同上;分组范围的当前轻量快照会随请求交给 Worker", returns: "Promise<GisViewSearchResult>:多一个 worker(是不是在 Worker 里算的)与 stale(回来时数据已经改过、或又搜过一次,这一份不作数了)", doc: "同一份口径的异步版:数据量大时把扫描放进 Worker(10 万点 / 10 万线下同步要占主线程 40 ms 上下的那一段),返回 Promise<GisViewSearchResult>;结果带 worker 与 stale 两个字段,见「异步搜索」", examples: [{"group":"相机与视图","code":"// search(input) / searchAsync(input):搜索(只返回结果、不动视角)\nconst hits = view.search('甲站')\nconst scoped = view.search({ keyword: '甲', scope: ['points', 'channels', 'groups'], limit: 10 })\nconst groupHits = view.search({ keyword: 'c1::2', scope: 'group' }) // 单数别名与 focusOn 一致\nview.focusOn(groupHits.groups[0], { zoom: true, select: true }) // 按整组范围适配并选中成员回线\nview.focusOn(hits.hits, { zoom: true, maxZoom: 8 }) // 命中集直接丢给 focusOn\nconst asyncHits = await view.searchAsync('甲站') // 大表走 Worker;stale 说明这一份不作数了\n","from":"header"}] },
58
- { name: "setCamera", kind: "method", params: "camera: Partial<GisViewCamera> 要改的相机字段 { x, y, scale }(只写一个也行)", returns: "this", doc: "读写 { center, scale }", examples: [{"group":"相机与视图","code":"// setCamera(camera) / getCamera():读写相机(只写一个字段也行)\nview.setCamera({ scale: 10 })\nview.setCamera({ x: 200, y: 120 })\nconst camera = view.getCamera()\n","from":"header"}] },
59
- { name: "getCamera", kind: "method", params: "无", returns: "GisViewCamera", doc: "读写 { center, scale }", examples: [{"group":"相机与视图","code":"// setCamera(camera) / getCamera():读写相机(只写一个字段也行)\nview.setCamera({ scale: 10 })\nview.setCamera({ x: 200, y: 120 })\nconst camera = view.getCamera()\n","from":"header"}] },
58
+ { name: "setCamera", kind: "method", params: "camera: Partial<GisViewCamera> 要改的相机字段 { center, scale }(只写一个也行)", returns: "this", doc: "读写相机 { center, scale };getCenter() 直接给当前中心 [x, y](独立副本),setCenter(center) 只移动中心、保留当前比例并返回实例", examples: [{"group":"相机与视图","code":"// setCamera(camera) / getCamera():读写相机(只写一个字段也行)\nview.setCamera({ scale: 10 })\nview.setCamera({ center: [200, 120] })\nconst camera = view.getCamera()\n","from":"header"}] },
59
+ { name: "getCamera", kind: "method", params: "无", returns: "GisViewCamera", doc: "读写相机 { center, scale };getCenter() 直接给当前中心 [x, y](独立副本),setCenter(center) 只移动中心、保留当前比例并返回实例", examples: [{"group":"相机与视图","code":"// setCamera(camera) / getCamera():读写相机(只写一个字段也行)\nview.setCamera({ scale: 10 })\nview.setCamera({ center: [200, 120] })\nconst camera = view.getCamera()\n","from":"header"}] },
60
+ { name: "getScale", kind: "method", params: "无", returns: "number:当前比例(像素 / 世界单位),与 getCamera().scale 同一份读数", doc: "读写当前比例(像素 / 世界单位):getScale() 与 getCamera().scale 同一份读数;setScale() 立即改比例,origin 是画布 CSS 像素锚点(缺省视口中心),返回实例", examples: [{"group":"相机与视图","code":"// getScale():读当前比例(与 getCamera().scale 同一份数)\nconst scale = view.getScale()\n","from":"header"}] },
61
+ { name: "setScale", kind: "method", params: "scale: number 目标比例;origin?: [number, number] 画布 CSS 像素锚点(缺省视口中心)", returns: "this:立即改比例,受 minScale / maxScale 夹取", doc: "读写当前比例(像素 / 世界单位):getScale() 与 getCamera().scale 同一份读数;setScale() 立即改比例,origin 是画布 CSS 像素锚点(缺省视口中心),返回实例", examples: [{"group":"相机与视图","code":"// setScale(scale, origin?):立即改比例;origin 是画布 CSS 像素锚点,缺省视口中心\nview.setScale(3)\nview.setScale(3, [320, 180])\n","from":"header"}] },
62
+ { name: "getCenter", kind: "method", params: "无", returns: "[number, number]:当前视图中心,返回独立副本;改返回值不会动引擎", doc: "读写相机 { center, scale };getCenter() 直接给当前中心 [x, y](独立副本),setCenter(center) 只移动中心、保留当前比例并返回实例", examples: [{"group":"相机与视图","code":"// getCenter() / setCenter(center):只读写视图中心(setCenter 保留当前比例,返回实例)\nconst center = view.getCenter() // [x, y] 的副本\ncenter[0] += 100 // 改副本不会移动视图\nview.setCenter([116.4, 39.9])\n","from":"header"}] },
63
+ { name: "setCenter", kind: "method", params: "center: [number, number] 新的视图中心", returns: "this:只移动中心、保留当前比例,可链式调用", doc: "读写相机 { center, scale };getCenter() 直接给当前中心 [x, y](独立副本),setCenter(center) 只移动中心、保留当前比例并返回实例", examples: [{"group":"相机与视图","code":"// getCenter() / setCenter(center):只读写视图中心(setCenter 保留当前比例,返回实例)\nconst center = view.getCenter() // [x, y] 的副本\ncenter[0] += 100 // 改副本不会移动视图\nview.setCenter([116.4, 39.9])\n","from":"header"}] },
60
64
  { name: "stopCameraAnimation", kind: "method", params: "无", returns: "this:停止当前相机飞行并停在当前帧;没有飞行时是空操作", doc: "停止当前相机飞行(停在当前帧,返回实例)/ 读当前飞行 { active, progress, duration, from, to }(没有动画时 null)", examples: [{"group":"相机与视图","code":"// stopCameraAnimation() / getCameraAnimation():停止飞行 / 读当前飞行读数(没有动画时为 null)\nconst flight = view.getCameraAnimation() // { active, progress, duration, from, to }\nview.stopCameraAnimation() // 停在当前帧,不补跳到终点\n","from":"header"}] },
61
65
  { name: "getCameraAnimation", kind: "method", params: "无", returns: "GisViewCameraAnimation | null:{ active, progress, duration, from, to },progress 是时间进度(0 ~ 1),没有动画时 null", doc: "停止当前相机飞行(停在当前帧,返回实例)/ 读当前飞行 { active, progress, duration, from, to }(没有动画时 null)", examples: [{"group":"相机与视图","code":"// stopCameraAnimation() / getCameraAnimation():停止飞行 / 读当前飞行读数(没有动画时为 null)\nconst flight = view.getCameraAnimation() // { active, progress, duration, from, to }\nview.stopCameraAnimation() // 停在当前帧,不补跳到终点\n","from":"header"}] },
66
+ { name: "getIdleTime", kind: "method", params: "无", returns: "number:距创建或上一次指针 / 滚轮 / 键盘操作的毫秒数;程序化 API 调用不重置", doc: "距创建或上一次指针 / 滚轮 / 键盘操作的毫秒数;程序化 API 调用不重置。配合 idleTimeout / onIdle / idle 做「多久没人动」的读数", examples: [{"group":"相机与视图","code":"// getIdleTime():距创建或上一次指针 / 滚轮 / 键盘操作的毫秒数\nconst idleTime = view.getIdleTime()\nview.updateOptions({ idleTimeout: 60000, onIdle: ({ idleTime }) => console.log(idleTime) })\n","from":"header"}] },
62
67
  { name: "getZoomBaseScale", kind: "method", params: "无", returns: "number 缩放联动的基准比例(pointZoomScale / lineZoomScale 共用那一份;缺省是首次适应视图时的 camera.scale)", doc: "读 / 重定缩放联动的基准比例(缺省是首次适应视图时的比例):不传参数就取当下相机的比例 —— 把现在这一屏当成「原样大小」,之后放大缩小都从它算倍数;配合 pointZoomScale / lineZoomScale 使用", examples: [{"group":"相机与视图","code":"// getZoomBaseScale() / setZoomBaseScale(scale?):缩放联动的基准比例(配合 pointZoomScale / lineZoomScale)\nconst zoomBase = view.getZoomBaseScale() // 基准(缺省首次适应视图时的 camera.scale)\nview.setZoomBaseScale() // 以当下这一屏为「原样大小」,之后放大缩小都从它算倍数\nview.setZoomBaseScale(2.5) // 也可以直接给一个比例\n","from":"header"}] },
63
68
  { name: "setZoomBaseScale", kind: "method", params: "scale?: number 新的基准比例;不传取当下相机的比例(把现在这一屏当成「原样大小」)", returns: "this", doc: "读 / 重定缩放联动的基准比例(缺省是首次适应视图时的比例):不传参数就取当下相机的比例 —— 把现在这一屏当成「原样大小」,之后放大缩小都从它算倍数;配合 pointZoomScale / lineZoomScale 使用", examples: [{"group":"相机与视图","code":"// getZoomBaseScale() / setZoomBaseScale(scale?):缩放联动的基准比例(配合 pointZoomScale / lineZoomScale)\nconst zoomBase = view.getZoomBaseScale() // 基准(缺省首次适应视图时的 camera.scale)\nview.setZoomBaseScale() // 以当下这一屏为「原样大小」,之后放大缩小都从它算倍数\nview.setZoomBaseScale(2.5) // 也可以直接给一个比例\n","from":"header"}] },
64
69
  { name: "getBounds", kind: "method", params: "无", returns: "GisViewBounds:每次返回独立副本;重复调用命中数据包围盒缓存,改点 / 改线 / 追加或拖拽后下一次读数自动重建", doc: "数据范围(没有点时回退到背景 GeoJSON 的 rawBounds,也就是 aspectScale 之前的真实经纬度范围);每次返回独立副本,重复调用命中缓存", examples: [{"group":"相机与视图","code":"// getBounds() / getViewRect() / getViewport():数据范围 / 视口世界矩形 / 画布尺寸读数\nconst dataBounds = view.getBounds()\nconst viewRect = view.getViewRect()\nconst { cssWidth, cssHeight, pixelRatio } = view.getViewport()\n","from":"header"}] },
@@ -100,7 +105,7 @@ export const API_SECTIONS = [
100
105
  { name: "getPointer", kind: "method", params: "无", returns: "GisViewPointerState", doc: "当前光标状态 { inside, screen, world, lngLat }(onPointer 回调的同一份数据)", examples: [{"group":"坐标、拾取与读数","code":"// getPointer():光标位置读数 { inside, screen, world, lngLat }\nconst pointer = view.getPointer()\n","from":"header"}] },
101
106
  { name: "pick", kind: "method", params: "x / y 画布 CSS 像素", returns: "GisViewPickResult | null", doc: "拾取指定画布位置上的要素(clickable: false 的要素不会返回)", 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":"// pick(x, y) / pickAt(clientX, clientY):按画布像素 / 客户端坐标拾取\nconst hit = view.pick(320, 200)\nconst hitAt = view.pickAt(event.clientX, event.clientY)\nhitAt?.groups // 命中通道回线:同一通道的全部分组;hitAt.group 是当前这一组\n","from":"header"}] },
102
107
  { name: "pickAt", kind: "method", params: "clientX / clientY 浏览器客户端坐标(PointerEvent 原样给);命中通道回线时返回的 group 是当前组、groups 是整条通道的全部分组", returns: "GisViewPickAtResult | null", doc: "按浏览器客户端坐标拾取(就是鼠标事件里的 clientX / clientY):与指针事件载荷同一份结果(type / index / item / distance / screen / coordinate 与通道字段),另加 target('point' / 'line' / 'channel')与 lngLat;命中通道回线时 group 是当前组、groups 是整条通道的全部分组;没命中返回 null。只读,不改选中也不动光标", examples: [{"group":"坐标、拾取与读数","code":"// pick(x, y) / pickAt(clientX, clientY):按画布像素 / 客户端坐标拾取\nconst hit = view.pick(320, 200)\nconst hitAt = view.pickAt(event.clientX, event.clientY)\nhitAt?.groups // 命中通道回线:同一通道的全部分组;hitAt.group 是当前这一组\n","from":"header"}] },
103
- { name: "selectAt", kind: "method", params: "clientX / clientY 浏览器客户端坐标;按普通单击的命中与通道摊开规则立即选中,空白 / 聚合圆返回 null、不改选中,不派发 onClick / onDblClick。每次成功命中都发 onSelect,选中集实际变化时再发 onSelectChange(cause: 'api',顺序 onSelect → onSelectChange);通道回线载荷带当前 group / 完整 groups,多通道看 channelContexts。已知 id 时优先 selectFeatures", returns: "GisViewSelectPayload | null", doc: "只有客户端坐标时用它像普通单击一样立即选中命中要素:节点 / 线路直接选中,通道回线按 channelSelectMode 摊开;空白或聚合圆返回 null 且不改选中。不等待 selectTrigger: 'dblClick',也不派发 onClick / onDblClick;每次成功命中都发 onSelect,选中集实际变化时再发 onSelectChange,顺序 onSelect → onSelectChange(cause: 'api')。选中通道回线时载荷带当前 group / 完整 groups,多通道看 channelContexts。已知节点 / 线路 id 时直接用 selectFeatures,见「按坐标单击选中(selectAt)」", examples: [{"group":"选中、复制与合并","code":"// selectAt(clientX, clientY):每次命中发 onSelect,集合变化时再发 onSelectChange(不动指针、不派发 onClick);已知 id 直接用 selectFeatures\nview.selectAt(event.clientX, event.clientY) // 节点 / 线路命中即选中;空白返回 null\nview.updateOptions({ channelSelectMode: 'channel' })\nview.selectAt(event.clientX, event.clientY) // 命中任一回线 = 选中整条通道\n","from":"header"}] },
108
+ { name: "selectAt", kind: "method", params: "clientX / clientY 浏览器客户端坐标;按普通单击的命中与通道摊开规则立即选中,空白 / 聚合圆返回 null、不改选中,不派发 onClick / onDblClick。每次成功命中都发 onSelect,选中集实际变化时再发 onSelectChange(cause: 'api',顺序 onSelect → onSelectChange);通道回线载荷带当前 group / 完整 groups,多通道看 channelContexts。已知 id 时优先 selectFeatures", returns: "GisViewSelectPayload | null", doc: "只有客户端坐标时用它像普通单击一样立即选中命中要素:节点 / 线路直接选中,通道回线按 channelSelectMode 摊开;空白或聚合圆返回 null 且不改选中。不等待 selectTrigger: 'dblClick',也不派发 onClick / onDblClick;每次成功命中都发 onSelect,选中集实际变化时再发 onSelectChange,顺序 onSelect → onSelectChange(cause: 'api')。选中通道回线时外层带当前 group / 完整 groups / 本次选中的 lineIndexes / lineIds,多通道看 channelContexts;items[] 不挂通道字段。已知节点 / 线路 id 时直接用 selectFeatures,见「按坐标单击选中(selectAt)」", examples: [{"group":"选中、复制与合并","code":"// selectAt(clientX, clientY):每次命中发 onSelect,集合变化时再发 onSelectChange(不动指针、不派发 onClick);已知 id 直接用 selectFeatures\nview.selectAt(event.clientX, event.clientY) // 节点 / 线路命中即选中;空白返回 null\nview.updateOptions({ channelSelectMode: 'channel' })\nview.selectAt(event.clientX, event.clientY) // 命中任一回线 = 选中整条通道\n","from":"header"}] },
104
109
  { name: "hoverAt", kind: "method", params: "clientX / clientY 客户端坐标", returns: "GisViewHoverPayload | null", doc: "程序化悬停:hoverAt 让指针「停」到某个客户端坐标上(悬停高亮、光标与 onHover 一起更新,返回与 onHover 载荷同一份读数,空白处 null;不走悬停阈值,也不用先订阅事件)、clearHover() 撤掉并补发一条 onHover(null)、getHover() 随时读当前这一份 —— 外部列表 / 表格 hover 到某一行时联动高亮图上的要素用它", examples: [{"group":"坐标、拾取与读数","code":"// hoverAt(clientX, clientY) / clearHover() / getHover():程序化悬停 / 撤掉 / 读当前那一份\nview.hoverAt(event.clientX, event.clientY)\nview.clearHover()\nconst hover = view.getHover()\n","from":"header"}] },
105
110
  { name: "clearHover", kind: "method", params: "无", returns: "null", doc: "程序化悬停:hoverAt 让指针「停」到某个客户端坐标上(悬停高亮、光标与 onHover 一起更新,返回与 onHover 载荷同一份读数,空白处 null;不走悬停阈值,也不用先订阅事件)、clearHover() 撤掉并补发一条 onHover(null)、getHover() 随时读当前这一份 —— 外部列表 / 表格 hover 到某一行时联动高亮图上的要素用它", examples: [{"group":"坐标、拾取与读数","code":"// hoverAt(clientX, clientY) / clearHover() / getHover():程序化悬停 / 撤掉 / 读当前那一份\nview.hoverAt(event.clientX, event.clientY)\nview.clearHover()\nconst hover = view.getHover()\n","from":"header"}] },
106
111
  { name: "getHover", kind: "method", params: "无", returns: "GisViewHoverPayload | null", doc: "程序化悬停:hoverAt 让指针「停」到某个客户端坐标上(悬停高亮、光标与 onHover 一起更新,返回与 onHover 载荷同一份读数,空白处 null;不走悬停阈值,也不用先订阅事件)、clearHover() 撤掉并补发一条 onHover(null)、getHover() 随时读当前这一份 —— 外部列表 / 表格 hover 到某一行时联动高亮图上的要素用它", examples: [{"group":"坐标、拾取与读数","code":"// hoverAt(clientX, clientY) / clearHover() / getHover():程序化悬停 / 撤掉 / 读当前那一份\nview.hoverAt(event.clientX, event.clientY)\nview.clearHover()\nconst hover = view.getHover()\n","from":"header"}] },
@@ -138,18 +143,19 @@ export const API_SECTIONS = [
138
143
  {
139
144
  title: "选中、复制与合并",
140
145
  items: [
141
- { name: "selectFeatures", kind: "method", params: "refs: GisViewSelectionRefs 要选中的东西:节点 / 线路 id、id 数组、{ type, index }、通道写法({ type: 'channel', channelId | channelIndex },可再给 groupIds / lineIds / lineIndexes 取子集)、分组写法({ type: 'group', channelId?, groupId },groupId 全局唯一时可省略通道)、拾取载荷 / 搜索命中,传 null / 空数组等于清空一份新的选中集。认不出来的条目逐条跳过;options?: GisViewSelectOptions 只有 mode:'replace' 缺省换一份、'add' 追加、'toggle' 在就取消 / 不在就选上、'remove' 去掉", returns: "this(选中真的变了才按 onSelect → onSelectChange 发,cause 为 api;载荷带通道上下文)", doc: "接口选中(换一份选中集;selectFeatures(null) / 空数组就是清空):refs 认节点 / 线路 id、id 数组、{ type, index }、通道写法({ type: 'channel', channelId } / { channelId, groupId } / { channelId, lineIds })、分组写法({ type: 'group', channelId?, groupId },全局唯一 groupId 可省略通道)以及拾取载荷与搜索命中;options.mode 给 'replace'(缺省,换一份)/ 'add' / 'toggle'(在就取消、不在就选上)/ 'remove'。会同步选中样式与读数;选中集实际变化时按 onSelect → onSelectChange 派发(cause: 'api'),载荷带同一份通道上下文(单通道摊平,多通道看 channelContexts),不发 onClick / onDblClick,见「接口选中(selectFeatures)与读回选中」", examples: [{"group":"选中、复制与合并","code":"// selectFeatures(refs, options?):接口选中(与点击选中走同一份 state;实际变化时按 onSelect → onSelectChange 发,载荷带通道上下文)\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({ type: 'channel', channelId: 'c1' }) // 整条通道的全部回线\nview.selectFeatures({ type: 'group', channelId: 'c1', groupId: 'c1::2' })\nview.selectFeatures({ type: 'group', groupId: 'global-group' }) // groupId 全局唯一时可省略通道\nview.selectFeatures(null) // 清空(空数组同义)\n","from":"header"}] },
146
+ { name: "selectFeatures", kind: "method", params: "refs: GisViewSelectionRefs 要选中的东西:节点 / 线路 id、id 数组、{ type, index }、通道写法({ type: 'channel', channelId | channelIndex },可再给 groupIds / lineIds / lineIndexes 取子集)、分组写法({ type: 'group', channelId?, groupId },groupId 全局唯一时可省略通道)、拾取载荷 / 搜索命中,传 null / 空数组等于清空一份新的选中集。认不出来的条目逐条跳过;options?: GisViewSelectOptions 只有 mode:'replace' 缺省换一份、'add' 追加、'toggle' 在就取消 / 不在就选上、'remove' 去掉", returns: "this(选中真的变了才按 onSelect → onSelectChange 发,cause 为 api;载荷带通道上下文)", doc: "接口选中(换一份选中集;selectFeatures(null) / 空数组就是清空):refs 认节点 / 线路 id、id 数组、{ type, index }、通道写法({ type: 'channel', channelId } / { channelId, groupId } / { channelId, lineIds })、分组写法({ type: 'group', channelId?, groupId },全局唯一 groupId 可省略通道)以及拾取载荷与搜索命中;options.mode 给 'replace'(缺省,换一份)/ 'add' / 'toggle'(在就取消、不在就选上)/ 'remove'。会同步选中样式与读数;选中集实际变化时按 onSelect → onSelectChange 派发(cause: 'api'),载荷外层带同一份通道上下文(单通道摊平,多通道看 channelContexts),items[] 不挂通道字段,不发 onClick / onDblClick,见「接口选中(selectFeatures)与读回选中」", examples: [{"group":"选中、复制与合并","code":"// selectFeatures(refs, options?):接口选中(与点击选中走同一份 state;实际变化时按 onSelect → onSelectChange 发,载荷带通道上下文)\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({ type: 'channel', channelId: 'c1' }) // 整条通道的全部回线\nview.selectFeatures({ type: 'group', channelId: 'c1', groupId: 'c1::2' })\nview.selectFeatures({ type: 'group', groupId: 'global-group' }) // groupId 全局唯一时可省略通道\nview.selectFeatures(null) // 清空(空数组同义)\n","from":"header"}] },
142
147
  { name: "selectWaypoint", kind: "method", params: "lineRef 线路 id、lines 下标或 { lineIndex, pathIndex } / { lineId, pathIndex } 对象;pathIndex?: number 必须是 getWaypoints() 给出的可编辑中间拐点下标(首尾端点不算,通常直接从读数里取);options?: GisViewSelectOptions 的 mode 决定所在线路怎么并进当前选中集(缺省 replace)。有效拐点会同时选中线路;线路不存在 / 下标非法 / 拐点不可见时只清拐点选中,不猜位置;传 null 也只清拐点,不改要素选中集", returns: "this", doc: "代码选中一个拐点:selectWaypoint('line-1', 2) / { lineIndex, pathIndex } / { lineId, pathIndex },并同时选中所在线路;有效下标从 getWaypoints() 取。传 null 只取消拐点选中、不改要素选中集,见「代码选中拐点(selectWaypoint)」", examples: [{"group":"选中、复制与合并","code":"// selectWaypoint(lineRef, pathIndex? / { lineIndex | lineId, pathIndex }, options?):选中拐点并带选线路\nview.selectWaypoint('l1', 2) // pathIndex 从 getWaypoints() 取\nview.selectWaypoint({ lineIndex: 0, pathIndex: 1 }, { mode: 'add' })\nview.selectWaypoint({ lineId: 'l1', pathIndex: 2 })\nview.selectWaypoint(null) // 只取消拐点选中,不改要素选中集\n","from":"header"}] },
143
148
  { name: "deselect", kind: "method", params: "refs?: GisViewSelectionRefs 要取消的东西(写法与 selectFeatures 一致:节点 / 通道 / 线路 / 混合一批);不传 / null 等于取消全部(= selectFeatures(null)),空数组是「没有目标」什么都不做", returns: "this(选中真的变了才按 onSelect → onSelectChange 发,cause 为 api;清空时 onSelect 载荷为 null)", doc: "取消选中:写法与 selectFeatures 完全一样,把这些从当前选中集里去掉、其余选中原样留着;不传 / null 等于取消全部(也就是 selectFeatures(null)),空数组是「没有目标」什么都不做。改变选中集时按 onSelect → onSelectChange 派发(cause: 'api';清空时 onSelect 载荷为 null),见「取消选中(deselect / selectFeatures(null))」", examples: [{"group":"选中、复制与合并","code":"// deselect(refs?):取消选中(写法与 selectFeatures 一致;不传 / null 全清,空数组什么都不做)\nview.deselect('a')\nview.deselect(['a', 'b'])\nview.deselect()\n","from":"header"}] },
144
- { 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"}] },
145
- { 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"}] },
146
- { 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"}] },
149
+ { name: "getSelections", kind: "method", params: "无", returns: "GisViewPickResult[]:选中项原始读数;通道回线不带 channelId / channelIndex / groupId / groups,单条归属用 getLineChannel(index)", doc: "读回选中结果 [{ type, index, item, … }](按选中顺序):通道回线不带通道字段,单条归属用 getLineChannel(index);要 id 列表 / 个数 / 包围盒看 getSelectionData()", examples: [{"group":"选中、复制与合并","code":"// getSelections() / getSelectionInfo() / getSelectionData() / isSelected(ref):读回选中\nconst picks = view.getSelections()\nconst info = view.getSelectionInfo() // { ids, count, points, lines, channels }\nconst selection = view.getSelectionData() // { ids, count, points, lines, channels, bounds, … }\nconst selected = view.isSelected('a')\n","from":"header"}] },
150
+ { name: "getSelectionInfo", kind: "method", params: "无", returns: "GisViewSelectionInfo:{ ids, count, points, lines, channels },通道回线按通道算一个;与 onSelectChange 顶层同口径并按键集合引用缓存", doc: "选中集轻量计数 { ids, count, points, lines, channels }(通道回线按通道算一个),与 onSelectChange 顶层同名字段同口径;按选中集引用缓存,十万级选中下也只是一次读取。指针 / 点击 / 悬停载荷不再重复挂 selection,状态栏这类只要计数的读数用它;要要素对象或包围盒再用 getSelectionData()", examples: [{"group":"选中、复制与合并","code":"// getSelections() / getSelectionInfo() / getSelectionData() / isSelected(ref):读回选中\nconst picks = view.getSelections()\nconst info = view.getSelectionInfo() // { ids, count, points, lines, channels }\nconst selection = view.getSelectionData() // { ids, count, points, lines, channels, bounds, … }\nconst selected = view.isSelected('a')\n","from":"header"}] },
151
+ { 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() / getSelectionInfo() / getSelectionData() / isSelected(ref):读回选中\nconst picks = view.getSelections()\nconst info = view.getSelectionInfo() // { ids, count, points, lines, channels }\nconst selection = view.getSelectionData() // { ids, count, points, lines, channels, bounds, … }\nconst selected = view.isSelected('a')\n","from":"header"}] },
152
+ { name: "getSelectionData", kind: "method", params: "无", returns: "GisViewSelectionData:{ ids, count, pointCount, lineCount, channelCount, points, lines, channels, items, pointIndexes, lineIndexes, bounds }(bounds 是世界包围盒,空选中时 null;items 的线路不带通道字段,channels 是去重后的所属通道)", doc: "选中集一次取全:读数(ids / count / pointCount / lineCount / channelCount)加要素本身(points / lines / channels(按通道去重,与 getData() 同一批对象)),另有 items(与 getSelections() 同一份,通道回线不带通道字段)、pointIndexes / lineIndexes 与 bounds(世界包围盒,空选中时 null),见「接口选中(selectFeatures)与读回选中」", examples: [{"group":"选中、复制与合并","code":"// getSelections() / getSelectionInfo() / getSelectionData() / isSelected(ref):读回选中\nconst picks = view.getSelections()\nconst info = view.getSelectionInfo() // { ids, count, points, lines, channels }\nconst selection = view.getSelectionData() // { ids, count, points, lines, channels, bounds, … }\nconst selected = view.isSelected('a')\n","from":"header"}] },
147
153
  { name: "getCascadeHighlight", kind: "method", params: "无", returns: "GisViewCascadeHighlightInfo | null:当前点击级联高亮的来源、范围与节点 / 线路读数 { origin, scope, points, lines, pointIndexes, lineIndexes },不改变选中集", doc: "当前点击级联高亮的读数:{ origin, scope, points, lines, pointIndexes, lineIndexes };没有高亮或 cascadeHighlight 关着时返回 null。它只读、不改选中集,见「点击级联高亮」", examples: [{"group":"选中、复制与合并","code":"// getCascadeHighlight():读点击级联高亮(与选中集分开;没有高亮时为 null)\nconst cascade = view.getCascadeHighlight() // { origin, scope, points, lines, pointIndexes, lineIndexes }\nview.updateOptions({\n cascadeHighlight: {\n scope: 'points',\n triggerOnClick: true,\n triggerOnMultiSelect: false,\n triggerOnBoxSelect: true,\n clearOnEmptyClick: true\n }\n})\nview.on('cascadeHighlight', payload => console.log(payload?.pointIndexes, payload?.lineIndexes))\n","from":"header"}] },
148
- { name: "selectInBox", kind: "method", params: "box: GisViewRect 画布 CSS 像素矩形 { x, y, width, height }(与手动框选同一套坐标);options?: GisViewSelectInBoxOptions:selectionKinds 临时覆盖这一次保留哪几类('point' / 'line' / 'channel'、数组、'all' / true / false / null,不写沿用全局 selectionKinds),originalEvent 原样带进 onSelect;第二段也兼容旧的 Event 写法。空框不会选中任何要素", returns: "this(每次框选都发 onSelect,空框为 null;集合变化时再发 onSelectChange,顺序 onSelect → onSelectChange,cause 为 boxSelect)", doc: "按画布 CSS 像素矩形框选,等价于 Shift + 拖动(跟随 shortcuts.boxSelect);options.selectionKinds 可只覆盖这一次的节点 / 线路 / 通道类型过滤。每次框选操作都发 onSelect(空框的载荷为 null),选中集实际变化时再发 onSelectChange,顺序 onSelect → onSelectChange(cause: 'boxSelect');通道回线的分组字段与鼠标框选同一份", 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"}] },
154
+ { name: "selectInBox", kind: "method", params: "box: GisViewRect 画布 CSS 像素矩形 { x, y, width, height }(与手动框选同一套坐标);options?: GisViewSelectInBoxOptions:selectionKinds 临时覆盖这一次保留哪几类('point' / 'line' / 'channel' / 'lineEndpoints' / 'channelEndpoints'、数组、'all' / true / false / null,不写沿用全局 selectionKinds),originalEvent 原样带进 onSelect。空框不会选中任何要素", returns: "this(每次框选都发 onSelect,空框为 null;集合变化时再发 onSelectChange,顺序 onSelect → onSelectChange,cause 为 boxSelect)", doc: "按画布 CSS 像素矩形框选,等价于 Shift + 拖动(跟随 shortcuts.boxSelect);options.selectionKinds 可只覆盖这一次的节点 / 线路 / 通道类型过滤,也支持 'lineEndpoints' / 'channelEndpoints' 要求两端节点都在框内。每次框选操作都发 onSelect(空框的载荷为 null),选中集实际变化时再发 onSelectChange,顺序 onSelect → onSelectChange(cause: 'boxSelect');通道回线的分组字段与鼠标框选同一份", 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'] })\nview.selectInBox({ x: 40, y: 40, width: 320, height: 200 }, { selectionKinds: ['lineEndpoints', 'channelEndpoints'] }) // 两端节点都在框内才命中\n","from":"header"}] },
149
155
  { name: "beginCopyPoint", kind: "method", params: "options: GisViewCopyStartOptions:id / index / item 三选一给来源,都不给就进入「下一次点选节点」模式;coordinate / screen 是落点(缺省按 copy.offset);follow 让预览跟指针;autoCommit 覆盖 copy.autoCommit;commit: true 出预览即落地;via / originalEvent 原样带回。必须配置 copy(enabled 不为 false),否则返回 null。预览节点插在 points 末尾且不带 id,不会把绑定源 id 的线路 / 通道带过去", returns: "GisViewPointCopyPayload | null:phase: 'start' 的预览载荷;来源认不出来时返回 null", doc: "开始复制一个节点:给 id / index 直接出预览(commit: true 出预览即落地,follow: true 跟随鼠标,autoCommit: false 停在预览态),不给来源就是「先点按钮再选节点」模式,见「节点复制」", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.updateOptions({ copy: { enabled: true, autoCommit: false } }) // API 复制入口要先开 copy 配置\nview.beginCopyPoint({ id: 'a', coordinate: [40, 30] }) // 出预览并钉在世界坐标 [40, 30]\nview.beginCopyPoint({ id: 'a', follow: true }) // 预览跟着指针走(autoCommit 缺省停住)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 字段级改预览节点(落点仍由 coordinate / 指针决定)\nconst copyEnd = view.commitPointCopy() // 落地:返回 end 载荷;没有预览时为 null\nview.cancelPointCopy() // 取消:预览撤掉,数据与历史不动\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
150
156
  { name: "commitPointCopy", kind: "method", params: "无:把当前复制预览落地,先发 commit、落地后发 end;commit 阶段载荷里的 cancel() 可以拦住这次复制", returns: "GisViewPointCopyPayload | null:成功的 end 载荷;没有预览或已被取消时为 null", doc: "落地 / 取消预览中的复制(返回 end / cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.updateOptions({ copy: { enabled: true, autoCommit: false } }) // API 复制入口要先开 copy 配置\nview.beginCopyPoint({ id: 'a', coordinate: [40, 30] }) // 出预览并钉在世界坐标 [40, 30]\nview.beginCopyPoint({ id: 'a', follow: true }) // 预览跟着指针走(autoCommit 缺省停住)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 字段级改预览节点(落点仍由 coordinate / 指针决定)\nconst copyEnd = view.commitPointCopy() // 落地:返回 end 载荷;没有预览时为 null\nview.cancelPointCopy() // 取消:预览撤掉,数据与历史不动\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
151
157
  { name: "cancelPointCopy", kind: "method", params: "无:撤掉预览并补一条 cancel,数据与历史不动", returns: "GisViewPointCopyPayload | null:取消载荷;没有预览时为 null", doc: "落地 / 取消预览中的复制(返回 end / cancel 载荷)", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.updateOptions({ copy: { enabled: true, autoCommit: false } }) // API 复制入口要先开 copy 配置\nview.beginCopyPoint({ id: 'a', coordinate: [40, 30] }) // 出预览并钉在世界坐标 [40, 30]\nview.beginCopyPoint({ id: 'a', follow: true }) // 预览跟着指针走(autoCommit 缺省停住)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 字段级改预览节点(落点仍由 coordinate / 指针决定)\nconst copyEnd = view.commitPointCopy() // 落地:返回 end 载荷;没有预览时为 null\nview.cancelPointCopy() // 取消:预览撤掉,数据与历史不动\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
152
- { name: "updateCopyPoint", kind: "method", params: "patch: Partial<GisViewPoint> 预览节点的字段级合并(名称 / 样式等;x / y 仍以当前落点为准),只重解析这一个预览节点", returns: "GisViewPoint | null:改完的预览节点;没有预览或 patch 不是对象时 null", doc: "改预览节点的数据(等价于回调里的 payload.update / setItem),返回改完的节点", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.updateOptions({ copy: { enabled: true, autoCommit: false } }) // API 复制入口要先开 copy 配置\nview.beginCopyPoint({ id: 'a', coordinate: [40, 30] }) // 出预览并钉在世界坐标 [40, 30]\nview.beginCopyPoint({ id: 'a', follow: true }) // 预览跟着指针走(autoCommit 缺省停住)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 字段级改预览节点(落点仍由 coordinate / 指针决定)\nconst copyEnd = view.commitPointCopy() // 落地:返回 end 载荷;没有预览时为 null\nview.cancelPointCopy() // 取消:预览撤掉,数据与历史不动\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
158
+ { name: "updateCopyPoint", kind: "method", params: "patch: Partial<GisViewPoint> 预览节点的字段级合并(名称 / 样式等;x / y 仍以当前落点为准),只重解析这一个预览节点", returns: "GisViewPoint | null:改完的预览节点;没有预览或 patch 不是对象时 null", doc: "改预览节点的数据(等价于回调里的 payload.update),返回改完的节点", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.updateOptions({ copy: { enabled: true, autoCommit: false } }) // API 复制入口要先开 copy 配置\nview.beginCopyPoint({ id: 'a', coordinate: [40, 30] }) // 出预览并钉在世界坐标 [40, 30]\nview.beginCopyPoint({ id: 'a', follow: true }) // 预览跟着指针走(autoCommit 缺省停住)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 字段级改预览节点(落点仍由 coordinate / 指针决定)\nconst copyEnd = view.commitPointCopy() // 落地:返回 end 载荷;没有预览时为 null\nview.cancelPointCopy() // 取消:预览撤掉,数据与历史不动\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
153
159
  { name: "getPointCopy", kind: "method", params: "无", returns: "GisViewPointCopyState | null", doc: "当前复制状态:预览中是 { phase: 'preview', index, item, source, … },等选点时是 { phase: 'pick' },没有就 null", examples: [{"group":"选中、复制与合并","code":"// beginCopyPoint(options) / getPointCopy() / updateCopyPoint(patch) / commitPointCopy() / cancelPointCopy()\nview.updateOptions({ copy: { enabled: true, autoCommit: false } }) // API 复制入口要先开 copy 配置\nview.beginCopyPoint({ id: 'a', coordinate: [40, 30] }) // 出预览并钉在世界坐标 [40, 30]\nview.beginCopyPoint({ id: 'a', follow: true }) // 预览跟着指针走(autoCommit 缺省停住)\nview.beginCopyPoint() // 先点按钮再选节点(点中下一个节点当来源)\nview.updateCopyPoint({ name: '新节点' }) // 字段级改预览节点(落点仍由 coordinate / 指针决定)\nconst copyEnd = view.commitPointCopy() // 落地:返回 end 载荷;没有预览时为 null\nview.cancelPointCopy() // 取消:预览撤掉,数据与历史不动\nconst copyState = view.getPointCopy() // 当前预览 / 选点态(没有就是 null)\n","from":"header"}] },
154
160
  { name: "copyPoint", kind: "method", params: "source?: string | number | GisViewCopyStartOptions 复制哪个节点(不给就用选中的 / 光标下的,都没有就进「点一个节点」模式)", returns: "GisViewCopyItem | null", doc: "复制一个节点到它旁边(一步到位):来源给 id / 下标 / 一份节点数据,不给就用选中的节点(再没有用光标下的);返回新节点 { index, item }", 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"}] },
155
161
  { name: "copyPoints", kind: "method", params: "sources?: GisViewPointRef | GisViewPointRef[] 要复制的节点(不给就取当前选中集;copySelectedPoints 不回落到光标);显式给 sources 时只复制这批节点,不再顺带选中的线路 / 通道。options: GisViewCopyPointsOptions:coordinate / screen(落点,缺省按 copy.offset)、offset(屏幕像素偏移)、lineIndexes / channelIndexes(显式点名选中的线路 / 通道)、withLines / withChannels(缺省 false:只复制选中要素;写 true 恢复「来源内部全带」的旧口径,写 false 连选中线路 / 通道也不带)、select(复制后选中新节点)、label / via / originalEvent", returns: "GisViewBatchCopyPayload", doc: "批量复制(不经过剪贴板):不给 sources 时复制当前选中集(框选之后一次复制整组);默认只带选中要素 —— 选中线路复制线路、选中通道复制整条通道及回线,并自动补所需端点(supportSources / supportItems / supportIndexes)。显式 sources 时只复制这批节点;lineIndexes / channelIndexes 可再点名,withLines: true / withChannels: true 才恢复「来源内部全带」的旧口径(写 false 则连选中线路 / 通道也不带)。落点按 coordinate / screen 或 copy.offset,select: true 复制后选中新节点。返回 phase: 'batch' 载荷(sources / items / indexes / selectedPointCount / lines / channels / count / revert()),复制不了时 ok: false + reason", 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"}] },
@@ -159,9 +165,9 @@ export const API_SECTIONS = [
159
165
  { name: "pastePoint", kind: "method", params: "options: GisViewPasteOptions:screen / coordinate(落在哪里,缺省光标位置)、offset(屏幕像素偏移)、select(粘贴后选中新节点)、label / via / originalEvent;单节点且快照里没有内部线路 / 通道时仍走原预览,其余走整组落地", returns: "GisViewCopyItem | GisViewBatchCopyPayload | 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"}] },
160
166
  { name: "pastePoints", kind: "method", params: "options 同上;强制整组粘贴(单节点也走批量路),返回带 count / indexes / lines / channels / revert() 的完整载荷", returns: "GisViewBatchCopyPayload | 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"}] },
161
167
  { 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"}] },
162
- { 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"}] },
168
+ { name: "mergePoints", kind: "method", params: "source: GisViewPointRef 被并入的节点(并完就没了)、target: GisViewPointRef 接收的节点、options?: { originalEvent?: Event | null; item?: GisViewPoint }:item 可以给一份已经改好的业务字段结果(确认阶段改过 payload.item 之后就是它);未给 item 时只对 merge.maxKeys 列出的字段取双方最高值(缺省空表,全部字段取保留节点,数组 / 逗号字符串均可);最终 id、坐标与 mergeInfo 由组件维护", returns: "GisViewMergeOutcome:保留节点写完整 mergeInfo,受影响通道写轻量 mergeInfo", doc: "把来源节点并进目标节点(接口调用,不做确认):来源 / 目标收 id、下标或 { id } / { index },节点数据按 merge.createItem 合并(缺省以保留节点为底,名称 / 图标等业务字段取保留端,merge.maxKeys 列出的数值字段取双方最高、缺省不取,尺寸取双方最大、图标类型用保留端),线路 from / to 与通道 from / to 改到保留节点,删自环 / 零长线 / 自环通道、把撞成同一条的通道合成一条。保留节点写完整 mergeInfo 快照,受影响通道写轻量 mergeInfo;返回 { 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 } })\nconsole.log(merged.item?.mergeInfo?.sourceIds) // 保留节点上的来源 id;只有 merge.maxKeys 列出的字段取最高,缺省全部取保留端\n","from":"header"}] },
163
169
  { 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"}] },
164
- { 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"}] },
170
+ { name: "splitPoint", kind: "method", params: "source: GisViewPointRef 要拆的节点;parts?: GisViewSplitPointPart[] | null 省略 / null / [] 且节点带 mergeInfo 时自动解除合并,传数组时至少两份,每份可直接写节点字段或放进 item,并用 lines / channels / channelFrom / channelTo 分配线路与通道端点;options?: GisViewSplitPointOptions:keepSourceId(缺省 true,第一份沿用来源 id)/ label / select(缺省 false,不选中结果且保留无关选中;true 选中全部结果节点)/ autoLines?: 'first' | 'alternate'(缺省 first 跟第一份;alternate 按「通道成组、独立线路单条」轮流给负载最少的一份,手工拆分推荐)", returns: "GisViewSplitPointOutcome:{ ok, reason, source, items, indexes, pointIds, linesChanged, removedLines, removedLineIds, removedLineIndexes, channelsChanged, removedChannels, removedChannelIds, autoLines, autoAssignedLines, lineAssignments, autoRestored, mergeSourceIds, skipped, changes };自动解除时 autoRestored: true、mergeSourceIds 给恢复的来源 id;lineAssignments 每项 { index, pointId, lineIds, lineCount };changes 可直接作为后端事务输入", doc: "mergePoints 的逆操作。省略 parts(或传 null / [])且节点带 mergeInfo 时自动解除合并:恢复第一次合并前的保留节点、全部来源节点、线路与通道,保留合并后新建且不在快照里的要素;来源 id 冲突 / 追溯不完整时 ok: false 且不动数据,整次一步历史。传 parts 时手工拆成两份或更多(第一份接在原下标上、缺省沿用原 id,其余追加),按每份 item / 顶层字段生成节点,按 lines 分配线路、按 channels / channelFrom / channelTo 分配通道两端;未分配线路默认跟第一份,autoLines: 'alternate' 按「通道成员成组、独立线路单条」轮流给负载最少的一份,未分配通道端点跟第一条被分配过的成员回线。options.select 缺省 false:不选中结果,只摘掉来源节点自己的选中态;写 true 才选中全部结果节点。拆完删自环 / 零长度线路、两端相同的通道与成员全空的通道。返回 { autoRestored, mergeSourceIds, autoLines, autoAssignedLines, lineAssignments, changes, ... },changes 可直接作为后端事务输入;手工拆分至少两份、坐标必须有效、线路不能重复分配,写错时 ok: false 并在 reason 说明", examples: [{"group":"选中、复制与合并","code":"// splitPoint(source):有 mergeInfo 时自动解除合并(省略 parts / null / [] 等价)\nconst autoRestored = view.splitPoint('b', null, { label: '解除合并(自动恢复)' })\nconsole.log(autoRestored.autoRestored, autoRestored.mergeSourceIds, autoRestored.changes)","from":"header"},{"group":"选中、复制与合并","code":"// 默认不选中结果;需要选中全部恢复节点时写 splitPoint('b', null, { select: true })\n","from":"header"},{"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], { autoLines: 'alternate', label: '解除合并' })","from":"header"}] },
165
171
  { 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"}] },
166
172
  { 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"}] },
167
173
  { name: "commitPointMerge", kind: "method", params: "无:收掉「已确认、数据已由使用方并好」的合并状态;mergePoints / resolvePointMerge 的正常路径由组件自己调用,只有完全自建合并落地流程时才手动调", returns: "boolean:真的收掉了一个待确认合并为 true,没有可收的状态为 false", 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"}] },
@@ -200,21 +206,23 @@ export const API_SECTIONS = [
200
206
  { 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"}] },
201
207
  { 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"}] },
202
208
  { 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"}] },
203
- { name: "beginAddChannel", kind: "method", params: "options?: GisViewChannelDraftOptions 草稿配置:from(预指定起点,下一步只选终点)/ kind / circuits / autoCommit / continuous / chain / name / lineId / id / lineProps / linePropsByMember / lineItems(第二段)/ routing / path(中间拐点)/ channelProps / channelDraftStyle(本次草稿的预览样式,含 dots 与 layer)/ handoff(交接模式)/ select(点中的节点顺手选中,走 onSelect 那一套)/ originalEvent", returns: "this(只负责那条示例假通道,真正新增走 commitAddChannel / addChannel)", doc: "进入「新增通道」:缺省点两个节点选起点 / 终点,或由 options.from 预指定起点、只需再点终点;options 还支持 kind('channel' 新建通道 / 'line' 新建独立线路,缺省 'channel')/ circuits(一次加几条,缺省 1)/ autoCommit / continuous / chain / name / lineId / id / lineProps / linePropsByMember / lineItems(第二段,连同线路一起新建)/ routing('straight' / 'orthogonal')/ path(中间拐点)/ channelProps / channelDraftStyle(本次草稿的预览样式,含 dots / layer)/ handoff(交接模式:ready 发完收起草稿,自己调 addChannel 落地)/ select(点中的节点顺手选中)/ originalEvent,见「新增通道」", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"}] },
204
- { name: "getAddChannelDraft", kind: "method", params: "无", returns: "GisViewChannelDraftPayload | null", doc: "当前新增通道草稿(两个节点的信息与可选方案),没有草稿时为 null", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"}] },
205
- { name: "updateAddChannelStyle", kind: "method", params: "patch?: GisViewChannelDraftStyle | null 字段级合并的预览样式(箭头位置 / 多回线间距 / 两端 dots / 层级 layer / 自绘等);传 null 回到全局 channelDraftStyle", returns: "this", doc: "字段级合并当前草稿的预览样式(color / width / dot / dotColor / dots / layer / arrow / arrowSize / arrowPositions / arrowReverse / arrowColor / circuitSpacing / opacity / customDraw);传 null 回到全局 channelDraftStyle,没有草稿时什么也不做", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"}] },
206
- { name: "continueAddChannel", kind: "method", params: "options?: GisViewChannelDraftOptions 开下一段草稿(写法与 beginAddChannel 一致,不传就沿用这一段原来的)", returns: "this", doc: "开下一段草稿:连续模式落地时内部自动调(发 phase: 'restart'),也可以手动调;草稿已经退出时按 options 重新进来", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"}] },
207
- { name: "cancelAddChannel", kind: "method", params: "无", returns: "this(收掉草稿并补一条 phase: 'cancel')", doc: "取消新增通道(草稿期间按 Esc 等价,会补一条 phase: 'cancel')", examples: [{"group":"拐点与通道","code":"// commitAddChannel(input?, options?) / 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 // 两端示例点:false 全关;对象可统一 size / color / shape,from / to 再分别覆盖\n dots: { size: 5, shape: 'square', from: { color: '#2f6fd0' }, to: { color: '#d9544d' } },\n layer: 'below-points' // 示例线 / 箭头 / customDraw 画在真实节点之下;示例点仍在节点之后\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nview.beginAddChannel({ from: 'station-a' }) // 只预指定起点:接下来只点终点(没有 from + to 的写法)\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\n","from":"header"}] },
208
- { name: "endAddChannel", kind: "method", params: "无", returns: "this(静默收掉视图上的示例假通道 / 线路,数据不动、不补事件)", doc: "结束新增通道:静默收掉视图上的示例假通道 / 线路(不补 cancel 事件),数据一个字节都不改 —— 结束事件里决定「不新建了」就用它", examples: [{"group":"拐点与通道","code":"// commitAddChannel(input?, options?) / 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 // 两端示例点:false 全关;对象可统一 size / color / shape,from / to 再分别覆盖\n dots: { size: 5, shape: 'square', from: { color: '#2f6fd0' }, to: { color: '#d9544d' } },\n layer: 'below-points' // 示例线 / 箭头 / customDraw 画在真实节点之下;示例点仍在节点之后\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nview.beginAddChannel({ from: 'station-a' }) // 只预指定起点:接下来只点终点(没有 from + to 的写法)\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\n","from":"header"}] },
209
- { name: "commitAddChannel", kind: "method", params: "input?: GisViewChannelAddResolution | GisViewChannel | GisViewLine | GisViewChannelAddCommitInput,五种写法:① 不传 / null = 用草稿 preferred;② 旧 resolution:字符串或只含非 undefined 的 type / groupId / groupIndex / channelId 的对象;③ 直接线路对象:没有 lineIds 数组,且写了 kind: 'line' / path / from / to / start / end 之一,业务字段与自己的 lineProps 透传到新线路;④ 直接通道对象:Array.isArray(lineIds) 且没有容器键,lineIds 逐条作新回线 id 种子、groups 作分组声明、自己的 lineProps 对所有新回线生效,其余字段进 channelProps,缺省 resolution: 'newChannel';⑤ 容器:出现 channel / line / lines / lineData / lineItems / channelGroups / group / channelProps / resolution 任一键(只写 lineProps 也算)。容器里 line 缺省是独立线路,lines 是成员表(给了几条建几条,空数组沿用草稿);channel.lineIds 只在没有 lines 时当种子。字段优先级:from / to = 顶层 → channel → line → lineItems 第一个对象项(裸 id 跳过)→ 草稿;path = 顶层 → line → channel → 草稿;分组 = channelGroups → group → channel.groups;容器 lineProps = 草稿 → 顶层 → line.lineProps → 逐条,不读 channel.lineProps;channelProps = 草稿 → channel 业务字段 → 顶层 channelProps。直接线路 / 直接通道对象默认新建,要并进已有分组必须用容器并显式写 resolution。options?: { auto?: boolean; continuous?: boolean; originalEvent?: Event | null }:auto 只标记自动提交,continuous: false 强制本次后结束,originalEvent 带回重开的草稿。ready 的方案对象不能整条回传,只取 { type, groupId, groupIndex, channelId } 子集。调用前草稿必须 ready,否则不写数据;没有草稿的程序化新增用 addChannel / addLine。完整示例见「10 通道编辑与新增」与「18 逐方法示例」", returns: "GisViewChannelAddResult", doc: "把已 ready 的草稿落到数据上。input 有五类:不传(用草稿 preferred)、旧 resolution(字符串,或只含 type / groupId / groupIndex / channelId 的对象)、直接线路对象(有 from / to / path / kind: 'line' 等线路形状)、直接通道对象(必须有 lineIds,缺省新建通道)、容器 { channel?, line?, lines?, lineData?, lineItems?, channelGroups?, group?, channelProps?, lineProps?, resolution?, ... }。对象字段优先、没写的沿用草稿;line 缺省表示独立线路,lines 才是成员回线表;直接通道对象缺省新建,直接线路对象缺省按独立线路落地,要并进已有分组必须用容器并显式写 resolution。options?: { auto?, continuous?, originalEvent? } 只影响本次事件与连续草稿。方案读数不能整条回传,只取 { type, groupId, groupIndex, channelId }。完整字段优先级与示例见「10 通道编辑与新增」的 commitAddChannel / 对象直传", examples: [{"group":"拐点与通道","code":"// commitAddChannel(input?, options?) / 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 // 两端示例点:false 全关;对象可统一 size / color / shape,from / to 再分别覆盖\n dots: { size: 5, shape: 'square', from: { color: '#2f6fd0' }, to: { color: '#d9544d' } },\n layer: 'below-points' // 示例线 / 箭头 / customDraw 画在真实节点之下;示例点仍在节点之后\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nview.beginAddChannel({ from: 'station-a' }) // 只预指定起点:接下来只点终点(没有 from + to 的写法)\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\n","from":"header"},{"group":"拐点与通道","code":"// commitAddChannel 只负责把已 ready 的草稿落地;没有草稿的程序化新增用 addChannel / addLine。","from":"header"}] },
209
+ { name: "beginAddChannel", kind: "method", params: "options?: GisViewChannelDraftOptions 草稿配置:from(预指定起点,下一步只选终点)/ circuits / singleChannel(已有通道时缺省按 block 失败)/ existingChannel?: 'block' | 'newGroup' | 'joinGroup' | 'auto' / groupId / groupIndex(joinGroup 的目标分组,序号从 0 起,都写以 groupId 为准)/ autoCommit / continuous / chain / name / lineId / id / lineProps / linePropsByMember / lineData(第二段)/ routing / path(中间拐点)/ channelProps / channelDraftStyle(本次草稿的预览样式,含 dots 与 layer)/ handoff(交接模式)/ select(点中的节点顺手选中,走 onSelect 那一套)/ originalEvent;入口固定为通道语义,旧 kind / lineItems 已移除且不会生效", returns: "this(只负责那条示例假通道,真正新增走 commitAddChannel / addChannel)", doc: "进入「新增通道」:缺省点两个节点选起点 / 终点,或由 options.from 预指定起点、只需再点终点。options 支持 autoCommit / continuous / chain / singleChannel / existingChannel / groupId / groupIndex / circuits / name / lineId / id / lineProps / linePropsByMember / lineData(第二段)/ routing / path / channelProps / channelDraftStyle / handoff / select(只选中点中的节点)/ originalEvent。入口固定为通道语义;旧 kind 与 lineItems 不再生效。", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / beginAddLine(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"},{"group":"拐点与通道","code":"// 旧 beginAddChannel({ kind: 'line' }) 已移除;线路入口只认 beginAddLine\n","from":"header"}] },
210
+ { name: "beginAddLine", kind: "method", params: "options?: GisViewChannelDraftOptions 与 beginAddChannel 同一套草稿配置,kind 恒为 line;不写 existingChannel 时只加独立线路,显式 existingChannel: 'newGroup' | 'joinGroup' | 'auto' 且两端已有通道时把新回线挂进通道;joinGroup 可写 groupId / groupIndex,singleChannel 不生效", returns: "this(真正新增走 commitAddChannel / addLine)", doc: "进入「新增线路」:与 beginAddChannel 共用拾取 / 预览 / 连续新增,入口固定为线路语义;不写 existingChannel 时只新建独立线路,显式写 existingChannel: 'newGroup' / 'joinGroup' / 'auto' 且两端已有通道时才把新回线挂进已有通道。旧 beginAddChannel({ kind: 'line' }) 已移除,见「10 通道编辑与新增」。", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / beginAddLine(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"},{"group":"拐点与通道","code":"// beginAddLine:入口固定为线路语义;缺省独立线路,显式 existingChannel 且已有通道时才挂进通道\nview.beginAddLine({ from: 'station-a' })\nview.beginAddLine({ from: 'station-a', existingChannel: 'newGroup' })\nview.beginAddLine({ from: 'station-a', existingChannel: 'joinGroup', groupId: 'c1::2' })","from":"header"},{"group":"拐点与通道","code":"// 连续模式只续草稿配置,不能把这一段切换成线路;要线路请重新 beginAddLine\nview.continueAddChannel({ from: 'station-b' })\nview.cancelAddChannel() // 取消(Esc / 右键等价)\n","from":"header"}] },
211
+ { name: "getAddChannelDraft", kind: "method", params: "无", returns: "GisViewChannelDraftPayload | null", doc: "当前新增草稿(两个节点的信息、可选方案与 lineData),没有草稿时为 null", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / beginAddLine(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"}] },
212
+ { name: "updateAddChannelStyle", kind: "method", params: "patch?: GisViewChannelDraftStyle | null 字段级合并的预览样式(箭头位置 / 多回线间距 / 两端 dots / 层级 layer / 自绘等);传 null 回到全局 channelDraftStyle", returns: "this", doc: "字段级合并当前草稿的预览样式(color / width / dot / dotColor / dots / layer / arrow / arrowSize / arrowPositions / arrowReverse / arrowColor / circuitSpacing / opacity / customDraw);传 null 回到全局 channelDraftStyle,没有草稿时什么也不做", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / beginAddLine(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"}] },
213
+ { name: "continueAddChannel", kind: "method", params: "options?: GisViewChannelDraftOptions 开下一段草稿(写法与 beginAddChannel 一致,不传就沿用这一段原来的;可以改 singleChannel / existingChannel / groupId / groupIndex 等配置,但不能切换通道 / 线路入口)", returns: "this", doc: "开下一段草稿:连续模式落地时内部自动调(发 phase: 'restart'),也可以手动调;草稿已经退出时按通道入口重新进来。只续配置,不能把当前段切换成线路;旧 kind 不生效。", examples: [{"group":"拐点与通道","code":"// beginAddChannel(options?) / beginAddLine(options?) / getAddChannelDraft() / updateAddChannelStyle(patch?) / continueAddChannel(options?)","from":"header"}] },
214
+ { name: "cancelAddChannel", kind: "method", params: "无", returns: "this(收掉草稿并补一条 phase: 'cancel')", doc: "取消新增通道(草稿期间按 Esc 等价,会补一条 phase: 'cancel')", examples: [{"group":"拐点与通道","code":"// commitAddChannel(input?, options?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\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 // 两端示例点:false 全关;对象可统一 size / color / shape,from / to 再分别覆盖\n dots: { size: 5, shape: 'square', from: { color: '#2f6fd0' }, to: { color: '#d9544d' } },\n layer: 'below-points' // 示例线 / 箭头 / customDraw 画在真实节点之下;示例点仍在节点之后\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nview.beginAddChannel({ from: 'station-a' }) // 只预指定起点:接下来只点终点(没有 from + to 的写法)\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\n","from":"header"}] },
215
+ { name: "endAddChannel", kind: "method", params: "无", returns: "this(静默收掉视图上的示例假通道 / 线路,数据不动、不补事件)", doc: "结束新增通道:静默收掉视图上的示例假通道 / 线路(不补 cancel 事件),数据一个字节都不改 —— 结束事件里决定「不新建了」就用它", examples: [{"group":"拐点与通道","code":"// commitAddChannel(input?, options?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\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 // 两端示例点:false 全关;对象可统一 size / color / shape,from / to 再分别覆盖\n dots: { size: 5, shape: 'square', from: { color: '#2f6fd0' }, to: { color: '#d9544d' } },\n layer: 'below-points' // 示例线 / 箭头 / customDraw 画在真实节点之下;示例点仍在节点之后\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nview.beginAddChannel({ from: 'station-a' }) // 只预指定起点:接下来只点终点(没有 from + to 的写法)\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\n","from":"header"}] },
216
+ { name: "commitAddChannel", kind: "method", params: "input?: GisViewChannelAddCommitInput,只接受一个容器对象;不传 / null 用草稿的推荐方案。字段:channel?(通道对象与 groups)/ line?(独立线路对象)/ lines? 或 lineData?(成员回线表)/ channelGroups? 或 group?(分组声明)/ lineProps? / linePropsByMember? / channelProps? / path? / routing? / resolution? / from? / to? / name? / id?。lines 与 lineData 同义且 lines 优先,空数组沿用草稿;channel.lineIds 只在线路表缺省时当回线 id 种子。字段优先级:from / to = 顶层 → channel → line → lines 第一个对象项 → 草稿;path = 顶层 → line → channel → 草稿;分组 = channelGroups → group → channel.groups;lineProps = 草稿 → 顶层 → line.lineProps → 逐条;channelProps = 草稿 → channel 业务字段 → 顶层 channelProps。resolution 收 'auto' / 'newChannel' / 'newGroup' / 'joinGroup' / 'newLine' 或 { type, groupId?, groupIndex?, channelId? }。旧顶层分派字段(kind / circuits / channelId / groupId / lineId / lineItems / lineIds / start / end 等)明确失败。options?: { auto?: boolean; continuous?: boolean; originalEvent?: Event | null; select?: boolean };select: true 才选中这次新建的全部回线,缺省不动选中集。调用前草稿必须 ready;没有草稿的程序化新增用 addChannel / addLine", returns: "GisViewChannelAddResult", doc: "把已 ready 的草稿落到数据上。第一个参数只接受一个容器对象:{ channel?, line?, lines? / lineData?, channelGroups? / group?, lineProps?, linePropsByMember?, channelProps?, path?, routing?, resolution?, from?, to?, name?, id? };字符串、数组和旧顶层分派字段(kind / circuits / channelId / groupId / lineId / lineItems / lineIds 等)都明确失败。options?: { auto?, continuous?, originalEvent?, select? };select: true 才选中落地的新回线。完整优先级见「10 通道编辑与新增」。", examples: [{"group":"拐点与通道","code":"// commitAddChannel(input?, options?) / cancelAddChannel() / endAddChannel()\nview.beginAddChannel({\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 // 两端示例点:false 全关;对象可统一 size / color / shape,from / to 再分别覆盖\n dots: { size: 5, shape: 'square', from: { color: '#2f6fd0' }, to: { color: '#d9544d' } },\n layer: 'below-points' // 示例线 / 箭头 / customDraw 画在真实节点之下;示例点仍在节点之后\n }\n}) // 点两个节点:第一个起点、第二个终点;通道 3 回时预览也画 3 条平行回线\nview.beginAddChannel({ from: 'station-a' }) // 只预指定起点:接下来只点终点(没有 from + to 的写法)\nconst draft = view.getAddChannelDraft() // 草稿读数(跟随光标的预览、两个节点、方案表与实际 style)\nview.updateAddChannelStyle({ arrowPositions: [0.25, 0.75], arrowReverse: true }) // 字段级合并,只改箭头\nview.updateAddChannelStyle(null) // 回到全局 channelDraftStyle\n","from":"header"},{"group":"拐点与通道","code":"// 这一段最终落地几条回线由 circuits / lineData 决定;落地后是否选中新回线由 commitAddChannel 的 options.select 决定\nview.commitAddChannel({}, { select: true })\n","from":"header"},{"group":"拐点与通道","code":"// commitAddChannel 只负责把已 ready 的草稿落地;没有草稿的程序化新增用 addChannel / addLine。","from":"header"}] },
210
217
  { 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"}] },
211
- { 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"}] },
212
- { 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":"// commitAddChannel 只负责把已 ready 的草稿落地;没有草稿的程序化新增用 addChannel / addLine。","from":"header"},{"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"}] },
213
- { 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"}] },
214
- { 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"}] },
215
- { 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"}] },
216
- { 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"}] },
217
- { 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":"// commitAddChannel 只负责把已 ready 的草稿落地;没有草稿的程序化新增用 addChannel / addLine。","from":"header"},{"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"}] },
218
+ { 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", 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"}] },
219
+ { name: "getDirectConnections", kind: "method", params: "pointIds: string | number | Array<string | number> 一组节点 id(单条也收);只查集合内部的直接边,两端必须能查到节点,去重后少于两个返回空表", returns: "GisViewDirectConnection[]:type 为 'channel' / 'line' 的联合;每项带 from / to({ id, index, item })与 item,通道项有 channelId / channelIndex / lineIds,线路项有 lineId / lineIndex;空结果严格为 []", doc: "一组节点之间的直接通道 / 线路(只读):两端都必须真实存在且都在传入的 id 集合里,只认通道端点或线路 from / to,不穿中间节点;通道先按 channels 顺序、线路再按 lines 顺序,通道与成员回线可同时命中。每项带 type / from / to / item,通道项另有 channelId / channelIndex / lineIds,线路项另有 lineId / lineIndex;没有结果返回 []", examples: [{"group":"拐点与通道","code":"// getDirectConnections(pointIds):只取这组节点之间的直接通道 / 线路(不走中间节点;没有就是 [])\nconst directConnections = view.getDirectConnections(['a', 'b'])\nfor (const connection of directConnections) {\n if (connection.type === 'channel') {\n console.log('通道', connection.channelId, connection.lineIds, connection.from.id, connection.to.id)\n }\n else {\n console.log('线路', connection.lineId, connection.from.id, connection.to.id)\n }\n}\n","from":"header"}] },
220
+ { name: "addChannel", kind: "method", params: "channel: GisViewChannelAddSpec 通道信息 { from, to, name?, id?, channelProps?, path?, routing?, lineData?, group? }(后两个是第二 / 第三段写在对象上的别名);lineData?: GisViewChannelLineData 线路数组(Partial<GisViewLine> / string / number 的一条或一批,按每项 id 建 lineIds);group?: GisViewChannelAddGroup | GisViewChannelAddGroup[] 可选分组信息 { id?, lineIds?, path? };options?: { emit?: boolean; select?: boolean },缺省不选中。只新建通道:两端已有通道时整条失败;旧 circuits / resolution / kind / channelId / lineItems 等入参已移除。path 是中间拐点,通道只写骨架拐点", returns: "GisViewChannelAddResult(channelLineIds 是落地后通道的完整成员表)", doc: "程序化只新建通道:第一段 { from, to, name?, id?, channelProps?, path?, routing?, lineData?, group? },第二段线路数据按每项 id 建 lineIds,第三段可选分组信息({ id?, lineIds?, path? })。两端已有通道时整条失败(reason 指路 addChannelGroupLines / joinChannelGroupLines)。options?: { emit?, select? },缺省不选中新回线。", examples: [{"group":"拐点与通道","code":"// commitAddChannel 只负责把已 ready 的草稿落地;没有草稿的程序化新增用 addChannel / addLine。","from":"header"},{"group":"拐点与通道","code":"// addChannel(spec, lineData?, group?, options?) / addChannels(input, options?)","from":"header"}] },
221
+ { name: "addChannelGroupLines", kind: "method", params: "channelId 目标通道 id;lineData?: GisViewChannelLineData 这次新建的线路数组(按每项 id 建回线);group?: GisViewChannelAddGroup 新分组信息 { id?, path? }(缺省 ${通道 id}::N、不带拐点);options?: { emit?: boolean; select?: boolean }", returns: "GisViewChannelAddResult", doc: "给已有通道新加一组回线:第二段按每项 id 建回线,groupInfo({ id?, groupId?, path?, ... })给新分组的 id 与中间拐点,缺省 ${通道 id}::N、不带拐点;options?: { emit?, select? },缺省不选中", examples: [{"group":"拐点与通道","code":"// addChannelGroupLines(channelId, lineData?, group?, options?) / joinChannelGroupLines(channelId, groupId?, lineData?, options?)","from":"header"}] },
222
+ { name: "addChannelGroups", kind: "method", params: "channelId 目标通道 id;groups: GisViewChannelAddGroupInput | GisViewChannelAddGroupInput[] 每项 { id?, groupId?, path?, lineData? | lines? }(线路数据与 addChannel 第二段同一份写法,lineItems 已移除);options?: { emit?: boolean; label?: string; select?: boolean },emit: false 只落地不通知", returns: "GisViewAddChannelGroupsResult", doc: "给已有通道一次新加多组回线:groups 每项 { id?, groupId?, path?, lineData? | lines?, ... };旧 lineItems 会让整批明确失败且不写数据。逐组落地但只记一步历史、只发一条 addChannelGroups 数据变更;options?: { emit?, label?, select? }", examples: [{"group":"拐点与通道","code":"// addChannelGroups(channelId, groups, options?) / addLine(spec, lineData?, options?):程序化新增","from":"header"}] },
223
+ { name: "joinChannelGroupLines", kind: "method", params: "channelId 目标通道 id;groupId?: string | number 并进哪一组(认分组 id 也认序号,从 0 起;不传挑第一个还有余量的分组);lineData?: GisViewChannelLineData 这次新建的线路数组;options?: { emit?: boolean; select?: boolean }", returns: "GisViewChannelAddResult", doc: "把新回线并进已有通道的某一组:第二段线路数据,groupId 认分组 id 也认序号(从 0 起、按声明顺序),不传就挑第一个还有余量的分组;options?: { emit?, select? }", examples: [{"group":"拐点与通道","code":"// addChannelGroupLines(channelId, lineData?, group?, options?) / joinChannelGroupLines(channelId, groupId?, lineData?, options?)","from":"header"}] },
224
+ { name: "addChannels", kind: "method", params: "input: GisViewChannelAddSpec | GisViewChannelAddSpec[] 一条或一批声明(每条与 addChannel 第一段同一套写法,可在项内写 lineData / group;routing: 'orthogonal' 自动正交折线,path 是中间拐点);options?: { emit?: boolean; select?: boolean },emit: false 只改数据不发 dataChange,缺省不选中", returns: "GisViewAddChannelsResult", doc: "addChannel 的批量版:一次新建多条通道(每项写法同 addChannel),逐条落地但只重排一次场景、只记一步历史、只发一条 addChannels 数据变更;返回 { ok, count, results, lineIds, channelIds, items },失败条目在各自 reason 里说明;options?: { emit?, select? },select 一次选中全部成功的新回线", examples: [{"group":"拐点与通道","code":"// addChannel(spec, lineData?, group?, options?) / addChannels(input, options?)","from":"header"}] },
225
+ { name: "addLine", kind: "method", params: "input: GisViewLineAddSpec 独立线路 { from, to, name?, id?, lineProps?, path?, routing?, lineData? };第二段 GisViewChannelLineData 与 addChannel 的线路数组同一份 —— 每项可以只写一个 id(裸字符串 / 数字按 { id } 收)、写对象给逐条字段,不写就按 from-to-序号 自动编号;options?: { emit?: boolean; select?: boolean },缺省不选中。旧 circuits / kind / lineItems / 通道字段已移除", returns: "GisViewChannelAddResult", doc: "程序化新增独立线路:spec 为 { from, to, name?, id?, lineProps?, path?, routing?, lineData? },第二段每条按自己的 id 建;不碰任何通道。落地走追加式引擎路径,已有通道声明时也能增量加线;options?: { emit?, select? },缺省不选中", examples: [{"group":"拐点与通道","code":"// commitAddChannel 只负责把已 ready 的草稿落地;没有草稿的程序化新增用 addChannel / addLine。","from":"header"},{"group":"拐点与通道","code":"// addChannelGroups(channelId, groups, options?) / addLine(spec, lineData?, options?):程序化新增","from":"header"}] },
218
226
  { 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"}] },
219
227
  { 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"}] },
220
228
  { 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"}] },
@@ -248,18 +256,18 @@ export const API_SECTIONS = [
248
256
  {
249
257
  title: "增删数据",
250
258
  items: [
251
- { name: "addPoint", kind: "method", params: "item: GisViewPoint 新节点(x / y 必填,其余随便带);options?: { emit?: boolean } emit: false 只改数据不发 dataChange", returns: "GisViewAddPointResult", doc: "把现成的数据对象追加到末尾(批量导入、从别处拷过来、按坐标补几条):老数据一条不动,返回 { ok, count, indexes, items }(addPoint 另有单条的 index / item),options.emit: false 时不发 onDataChange;与 addChannel / addLine 的分工是后者走「通道 / 草稿」那一套", examples: [{"group":"增删数据","code":"// addPoint(item, options?) / addPoints(items, options?) / addLines(items, options?)\nview.addPoint({ id: 's-1', x: 116.4, y: 39.9, name: '甲站' })\nconst addedPoints = view.addPoints([{ id: 's-2', x: 116.6, y: 40.1 }, { id: 's-3', x: 116.8, y: 40.2 }])\nview.addLines([{ id: 'x-1', from: 's-1', to: 's-2' }])\nview.addPoints(nextBatch, { emit: false }) // 只落地、不发 dataChange","from":"header"}] },
252
- { name: "addPoints", kind: "method", params: "items: GisViewPoint | GisViewPoint[] 一个或一批新节点;options?: { emit?: boolean } 同上", returns: "GisViewAddItemsResult<GisViewPoint>", doc: "把现成的数据对象追加到末尾(批量导入、从别处拷过来、按坐标补几条):老数据一条不动,返回 { ok, count, indexes, items }(addPoint 另有单条的 index / item),options.emit: false 时不发 onDataChange;与 addChannel / addLine 的分工是后者走「通道 / 草稿」那一套", examples: [{"group":"增删数据","code":"// addPoint(item, options?) / addPoints(items, options?) / addLines(items, options?)\nview.addPoint({ id: 's-1', x: 116.4, y: 39.9, name: '甲站' })\nconst addedPoints = view.addPoints([{ id: 's-2', x: 116.6, y: 40.1 }, { id: 's-3', x: 116.8, y: 40.2 }])\nview.addLines([{ id: 'x-1', from: 's-1', to: 's-2' }])\nview.addPoints(nextBatch, { emit: false }) // 只落地、不发 dataChange","from":"header"}] },
253
- { name: "addLines", kind: "method", params: "items: GisViewLine | GisViewLine[] 一个或一批新线路(通道成员也能这样直接加);options?: { emit?: boolean } 同上", returns: "GisViewAddItemsResult<GisViewLine>", doc: "把现成的数据对象追加到末尾(批量导入、从别处拷过来、按坐标补几条):老数据一条不动,返回 { ok, count, indexes, items }(addPoint 另有单条的 index / item),options.emit: false 时不发 onDataChange;与 addChannel / addLine 的分工是后者走「通道 / 草稿」那一套", examples: [{"group":"增删数据","code":"// addPoint(item, options?) / addPoints(items, options?) / addLines(items, options?)\nview.addPoint({ id: 's-1', x: 116.4, y: 39.9, name: '甲站' })\nconst addedPoints = view.addPoints([{ id: 's-2', x: 116.6, y: 40.1 }, { id: 's-3', x: 116.8, y: 40.2 }])\nview.addLines([{ id: 'x-1', from: 's-1', to: 's-2' }])\nview.addPoints(nextBatch, { emit: false }) // 只落地、不发 dataChange","from":"header"}] },
259
+ { name: "addPoint", kind: "method", params: "item: GisViewPoint 新节点(x / y 必填,其余随便带);options?: { emit?: boolean } emit: false 只改数据不发 dataChange", returns: "GisViewAddPointResult", doc: "把现成的数据对象追加到末尾(批量导入、从别处拷过来、按坐标补几条):老数据一条不动,返回 { ok, count, indexes, items }(addPoint 另有单条的 index / item);options?: { emit?, select? },select: true 选中这次新加的要素,缺省不选中", examples: [{"group":"增删数据","code":"// addPoint(item, options?) / addPoints(items, options?) / addLines(items, options?)\nview.addPoint({ id: 's-1', x: 116.4, y: 39.9, name: '甲站' })\nconst addedPoints = view.addPoints([{ id: 's-2', x: 116.6, y: 40.1 }, { id: 's-3', x: 116.8, y: 40.2 }])\nview.addLines([{ id: 'x-1', from: 's-1', to: 's-2' }])\nview.addPoints(nextBatch, { emit: false }) // 只落地、不发 dataChange","from":"header"}] },
260
+ { name: "addPoints", kind: "method", params: "items: GisViewPoint | GisViewPoint[] 一个或一批新节点;options?: { emit?: boolean } 同上", returns: "GisViewAddItemsResult<GisViewPoint>", doc: "把现成的数据对象追加到末尾(批量导入、从别处拷过来、按坐标补几条):老数据一条不动,返回 { ok, count, indexes, items }(addPoint 另有单条的 index / item);options?: { emit?, select? },select: true 选中这次新加的要素,缺省不选中", examples: [{"group":"增删数据","code":"// addPoint(item, options?) / addPoints(items, options?) / addLines(items, options?)\nview.addPoint({ id: 's-1', x: 116.4, y: 39.9, name: '甲站' })\nconst addedPoints = view.addPoints([{ id: 's-2', x: 116.6, y: 40.1 }, { id: 's-3', x: 116.8, y: 40.2 }])\nview.addLines([{ id: 'x-1', from: 's-1', to: 's-2' }])\nview.addPoints(nextBatch, { emit: false }) // 只落地、不发 dataChange","from":"header"}] },
261
+ { name: "addLines", kind: "method", params: "items: GisViewLine | GisViewLine[] 一个或一批新线路(通道成员也能这样直接加);options?: { emit?: boolean } 同上", returns: "GisViewAddItemsResult<GisViewLine>", doc: "把现成的数据对象追加到末尾(批量导入、从别处拷过来、按坐标补几条):老数据一条不动,返回 { ok, count, indexes, items }(addPoint 另有单条的 index / item);options?: { emit?, select? },select: true 选中这次新加的要素,缺省不选中", examples: [{"group":"增删数据","code":"// addPoint(item, options?) / addPoints(items, options?) / addLines(items, options?)\nview.addPoint({ id: 's-1', x: 116.4, y: 39.9, name: '甲站' })\nconst addedPoints = view.addPoints([{ id: 's-2', x: 116.6, y: 40.1 }, { id: 's-3', x: 116.8, y: 40.2 }])\nview.addLines([{ id: 'x-1', from: 's-1', to: 's-2' }])\nview.addPoints(nextBatch, { emit: false }) // 只落地、不发 dataChange","from":"header"}] },
254
262
  ]
255
263
  },
256
264
  {
257
265
  title: "标签",
258
266
  items: [
259
267
  { name: "getLabelStates", kind: "method", params: "kind?: 'point' | 'line' 只看一类(不传两类都给)", returns: "GisViewLabelState[]", doc: "标签的运行时状态(拖出来的偏移 + 逐条覆盖,每条带 labelId):kind 写 'point' / 'line' 只取一类;做持久化 / 回显编辑面板用它,见「标签的拖动与编辑」", examples: [{"group":"标签","code":"// getLabelStates(kind?) / getLabels(kind, ref?):标签状态(持久化那一份)/ 标签读数\nconst labelStates = view.getLabelStates()\nconst lineStates = view.getLabelStates('line')\nconst labelsOfPoint = view.getLabels('point', 'a') // 一个要素上的标签\nconst labeledLines = view.getLabels('line') // 不传 ref = 有标签的线路清单\n","from":"header"}] },
260
- { name: "getLabels", kind: "method", params: "kind: 'point' | 'line' 看哪一类;ref?: GisViewFeatureRef 看哪一个要素(不传 = 给「有标签的要素」清单)", returns: "GisViewLabelListItem[] | null / GisViewItemLabelsInfo[]", doc: "一条要素上现在有哪些标签(配置里的每一条 + 数据 / 运行时多出来的,各自带内容 / 锚点 / 偏移 / 样式 / 可见性、来源(source:'config' 配置里定义的 / 'data' 数据里写的 / 'runtime' 运行时加的)与运行时状态);不给 ref 时给「有标签的要素」清单;找不到要素返回 null", examples: [{"group":"标签","code":"// getLabelStates(kind?) / getLabels(kind, ref?):标签状态(持久化那一份)/ 标签读数\nconst labelStates = view.getLabelStates()\nconst lineStates = view.getLabelStates('line')\nconst labelsOfPoint = view.getLabels('point', 'a') // 一个要素上的标签\nconst labeledLines = view.getLabels('line') // 不传 ref = 有标签的线路清单\n","from":"header"}] },
268
+ { name: "getLabels", kind: "method", params: "kind: 'point' | 'line' 看哪一类;ref?: GisViewFeatureRef 看哪一个要素(不传 = 给「有标签的要素」清单)", returns: "GisViewLabelListItem[] | null / GisViewItemLabelsInfo[]", doc: "一条要素上现在有哪些标签(配置里的每一条 + 数据 / 运行时多出来的,各自带内容 / 锚点 / 偏移 / 样式 / 可见性、当下生效的 zIndex / followNodeZIndex / zoomScale、来源(source:'config' 配置里定义的 / 'data' 数据里写的 / 'runtime' 运行时加的)与运行时状态);不给 ref 时给「有标签的要素」清单;找不到要素返回 null", examples: [{"group":"标签","code":"// getLabelStates(kind?) / getLabels(kind, ref?):标签状态(持久化那一份)/ 标签读数\nconst labelStates = view.getLabelStates()\nconst lineStates = view.getLabelStates('line')\nconst labelsOfPoint = view.getLabels('point', 'a') // 一个要素上的标签\nconst labeledLines = view.getLabels('line') // 不传 ref = 有标签的线路清单\n","from":"header"}] },
261
269
  { name: "setLabelContent", kind: "method", params: "content: GisViewLabelContent | GisViewLineLabelContent | null 新内容(模板串 {字段} / 函数 / null 回到默认);options: GisViewSetLabelContentOptions kind 缺省 'point'('line' / 'both')、labelId 缺省 'default'('*' 换配置里的每一条)", returns: "this", doc: "一键换全局标签内容(面板上「显示名称 / 电压等级」这类切换):content 与 label.content 同一套写法('{vn_kv}' 模板串 / 函数 / null 回到默认),只换内容,位置 / 样式 / 显隐保持;options.kind 缺省 'point'('line' / 'both' 连线路标签一起),options.labelId 缺省 'default'(写 '*' 换配置里的每一条),见「节点标签」", examples: [{"group":"标签","code":"// setLabelContent(content, options?):一键换全局标签内容(模板串 / 函数 / null 回默认)\nview.setLabelContent('{name}')\nview.setLabelContent('{name}({vn_kv} kV)')\nview.setLabelContent(null)\nview.setLabelContent('{name}', { kind: 'both', labelId: 'default' })\n","from":"header"}] },
262
- { name: "updateLabel", kind: "method", params: "kind 哪一类;ref 哪个要素;patch: GisViewLabelPatch 要改的项:labelId(改哪一条,缺省 'default')、content / html / position / style(增量合并)/ offset / visibility / parallel / hidden,写 null 回到默认", returns: "GisViewLabelState | null", doc: "逐条改一个标签:patch.labelId 指定改哪一条(缺省 'default'),另外认 content / html / position / style / offset / visibility / parallel / hidden,不写的保持、写 null 回到默认,style 是增量合并;改完当场重排一次并返回这一条的最新状态读数,找不到要素或这条要素上没有这一条标签时返回 null 并记一条 warning", examples: [{"group":"标签","code":"// updateLabel(kind, ref, patch):改一个要素的一条标签(labelId 缺省 'default')\nview.updateLabel('point', 'a', { style: { color: '#f60' } })\nview.updateLabel('point', 'a', { labelId: 'volt', content: '{vn_kv} kV' })\nview.updateLabel('line', 'l1', { labelId: 'note1', hidden: true })\nview.updateLabel('point', 'a', { position: 'bottom', offset: [0, 6], visibility: 'always' })\n","from":"header"}] },
270
+ { name: "updateLabel", kind: "method", params: "kind 哪一类;ref 哪个要素;patch: GisViewLabelPatch 要改的项:labelId(改哪一条,缺省 'default')、content / html / position / style(增量合并)/ offset / visibility / parallel / hidden / zIndex / followNodeZIndex / zoomScale,写 null 回到默认", returns: "GisViewLabelState | null", doc: "逐条改一个标签:patch.labelId 指定改哪一条(缺省 'default'),另外认 content / html / position / style / offset / visibility / parallel / hidden / zIndex / followNodeZIndex / zoomScale,不写的保持、写 null 回到默认,style 是增量合并;改完当场重排一次并返回这一条的最新状态读数,找不到要素或这条要素上没有这一条标签时返回 null 并记一条 warning", examples: [{"group":"标签","code":"// updateLabel(kind, ref, patch):改一个要素的一条标签(labelId 缺省 'default')\nview.updateLabel('point', 'a', { style: { color: '#f60' } })\nview.updateLabel('point', 'a', { labelId: 'volt', content: '{vn_kv} kV' })\nview.updateLabel('line', 'l1', { labelId: 'note1', hidden: true })\nview.updateLabel('point', 'a', { position: 'bottom', offset: [0, 6], visibility: 'always' })\nview.updateLabel('point', 'a', { followNodeZIndex: true }) // 跟随节点样式链的 zIndex\nview.updateLabel('point', 'a', { zIndex: 30 }) // 显式层级压过跟随\nview.updateLabel('line', 'l1', { zIndex: 10, zoomScale: 1 }) // 线路标签层级 + 字号随地图缩放\nview.updateLabel('point', 'a', { zIndex: null, zoomScale: null }) // 回到配置默认\n","from":"header"}] },
263
271
  { name: "addLabel", kind: "method", params: "kind / ref 同上;definition: GisViewItemLabel 一条标签的定义(与配置里同一套写法:content / position / offset / style / html…);labelId?: string 指定 id(缺省自动取 note1 / note2…)", returns: "GisViewLabelState | null", doc: "运行时加一条标签(不写进业务数据):definition 与配置里的一条同一套写法,id 缺省自动取 note1 / note2…;同 id 已存在时按 updateLabel 处理", examples: [{"group":"标签","code":"// addLabel(kind, ref, definition, labelId?) / removeLabel(kind, ref, labelId?)\nconst addedLabel = view.addLabel('point', 'a', { content: '{name} 备注', position: 'bottom' })\nview.addLabel('point', 'a', { content: '临时' }, 'note9')\nview.removeLabel('point', 'a', 'note9')\nview.removeLabel('point', 'a') // 缺省摘 'default'\n","from":"header"}] },
264
272
  { name: "removeLabel", kind: "method", params: "kind / ref;labelId?: string 删哪一条(缺省 'default')", returns: "GisViewRemoveLabelResult | null", doc: "删一条标签:运行时加的(addLabel)删掉那一份;数据 / 配置里还声明着同 id 的标签时再标一条隐藏(它照样会画出来,数据是使用方的,组件只记一条覆盖)。返回 { removed, hidden },找不到返回 null", examples: [{"group":"标签","code":"// addLabel(kind, ref, definition, labelId?) / removeLabel(kind, ref, labelId?)\nconst addedLabel = view.addLabel('point', 'a', { content: '{name} 备注', position: 'bottom' })\nview.addLabel('point', 'a', { content: '临时' }, 'note9')\nview.removeLabel('point', 'a', 'note9')\nview.removeLabel('point', 'a') // 缺省摘 'default'\n","from":"header"}] },
265
273
  { name: "addLabels", kind: "method", params: "kind;refs: GisViewLabelRef | 数组 批量定位(单个 / 数组 / 'all' / 'visible' / 'selection',线路还认 { channel } / { group });definition 一条定义、定义数组,或 (item, index) => 定义;options: { labelId?, overwrite? } 已有同 id 的缺省跳过、overwrite: true 覆盖", returns: "GisViewAddLabelsResult", doc: "批量加同一套标签:refs 见「统一加 / 改 / 删一批标签」(单个 / 数组 / 'all' / 'visible' / 'selection' / { channel } / { group }),definition 认一条定义、数组或 (item, index) => 定义,已有同 id 的缺省跳过、options.overwrite 覆盖;返回 { kind, requested, added, updated, skipped }", examples: [{"group":"标签","code":"// addLabels(kind, refs, definition, options?):批量加(refs 认 'all' / 'visible' / 'selection' / 数组)\nview.addLabels('point', 'all', { content: '{name}' })\nview.addLabels('point', ['a', 'b'], item => ({ content: item.name }), { labelId: 'tag' })\nview.addLabels('line', { channel: 'c1' }, { content: '{name}' }, { labelId: 'tag', overwrite: true })\n","from":"header"}] },
@@ -297,7 +305,7 @@ export const API_SECTIONS = [
297
305
  {
298
306
  title: "导出",
299
307
  items: [
300
- { 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"}] },
308
+ { 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(只导指定要素)、selectionKinds(仅 viewport,支持 lineEndpoints / channelEndpoints)、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 可以只要一部分;scope: 'viewport' 可用 selectionKinds 按类型或 lineEndpoints / channelEndpoints 筛。解不出的引用进 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 endpointsOnly = view.exportData({ scope: 'viewport', selectionKinds: ['lineEndpoints', 'channelEndpoints'] }) // 两端节点都在视口内\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"}] },
301
309
  { name: "exportImage", kind: "method", params: "options?: GisViewExportImageOptions:type('image/png' / 'image/jpeg' / 'image/webp' / 'svg')、quality(JPEG / WebP 0 ~ 1)、scale(导出倍数;SVG 只影响宽高)、scope('viewport' 缺省 / 'all' 全部内容)、padding(scope: 'all' 的留白,缺省 24)、background(缺省带背景 / false 或 'none' 透明 / 颜色字符串换底色)、includeLabels(缺省 true)、download(true 或文件名)", returns: "Promise<string>(data URL)", doc: "导出当前画面(含标签)为图片,返回 data URL;scope: 'viewport'(缺省)导当前视口、'all' 临时适应全部可见内容,另有 padding / type / quality / scale / background / includeLabels / download,见「导出图片」", 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' }) // 也可以直接下载\nawait view.exportImage({ scope: 'all', padding: 24, includeLabels: false }) // 全部内容(导完恢复相机)\n","from":"header"}] },
302
310
  { 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"}] },
303
311
  ]
@@ -375,6 +383,7 @@ export const API_OPTIONS = [
375
383
  { name: "channelTangentInset", type: "number | null", defaultValue: "null", doc: "两端切点往节点里收多少 CSS 像素:缺省(null)按成员回线里最粗那条的线宽收,线因此不会从节点边缘探出去;0 表示切点正好落在节点边上,负数外收(切点往节点外让、回线整段比节点宽);单个通道可用 tangentInset 覆盖;内收两侧合计最多收掉节点宽度的 40%,外收单侧最多让出 50%" },
376
384
  { name: "channelMaxGroups", type: "number", defaultValue: "0", doc: "一条通道最多几个分组(0 表示不限):新增通道时用来判断还能不能变成新分组,见「新增通道」" },
377
385
  { name: "channelGroupMaxLines", type: "number", defaultValue: "0", doc: "一个分组最多几条回线(0 表示不限):新增通道时用来判断还能不能并进某一组,见「新增通道」" },
386
+ { name: "channelSimplify", type: "boolean | GisViewChannelSimplifyOptions", defaultValue: "false", doc: "通道简略:true 用缺省阈值 4;对象可调 enabled / threshold / style。分组回线数严格大于阈值时只画一条代表线,见「通道简略(channelSimplify)」" },
378
387
  { name: "channelDraftStyle", type: "GisViewChannelDraftStyle", defaultValue: "蓝色 2px + 两端圆点,箭头关闭", doc: "新增通道草稿预览的全局样式:color / width / dot / dotColor / dots(false 关示例点,或 { show, size, color, shape, from, to } 分端配置;示例点固定在点中的节点中心)/ layer('above' 默认,'below-points' 让示例线 / 箭头 / customDraw 位于真实节点之下)/ arrow / arrowSize / arrowPositions / arrowReverse / arrowColor / circuitSpacing / opacity / customDraw;beginAddChannel({ channelDraftStyle }) 可按这一次草稿覆盖,updateAddChannelStyle(patch) 可在草稿期间增量修改" },
379
388
  { name: "webglLayers", type: "GisViewWebGLLayer[]", defaultValue: "[]", doc: "WebGL 自定义绘制层:每层提供 draw({ gl, canvas, viewport, camera, frame, project, unproject, requestRender }),在内置内容之后按 order 绘制;运行时也可用 addWebGLLayer / updateWebGLLayer / removeWebGLLayer 维护" },
380
389
  { name: "background", type: "GisViewBackground", defaultValue: "浅色底", doc: "背景层,支持底色、图片与 GeoJSON" },
@@ -386,10 +395,10 @@ export const API_OPTIONS = [
386
395
  { 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)」" },
387
396
  { name: "lineDirection", type: "GisViewLineDirectionInput", defaultValue: "关(null)", doc: "线路方向箭头(全局缺省):沿线摆一串静态箭头,朝向跟着线路切向走(起点 / from 那一端 → 终点,reverse 指回上游),按弧长等分、缺省每条线只在中点一个;逐条线路用 lines[].direction 覆盖,写法与 effects 同构(true 用全局、对象逐字段覆盖、false / null 关掉),见「线路方向箭头(lineDirection)」" },
388
397
  { name: "prebake", type: "GisViewPrebakeOptions | true", defaultValue: "关", doc: "贴图符号预热:把「这次画面会出现什么」提前告诉组件 —— 两种写法:combos 逐组合(精确,getSymbolCombos() 收出来的那份)/ symbols × pointColors × sizes 与 lineColors × 线路动画图标 全排列(省事,颜色与尺寸由同一个字段决定时会多烤很多)—— 第一帧之前就烤好,画到它们时命中的是现成的贴图(省掉解码 + 光栅化那一下);组合数与数据量无关,不配就是从前那条按需路径。读数 getPrebake() / getSymbolCombos()、手动再烤一遍 runPrebake(),见「贴图符号预热(prebake)」" },
389
- { name: "label", type: "GisViewLabelOptions | GisViewLabelOptions[]", defaultValue: "无", doc: "节点标签:内容 / 位置 / 显隐 / 避让 / 拖动与编辑都可配,写数组就是同一个节点上多条标签,与 lineLabel 共用一套避让网格,见「节点标签」" },
398
+ { name: "label", type: "GisViewLabelOptions | GisViewLabelOptions[]", defaultValue: "无", doc: "节点标签:内容 / 位置 / 显隐 / 避让 / 层级 / 缩放字号 / 拖动与编辑都可配,写数组就是同一个节点上多条标签,与 lineLabel 共用一套避让网格;zIndex 显式定层,followNodeZIndex 跟随节点样式链,zoomScale 控制字号是否随地图缩放,见「节点标签」" },
390
399
  { name: "labelOptimize", type: "boolean", defaultValue: "false", doc: "标签显示优化开关:缺省关 = 强制显示(不避让、不按 maxCount 截断、不设 scanLimit / 扫描预算,节点 / 线路的每个可见要素该出现的标签一条不少);写 true 与从前一致 —— 避让 / 换落点 / 数量上限 / 候选上限全部生效。标签订得密、数据量大(十万级)时建议打开,见「标签显示优化开关」" },
391
400
  { name: "labelRender", type: "'auto' | 'canvas' | 'dom'", defaultValue: "'auto'", doc: "纯文本标签的容器渲染方式:auto 在强制显示档(labelOptimize 未开且未进密集档)下,同一层纯文本标签达到 1024 条时改画到一张 Canvas;canvas 不受数量阈值限制,优化档 / 密集档也强制画布并直接用画布尺寸参与避让;dom 始终逐条建 .gis-view__label。HTML / 元素内容 / 可拖拽 / 可编辑 / 超出 Canvas 样式能力的标签仍走 DOM。只影响容器,不改内容、锚点、显隐以及 maxCount / when / scanLimit 等优化策略,见「标签容器渲染(labelRender)」" },
392
- { name: "lineLabel", type: "GisViewLineLabelOptions | GisViewLineLabelOptions[]", defaultValue: "无", doc: "线路标签:位置沿线走(比例 / 百分比 / 绝对距离),内容、避让、显隐都可配,与节点标签共用一套避让网格;写数组就是同一条线上多条标签,见「线路标签」" },
401
+ { name: "lineLabel", type: "GisViewLineLabelOptions | GisViewLineLabelOptions[]", defaultValue: "无", doc: "线路标签:位置沿线走(比例 / 百分比 / 绝对距离),内容、避让、显隐、层级与缩放字号都可配,与节点标签共用一套避让网格;写数组就是同一条线上多条标签,见「线路标签」" },
393
402
  { name: "labelStates", type: "GisViewLabelState[]", defaultValue: "无", doc: "标签的运行时状态(getLabelStates() 的那一份:拖出来的偏移、改过的内容与样式、运行时加的标签、隐藏覆盖):创建时喂回来就回显,等价于创建之后调 setLabelStates(states);updateOptions({ labelStates }) 同样认。exportData({ format: 'input' }) 的结果里就叫 labelStates,存档 → 回灌直接接上" },
394
403
  { name: "graphics", type: "GisViewGraphic[]", defaultValue: "无", doc: "与节点无关的扩展图形:按世界坐标放 SVG 路径 / 图片 / Canvas,支持锚点、偏移、旋转、透明度、zIndex 与 scaleWithView;位于画布之上、标签之下,运行时用 addGraphic / addGraphics / updateGraphic / removeGraphic / clearGraphics 增删改,见「扩展图形(graphic)」" },
395
404
  { name: "tooltip", type: "GisViewTooltipOptions", defaultValue: "无", doc: "悬停提示:点 / 线 / 通道分别配置内容,见「悬浮提示」" },
@@ -415,7 +424,7 @@ export const API_OPTIONS = [
415
424
  { name: "boxSelect", type: "boolean", defaultValue: "false", doc: "是否允许按住框选快捷键(shortcuts.boxSelect,默认 Shift)拖动鼠标框选要素;缺省关,写 boxSelect: true 或 features: { boxSelect: true } 才开。框选默认只收节点,selectionKinds 可把线路 / 通道也纳入" },
416
425
  { name: "multiSelect", type: "boolean", defaultValue: "false", doc: "多选开关:打开后不用按修饰键,直接单击节点 / 线路就取反累加选中(与按住 shortcuts.multiSelect 点击同一套行为、同一个 multiSelectStyle;取反那一下不经过 onClick,onSelectChange.action.type 是 toggleSelect);缺省关,关着时多选走框选(boxSelect)与按住多选快捷键(默认 Ctrl / ⌘)。运行时 updateOptions({ multiSelect }) 切换只重画一帧、不重排场景" },
417
426
  { name: "selectTrigger", type: "'click' | 'dblClick'", defaultValue: "'click'", doc: "选中触发方式:click 第一次单击就改选中集;dblClick 第一下只派发 onClick,等双击判定命中的第二下才改选中集,并同时派发 onClick 与 onDblClick。Ctrl / ⌘ 多选与 multiSelect 在双击模式下同样等第二下才取反。运行时走 updateOptions({ selectTrigger }),只重画一帧、不重排场景" },
418
- { name: "selectionKinds", type: "GisViewSelectionKindsInput", defaultValue: "无(框选只收节点;Ctrl 多选收节点 / 线路 / 通道)", doc: "框选与 Ctrl / 多选点击的类型过滤:'point' 节点、'line' 通道外的独立线路、'channel' 通道回线;可写数组任意组合,'all' / true 全开,false / null 全关。通道回线只归 channel 管,通道外的线路只归 line 管;通道回线仍按 channelSelectMode 摊开。不写时保留旧口径;普通单选与 select / selectFeatures 不受它限制。运行时走 updateOptions({ selectionKinds }),见「框选」与「选择类型过滤」" },
427
+ { name: "selectionKinds", type: "GisViewSelectionKindsInput", defaultValue: "无(框选只收节点;Ctrl 多选收节点 / 线路 / 通道)", doc: "框选与 Ctrl / 多选点击的类型过滤:'point' 节点、'line' 通道外的独立线路、'channel' 通道回线;另有 'lineEndpoints' / 'channelEndpoints',只在框选时要求线路 / 通道两端节点都在框内。可写数组任意组合,'all' / true 全开,false / null 全关。通道回线只归 channel 管,通道外的线路只归 line 管;通道回线仍按 channelSelectMode 摊开。不写时保留旧口径;普通单选与 select / selectFeatures 不受它限制。运行时走 updateOptions({ selectionKinds }),见「框选」与「选择类型过滤」" },
419
428
  { name: "selectionBoxStyle", type: "GisViewSelectionBoxStyle", defaultValue: "蓝底 0.16 透明 + 1px 蓝框", doc: "框选矩形的填充与边框:fill、fillOpacity、stroke、strokeWidth" },
420
429
  { name: "selectionOnTop", type: "boolean", defaultValue: "true", doc: "选中的节点 / 拖动中的整组 / 待确认合并的目标节点,以及选中线路所在的整条通道,是否画在所有要素之上(与 zIndex 无关),见「选中 / 拖动的层级」" },
421
430
  { name: "channelSelectMode", type: "'line' | 'group' | 'channel'", defaultValue: "'line'", doc: "通道选中模式:点中通道里的一条回线时选中什么 —— 'line' 只选这一条、'group' 连它所在的分组一起、'channel' 整条通道(所有分组的回线);通道以外的线路永远只选自己。普通点选与 Ctrl / ⌘ + 点击加点共用这一档高亮范围;Ctrl / ⌘ + 点击在 group / channel 下按整批取反;切换走 updateOptions({ channelSelectMode }),只重画一帧、不重排场景,见「通道选中模式」" },
@@ -437,14 +446,17 @@ export const API_OPTIONS = [
437
446
  { name: "shortcuts", type: "GisViewShortcuts", defaultValue: "见「快捷键」", doc: "所有快捷键都可自定义:框选 / 多选 / 加点 / 复制 / 粘贴 / 取消 / 删除 / 适应视图,没写的动作沿用默认值,写 false 等于关掉这个动作的快捷键" },
438
447
  { name: "copy", type: "GisViewCopyOptions", defaultValue: "缺省关", doc: "复制节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、offset 落点偏移(默认 [28, 24] 像素)、autoCommit(交互入口落地前是否自动确认:不写就是落地,false 停在预览态等 commitPointCopy() / 载荷里的 payload.commit())、idPrefix(默认 copy-)、createId / createItem 定制复制品,见「节点复制」" },
439
448
  { name: "remove", type: "GisViewRemoveOptions", defaultValue: "缺省关", doc: "删除选中的拐点 / 线路 / 节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、scope(confirm() 不带参数时的缺省范围:'lines' 只删选中的回线 / 'groups' 连所在分组 / 'channels' 连整条通道,缺省 'lines')、confirm(不写停在 pending 等使用方裁决 / false 直接删 / 函数自行裁决,支持 Promise)。Delete 键与 requestRemove() 都先出一份「要删什么、连带什么」的载荷,确认之后才动数据;删节点会连挂在它身上的线路与被它锚定的通道一起删,见「删除(remove)」" },
440
- { name: "merge", type: "GisViewMergeOptions", defaultValue: "缺省关", doc: "合并节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、trigger 触发时机('collision' 两个节点半径相碰 / 'center' 拖动节点中心进入目标节点区域)、distance 额外像素容差、confirm(不写停在 pending 等使用方裁决 / false 直接合并 / 函数自行裁决)、channelGroups('keep' 各自保留分组 / 'merge' 合成一个分组)、createItem 定制合并结果,见「节点合并」" },
449
+ { name: "merge", type: "GisViewMergeOptions", defaultValue: "缺省关", doc: "合并节点(写了这份配置才算开,enabled: false 显式关掉):enabled 开关、trigger 触发时机('collision' 两个节点半径相碰 / 'center' 拖动节点中心进入目标节点区域)、distance 额外像素容差、confirm(不写停在 pending 等使用方裁决 / false 直接合并 / 函数自行裁决)、channelGroups('keep' 各自保留分组 / 'merge' 合成一个分组)、maxKeys 选哪些字段取双方最高、createItem 定制合并结果,见「节点合并」" },
441
450
  { name: "minScale", type: "number", defaultValue: "0.002 / 20000", doc: "缩放范围(像素 / 世界单位)" },
442
451
  { name: "maxScale", type: "number", defaultValue: "0.002 / 20000", doc: "缩放范围(像素 / 世界单位)" },
443
452
  { name: "fitPadding", type: "number", defaultValue: "48", doc: "适应视图时四周留白(CSS 像素);留白比画布还大时按「内容至少留 48px」反过来压留白,不会把内容挤成一个点" },
444
453
  { name: "fitOnInit", type: "boolean", defaultValue: "true", doc: "首次拿到数据时自动适应视图;配了 initialView 时以它为准(false 只关掉「适应」,initialView 仍然生效,见「初始视图」)" },
454
+ { name: "center", type: "GisViewCoordinate", defaultValue: "无", doc: "首屏中心 [x, y] / { x, y },是 initialView.center 的顶层简写;显式给出非空 initialView 时以那一份为准" },
455
+ { name: "scale", type: "number", defaultValue: "无", doc: "首屏绝对比例(像素 / 世界单位),是 initialView.scale 的顶层简写;显式给出非空 initialView 时以那一份为准" },
445
456
  { name: "initialView", type: "GisViewInitialView", defaultValue: "无", doc: "首次加载的相机落位:中心点、绝对比例、相对放大倍数或要适应的范围,见「初始视图」" },
446
457
  { name: "progressiveInit", type: "boolean", defaultValue: "true", doc: "大数据(2 万点以上)初始化是否从视图中心向外发散渲染:首帧只排中心附近的一批,剩下的分帧往外补,见「大数据量」" },
447
458
  { name: "statsInterval", type: "number", defaultValue: "250", doc: "onStats 的最小间隔(毫秒),0 表示每帧都发" },
459
+ { name: "idleTimeout", type: "number", defaultValue: "0(关闭)", doc: "用户操作空闲阈值(毫秒):根节点上这么久没有指针 / 滚轮 / 键盘活动就发一次 onIdle / idle;每个空闲段只触发一次,恢复操作后重新计时" },
448
460
  { name: "renderEmitInterval", type: "number", defaultValue: "400", doc: "onRender 的节流间隔(毫秒),0 与 onStats 同拍(再配上 statsInterval: 0 就是每帧一条)" },
449
461
  { name: "plugins", type: "GisViewPlugin[]", defaultValue: "[]", doc: "插件:(view, context) => hook,返回的 destroy 在实例销毁时倒序回调,见「插件」" },
450
462
  { name: "zoomStep", type: "number", defaultValue: "1.4", doc: "zoomIn() / zoomOut() 的步进倍率" },