gis-view-webgl2 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -366
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +63 -6
- package/dist/index.js +1 -1
- package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +30 -5
- package/docs/GisView.md +1 -1
- 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 +8 -5
- package/docs/demos/api-index.js +5 -4
- package/docs/demos/gis-view-demo/panels/StylePanels.vue +14 -2
- package/docs/demos/gis-view-demo/useGisViewDemo.js +29 -5
- package/docs/index.html +3 -3
- package/docs/manual/03-/351/205/215/347/275/256/351/241/271.md +2 -2
- package/docs/manual/09-/351/200/232/351/201/223/344/270/216/345/244/232/345/233/236/347/272/277.md +16 -13
- package/docs/manual/14-/350/247/206/345/233/276/344/270/216/347/255/233/351/200/211.md +19 -5
- package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md +3 -2
- package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +3 -2
- package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +23 -9
- package/docs/steps/README.md +1 -1
- package/docs/steps/selftest-demos.html +2 -2
- package/docs/steps/selftest-docs.html +3 -3
- package/docs/steps/selftest-features.html +16 -10
- package/docs/steps/selftest-scale.html +33 -0
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# AI 对话汇总
|
|
2
2
|
|
|
3
|
-
> 一页读完 gis-view 的 AI 协作史:39 个会话、
|
|
3
|
+
> 一页读完 gis-view 的 AI 协作史:39 个会话、197 轮需求,按「关键决策 → 演进主线 → 精选问答」整理。
|
|
4
4
|
> 原先拆开的 01 ~ 05 已合并到这里;逐会话文件、历史增量索引与复查命令统一放在 [维护索引](ai/06-会话索引与复查方法.md)。
|
|
5
5
|
|
|
6
6
|
这份汇总不是使用手册。组件行为以 [GisView 手册](GisView.md) 和 [数据格式](数据格式.md) 为准,实现细节与逐轮证据在 [GisView 实现原理](GisView实现原理.md) 的 `internals/15-*`、`16-*`。这里只回答三件事:当时为什么这么定、后来怎么演进、现在该从哪里继续查。
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
|
|
21
21
|
| 项目 | 结论 |
|
|
22
22
|
| --- | --- |
|
|
23
|
-
| 对话范围 | 2026-09-15 ~ 2026-10-29,39 个会话、
|
|
23
|
+
| 对话范围 | 2026-09-15 ~ 2026-10-29,39 个会话、197 轮;10-14 之后主要为现有会话的增量轮次 |
|
|
24
24
|
| 产品形态 | 一个无内置界面的 `createGisView(dom, options)` WebGL2 矢量视图,交互与视觉效果通过配置、事件和实例方法组合 |
|
|
25
25
|
| 核心对象 | 节点、线路、通道(多回线 / 分组)、拐点、装饰、标签、覆盖层、鹰眼图、扩展图形 |
|
|
26
26
|
| 技术路线 | WebGL2 批量渲染 + HTML / Canvas 覆盖层 + 网格索引 + 增量更新 + Worker 筛选与搜索 |
|
|
27
|
-
| 当前公开面 |
|
|
27
|
+
| 当前公开面 | 274 个实例成员、100 个 options、266 个数据字段、44 个事件、17 个功能开关、16 个分组 |
|
|
28
28
|
| 维护方式 | 文档双向对账、API 索引生成、14 个自测页与无头浏览器回归;每轮记录同步到本页与维护索引 |
|
|
29
29
|
|
|
30
30
|
## 关键技术决策
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
|
|
57
57
|
### 2026-10-26 ~ 10-29:选中、事件与增量接口
|
|
58
58
|
|
|
59
|
-
统一选中回调与载荷、补 `selectAt` / 中心点等窄接口、让删除与合并后的选中集和拐点键跟着要素走;同时继续优化通道批量更新、节点 id 索引和线路端点 /
|
|
59
|
+
统一选中回调与载荷、补 `selectAt` / 中心点等窄接口、让删除与合并后的选中集和拐点键跟着要素走;同时继续优化通道批量更新、节点 id 索引和线路端点 / 通道端点框选。最新两轮先后补了直接连接查询与回显比例,再把 `fitSpacing` 的距离模式收口为互斥并让 `getPointSpacing()` 返回屏幕像素。
|
|
60
60
|
|
|
61
61
|
## 精选问答
|
|
62
62
|
|
|
@@ -84,7 +84,32 @@
|
|
|
84
84
|
|
|
85
85
|
先分清组件与宿主:本组件只负责接收已经整理好的点线数据,`initData` 只应在挂载时调用一次;若宿主定时重建数据,先查宿主路由、监听与 `gisTools.js` / `buildNewData`。SVG 被画成圆通常是宿主传入了错误的 `symbol` 或 `pointRules`,直流标记则要确认装饰类型与数据映射。历史排查见维护索引的 10-12 旁支记录。
|
|
86
86
|
|
|
87
|
-
## 当前轮次:
|
|
87
|
+
## 当前轮次:README 精简与维护规则(2026-10-29)
|
|
88
|
+
|
|
89
|
+
- **需求来源**:根目录 `修改.txt` —— 根 `README.md` 太长,不适合直接作为 npm 首页;并明确要求不要每轮都更新 README。
|
|
90
|
+
- **README 定位**:把根 README 从 406 行的逐轮记录与性能长文收敛为 88 行、约 3 KB 的稳定首页,只保留产品简介、特性、安装、最小示例、文档入口、开发命令与运行说明;代码示例的包名统一为 `package.json` 里的 `gis-view-webgl2`。
|
|
91
|
+
- **维护规则**:`AGENTS.md` 新增根 README 维护约定:默认不随每轮代码修改;只有用户明确要求,或安装方式、最小示例、主要功能入口确实过期时才改。性能数据、逐轮变更和排查细节继续写入 aimd 或手册。
|
|
92
|
+
- **核心文件**:`README.md`、`AGENTS.md`、`docs/AI对话汇总.md`、`docs/ai/06-会话索引与复查方法.md`。
|
|
93
|
+
- **验证**:`npx tsc --noEmit`、`npm run check:docs`(274 个实例成员 / 100 个 options / 266 个数据字段)、`node docs/steps/gen-api-index.mjs --check`、`npm run build` 与 `git diff --check` 通过;`selftest-docs` 138 条 0 失败。
|
|
94
|
+
|
|
95
|
+
## 上一轮:fitSpacing 距离模式互斥与屏幕距离读数(2026-10-29)
|
|
96
|
+
|
|
97
|
+
- **需求来源**:根目录 `修改.txt` 两条 —— ① `fitSpacing` 的 `minDistance` / `maxDistance` 只能选一种,节点距离要么按最大、要么按最小;② `getPointSpacing()` 的最近 / 最远距离要和 `fitSpacing` 一样考虑地图缩放比例。
|
|
98
|
+
- **fitSpacing 互斥**:`normalizeFitSpacing()` 把两个距离归一成单一模式;同时给出时只按 `maxDistance` 计算,`minDistance` 不参与。`fitSpacingAdjustment()` 改为明确分支,`maxDistance` 仍只压低比例,不会因上限过宽反而放大。`getOptions()` 保留原始入参,不回写内部归一化结果。
|
|
99
|
+
- **屏幕距离读数**:`getPointSpacing()` 把 `measurePointSpacing()` 的世界距离乘当前 `camera.scale`;`minDistance` / `maxDistance` 与 `nearest` / `farthest.distance` 全部返回 CSS 像素,随缩放变化,与 `fitSpacing` 同口径,除以 `getScale()` 才回到世界单位。demo 样式面板增加最小 / 最大距离模式选择。
|
|
100
|
+
- **核心文件**:`src/gis-view/engine.js`、`create.js`、`types.d.ts`;manual 03 / 14 / 16 / 17 / 18、demo 样式面板、`selftest-scale.html`、`docs/demos/api-index.js`。
|
|
101
|
+
- **验证**:`npx tsc --noEmit`、`npm run check:docs`(274 个实例成员 / 100 个 options / 266 个数据字段)、`node docs/steps/gen-api-index.mjs --check`、`npm run build` 通过;`selftest-features` 740/0、`selftest-docs` 138/0、`selftest-demos` 395/0;`selftest-scale` 120/122,新增的互斥与屏幕距离断言通过,剩余两条仍是既有筛选回调断言(`onFilter 0 条`,与本轮改动无关)。
|
|
102
|
+
|
|
103
|
+
## 更早一轮:直接连接分列、节点距离与回显比例(2026-10-29)
|
|
104
|
+
|
|
105
|
+
- **需求来源**:根目录 `修改.txt` 三条 —— ① `getDirectConnections` 可按通道 / 线路筛选并按类外层分列;② 导出部分场站后回显比例被自动适应放大;③ 读取最近 / 最远节点距离,并给 `fitSpacing` 增加 `maxDistance`。
|
|
106
|
+
- **直接连接查询**:`getDirectConnections(pointIds, options?)` 固定返回 `{ channels, lines }`;第二段支持 `'channel'` / `'line'` / `'both'` 或 `{ kind }`,只查一列时另一列为空数组,无效值按 `both`;通道与成员回线分别落列,仍只查集合内部的直接边。
|
|
107
|
+
- **回显比例**:推荐同时保存 `getCamera()`;full 文档已有 `view.camera`,回显用 `initialView: { mode: 'scale', center, scale }`;同一个实例更新数据用 `updateData()` / `importData()` 会保持当前相机,仍要自动适应时可用 `fitSpacing.maxDistance` 防过度放大。
|
|
108
|
+
- **距离读数与 fitSpacing**:新增 `getPointSpacing()`,返回可见节点最近正距离、最远距离和两端节点(世界单位,乘 `getScale()` 才是 CSS 像素);`fitSpacing.maxDistance` 按最远节点对的屏幕距离压低比例,和 `minDistance` 冲突时 `maxDistance` 优先。
|
|
109
|
+
- **核心文件**:`src/gis-view/create.js`、`engine.js`、`utils.js`、`types.d.ts`;`docs/manual/03` / `09` / `14` / `16` / `17` / `18`、demo 样式面板、`selftest-features`、`selftest-scale`。
|
|
110
|
+
- **验证**:`npx tsc --noEmit`、`npm run check:docs`(274 个实例成员 / 100 个 options / 266 个数据字段)、`node docs/steps/gen-api-index.mjs --check`、`npm run build`、`git diff --check` 通过;`selftest-features` 740 条 0 FAIL,`selftest-docs` 138 条 / `selftest-demos` 395 条均 0 FAIL;`selftest-scale` 120/122,本轮新增的距离与 `maxDistance` 断言通过,失败的两条是既有筛选回调断言(`onFilter 0 条`,与本轮改动无调用关系)。
|
|
111
|
+
|
|
112
|
+
## 再早一轮:AI 文档合并与阅读导航(2026-10-29)
|
|
88
113
|
|
|
89
114
|
- **需求来源**:根目录 `修改.txt` 两条 —— ① 修改 AI 文档页,精简合并;② 继续优化文档页面的呈现效果。
|
|
90
115
|
- **AI 文档合并**:把原先 `ai/01` ~ `ai/05` 的来源、主题分类、精选问答与旁支记录压缩进本页;保留 `ai/06` 作为会话文件、历史增量与复查方法的维护索引。AI 文档从 7 个入口收敛为 2 个入口,主页面不再重复堆叠逐轮细节。
|
package/docs/GisView.md
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
| [14 视图与筛选](manual/14-视图与筛选.md) | 筛选、搜索定位、初始视图与缩放范围、背景层、鹰眼图、近义入口 |
|
|
33
33
|
| [15 导出与集成](manual/15-导出与集成.md) | 导出图片 / 选中节点 / 数据、自定义导出格式,插件、自建界面与键盘交互 |
|
|
34
34
|
| [16 实例方法总表](manual/16-实例方法总表.md) | 按功能分组的实例方法主表(找方法从这一章开始) |
|
|
35
|
-
| [17 参数速查(逐个方法)](manual/17-参数速查.md) |
|
|
35
|
+
| [17 参数速查(逐个方法)](manual/17-参数速查.md) | 274 个成员逐个列全:参数、默认值与返回 |
|
|
36
36
|
| [18 逐方法示例(复制就能跑)](manual/18-逐方法示例.md) | 每个成员一段可复制的调用示例(API 速查页读的就是这一章) |
|
|
37
37
|
| [19 读数与拖拽预览](manual/19-读数与拖拽预览.md) | 自建界面常用的读数 / 定位方法;拖拽落点预览 |
|
|
38
38
|
| [20 性能与大数据](manual/20-性能与大数据.md) | 十万级数据的开关与实测、WebGPU 取舍、渲染后端开关 |
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
|
|
56
56
|
| 日期 | 这一轮 |
|
|
57
57
|
| --- | --- |
|
|
58
|
+
| 2026-10-29 | 增量:(「修改.txt」:根 README 精简为 npm 首页并约定不逐轮更新) |
|
|
59
|
+
| 2026-10-29 | 增量:(「修改.txt」两条:fitSpacing 距离模式互斥 / getPointSpacing 屏幕距离读数) |
|
|
60
|
+
| 2026-10-29 | 增量:(「修改.txt」三条:直接连接筛选、回显比例与节点距离读数) |
|
|
58
61
|
| 2026-10-29 | 增量:通道性能文档补齐与节点直接连接查询 |
|
|
59
62
|
| 2026-10-29 | 增量:线路 / 通道端点框选与视口端点导出 |
|
|
60
63
|
| 2026-10-28 | 增量:(续):Demo 落地与新手路线 |
|
|
@@ -116,12 +119,12 @@
|
|
|
116
119
|
| 2026-10-19 | 增量:(「修改.txt」继续优化与排查) |
|
|
117
120
|
| 2026-10-19 | 增量:(「修改.txt」五条) |
|
|
118
121
|
|
|
119
|
-
##
|
|
122
|
+
## 三、当前增量:根 README 精简为 npm 首页(2026-10-29)
|
|
120
123
|
|
|
121
|
-
- **需求来源**:根目录 `修改.txt
|
|
122
|
-
-
|
|
123
|
-
- **核心文件**:`docs/AI对话汇总.md`、`docs/ai/06-会话索引与复查方法.md
|
|
124
|
-
- **验证**:`npm run check:docs
|
|
124
|
+
- **需求来源**:根目录 `修改.txt`:根 `README.md` 太长,放到 npm 页面不合适,并明确要求不再每轮更新 README。
|
|
125
|
+
- **改动主题**:根 README 从 406 行精简为 88 行(约 3 KB),只保留产品简介、核心能力、安装、最小示例、文档入口、开发命令与运行说明;示例包名改为 `gis-view-webgl2`。`AGENTS.md` 同步约定根 README 默认稳定、不逐轮追加,逐轮记录写回 aimd 或手册。
|
|
126
|
+
- **核心文件**:`README.md`、`AGENTS.md`、`docs/AI对话汇总.md`、`docs/ai/06-会话索引与复查方法.md`。
|
|
127
|
+
- **验证**:`npx tsc --noEmit`、`npm run check:docs`(274 个实例成员 / 269 个方法 / 5 个属性 / 100 个 options / 266 个数据字段)、`gen-api-index --check`、`npm run build` 与 `git diff --check` 通过;`selftest-docs` 138/0。
|
|
125
128
|
|
|
126
129
|
## 四、怎么自己复查
|
|
127
130
|
|
package/docs/demos/api-index.js
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
* 源码或文档改过之后重跑一遍;`node docs/steps/check-doc-coverage.mjs` 会对账。
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
/** { members:
|
|
11
|
-
export const API_SUMMARY = {"members":
|
|
10
|
+
/** { members: 274, methods: 269, properties: 5, options: 100, sections: 16 } */
|
|
11
|
+
export const API_SUMMARY = {"members":274,"methods":269,"properties":5,"options":100,"sections":16}
|
|
12
12
|
|
|
13
13
|
/** 实例成员,按 docs/GisView.md「参数速查」的分组排 */
|
|
14
14
|
export const API_SECTIONS = [
|
|
@@ -123,6 +123,7 @@ export const API_SECTIONS = [
|
|
|
123
123
|
{ name: "listPoints", kind: "method", params: "options?: GisViewListOptions:indexes(只看这几个下标)、inView: boolean(只要当前视口里的)、withScreen: boolean(连屏幕坐标一起给)、visibleOnly: boolean(跳过隐藏的)、limit: number(最多几条)", returns: "GisViewListedPoint[]", doc: "按条件列节点快照 { index, item, x, y, radius, layerRank, screen? }:选项见 GisViewListOptions(indexes / inView / limit / withScreen / visibleOnly),可见判定与 isPointVisible 是同一份", examples: [{"group":"坐标、拾取与读数","code":"// listPoints(options?) / listLines(options?):按条件列一批\nconst listedPoints = view.listPoints({ limit: 5, withScreen: true })\nconst listedLines = view.listLines({ inView: true, limit: 200 })\n","from":"header"}] },
|
|
124
124
|
{ name: "getClusters", kind: "method", params: "无", returns: "GisViewCluster[]。当前展示组(含 count: 1 的单成员),screen 按当前相机现算;聚合关掉时是空表", doc: "当前点聚合的展示组 GisViewCluster[]:按数据顺序返回,含 count: 1 的单成员与 count > 1 的聚合圆;每项带 id / pointIndexes / pointIds / 世界坐标 coordinate / 当前屏幕坐标 screen / 半径 radius / 包围盒 bounds。原始 points 与 getData() 不变,聚合关掉时返回空表", examples: [{"group":"坐标、拾取与读数","code":"// getClusters() / getPointCluster():读当前点聚合展示组与配置\nview.updateOptions({ pointCluster: { radius: 64, minPoints: 3, maxZoom: 2.5 } })\nconst clusterGroups = view.getClusters()\nconst clusteredOnly = clusterGroups.filter(group => group.count > 1)\nconst clusterState = view.getPointCluster() // { enabled, radius, minPoints, maxZoom, active }\nview.updateOptions({ pointCluster: false }) // 关掉聚合,原始点全部恢复\n","from":"header"}] },
|
|
125
125
|
{ name: "getPointCluster", kind: "method", params: "无", returns: "GisViewPointClusterReadout | null。归一化配置 { enabled, radius, minPoints, maxZoom, active },超过 maxZoom 后 active 为 false", doc: "当前点聚合配置的归一化读数 GisViewPointClusterReadout | null:{ enabled, radius, minPoints, maxZoom, active },active 说明当前缩放档是否仍在聚合(超过 maxZoom 后为 false);引擎未就绪时为 null", examples: [{"group":"坐标、拾取与读数","code":"// getClusters() / getPointCluster():读当前点聚合展示组与配置\nview.updateOptions({ pointCluster: { radius: 64, minPoints: 3, maxZoom: 2.5 } })\nconst clusterGroups = view.getClusters()\nconst clusteredOnly = clusterGroups.filter(group => group.count > 1)\nconst clusterState = view.getPointCluster() // { enabled, radius, minPoints, maxZoom, active }\nview.updateOptions({ pointCluster: false }) // 关掉聚合,原始点全部恢复\n","from":"header"}] },
|
|
126
|
+
{ name: "getPointSpacing", kind: "method", params: "无", returns: "GisViewPointSpacing:count / minDistance / maxDistance / nearest / farthest。距离都是当前相机比例下的 CSS 像素,与 fitSpacing 同一套口径;最近 / 最远各带两端 { id, index, item } 与同口径的 distance,筛选 / 隐藏后的节点不参与", doc: "当前可见节点的最近正距离与最远距离 GisViewPointSpacing:minDistance / maxDistance 与 nearest / farthest.distance 都是当前相机比例下的 CSS 像素,和 fitSpacing 同一套口径;nearest / farthest 各带两端节点 { id, index, item }。筛选 / 隐藏后的节点不参与;少于两个可见节点时为 null,全部重合时最近为 null、最远为 0", examples: [{"group":"坐标、拾取与读数","code":"// getPointSpacing():最近 / 最远可见节点的中心距(CSS 像素,和 fitSpacing 同口径)\nconst spacing = view.getPointSpacing()\nif (spacing.nearest) {\n console.log('最近', spacing.nearest.from.id, spacing.nearest.to.id, spacing.nearest.distance, 'px')\n console.log('世界距离', spacing.nearest.distance / view.getScale())\n}\nif (spacing.farthest) {\n console.log('最远', spacing.farthest.from.id, spacing.farthest.to.id, spacing.farthest.distance, 'px')\n}","from":"header"}] },
|
|
126
127
|
{ name: "listLines", kind: "method", params: "同 listPoints(inView / withScreen / limit…)", returns: "GisViewListedLine[]", doc: "按条件列线路快照 { index, item, path, bounds, color, width, channelId?, groupId?, channelIndex?, screen? }:选项与 listPoints 同一套;通道回线给的是骨架推导出来的那条折线(跟图上画的一致)", examples: [{"group":"坐标、拾取与读数","code":"// listPoints(options?) / listLines(options?):按条件列一批\nconst listedPoints = view.listPoints({ limit: 5, withScreen: true })\nconst listedLines = view.listLines({ inView: true, limit: 200 })\n","from":"header"}] },
|
|
127
128
|
{ name: "forEachPointInView", kind: "method", params: "rect: GisViewBounds 世界坐标矩形(一般直接给 getViewRect() 的返回值);visit: (index, item, x, y, radius) => void | false 逐个回调,返回 false 提前结束", returns: "void。只遍历矩形里的可见节点(数据顺序、不建中间数组):与 listPoints({ inView: true }) 同一份可见判定,但不生成清单 —— 放大看一小片时不会去碰整份数据", doc: "/** * 只遍历落在给定世界矩形({ minX, minY, maxX, maxY })里的可见节点,逐个回调 * (index, item, x, y, radius)。", examples: [{"group":"坐标、拾取与读数","code":"// forEachPointInView(rect, visit):只遍历视口里的节点,不建中间数组;回调返回 false 提前结束\nview.forEachPointInView(view.getViewRect(), (index, item, x, y, radius) => {\n readout.push(`${item.name}:半径 ${radius.toFixed(1)}px`)\n})\n","from":"header"}] },
|
|
128
129
|
{ name: "getVisibleData", kind: "method", params: "无", returns: "GisViewData", doc: "过滤之后的数据副本(points / lines)", examples: [{"group":"坐标、拾取与读数","code":"// getVisibleData() / isPointVisible(index):筛选之后的整份数据 / 某个节点在不在图上\nconst visibleData = view.getVisibleData()\nconst shown = view.isPointVisible(0)\n","from":"header"}] },
|
|
@@ -216,7 +217,7 @@ export const API_SECTIONS = [
|
|
|
216
217
|
{ 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"}] },
|
|
217
218
|
{ 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"}] },
|
|
218
219
|
{ 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
|
|
220
|
+
{ name: "getDirectConnections", kind: "method", params: "pointIds: string | number | Array<string | number> 一组节点 id(单条也收);options?: 'channel' | 'line' | 'both' | { kind?: 'channel' | 'line' | 'both' } 只查一列(省略或 both 两列都查)。只查集合内部的直接边,两端必须能查到节点,去重后少于两个返回两列空数组", returns: "GisViewDirectConnections:固定为 { channels, lines };通道项有 channelId / channelIndex / lineIds,线路项有 lineId / lineIndex;每项都带 type / from / to({ id, index, item })与 item", doc: "一组节点之间的直接通道 / 线路(只读):两端都必须真实存在且都在传入的 id 集合里,只认通道端点或线路 from / to,不穿中间节点;结果固定拆成 { channels, lines } 两列,各自按数据顺序。options 可直接写 'channel' / 'line' / 'both',也可写 { kind };省略或 'both' 两列都查。没有结果时返回 { channels: [], lines: [] }。每项带 type / from / to / item,通道项另有 channelId / channelIndex / lineIds,线路项另有 lineId / lineIndex", examples: [{"group":"拐点与通道","code":"// getDirectConnections(pointIds, options?):直接通道 / 线路固定拆成 channels / lines 两列\nconst direct = view.getDirectConnections(['a', 'b'])\nfor (const connection of direct.channels) {\n console.log('通道', connection.channelId, connection.lineIds, connection.from.id, connection.to.id)\n}\nfor (const connection of direct.lines) {\n console.log('线路', connection.lineId, connection.from.id, connection.to.id)\n}\nview.getDirectConnections(['a', 'b'], 'channel') // 只要通道\nview.getDirectConnections(['a', 'b'], { kind: 'line' }) // 只要线路\n","from":"header"}] },
|
|
220
221
|
{ 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
222
|
{ 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
223
|
{ 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"}] },
|
|
@@ -420,7 +421,7 @@ export const API_OPTIONS = [
|
|
|
420
421
|
{ name: "pointZoomScale", type: "number", defaultValue: "1 / 0", doc: "两组系数各管一件事,不重复:pointSizeScale / lineWidthScale 是与地图无关的整体放大(常数倍数,屏幕上的大小因此恒定),pointZoomScale / lineZoomScale 是「跟随地图缩放」的指数(0 表示不跟随,1 表示与地图同倍率放大,0.5 是地图放大 4 倍、要素放大 2 倍),绘制尺寸是两者相乘;zoomBaseScale 是联动基准,缺省取首次适应视图时的比例" },
|
|
421
422
|
{ name: "lineZoomScale", type: "number", defaultValue: "1 / 0", doc: "两组系数各管一件事,不重复:pointSizeScale / lineWidthScale 是与地图无关的整体放大(常数倍数,屏幕上的大小因此恒定),pointZoomScale / lineZoomScale 是「跟随地图缩放」的指数(0 表示不跟随,1 表示与地图同倍率放大,0.5 是地图放大 4 倍、要素放大 2 倍),绘制尺寸是两者相乘;zoomBaseScale 是联动基准,缺省取首次适应视图时的比例" },
|
|
422
423
|
{ name: "zoomBaseScale", type: "number", defaultValue: "1 / 0", doc: "两组系数各管一件事,不重复:pointSizeScale / lineWidthScale 是与地图无关的整体放大(常数倍数,屏幕上的大小因此恒定),pointZoomScale / lineZoomScale 是「跟随地图缩放」的指数(0 表示不跟随,1 表示与地图同倍率放大,0.5 是地图放大 4 倍、要素放大 2 倍),绘制尺寸是两者相乘;zoomBaseScale 是联动基准,缺省取首次适应视图时的比例" },
|
|
423
|
-
{ name: "fitSpacing", type: "boolean | GisViewFitSpacingOptions", defaultValue: "关", doc: "适应视图的节点间距兜底:true
|
|
424
|
+
{ name: "fitSpacing", type: "boolean | GisViewFitSpacingOptions", defaultValue: "关", doc: "适应视图的节点间距兜底:true 用最小中心距模式(默认 24 CSS 像素);对象在 minDistance / maxDistance 中二选一,同时给出时只启用 maxDistance,maxZoom 是相对普通适应比例的上限(0 表示不限);只在首次默认适应与 fitView() 生效,远处孤立点允许落到视口外,见「适应视图的节点间距(fitSpacing)」" },
|
|
424
425
|
{ name: "boxSelect", type: "boolean", defaultValue: "false", doc: "是否允许按住框选快捷键(shortcuts.boxSelect,默认 Shift)拖动鼠标框选要素;缺省关,写 boxSelect: true 或 features: { boxSelect: true } 才开。框选默认只收节点,selectionKinds 可把线路 / 通道也纳入" },
|
|
425
426
|
{ name: "multiSelect", type: "boolean", defaultValue: "false", doc: "多选开关:打开后不用按修饰键,直接单击节点 / 线路就取反累加选中(与按住 shortcuts.multiSelect 点击同一套行为、同一个 multiSelectStyle;取反那一下不经过 onClick,onSelectChange.action.type 是 toggleSelect);缺省关,关着时多选走框选(boxSelect)与按住多选快捷键(默认 Ctrl / ⌘)。运行时 updateOptions({ multiSelect }) 切换只重画一帧、不重排场景" },
|
|
426
427
|
{ name: "selectTrigger", type: "'click' | 'dblClick'", defaultValue: "'click'", doc: "选中触发方式:click 第一次单击就改选中集;dblClick 第一下只派发 onClick,等双击判定命中的第二下才改选中集,并同时派发 onClick 与 onDblClick。Ctrl / ⌘ 多选与 multiSelect 在双击模式下同样等第二下才取反。运行时走 updateOptions({ selectTrigger }),只重画一帧、不重排场景" },
|
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
perItemFollow, perItemOff, applyPrebake, applyPrebakeExact, runPrebakeNow, clearPrebake, building, activePanel,
|
|
7
7
|
pointSize, lineWidth, lineTypeMode, dcLineMark, dcLineAnchor, dcLineParallel, lineDirectionMark,
|
|
8
8
|
lineDirectionCount, lineDirectionReverse, dcLineButtonText, cursorMode, pointSizeScale, lineWidthScale,
|
|
9
|
-
pointZoomScale, lineZoomScale, fitSpacing, fitSpacingMinDistance, fitSpacingMaxZoom, zoomBaseReadout,
|
|
9
|
+
pointZoomScale, lineZoomScale, fitSpacing, fitSpacingMode, fitSpacingMinDistance, fitSpacingMaxDistance, fitSpacingMaxZoom, pointSpacingReadout, zoomBaseReadout,
|
|
10
10
|
pointShape, symbolByStationType, symbolIconMode, symbolStrokeWidth, pointLayering, lineLayering, perPointStyle,
|
|
11
11
|
perPointSymbol, applyRules, showLabels, labelPosition, labelMaxCount, labelVoltageScope, LABEL_VOLTAGE_SCOPES,
|
|
12
12
|
labelAvoidOverlap, labelScanMode, labelOptimize, labelTemplate, labelHtml, labelBackground, labelColor,
|
|
@@ -255,17 +255,29 @@ const {
|
|
|
255
255
|
<span>{{ fitSpacing ? '开' : '关' }}</span>
|
|
256
256
|
</label>
|
|
257
257
|
<label class="demo-slider">
|
|
258
|
+
距离模式
|
|
259
|
+
<select v-model="fitSpacingMode" :disabled="!fitSpacing">
|
|
260
|
+
<option value="min">最小中心距</option>
|
|
261
|
+
<option value="max">最大中心距</option>
|
|
262
|
+
</select>
|
|
263
|
+
</label>
|
|
264
|
+
<label v-if="fitSpacingMode === 'min'" class="demo-slider">
|
|
258
265
|
最小中心距
|
|
259
266
|
<input v-model.number="fitSpacingMinDistance" type="number" min="1" step="1" :disabled="!fitSpacing" />
|
|
260
267
|
<span>px</span>
|
|
261
268
|
</label>
|
|
269
|
+
<label v-else class="demo-slider">
|
|
270
|
+
最大中心距
|
|
271
|
+
<input v-model.number="fitSpacingMaxDistance" type="number" min="1" step="1" :disabled="!fitSpacing" />
|
|
272
|
+
<span>{{ fitSpacingMaxDistance }}px</span>
|
|
273
|
+
</label>
|
|
262
274
|
<label class="demo-slider">
|
|
263
275
|
最大放大
|
|
264
276
|
<input v-model.number="fitSpacingMaxZoom" type="number" min="0" step="1" :disabled="!fitSpacing" />
|
|
265
277
|
<span>{{ fitSpacingMaxZoom > 0 ? `×${fitSpacingMaxZoom}` : '不限' }}</span>
|
|
266
278
|
</label>
|
|
267
279
|
<button type="button" @click="applyZoomBase()">以当前比例为基准</button>
|
|
268
|
-
<span class="demo-control-hint"
|
|
280
|
+
<span class="demo-control-hint">放大与跟随缩放是两个系数:滚轮缩放时再乘一次联动系数(基准为首次适应视图的比例);「适应节点间距」的最小 / 最大中心距二选一,首次适应与 fitView 会按所选屏幕距离调整比例,远处孤立点允许落到视口外{{ pointSpacingReadout ? ` · ${pointSpacingReadout}` : '' }}{{ zoomBaseReadout ? ` · ${zoomBaseReadout}` : '' }}</span>
|
|
269
281
|
</div>
|
|
270
282
|
|
|
271
283
|
</div>
|
|
@@ -1985,11 +1985,24 @@ export const useGisViewDemo = () => {
|
|
|
1985
1985
|
const lineWidthScale = ref(1)
|
|
1986
1986
|
const pointZoomScale = ref(0)
|
|
1987
1987
|
const lineZoomScale = ref(0)
|
|
1988
|
-
//
|
|
1988
|
+
// 适应视图的节点间距兜底:最小 / 最大中心距二选一;打开后首次适应 / fitView 按当前模式调整比例
|
|
1989
1989
|
const fitSpacing = ref(false)
|
|
1990
|
+
const fitSpacingMode = ref('min')
|
|
1990
1991
|
const fitSpacingMinDistance = ref(24)
|
|
1992
|
+
const fitSpacingMaxDistance = ref(480)
|
|
1991
1993
|
const fitSpacingMaxZoom = ref(0)
|
|
1994
|
+
const pointSpacingReadout = ref('')
|
|
1992
1995
|
const zoomBaseReadout = ref('')
|
|
1996
|
+
/** fitSpacing 只发送当前选中的距离模式,避免 minDistance 与 maxDistance 同时出现 */
|
|
1997
|
+
const buildFitSpacingOptions = () => {
|
|
1998
|
+
if (!fitSpacing.value) {
|
|
1999
|
+
return false
|
|
2000
|
+
}
|
|
2001
|
+
const maxZoom = fitSpacingMaxZoom.value
|
|
2002
|
+
return fitSpacingMode.value === 'max'
|
|
2003
|
+
? { maxDistance: fitSpacingMaxDistance.value, maxZoom }
|
|
2004
|
+
: { minDistance: fitSpacingMinDistance.value, maxZoom }
|
|
2005
|
+
}
|
|
1993
2006
|
/** 节点形状:auto 用数据 / 规则自带的符号,其余把全部节点改成内置的圆或正方形 */
|
|
1994
2007
|
const pointShape = ref('auto')
|
|
1995
2008
|
/**
|
|
@@ -4181,7 +4194,7 @@ export const useGisViewDemo = () => {
|
|
|
4181
4194
|
lineWidthScale: lineWidthScale.value,
|
|
4182
4195
|
pointZoomScale: pointZoomScale.value,
|
|
4183
4196
|
lineZoomScale: lineZoomScale.value,
|
|
4184
|
-
fitSpacing:
|
|
4197
|
+
fitSpacing: buildFitSpacingOptions(),
|
|
4185
4198
|
gridColor: 'rgba(126, 168, 214, 0.22)',
|
|
4186
4199
|
showGrid: showGrid.value,
|
|
4187
4200
|
// 背景:不配图片,按数据范围现生成一份很淡的 GeoJSON 底图(街区 + 环线,可选经纬网)
|
|
@@ -4452,17 +4465,28 @@ export const useGisViewDemo = () => {
|
|
|
4452
4465
|
refreshZoomBaseText()
|
|
4453
4466
|
scheduleChannelLabel()
|
|
4454
4467
|
}
|
|
4468
|
+
const refreshPointSpacingText = () => {
|
|
4469
|
+
const view = viewRef.value
|
|
4470
|
+
const spacing = view?.getPointSpacing?.()
|
|
4471
|
+
if (!view || !spacing?.count) {
|
|
4472
|
+
pointSpacingReadout.value = ''
|
|
4473
|
+
return
|
|
4474
|
+
}
|
|
4475
|
+
const screen = value => value === null ? '—' : `${value.toFixed(1)}px`
|
|
4476
|
+
pointSpacingReadout.value = `可见 ${spacing.count} 个 · 最近 ${screen(spacing.minDistance)} · 最远 ${screen(spacing.maxDistance)}`
|
|
4477
|
+
}
|
|
4455
4478
|
// 节点间距兜底:改参数不移动相机,这里补一次 fitView 让面板上立刻看到效果;关掉时也恢复普通适应
|
|
4456
|
-
watch([fitSpacing, fitSpacingMinDistance, fitSpacingMaxZoom], ([enabled], [wasEnabled]) => {
|
|
4479
|
+
watch([fitSpacing, fitSpacingMode, fitSpacingMinDistance, fitSpacingMaxDistance, fitSpacingMaxZoom], ([enabled], [wasEnabled]) => {
|
|
4457
4480
|
const view = viewRef.value
|
|
4458
4481
|
if (!view) {
|
|
4459
4482
|
return
|
|
4460
4483
|
}
|
|
4461
4484
|
view.updateOptions({
|
|
4462
|
-
fitSpacing:
|
|
4485
|
+
fitSpacing: buildFitSpacingOptions()
|
|
4463
4486
|
})
|
|
4464
4487
|
if (enabled || wasEnabled) {
|
|
4465
4488
|
view.fitView()
|
|
4489
|
+
refreshPointSpacingText()
|
|
4466
4490
|
}
|
|
4467
4491
|
})
|
|
4468
4492
|
watch([channelMode, channelOffset, channelWidth, channelInset, channelNodeWidth, channelTangentInset], () => applyChannelOptions())
|
|
@@ -6122,7 +6146,7 @@ const members = (payload.lineData ?? payload.linePropsByMember ?? []).filter(Boo
|
|
|
6122
6146
|
cascadeTriggerOnBoxSelect, cascadeReadout, buildCascadeHighlightOptions,
|
|
6123
6147
|
handleCascadeHighlight, readCascadeHighlight,
|
|
6124
6148
|
searchKeyword, searchScope, searchFocus, searchReadout, pointSizeScale, lineWidthScale, pointZoomScale,
|
|
6125
|
-
lineZoomScale, fitSpacing, fitSpacingMinDistance, fitSpacingMaxZoom, zoomBaseReadout, pointShape,
|
|
6149
|
+
lineZoomScale, fitSpacing, fitSpacingMode, fitSpacingMinDistance, fitSpacingMaxDistance, fitSpacingMaxZoom, pointSpacingReadout, zoomBaseReadout, pointShape,
|
|
6126
6150
|
symbolByStationType, symbolIconMode, symbolStrokeWidth, pointLayering, lineLayering, perPointStyle,
|
|
6127
6151
|
perPointSymbol, PER_POINT_SYMBOL, applyRules, topVoltageOf, voltageWhen, showLabels, labelPosition,
|
|
6128
6152
|
labelMaxCount, labelVoltageScope, LABEL_VOLTAGE_SCOPES, topPointVoltage, labelWhen, labelAvoidOverlap,
|
package/docs/index.html
CHANGED
|
@@ -1421,7 +1421,7 @@
|
|
|
1421
1421
|
{ file: 'manual/14-视图与筛选.md', title: '手册 14 · 视图与筛选', blurb: '筛选 / 搜索 / 视图与背景', parent: 'GisView.md' },
|
|
1422
1422
|
{ file: 'manual/15-导出与集成.md', title: '手册 15 · 导出与集成', blurb: '导出 / 插件 / 自建界面', parent: 'GisView.md' },
|
|
1423
1423
|
{ file: 'manual/16-实例方法总表.md', title: '手册 16 · 实例方法总表', blurb: '实例方法主表', parent: 'GisView.md' },
|
|
1424
|
-
|
|
1424
|
+
{ file: 'manual/17-参数速查.md', title: '手册 17 · 参数速查', blurb: '274 个成员逐个列全', parent: 'GisView.md' },
|
|
1425
1425
|
{ file: 'manual/18-逐方法示例.md', title: '手册 18 · 逐方法示例', blurb: '每个成员一段示例', parent: 'GisView.md' },
|
|
1426
1426
|
{ file: 'manual/19-读数与拖拽预览.md', title: '手册 19 · 读数与拖拽预览', blurb: '读数 / 定位 / 落点预览', parent: 'GisView.md' },
|
|
1427
1427
|
{ file: 'manual/20-性能与大数据.md', title: '手册 20 · 性能与大数据', blurb: '大数据开关与实测', parent: 'GisView.md' },
|
|
@@ -1492,7 +1492,7 @@
|
|
|
1492
1492
|
{ file: '../src/gis-view/README.md', title: 'src/gis-view/README.md', blurb: '源码导读与逐轮实现记录' }
|
|
1493
1493
|
]
|
|
1494
1494
|
const PAGES = [
|
|
1495
|
-
|
|
1495
|
+
{ href: 'api/index.html', title: 'API 速查(方法 + 示例)', blurb: '274 个实例成员 / 100 个 options,逐个带示例与复制' },
|
|
1496
1496
|
{ href: 'playground/index.html', title: '调试演示页(粘代码就跑)', blurb: '左侧编辑、右侧真实实例 + GeoJSON 底图:内置示例与「这一份文档」的示例同在一个下拉,粘代码直接跑' },
|
|
1497
1497
|
{ href: 'guide/sample-document.html', title: 'sample-document.json 图解', blurb: '点数据看端点 / 拐点 / 分组骨架' },
|
|
1498
1498
|
{ href: 'steps/index.html', title: '从 0 手写分步 demo', blurb: '13 步,每步一个文件' },
|
|
@@ -2074,7 +2074,7 @@
|
|
|
2074
2074
|
{ badge: 'START', title: '第一次使用', desc: '引入、最小数据与首屏配置,先把图画出来。', meta: '01 快速开始 · 约 10 分钟', file: 'manual/01-快速开始.md' },
|
|
2075
2075
|
{ badge: 'BACKEND', title: '接后端与导出', desc: '编辑接口、导出回灌、插件与自建界面。', meta: '15 导出与集成', file: 'manual/15-导出与集成.md' },
|
|
2076
2076
|
{ badge: 'PERF', title: '十万级性能', desc: 'Worker 筛选 / 异步搜索、批量更新与质量档。', meta: '20 性能与大数据', file: 'manual/20-性能与大数据.md' },
|
|
2077
|
-
|
|
2077
|
+
{ badge: 'API', title: '查方法与参数', desc: '实例方法、options 与可复制示例集中检索。', meta: 'API 速查 · 274 个成员', href: 'api/index.html', external: true }
|
|
2078
2078
|
]
|
|
2079
2079
|
const renderReadingPaths = () => `<section class='doc-paths' aria-label='推荐阅读路径'>` +
|
|
2080
2080
|
`<div class='doc-paths__head'><strong>按任务选一条阅读路径</strong><span>第一次进来先看快速开始;带着明确目标时直接跳到对应章节。</span></div>` +
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
| `lineMultiSelectStyle` | `GisViewLineStyle` | 无 | 多选命中时的线样式,缺省与 `lineSelectStyle` 一致,单条线可用 `multiSelectStyle` 覆盖;框选出来的线路仍走 `lineSelectStyle`(线路没有单独的框选样式) |
|
|
56
56
|
| `defaultHighlight` | `boolean` | `false` | 没有配置状态样式时是否仍用尺寸 / 宽度增幅与强调环画出内置强调;默认 `false`(不配样式就不改变外观),设为 `true` 可退回旧行为 |
|
|
57
57
|
| `pointSizeScale` / `lineWidthScale`、`pointZoomScale` / `lineZoomScale`、`zoomBaseScale` | `number` | `1` / `0` | 两组系数各管一件事,不重复:`pointSizeScale` / `lineWidthScale` 是与地图无关的整体放大(常数倍数,屏幕上的大小因此恒定),`pointZoomScale` / `lineZoomScale` 是「跟随地图缩放」的指数(0 表示不跟随,1 表示与地图同倍率放大,0.5 是地图放大 4 倍、要素放大 2 倍),绘制尺寸是两者相乘;`zoomBaseScale` 是联动基准,缺省取首次适应视图时的比例 |
|
|
58
|
-
| `fitSpacing` | `boolean \| GisViewFitSpacingOptions` | 关 | 适应视图的节点间距兜底:`true`
|
|
58
|
+
| `fitSpacing` | `boolean \| GisViewFitSpacingOptions` | 关 | 适应视图的节点间距兜底:`true` 用最小中心距模式(默认 `24` CSS 像素);对象在 `minDistance` / `maxDistance` 中二选一,同时给出时只启用 `maxDistance`,`maxZoom` 是相对普通适应比例的上限(`0` 表示不限);只在首次默认适应与 `fitView()` 生效,远处孤立点允许落到视口外,见「适应视图的节点间距(fitSpacing)」 |
|
|
59
59
|
| `boxSelect` | `boolean` | `false` | 是否允许按住框选快捷键(`shortcuts.boxSelect`,默认 Shift)拖动鼠标框选要素;**缺省关**,写 `boxSelect: true` 或 `features: { boxSelect: true }` 才开。框选默认只收节点,`selectionKinds` 可把线路 / 通道也纳入 |
|
|
60
60
|
| `multiSelect` | `boolean` | `false` | 多选开关:打开后不用按修饰键,直接单击节点 / 线路就取反累加选中(与按住 `shortcuts.multiSelect` 点击同一套行为、同一个 `multiSelectStyle`;取反那一下不经过 `onClick`,`onSelectChange.action.type` 是 `toggleSelect`);**缺省关**,关着时多选走框选(`boxSelect`)与按住多选快捷键(默认 Ctrl / ⌘)。运行时 `updateOptions({ multiSelect })` 切换只重画一帧、不重排场景 |
|
|
61
61
|
| `selectTrigger` | `'click' \| 'dblClick'` | `'click'` | 选中触发方式:`click` 第一次单击就改选中集;`dblClick` 第一下只派发 `onClick`,等双击判定命中的第二下才改选中集,并同时派发 `onClick` 与 `onDblClick`。Ctrl / ⌘ 多选与 `multiSelect` 在双击模式下同样等第二下才取反。运行时走 `updateOptions({ selectTrigger })`,只重画一帧、不重排场景 |
|
|
@@ -490,7 +490,7 @@ view.clearGraphics()
|
|
|
490
490
|
|
|
491
491
|
- **类型**:`boolean | GisViewFitSpacingOptions`
|
|
492
492
|
- **默认值**:关
|
|
493
|
-
-
|
|
493
|
+
- **说明**:适应视图的节点间距兜底。普通适应按数据包围盒铺满,远处多一个孤立点就会把比例压小、主体节点挤成一团;打开后先按普通规则算出适应比例,再用**可见节点最近的正中心距**反推更高的比例(最近距离达到 `minDistance` 为止)。`maxDistance` 是另一种距离模式:最远一对节点的屏幕距离超过上限就把比例压低,适合只回显少量场站等稀疏数据。`minDistance` / `maxDistance` **二选一**,同时给出时只按 `maxDistance` 计算,`minDistance` 不参与,不会在一次适应里同时放大和压低。**只改比例,不改中心**:相机中心仍取普通适应的包围盒中心,最近节点对并列时不挑中点、不跳视点。`maxZoom` 是相对普通适应比例的上限,`0` 表示不限;最后仍受 `minScale` / `maxScale` 约束。重合坐标不算有效间距,少于两个不同位置时不调整。显式写了 `initialView.scale` / `zoom` 时以显式值为准;运行时 `updateOptions` 不会当场移动相机,需要再调 `fitView()`
|
|
494
494
|
- **参考**:见「适应视图的节点间距(fitSpacing)」一节
|
|
495
495
|
|
|
496
496
|
#### `cursorStyle`
|
package/docs/manual/09-/351/200/232/351/201/223/344/270/216/345/244/232/345/233/236/347/272/277.md
CHANGED
|
@@ -120,28 +120,31 @@ view.updateOptions({ channelSimplify: false }) // 关闭:全部回线原样
|
|
|
120
120
|
|
|
121
121
|
### 查询节点之间的直接连接(getDirectConnections)
|
|
122
122
|
|
|
123
|
-
传一组节点 id
|
|
123
|
+
传一组节点 id,只找出**这组节点内部**已经直接连上的通道与线路;不会从一个节点沿线路走到第三个节点,也不会把只连着集合外节点的边带回来。结果固定拆成 `channels` / `lines` 两列,第二段写 `'channel'` 或 `'line'` 可以只查一类:
|
|
124
124
|
|
|
125
125
|
```js
|
|
126
|
-
const
|
|
126
|
+
const { channels, lines } = view.getDirectConnections(['a', 'b', 'c'])
|
|
127
127
|
|
|
128
|
-
for (const connection of
|
|
129
|
-
|
|
130
|
-
console.log('通道', connection.channelId, connection.from.id, connection.to.id, connection.lineIds)
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
console.log('线路', connection.lineId, connection.from.id, connection.to.id)
|
|
134
|
-
}
|
|
128
|
+
for (const connection of channels) {
|
|
129
|
+
console.log('通道', connection.channelId, connection.from.id, connection.to.id, connection.lineIds)
|
|
135
130
|
}
|
|
131
|
+
for (const connection of lines) {
|
|
132
|
+
console.log('线路', connection.lineId, connection.from.id, connection.to.id)
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
view.getDirectConnections(['a', 'b'], 'channel') // 只有 channels
|
|
136
|
+
view.getDirectConnections(['a', 'b'], { kind: 'line' }) // 只有 lines
|
|
137
|
+
view.getDirectConnections(['a', 'b'], 'both') // 两列都查(缺省也是这个)
|
|
136
138
|
|
|
137
|
-
view.getDirectConnections(['a', 'not-exist']) // []:只有一个真实节点,凑不成一条边
|
|
138
|
-
view.getDirectConnections([]) // []
|
|
139
|
+
view.getDirectConnections(['a', 'not-exist']) // { channels: [], lines: [] }:只有一个真实节点,凑不成一条边
|
|
140
|
+
view.getDirectConnections([]) // { channels: [], lines: [] }
|
|
139
141
|
```
|
|
140
142
|
|
|
141
143
|
- **两端必须存在且都在集合里**:节点 id 要能查到数据里的 `points`;只给一个有效节点、空数组、重复 id 都不会凭空产生连接。
|
|
142
144
|
- **只认直接绑定**:线路看自己的 `from` / `to`;通道看声明的两端,没声明 `from` / `to` 时按第一条成员回线继承。没有端点绑定的纯 `path` 线路、自环和认不出端点的通道都跳过。
|
|
143
|
-
-
|
|
144
|
-
-
|
|
145
|
+
- **通道与回线分列返回**:通道本身是一条连接,进入 `channels`;通道里的成员回线也是有 `from` / `to` 的直接线路,进入 `lines`,所以同一条走廊可能两列都有。两列各自按数据顺序排列。
|
|
146
|
+
- **筛选参数**:第二段可以直接写 `'channel'` / `'line'` / `'both'`,也可以写 `{ kind: 'line' }`;省略、`'both'` 或认不出的值都按两列都查处理。只查一列时,另一列固定是空数组。
|
|
147
|
+
- **只读**:不改选中、筛选、显隐或数据;被 `visible: false` / 筛选隐藏的要素只要数据里的端点成立,仍会被这个拓扑查询找到。找不到任何一条时返回 `{ channels: [], lines: [] }`。
|
|
145
148
|
- 每条连接都带 `from` / `to`(`{ id, index, item }`)与 `item`;通道项另有 `channelId` / `channelIndex` / `lineIds`,线路项另有 `lineId` / `lineIndex`。单条 id 和 id 数组都收。
|
|
146
149
|
|
|
147
150
|
### 由数组批量生成:createChannels
|
|
@@ -343,14 +343,16 @@ view.updateOptions({ idleTimeout: 0 }) // 关闭空闲回调
|
|
|
343
343
|
|
|
344
344
|
「两个本来一样的视图,只因为多了一个远处节点,节点就突然很大、很挤」——根因是自动适应读的是**数据包围盒**:远处节点把范围撑大,`fitView()` 只能把 `camera.scale` 压小,节点之间的距离随之变短;节点自己的屏幕尺寸不跟着缩,看起来就像放大了一样。
|
|
345
345
|
|
|
346
|
-
`fitSpacing`
|
|
346
|
+
`fitSpacing` 不改包围盒,而是在普通适应算完之后再做一次**节点间距兜底**。它一次只用一种距离模式:最小中心距模式在最近两个可见节点的屏幕距离小于 `minDistance` 时提高比例;最大中心距模式在最远一对的屏幕距离大于 `maxDistance` 时压低比例。两种距离都用**屏幕 CSS 像素**,`minDistance` / `maxDistance` **二选一**,不会同时生效。它**不改相机中心**:中心始终沿用普通适应按数据包围盒算出的那一个,不会因为节点对换了一对就跳到图上另一个位置。规则网格里最近距离大量并列也不会影响结果。
|
|
347
347
|
|
|
348
348
|
```js
|
|
349
349
|
// 最省事:最小中心距 24 CSS 像素,放大倍数不设相对上限(仍受 maxScale 约束)
|
|
350
350
|
const view = createGisView('#map', { points, lines, channels, fitSpacing: true })
|
|
351
351
|
|
|
352
|
-
//
|
|
352
|
+
// 最小中心距模式:最近节点至少隔 32px,最多放大到普通适应比例的 8 倍
|
|
353
353
|
view.updateOptions({ fitSpacing: { minDistance: 32, maxZoom: 8 } })
|
|
354
|
+
// 或最大中心距模式:最远节点对最多铺开 520px(不要和 minDistance 同时写)
|
|
355
|
+
view.updateOptions({ fitSpacing: { maxDistance: 520 } })
|
|
354
356
|
view.fitView() // 改配置不会当场动相机,再适应一次才看得到
|
|
355
357
|
|
|
356
358
|
view.updateOptions({ fitSpacing: false }) // 关掉,下一次 fitView 恢复普通包围盒适应
|
|
@@ -360,12 +362,24 @@ view.updateOptions({ fitSpacing: false }) // 关掉,下一次 fitView 恢复
|
|
|
360
362
|
|
|
361
363
|
- **默认关**,打开后只影响「默认 fit 模式下的首次适应」与手动 `fitView()`;`zoomToBounds()` / `focusOn(..., { zoom: true })` 仍按指定范围算,不会强行套节点间距。
|
|
362
364
|
- 只统计**筛选 / 隐藏之后仍然可见**的节点。完全重合的坐标不算有效间距(否则两个重叠点会让整套兜底失效);少于两个不同位置时不调整。
|
|
363
|
-
-
|
|
364
|
-
- `minDistance`
|
|
365
|
+
- **只调比例、不跳视点**:`fitSpacing` 不重算中心,也不挑一对节点居中。需要改变中心时用 `initialView.center` / `initialView.bounds`、`focusOn()` 或 `setCamera({ center })`。
|
|
366
|
+
- `minDistance` 是**最小中心距模式**:节点中心之间的最小屏幕距离(CSS 像素),默认 `24`。想给节点本身和描边留更多空隙就调大。
|
|
367
|
+
- `maxDistance` 是**最大中心距模式**:节点中心之间的最大屏幕距离(CSS 像素),适合稀疏数据或只回显少量场站。普通适应会把最远两点顶到画布边缘、整体显得过大;配一个例如 `480` 的上限就会按最远节点对把比例压回来。
|
|
368
|
+
- 两种模式互斥:同时写 `minDistance` 与 `maxDistance` 时只按 `maxDistance` 计算,`minDistance` 不参与,不要靠两者同时生效;最后仍由 `maxZoom` / `minScale` / `maxScale` 兜底。
|
|
365
369
|
- `maxZoom` 是相对普通适应当前比例的倍数上限,默认 `0` 表示不限;设成正数可避免极端数据把画面放大到只剩局部。`minScale` / `maxScale` 始终是最后一层夹取。
|
|
366
370
|
- 远处孤立点仍参与普通适应的包围盒与中心计算;放大后它可以落到视口外,这是「先保证节点间距」的取舍。如果孤立点连中心都不该影响,关掉 `fitSpacing` 或改用 `initialView.bounds` / 预筛数据钉住业务范围。
|
|
367
371
|
- 显式配了 `initialView.scale` / `initialView.zoom` 时以使用方给的为准;只有没有写死比例 / 倍数的 fit 模式才走间距兜底。
|
|
368
|
-
-
|
|
372
|
+
- 要读当前可见节点的实际距离用 `getPointSpacing()`:`minDistance` / `maxDistance` 以及 `nearest` / `farthest.distance` 都按当前相机比例返回 **CSS 像素**,与 `fitSpacing` 同一套口径,可直接拿来配置中心距;除以 `getScale()` 才是世界单位。`nearest` / `farthest` 还带两端节点的 id / 下标 / 数据对象。它和 `fitSpacing` 使用同一份「筛选 / 隐藏后仍可见」的节点集合。
|
|
373
|
+
- demo 的「样式」面板有「适应节点间距」开关、距离模式选择(最小 / 最大二选一)、对应中心距与最大放大输入,并显示 `getPointSpacing()` 的屏幕距离读数;自测页 `docs/steps/selftest-scale.html` 有 11 条断言盯着这一套(配置回显 / 提高比例且忽略重合点 / 最近最远屏幕读数 / 保持普通适应中心 / 屏幕间距 / `maxZoom` / 关闭恢复 / `maxDistance` 压低稀疏数据且互斥 / `fitView` 复用 `maxDistance` / 规则网格并列时仍保持原中心)。
|
|
374
|
+
|
|
375
|
+
### 导出数据回显后比例不一样?(方案)
|
|
376
|
+
|
|
377
|
+
「只把一部分场站导给后端,重新显示时画布放得很大」不是数据变了,而是**新的视图没有导出时的相机**:只要创建一个新实例,首次拿到数据就会按这组场站的包围盒 `fitView()`,范围越小比例越大。按能否接受自动适应选一种:
|
|
378
|
+
|
|
379
|
+
1. **要一比一还原(推荐)**:把相机和业务数据一起保存,回显时用绝对比例落位。标准文档 `exportData({ format: 'full' })` 已经带 `view.camera`,整份喂回 `createGisView(container, document)` 或 `view.importData(document)` 就在同一屏;只传场站时单独带上 `view.getCamera()` 的 `{ center, scale }`,再用 `initialView: { mode: 'scale', center, scale }` 创建。
|
|
380
|
+
2. **同一个实例换数据**:`updateData(points, lines)` / `importData({ points, lines })` 不会重新执行首次适应,相机原地不动;只有创建实例后的第一次有数据落位、手动 `fitView()` / `applyInitialView()` 才会移动视角。
|
|
381
|
+
3. **不要自动适应**:创建时写 `fitOnInit: false`,先 `setCamera()` 再灌数据;或给 `initialView` 写死业务范围 / 比例。
|
|
382
|
+
4. **仍要自动适应,但别铺得太满**:配 `fitSpacing: { maxDistance: 480 }`。它按最远可见节点对的屏幕距离压住比例,少量场站不会因为包围盒变小而被过度放大;最大 / 最小中心距二选一,要最小间距就改用 `fitSpacing: { minDistance: 24 }`。
|
|
369
383
|
|
|
370
384
|
## 背景层
|
|
371
385
|
|
package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md
CHANGED
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
| `listPoints(options?)` | 按条件列节点快照 `{ index, item, x, y, radius, layerRank, screen? }`:选项见 `GisViewListOptions`(`indexes` / `inView` / `limit` / `withScreen` / `visibleOnly`),可见判定与 `isPointVisible` 是同一份 |
|
|
57
57
|
| `getClusters()` | 当前点聚合的展示组 `GisViewCluster[]`:按数据顺序返回,含 `count: 1` 的单成员与 `count > 1` 的聚合圆;每项带 `id` / `pointIndexes` / `pointIds` / 世界坐标 `coordinate` / 当前屏幕坐标 `screen` / 半径 `radius` / 包围盒 `bounds`。原始 `points` 与 `getData()` 不变,聚合关掉时返回空表 |
|
|
58
58
|
| `getPointCluster()` | 当前点聚合配置的归一化读数 `GisViewPointClusterReadout \| null`:`{ enabled, radius, minPoints, maxZoom, active }`,`active` 说明当前缩放档是否仍在聚合(超过 `maxZoom` 后为 `false`);引擎未就绪时为 `null` |
|
|
59
|
+
| `getPointSpacing()` | 当前可见节点的最近正距离与最远距离 `GisViewPointSpacing`:`minDistance` / `maxDistance` 与 `nearest` / `farthest.distance` 都是当前相机比例下的 CSS 像素,和 `fitSpacing` 同一套口径;`nearest` / `farthest` 各带两端节点 `{ id, index, item }`。筛选 / 隐藏后的节点不参与;少于两个可见节点时为 `null`,全部重合时最近为 `null`、最远为 `0` |
|
|
59
60
|
| `listLines(options?)` | 按条件列线路快照 `{ index, item, path, bounds, color, width, channelId?, groupId?, channelIndex?, screen? }`:选项与 `listPoints` 同一套;通道回线给的是骨架推导出来的那条折线(跟图上画的一致) |
|
|
60
61
|
| `getLineChannel(ref)` | 这条线路属于哪条通道:`getLineChannel('line-a')`(id)/ `getLineChannel(12)`(`lines` 下标)给 `{ lineIndex, channelId, channelIndex, channel, groupId, group }`,不在通道里返回 `null`。点了一条回线想知道它归哪条通道 / 哪一组时用它,不必自己扫通道定义 |
|
|
61
62
|
| `getElementBounds(keys)` | 一批要素 `GisViewFeatureKey[]`(`{ type: 'point' \| 'line', index }`,`getSelections()` 的结果可以直接传)的世界包围盒 `{ minX, minY, maxX, maxY }`;一个都没对上返回 `null`(数据已经换过) |
|
|
@@ -142,7 +143,7 @@
|
|
|
142
143
|
| `commitAddChannel(input?, options?)` | 把已 `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 通道编辑与新增」。 |
|
|
143
144
|
| `getChannelAddOptions(from, to, count?, kind?)` | 两个节点之间的新增方案:新通道 / 新分组 / 并进某一组 / 无法添加;`count` 是这一次要加的回数(余量按它判),`kind: 'line'` 时方案表为空(独立线路不挑方案) |
|
|
144
145
|
| `getChannelBetween(from, to)` | 两个节点之间的通道读数(只读):有通道时 `hasChannel: true`,`channelId` / `channelIndex` / `groupCount` / `currentGroupId` 与 `groups` / `group` / `channel`(id / name / lineIds / 分组明细)都给全;没有通道时 `hasChannel: false`、`channel: null`、`groups: []`,端点认不出来返回 `null` |
|
|
145
|
-
| `getDirectConnections(pointIds)` | 一组节点之间的**直接**通道 / 线路(只读):两端都必须真实存在且都在传入的 id 集合里,只认通道端点或线路 `from` / `to
|
|
146
|
+
| `getDirectConnections(pointIds, options?)` | 一组节点之间的**直接**通道 / 线路(只读):两端都必须真实存在且都在传入的 id 集合里,只认通道端点或线路 `from` / `to`,不穿中间节点;结果固定拆成 `{ channels, lines }` 两列,各自按数据顺序。`options` 可直接写 `'channel'` / `'line'` / `'both'`,也可写 `{ kind }`;省略或 `'both'` 两列都查。没有结果时返回 `{ channels: [], lines: [] }`。每项带 `type` / `from` / `to` / `item`,通道项另有 `channelId` / `channelIndex` / `lineIds`,线路项另有 `lineId` / `lineIndex` |
|
|
146
147
|
| `addChannel(spec, lineData?, group?, options?)` | 程序化**只新建**通道:第一段 `{ from, to, name?, id?, channelProps?, path?, routing?, lineData?, group? }`,第二段线路数据按每项 id 建 `lineIds`,第三段可选分组信息(`{ id?, lineIds?, path? }`)。两端已有通道时整条失败(`reason` 指路 `addChannelGroupLines` / `joinChannelGroupLines`)。`options?: { emit?, select? }`,缺省不选中新回线。 |
|
|
147
148
|
| `addChannelGroupLines(channelId, lineData?, groupInfo?, options?)` | 给已有通道**新加一组**回线:第二段按每项 id 建回线,`groupInfo`(`{ id?, groupId?, path?, ... }`)给新分组的 id 与中间拐点,缺省 `${通道 id}::N`、不带拐点;`options?: { emit?, select? }`,缺省不选中 |
|
|
148
149
|
| `addChannelGroups(channelId, groups, options?)` | 给已有通道**一次新加多组**回线:`groups` 每项 `{ id?, groupId?, path?, lineData? \| lines?, ... }`;旧 `lineItems` 会让整批明确失败且不写数据。逐组落地但只记一步历史、只发一条 `addChannelGroups` 数据变更;`options?: { emit?, label?, select? }` |
|
|
@@ -206,7 +207,7 @@
|
|
|
206
207
|
|
|
207
208
|
返回 `this` 的方法都可以链式调用;返回其它值的方法(`get*` / `list*` / `export*` / `search` / `pick*` / `add*` / `remove*` / `copy*` / `merge*` / `locate*` 这些)在下面的「参数速查」里都标了返回类型。
|
|
208
209
|
|
|
209
|
-
**怎么确认「组件到底有哪些属性和方法」**:上面那张表按功能分组介绍,下面的「参数速查」把实例的**每个成员逐个列全**(当前
|
|
210
|
+
**怎么确认「组件到底有哪些属性和方法」**:上面那张表按功能分组介绍,下面的「参数速查」把实例的**每个成员逐个列全**(当前 274 个:269 个方法 + `el` / `canvas` / `gl` / `cameraAnimating` / `dataVersion` 五个属性),`options` 表列全 100 个键,数据字段表列全 266 个字段。这三份清单不靠手抄 —— 它们直接对着源码与类型对账:
|
|
210
211
|
|
|
211
212
|
- `node docs/steps/gen-api-index.mjs`:从 `create.js` 的实例定义、本文档的两张表与 `types.d.ts` 生成 `docs/demos/api-index.js`(`API_SUMMARY` / `API_SECTIONS` / `API_OPTIONS`),demo 的「实例 API」面板读的就是它;带 `--check` 时只校验有没有过期。
|
|
212
213
|
- `node docs/steps/check-doc-coverage.mjs`:10 项双向对账 —— 实例成员 × 文档 / × 参数速查 / × 类型、参数速查与实例方法主表各自反查过期条目、类型反查过期声明、数据字段 × 文档、options 键 × 文档 / options 表反查过期字段、demo 清单是否最新。加一个实例成员、改一个 options 键而没同步文档时,这个脚本会直接报出来。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 17 参数速查(逐个方法)
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> 274 个成员逐个列全:参数、默认值与返回。
|
|
4
4
|
|
|
5
5
|
### 参数速查(逐个方法)
|
|
6
6
|
|
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
| `listPoints(options?)` | `options?: GisViewListOptions`:`indexes`(只看这几个下标)、`inView: boolean`(只要当前视口里的)、`withScreen: boolean`(连屏幕坐标一起给)、`visibleOnly: boolean`(跳过隐藏的)、`limit: number`(最多几条) | `GisViewListedPoint[]` |
|
|
132
132
|
| `getClusters()` | 无 | `GisViewCluster[]`。当前展示组(含 `count: 1` 的单成员),`screen` 按当前相机现算;聚合关掉时是空表 |
|
|
133
133
|
| `getPointCluster()` | 无 | `GisViewPointClusterReadout \| null`。归一化配置 `{ enabled, radius, minPoints, maxZoom, active }`,超过 `maxZoom` 后 `active` 为 `false` |
|
|
134
|
+
| `getPointSpacing()` | 无 | `GisViewPointSpacing`:`count` / `minDistance` / `maxDistance` / `nearest` / `farthest`。距离都是当前相机比例下的 CSS 像素,与 `fitSpacing` 同一套口径;最近 / 最远各带两端 `{ id, index, item }` 与同口径的 `distance`,筛选 / 隐藏后的节点不参与 |
|
|
134
135
|
| `listLines(options?)` | 同 `listPoints`(`inView` / `withScreen` / `limit`…) | `GisViewListedLine[]` |
|
|
135
136
|
| `forEachPointInView(rect, visit)` | `rect: GisViewBounds` 世界坐标矩形(一般直接给 `getViewRect()` 的返回值);`visit: (index, item, x, y, radius) => void \| false` 逐个回调,返回 `false` 提前结束 | `void`。只遍历矩形里的可见节点(数据顺序、不建中间数组):与 `listPoints({ inView: true })` 同一份可见判定,但不生成清单 —— 放大看一小片时不会去碰整份数据 |
|
|
136
137
|
| `getVisibleData()` | 无 | `GisViewData` |
|
|
@@ -224,7 +225,7 @@
|
|
|
224
225
|
| `commitAddChannel(input?, options?)` | `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` | `GisViewChannelAddResult` |
|
|
225
226
|
| `getChannelAddOptions(from, to, count?, kind?)` | `from` / `to` 两端节点 id;`count?: number` 回数(缺省 1);`kind?: 'channel' \| 'line'`(缺省 `'channel'`) | `GisViewChannelAddPlan \| null` |
|
|
226
227
|
| `getChannelBetween(from, to)` | `from` / `to` 两端节点 id | `GisViewChannelBetween \| null` |
|
|
227
|
-
| `getDirectConnections(pointIds)` | `pointIds: string \| number \| Array<string \| number>` 一组节点 id
|
|
228
|
+
| `getDirectConnections(pointIds, options?)` | `pointIds: string \| number \| Array<string \| number>` 一组节点 id(单条也收);`options?: 'channel' \| 'line' \| 'both' \| { kind?: 'channel' \| 'line' \| 'both' }` 只查一列(省略或 `both` 两列都查)。只查集合内部的直接边,两端必须能查到节点,去重后少于两个返回两列空数组 | `GisViewDirectConnections`:固定为 `{ channels, lines }`;通道项有 `channelId` / `channelIndex` / `lineIds`,线路项有 `lineId` / `lineIndex`;每项都带 `type` / `from` / `to`(`{ id, index, item }`)与 `item` |
|
|
228
229
|
| `addChannel(channel, lineData?, group?, options?)` | `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` 是中间拐点,通道只写骨架拐点 | `GisViewChannelAddResult`(`channelLineIds` 是落地后通道的完整成员表) |
|
|
229
230
|
| `addChannelGroupLines(channelId, lineData?, group?, options?)` | `channelId` 目标通道 id;`lineData?: GisViewChannelLineData` 这次新建的线路数组(按每项 id 建回线);`group?: GisViewChannelAddGroup` 新分组信息 `{ id?, path? }`(缺省 `${通道 id}::N`、不带拐点);`options?: { emit?: boolean; select?: boolean }` | `GisViewChannelAddResult` |
|
|
230
231
|
| `addChannelGroups(channelId, groups, options = {})` | `channelId` 目标通道 id;`groups: GisViewChannelAddGroupInput \| GisViewChannelAddGroupInput[]` 每项 `{ id?, groupId?, path?, lineData? \| lines? }`(线路数据与 `addChannel` 第二段同一份写法,`lineItems` 已移除);`options?: { emit?: boolean; label?: string; select?: boolean }`,`emit: false` 只落地不通知 | `GisViewAddChannelGroupsResult` |
|