gis-view-webgl2 0.1.3 → 0.1.4
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 +12 -9
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +112 -17
- package/dist/index.js +1 -1
- package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +34 -0
- package/docs/GisView.md +3 -3
- 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 +30 -0
- package/docs/api/index.html +22 -8
- package/docs/demos/ApiCoverageDemo.vue +1 -1
- package/docs/demos/ExtensionDemo.vue +69 -12
- package/docs/demos/SearchFilterDemo.vue +13 -11
- package/docs/demos/api-index.js +13 -9
- package/docs/demos/demos.js +1 -1
- package/docs/demos/gis-view-demo/GisViewDemoCardHeader.vue +1 -0
- package/docs/demos/gis-view-demo/panels/OpsPanels.vue +2 -2
- package/docs/demos/gis-view-demo/useGisViewDemo.js +9 -9
- package/docs/index.html +41 -4
- package/docs/manual/03-/351/205/215/347/275/256/351/241/271.md +18 -3
- package/docs/manual/04-/344/272/213/344/273/266/344/270/216/345/233/236/350/260/203.md +7 -6
- package/docs/manual/08-/351/200/211/344/270/255/344/270/216/346/213/220/347/202/271.md +24 -3
- package/docs/manual/14-/350/247/206/345/233/276/344/270/216/347/255/233/351/200/211.md +90 -34
- package/docs/manual/15-/345/257/274/345/207/272/344/270/216/351/233/206/346/210/220.md +32 -3
- package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md +7 -4
- package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +9 -6
- package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +39 -7
- 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 +3 -3
- 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 +6 -3
- package/docs/steps/README.md +7 -7
- package/docs/steps/selftest-demos.html +26 -9
- package/docs/steps/selftest-docs.html +33 -4
- package/docs/steps/selftest-features.html +91 -10
- package/docs/steps/selftest-scale.html +98 -0
- package/docs/steps/selftest-select.html +90 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2886,7 +2886,7 @@ export interface GisViewClickPayload extends GisViewPickResult {
|
|
|
2886
2886
|
selection: GisViewSelectionInfo
|
|
2887
2887
|
/**
|
|
2888
2888
|
* 这一次点击的判读:type 为 'select'(点中要素、选中已生效)或 'click'(没开选中时的普通点击),
|
|
2889
|
-
* double 为 true 说明这一下是双击里的第二下。点空白处的载荷是 null,
|
|
2889
|
+
* 多选取反生效时是 'toggleSelect';double 为 true 说明这一下是双击里的第二下。点空白处的载荷是 null,
|
|
2890
2890
|
* 「点了空白」这件事看 onPointerDown / onPointerUp 的 action.target('empty')与 selectChange。
|
|
2891
2891
|
*/
|
|
2892
2892
|
action: GisViewPointerAction
|
|
@@ -3681,6 +3681,8 @@ export type GisViewDataChangeType =
|
|
|
3681
3681
|
| 'addLines'
|
|
3682
3682
|
| 'removePoints'
|
|
3683
3683
|
| 'removeLines'
|
|
3684
|
+
/** 删除型筛选(filter.mode: 'remove')把不命中的要素从数据里删掉 */
|
|
3685
|
+
| 'filterRemove'
|
|
3684
3686
|
| 'removeSelected'
|
|
3685
3687
|
| 'removeLine'
|
|
3686
3688
|
| 'removeChannel'
|
|
@@ -3704,6 +3706,8 @@ export interface GisViewDataChangePayload {
|
|
|
3704
3706
|
/** 动到 / 删掉的节点下标(单点更新是那一个,删除是删除前的下标升序,新增是它们在数组里的位置) */
|
|
3705
3707
|
index?: number
|
|
3706
3708
|
indexes?: number[]
|
|
3709
|
+
/** 这一次删掉的节点下标(删除前它们在 points 里的位置,升序;removeSelected / filterRemove 会带上) */
|
|
3710
|
+
pointIndexes?: number[]
|
|
3707
3711
|
/** 这一次调用成没成(addPoints / addLines / removePoints 这类批量接口会带上) */
|
|
3708
3712
|
ok?: boolean
|
|
3709
3713
|
/** 新增这类动作:这批要素是从哪个下标开始接上去的(就是追加前原数组的长度) */
|
|
@@ -3753,8 +3757,14 @@ export interface GisViewDataChangePayload {
|
|
|
3753
3757
|
lineIndex?: number
|
|
3754
3758
|
channelId?: string | number | null
|
|
3755
3759
|
channelIndex?: number
|
|
3760
|
+
/** filterRemove:这次从数据里删掉的节点数据,顺序与 pointIndexes 对应 */
|
|
3761
|
+
removedPoints?: GisViewPoint[]
|
|
3762
|
+
/** filterRemove:这次从数据里删掉的线路数据,顺序与 removedLineIndexes 对应 */
|
|
3763
|
+
removedLineItems?: GisViewLine[]
|
|
3756
3764
|
removedLineIds?: Array<string | number>
|
|
3757
3765
|
removedLineIndexes?: number[]
|
|
3766
|
+
/** filterRemove:固定为 'remove',便于按载荷分流 */
|
|
3767
|
+
mode?: GisViewFilterMode
|
|
3758
3768
|
/** 通道分组:这条通道最新的分组声明 */
|
|
3759
3769
|
groups?: GisViewChannelGroup[]
|
|
3760
3770
|
replaced?: boolean
|
|
@@ -4886,19 +4896,29 @@ export interface GisViewTooltipOptions {
|
|
|
4886
4896
|
*/
|
|
4887
4897
|
export type GisViewFilterCascade = false | 'binding' | 'coordinate' | 'both'
|
|
4888
4898
|
|
|
4889
|
-
/**
|
|
4899
|
+
/** 筛选模式:hide 只隐藏(缺省);remove 把不命中的要素从数据里删掉(不可恢复,除非撤销) */
|
|
4900
|
+
export type GisViewFilterMode = 'hide' | 'remove'
|
|
4901
|
+
|
|
4902
|
+
/**
|
|
4903
|
+
* 筛选条件:点、线各一个条件,缺省表示该维度不过滤。
|
|
4904
|
+
* 缺省 mode: 'hide' 只算「隐藏集合」,不改数据;已经选中的要素被隐藏后仍留在选中集里,
|
|
4905
|
+
* 条件放宽 / 清空后会原样恢复高亮。mode: 'remove' 把筛选结果(hiddenPoints / hiddenLines)
|
|
4906
|
+
* 真正从数据里删掉(走 dataChange('filterRemove'),可用撤销恢复;不会额外按节点联级删线路)。
|
|
4907
|
+
*/
|
|
4890
4908
|
export interface GisViewFilter {
|
|
4891
4909
|
points?: GisViewConditionInput<GisViewPoint>
|
|
4892
4910
|
lines?: GisViewConditionInput<GisViewLine>
|
|
4893
4911
|
/** 联动隐藏,默认 binding */
|
|
4894
4912
|
cascade?: GisViewFilterCascade
|
|
4913
|
+
/** 不命中的要素怎么处理:'hide' 只隐藏(默认),'remove' 从数据里删除 */
|
|
4914
|
+
mode?: GisViewFilterMode
|
|
4895
4915
|
/** 是否用 Worker 计算,缺省跟随 options.filterWorker */
|
|
4896
4916
|
worker?: boolean
|
|
4897
4917
|
}
|
|
4898
4918
|
|
|
4899
4919
|
/**
|
|
4900
4920
|
* 筛选条件的简写:只筛节点时可以直接给节点条件,等价于 `{ points: 条件 }`:
|
|
4901
|
-
* `view.setFilter({ vn_kv: { gte: 525 } })`。顶层出现 points / lines / cascade / worker
|
|
4921
|
+
* `view.setFilter({ vn_kv: { gte: 525 } })`。顶层出现 points / lines / cascade / mode / worker
|
|
4902
4922
|
* 任一键时按完整格式解释,因此简写里可以放心使用业务字段名。
|
|
4903
4923
|
*/
|
|
4904
4924
|
export type GisViewFilterShorthand = GisViewConditionInput<GisViewPoint>
|
|
@@ -4906,7 +4926,7 @@ export type GisViewFilterShorthand = GisViewConditionInput<GisViewPoint>
|
|
|
4906
4926
|
/** setFilter / options.filter 接受的条件:完整格式,或只筛节点的简写 */
|
|
4907
4927
|
export type GisViewFilterInput = GisViewFilter | GisViewFilterShorthand
|
|
4908
4928
|
|
|
4909
|
-
/** 筛选结果:hiddenPoints / hiddenLines
|
|
4929
|
+
/** 筛选结果:hiddenPoints / hiddenLines 是当前被隐藏的要素下标;remove 模式删除完会回到空数组 */
|
|
4910
4930
|
export interface GisViewFilterResult {
|
|
4911
4931
|
filter: GisViewFilter | null
|
|
4912
4932
|
hiddenPoints: number[]
|
|
@@ -5218,6 +5238,24 @@ export interface GisViewPluginContext {
|
|
|
5218
5238
|
|
|
5219
5239
|
export type GisViewPlugin = (view: GisViewInstance, context: GisViewPluginContext) => void | { destroy?: () => void }
|
|
5220
5240
|
|
|
5241
|
+
/** 实例命令的上下文:注册表属于这个视图,handler 里拿它就能继续调实例方法 */
|
|
5242
|
+
export interface GisViewCommandContext {
|
|
5243
|
+
readonly view: GisViewInstance
|
|
5244
|
+
/** 这次执行注册时用的命令名(已去掉首尾空白) */
|
|
5245
|
+
readonly name: string
|
|
5246
|
+
}
|
|
5247
|
+
|
|
5248
|
+
/** 实例命令:同步执行;返回值原样放进 GisViewCommandResult.value */
|
|
5249
|
+
export type GisViewCommandHandler<Payload = unknown, Value = unknown> = (payload: Payload, context: GisViewCommandContext) => Value
|
|
5250
|
+
|
|
5251
|
+
/** executeCommand 的读数:拿到命令并执行成功时 ok: true;没注册 / 名字非法 / handler 抛错时 ok: false 并给原因 */
|
|
5252
|
+
export interface GisViewCommandResult<Value = unknown> {
|
|
5253
|
+
readonly ok: boolean
|
|
5254
|
+
readonly name: string
|
|
5255
|
+
readonly value?: Value
|
|
5256
|
+
readonly reason?: string
|
|
5257
|
+
}
|
|
5258
|
+
|
|
5221
5259
|
/**
|
|
5222
5260
|
* 快捷键写法(大小写不敏感,多个用 + 连接):
|
|
5223
5261
|
* - 纯修饰键:`ctrl` / `meta` / `shift` / `alt` / `mod`(`ctrl` 同时认 macOS 的 ⌘),按住 + 操作;
|
|
@@ -6025,6 +6063,12 @@ export interface GisViewWebGLLayer {
|
|
|
6025
6063
|
draw(context: GisViewWebGLLayerDrawContext): void
|
|
6026
6064
|
}
|
|
6027
6065
|
|
|
6066
|
+
/**
|
|
6067
|
+
* 选中触发方式:'click'(缺省)在第一次单击时改选中集;'dblClick' 等到双击的第二下才改,
|
|
6068
|
+
* 第一下仍照常派发 onClick。两种方式下 onDblClick 都会在双击第二下派发。
|
|
6069
|
+
*/
|
|
6070
|
+
export type GisViewSelectTrigger = 'click' | 'dblClick'
|
|
6071
|
+
|
|
6028
6072
|
export interface GisViewOptions {
|
|
6029
6073
|
/**
|
|
6030
6074
|
* 功能开关:预设名('edit' / 'view' / 'static')、开关表或布尔值 ——
|
|
@@ -6288,6 +6332,12 @@ export interface GisViewOptions {
|
|
|
6288
6332
|
* 关着时多选仍走框选(boxSelect)与按住多选快捷键(默认 Ctrl / ⌘)。
|
|
6289
6333
|
*/
|
|
6290
6334
|
multiSelect?: boolean
|
|
6335
|
+
/**
|
|
6336
|
+
* 选中触发方式:缺省 'click'(单击选中);写 'dblClick' 后第一次点击只派发 onClick,
|
|
6337
|
+
* 第二次(双击判定命中)才更新选中集,并同时派发 onClick 与 onDblClick。
|
|
6338
|
+
* Ctrl / ⌘ 多选与 multiSelect 在双击模式下同样等到第二下才取反。运行时走 updateOptions({ selectTrigger })。
|
|
6339
|
+
*/
|
|
6340
|
+
selectTrigger?: GisViewSelectTrigger
|
|
6291
6341
|
/**
|
|
6292
6342
|
* 框选 / Ctrl 多选允许收哪几类要素:'point' 节点、'line' 独立线路、'channel' 通道回线,
|
|
6293
6343
|
* 可写数组任意组合,'all' / true 全开,false / null 全关。
|
|
@@ -6510,37 +6560,63 @@ export interface GisViewOptions {
|
|
|
6510
6560
|
onError?: (message: string) => void
|
|
6511
6561
|
}
|
|
6512
6562
|
|
|
6513
|
-
/**
|
|
6514
|
-
export type GisViewSearchScope = 'points' | 'lines' | 'channels'
|
|
6563
|
+
/** 搜索范围(规范化后的键):节点 / 线路 / 通道 / 通道分组(通道会连成员回线一起搜) */
|
|
6564
|
+
export type GisViewSearchScope = 'points' | 'lines' | 'channels' | 'groups'
|
|
6565
|
+
|
|
6566
|
+
/** scope 的入参写法:复数的规范化键,或与 focusOn 目标一致的 point / line / channel / group 单数别名 */
|
|
6567
|
+
export type GisViewSearchScopeInput = GisViewSearchScope | 'point' | 'line' | 'channel' | 'group'
|
|
6515
6568
|
|
|
6516
6569
|
export interface GisViewSearchOptions {
|
|
6517
6570
|
/** 关键字:空格分隔多个词时要在同一个字段里全部出现才命中,不区分大小写 */
|
|
6518
6571
|
keyword?: string
|
|
6519
|
-
/**
|
|
6520
|
-
|
|
6572
|
+
/**
|
|
6573
|
+
* 搜索范围,缺省四类都搜。复数的 points / lines / channels / groups 与单数别名
|
|
6574
|
+
* point / line / channel / group 都收;写错或空数组会回落到四类全搜。
|
|
6575
|
+
*/
|
|
6576
|
+
scope?: GisViewSearchScopeInput | GisViewSearchScopeInput[]
|
|
6521
6577
|
/** 限定参与匹配的字段路径(如 ['name', 'props.vn_kv']),缺省用要素的全部字段 */
|
|
6522
6578
|
fields?: string[]
|
|
6523
6579
|
/** 每类要素的命中上限,缺省 200,0 表示不限 */
|
|
6524
6580
|
limit?: number
|
|
6525
6581
|
}
|
|
6526
6582
|
|
|
6583
|
+
/**
|
|
6584
|
+
* 分组搜索命中里的 item:与 getChannelGroups() 的读数同源,但只保留搜索与定位需要的轻量字段
|
|
6585
|
+
* (不带骨架 / 回线几何)。groupIndex 是这一组在所属通道里的序号(从 0 起)。
|
|
6586
|
+
*/
|
|
6587
|
+
export interface GisViewSearchGroupItem {
|
|
6588
|
+
channelId: string | number
|
|
6589
|
+
channelIndex: number
|
|
6590
|
+
id: string | number
|
|
6591
|
+
groupIndex: number
|
|
6592
|
+
lineIndexes: number[]
|
|
6593
|
+
lineIds: Array<string | number>
|
|
6594
|
+
lineCount: number
|
|
6595
|
+
anchored: boolean
|
|
6596
|
+
edited: boolean
|
|
6597
|
+
}
|
|
6598
|
+
|
|
6527
6599
|
/** 一条搜索命中:field / value 是命中的那一项,bounds 用来居中或适应视图 */
|
|
6528
6600
|
export interface GisViewSearchHit {
|
|
6529
|
-
kind: 'point' | 'line' | 'channel'
|
|
6530
|
-
/** 点 /
|
|
6601
|
+
kind: 'point' | 'line' | 'channel' | 'group'
|
|
6602
|
+
/** 点 / 线在数据里的下标;通道是通道下标;分组是 groups 结果里的下标 */
|
|
6531
6603
|
index: number
|
|
6532
6604
|
id?: string | number
|
|
6533
|
-
item: GisViewPoint | GisViewLine | GisViewChannel
|
|
6605
|
+
item: GisViewPoint | GisViewLine | GisViewChannel | GisViewSearchGroupItem
|
|
6534
6606
|
field: string
|
|
6535
6607
|
value: string
|
|
6536
6608
|
bounds: GisViewBounds
|
|
6537
|
-
/**
|
|
6609
|
+
/** 要素属于某条通道时给出通道下标(线路 / 分组命中,或通道命中自身字段) */
|
|
6538
6610
|
channelIndex?: number
|
|
6539
6611
|
/** 通道内第几条回线(0 开始) */
|
|
6540
6612
|
memberIndex?: number
|
|
6541
6613
|
/** 通道命中来自回线时,该回线在 lines 里的下标与 id */
|
|
6542
6614
|
memberLineIndex?: number
|
|
6543
6615
|
memberLineId?: string | number
|
|
6616
|
+
/** 分组命中:分组 id(与 focusOn / selectFeatures 的 groupId 同一口径) */
|
|
6617
|
+
groupId?: string | number
|
|
6618
|
+
/** 分组命中:这一组在所属通道里的序号(从 0 起) */
|
|
6619
|
+
groupIndex?: number
|
|
6544
6620
|
}
|
|
6545
6621
|
|
|
6546
6622
|
export interface GisViewSearchResult {
|
|
@@ -6549,7 +6625,8 @@ export interface GisViewSearchResult {
|
|
|
6549
6625
|
points: GisViewSearchHit[]
|
|
6550
6626
|
lines: GisViewSearchHit[]
|
|
6551
6627
|
channels: GisViewSearchHit[]
|
|
6552
|
-
|
|
6628
|
+
groups: GisViewSearchHit[]
|
|
6629
|
+
/** 四类命中的合集,顺序是节点、线路、通道、分组 */
|
|
6553
6630
|
hits: GisViewSearchHit[]
|
|
6554
6631
|
total: number
|
|
6555
6632
|
/** 命中数达到上限被截断 */
|
|
@@ -6575,13 +6652,15 @@ export type GisViewFocusTarget = GisViewSearchHit | GisViewFeatureKey | GisViewS
|
|
|
6575
6652
|
export type GisViewFocusTargets = GisViewFocusTarget | GisViewFocusTarget[]
|
|
6576
6653
|
|
|
6577
6654
|
export interface GisViewFocusOptions {
|
|
6578
|
-
/** 直接设成这个比例(像素 /
|
|
6655
|
+
/** 直接设成这个比例(像素 / 世界单位);优先级高于 zoom */
|
|
6579
6656
|
scale?: number
|
|
6580
|
-
/**
|
|
6657
|
+
/** 显式要求按目标范围适应视图;**缺省不缩放**,只把中心移到目标上 */
|
|
6658
|
+
zoom?: boolean
|
|
6659
|
+
/** 显式只居中、比例一点不动(与缺省行为一致,保留旧写法) */
|
|
6581
6660
|
center?: boolean
|
|
6582
|
-
/**
|
|
6661
|
+
/** 按范围适应视图(zoom: true)时四周的留白(CSS 像素),缺省 40 */
|
|
6583
6662
|
padding?: number
|
|
6584
|
-
/**
|
|
6663
|
+
/** 适应视图(zoom: true)时最多放大到多少比例:单个节点 / 一条直线没有面积,靠它决定要不要放大 */
|
|
6585
6664
|
maxZoom?: number
|
|
6586
6665
|
/**
|
|
6587
6666
|
* 顺手把这些被聚焦的要素变成选中状态:`true` 选中这次聚焦的这批(通常配合搜索命中),
|
|
@@ -8083,6 +8162,16 @@ export interface GisViewInstance {
|
|
|
8083
8162
|
* 调它就把这个插件返回的 `destroy` 清掉(重复调用只清一次;实例销毁之后再调也安全)
|
|
8084
8163
|
*/
|
|
8085
8164
|
use(plugin: GisViewPlugin): () => void
|
|
8165
|
+
/**
|
|
8166
|
+
* 注册一个实例命令:`handler(payload, context)` 同步执行,`context.view` 就是这个视图。
|
|
8167
|
+
* 同名覆盖(后注册的生效);返回幂等的注销函数,同名被后注册覆盖后旧卸载函数不会误删新命令。
|
|
8168
|
+
* 名字空 / handler 不是函数只报一条 onWarning;实例销毁后注册不生效。
|
|
8169
|
+
*/
|
|
8170
|
+
registerCommand<Payload = unknown, Value = unknown>(name: string, handler: GisViewCommandHandler<Payload, Value>): () => void
|
|
8171
|
+
/** 执行一个实例命令:成功给 `{ ok: true, name, value }`;没注册 / 名字非法 / handler 抛错给 `{ ok: false, name, reason }` */
|
|
8172
|
+
executeCommand<Value = unknown>(name: string, payload?: unknown): GisViewCommandResult<Value>
|
|
8173
|
+
/** 当前注册着哪些实例命令(按注册顺序;同名覆盖不改变原来的位置) */
|
|
8174
|
+
listCommands(): string[]
|
|
8086
8175
|
/**
|
|
8087
8176
|
* 注册一个自定义图元:名字写进数据的 `symbol` 字段(`symbol: '三角'`),画法交给一支画笔
|
|
8088
8177
|
* (`painter(context, info)`,读数见 `GisViewSymbolPainterInfo`)。注册完(或换一支画笔之后)
|
|
@@ -8234,6 +8323,8 @@ export interface GisViewEngineOptions {
|
|
|
8234
8323
|
zoom?: boolean
|
|
8235
8324
|
hover?: boolean
|
|
8236
8325
|
select?: boolean
|
|
8326
|
+
/** 选中触发方式:'click'(缺省)或 'dblClick',见 GisViewSelectTrigger */
|
|
8327
|
+
selectTrigger?: GisViewSelectTrigger
|
|
8237
8328
|
contextMenu?: boolean
|
|
8238
8329
|
/**
|
|
8239
8330
|
* 右键默认把浏览器的系统菜单收掉(组件接住右键时 preventDefault contextmenu)。
|
|
@@ -8379,6 +8470,10 @@ export interface GisViewEngine {
|
|
|
8379
8470
|
getChannels(): GisViewChannelInfo[]
|
|
8380
8471
|
/** 单条通道运行时状态:只复制这一组;channelId 找不到时可按 channels 下标兜底 */
|
|
8381
8472
|
getChannel(channelId?: string | number | null, channelIndex?: number): GisViewChannelInfo | null
|
|
8473
|
+
/** 单条通道的范围:按当前骨架与每条回线的折线计算,不复制几何;channelId 找不到时可按 channels 下标兜底 */
|
|
8474
|
+
getChannelBounds(channelId?: string | number | null, channelIndex?: number): GisViewBounds | null
|
|
8475
|
+
/** 一个分组的范围:按这一组当前骨架与回线折线计算,不复制几何;没有 channelId 时按通道下标兜底 */
|
|
8476
|
+
getChannelGroupBounds(channelId: string | number | null | undefined, groupId: string | number, channelIndex?: number): GisViewBounds | null
|
|
8382
8477
|
/** 通道成员表:成员回线下标与各自的横向偏移,不复制几何(自建覆盖层按通道分流绘制用它) */
|
|
8383
8478
|
getChannelMembers(): GisViewChannelMembers[]
|
|
8384
8479
|
/** 通道分组现状:不传 channelId 返回所有分组 */
|