gis-view-webgl2 0.1.6 → 0.1.7

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 (25) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.ts +86 -7
  4. package/dist/index.js +1 -1
  5. package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +57 -0
  6. package/docs/GisView.md +1 -1
  7. 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 +62 -0
  8. package/docs/demos/LabelDemo.vue +2 -2
  9. package/docs/demos/StyleDemo.vue +1 -1
  10. package/docs/demos/api-index.js +8 -7
  11. package/docs/demos/gis-view-demo/useGisViewDemo.js +2 -2
  12. package/docs/manual/04-/344/272/213/344/273/266/344/270/216/345/233/236/350/260/203.md +36 -8
  13. 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 +7 -6
  14. package/docs/manual/08-/351/200/211/344/270/255/344/270/216/346/213/220/347/202/271.md +59 -3
  15. package/docs/manual/09-/351/200/232/351/201/223/344/270/216/345/244/232/345/233/236/347/272/277.md +14 -1
  16. package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md +6 -5
  17. package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +7 -6
  18. package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +7 -1
  19. package/docs/manual/20-/346/200/247/350/203/275/344/270/216/345/244/247/346/225/260/346/215/256.md +1 -0
  20. package/docs/steps/README.md +4 -4
  21. package/docs/steps/selftest-demos.html +2 -2
  22. package/docs/steps/selftest-docs.html +3 -3
  23. package/docs/steps/selftest-features.html +1 -1
  24. package/docs/steps/selftest-select.html +168 -1
  25. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2724,6 +2724,11 @@ export interface GisViewPickResult extends GisViewFeatureKey {
2724
2724
  groupIndex?: number
2725
2725
  /** 命中的是通道内的回线时,这一组的读数(成员、拐点数、骨架),结构与 getChannelGroups 的一项一致 */
2726
2726
  group?: GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }
2727
+ /**
2728
+ * 命中的是通道内的回线时,同一通道全部分组的读数(按声明顺序,每项 groupIndex 是组号)。
2729
+ * `group` 是当前命中的那一组,`groups` 是整条通道的分组表;通道外的线路没有这两个字段。
2730
+ */
2731
+ groups?: Array<GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }>
2727
2732
  }
2728
2733
 
2729
2734
  /** 点聚合配置:true 等价于开着一份缺省档;对象写法可逐项覆盖。 */
@@ -2792,8 +2797,46 @@ export type GisViewClusterClickPayload = GisViewClusterPickResult & {
2792
2797
  action: GisViewPointerAction
2793
2798
  }
2794
2799
 
2800
+ /**
2801
+ * 一条被选中的通道的上下文:通道本身、当前组与全部分组。
2802
+ * 单通道选中时这些字段直接摊平到选中载荷顶层;多通道时改为 channelContexts 里的一项,不会两处重复。
2803
+ */
2804
+ export interface GisViewSelectionChannelContext {
2805
+ channelId: string | number
2806
+ channelIndex: number
2807
+ channel: GisViewChannel
2808
+ /** 当前组:真实点击 / selectAt 是命中的那一组;框选 / 按引用接口是选中集里第一条通道回线所在的组 */
2809
+ groupId: string | number
2810
+ groupIndex: number
2811
+ group: GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }
2812
+ /** 同一通道的全部分组(按声明顺序;同一条通道内与其他载荷项共享这一份数组) */
2813
+ groups: Array<GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }>
2814
+ /** 本次选中集里属于这条通道的回线下标 / id */
2815
+ lineIndexes: number[]
2816
+ lineIds: Array<string | number>
2817
+ }
2818
+
2819
+ /** 选中载荷里的通道上下文字段:只有一条通道时摊平,多通道时只保留 channelContexts */
2820
+ export interface GisViewSelectionChannelFields {
2821
+ channelId?: string | number
2822
+ channelIndex?: number
2823
+ channel?: GisViewChannel
2824
+ groupId?: string | number
2825
+ groupIndex?: number
2826
+ group?: GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }
2827
+ groups?: Array<GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }>
2828
+ /** 选中集涉及多条通道时才有(按选中顺序);单通道不创建这一份,直接读顶层平铺字段 */
2829
+ channelContexts?: GisViewSelectionChannelContext[]
2830
+ }
2831
+
2832
+ /** describeSelection 的返回值:要素读数 + 与选中载荷同一套通道上下文字段 */
2833
+ export interface GisViewDescribedSelection extends GisViewSelectionChannelFields {
2834
+ items: GisViewPickResult[]
2835
+ }
2836
+
2795
2837
  /** 选中事件载荷:点击选中为 0 / 1 个要素,Shift 框选为框内全部节点(随 shortcuts.boxSelect 改变) */
2796
- export interface GisViewSelectPayload {
2838
+ export interface GisViewSelectPayload extends GisViewSelectionChannelFields {
2839
+ /** 选中项;通道回线只带 channelId / channelIndex / groupId / groupIndex 标量归属,分组读数看顶层或 channelContexts */
2797
2840
  items: GisViewPickResult[]
2798
2841
  /** 框选时的画布 CSS 像素矩形,点击选中为 null */
2799
2842
  box: GisViewRect | null
@@ -2901,7 +2944,8 @@ export interface GisViewSelectionData {
2901
2944
  * 选中集变更载荷:与 onSelect 的区别是这个只在「选中集真的变了」时发一条,
2902
2945
  * 接口选中(select / clearSelection / selectInBox)也会发。
2903
2946
  */
2904
- export interface GisViewSelectChangePayload extends GisViewSelectionInfo {
2947
+ export interface GisViewSelectChangePayload extends GisViewSelectionInfo, GisViewSelectionChannelFields {
2948
+ /** 与对应 onSelect 载荷共用同一批对象;通道回线不重复挂 group / groups */
2905
2949
  items: GisViewPickResult[]
2906
2950
  /** 框选时的矩形,其余为 null */
2907
2951
  box: GisViewRect | null
@@ -3136,6 +3180,8 @@ export interface GisViewPointerPayload {
3136
3180
  groupIndex?: number
3137
3181
  /** 命中的是通道内的回线时,这一组的读数 */
3138
3182
  group?: GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }
3183
+ /** 命中的是通道内的回线时,同一通道全部分组的读数;`group` 是当前这组,`groups` 是整条通道 */
3184
+ groups?: Array<GisViewChannelGroupInfo & { groupIndex: number; lineCount: number; waypointCount: number }>
3139
3185
  /** 命中通道回线时的分组上下文:action.target 为 channel,按它直接渲染通道菜单 */
3140
3186
  channelContext?: GisViewChannelContext
3141
3187
  /** 命中多成员聚合时:聚合 id、成员数、成员下标 / id、包围盒与屏幕半径 */
@@ -6569,6 +6615,16 @@ export interface GisViewOptions {
6569
6615
  maxCanvasPixels?: number
6570
6616
  ariaLabel?: string
6571
6617
  onReady?: (payload: GisViewReadyPayload) => void
6618
+ /**
6619
+ * 本次选中操作:真实单击 / Ctrl 与 multiSelect 取反 / 框选 / selectAt 每次成功操作都发;
6620
+ * selectFeatures / deselect / focusOn({ select }) 等按引用接口只在选中集实际变化时发。
6621
+ * 清空与取反取没了时载荷是 null。onSelectChange 仍只在选中集实际变化时发。
6622
+ * 真实点击的派发顺序是 onClick → onSelect → onSelectChange;单通道选中时载荷顶层带
6623
+ * channelId / group / groups,多通道看 channelContexts。items 里的回线只带 channelId /
6624
+ * channelIndex / groupId / groupIndex 这些标量归属,不重复挂 group / groups;需要分组读数
6625
+ * 从顶层或 channelContexts 取。onSelect 与 onSelectChange 各自可独立订阅,两条载荷引用同一份
6626
+ * items 与分组数组,不会深拷贝;按只读使用,不要在回调里改载荷。
6627
+ */
6572
6628
  onSelect?: (payload: GisViewSelectPayload | null) => void
6573
6629
  /** 单击要素或空白处 */
6574
6630
  onClick?: (payload: GisViewClickPayload | null) => void
@@ -6644,8 +6700,11 @@ export interface GisViewOptions {
6644
6700
  */
6645
6701
  onDataChange?: (payload: GisViewDataChangePayload) => void
6646
6702
  /**
6647
- * 选中集变化:与 onSelect 的区别有两点 —— 只在选中集真的变了时发一条(框选拖动 / 数据补发不会重复发),
6648
- * 并且接口选中(select / clearSelection / selectInBox)也走这里;载荷带 ids / count / 各类型条数与来源 cause。
6703
+ * 选中集变化:覆盖所有来源(点击 / 框选 / selectFeatures / deselect / selectAt / selectInBox),
6704
+ * 且只在选中集真的变了时发一条;载荷带 ids / count / 各类型条数与来源 cause。
6705
+ * 与 onSelect 共用同一份选中集;需要「任何来源只通知一次」时优先订阅这一条。
6706
+ * 通道上下文与 onSelect 同一份:单通道摊平 channelId / group / groups,多通道给 channelContexts;
6707
+ * 不与 items 重复,两个事件共享同一批对象引用(按只读使用)。
6649
6708
  */
6650
6709
  onSelectChange?: (payload: GisViewSelectChangePayload) => void
6651
6710
  /**
@@ -7739,9 +7798,17 @@ export interface GisViewInstance {
7739
7798
  /**
7740
7799
  * 按浏览器客户端坐标拾取(鼠标事件里的 clientX / clientY):与指针事件载荷同一份读数,另加 target
7741
7800
  * ('point' / 'line' / 'channel')与 lngLat(配了 GeoJSON 底图才有);没命中返回 null。
7801
+ * 命中通道回线时给 group(当前这一组)与 groups(同一通道的全部分组)。
7742
7802
  * 只读 —— 不改选中、不动光标。自建浮层 / 自定义菜单 / 拖拽放下时「问一下这儿是什么」用它
7743
7803
  */
7744
7804
  pickAt(clientX: number, clientY: number): GisViewPickAtResult | null
7805
+ /**
7806
+ * 按客户端坐标做一次「普通单击选中」:与画布点击共用命中顺序与选中状态,
7807
+ * 通道回线按 channelSelectMode 摊开。空白 / 聚合圆返回 null 且不改选中。
7808
+ * 立即生效,不等待 selectTrigger: 'dblClick',也不派发 onClick / onDblClick;选中集实际变化时发
7809
+ * onSelect / onSelectChange。已知节点 / 线路 id 时直接用 selectFeatures,不必先求坐标。
7810
+ */
7811
+ selectAt(clientX: number, clientY: number): GisViewSelectPayload | null
7745
7812
  /**
7746
7813
  * 程序化悬停(参数就是鼠标事件里的 clientX / clientY):让指针「停」到这个位置上 ——
7747
7814
  * 悬停高亮、光标与 onHover 都按它更新(外部列表 / 表格 hover 到某一行时联动高亮图上的要素)。
@@ -7768,7 +7835,8 @@ export interface GisViewInstance {
7768
7835
  getLineChannel(ref: GisViewFeatureRef): GisViewLineChannelInfo | null
7769
7836
  /**
7770
7837
  * 让一批东西变成选中状态(接口选中):与点击选中走同一份 state,因此 getSelections / getSelectionData
7771
- * getSelectionData 立刻就能读回来。认这些写法(见 GisViewSelectionRef):
7838
+ * 立刻就能读回来。会同步选中样式与读数;选中集实际变化时发 onSelect 与 onSelectChange(cause: api)。
7839
+ * 认这些写法(见 GisViewSelectionRef):
7772
7840
  * ① 节点:id、`{ type: 'point', index: 3 }`、一批 id 与对象混着写;
7773
7841
  * ② 通道:`{ type: 'channel', channelId: 'channel-a' }` 选整条通道的回线,
7774
7842
  * `{ channelId, groupId }` / `{ type: 'group', channelId, groupId }` 选某一组
@@ -7789,7 +7857,8 @@ export interface GisViewInstance {
7789
7857
  * 把这些从当前选中集里去掉,其余选中原样留着 —— `deselect('p-1')` 取消一个节点、
7790
7858
  * `deselect({ type: 'channel', channelId: 'channel-a' })` 取消整条通道的回线。
7791
7859
  * 一个目标都不给(不传 / 传 null)等于取消全部(与 selectFeatures(null) 同一件事),
7792
- * 传空数组是「没有目标」,什么都不做;认不出来的条目跳过
7860
+ * 传空数组是「没有目标」,什么都不做;认不出来的条目跳过。改变选中集时发
7861
+ * onSelect 与 onSelectChange(cause: api)。
7793
7862
  */
7794
7863
  deselect(refs?: GisViewSelectionRefs): GisViewInstance
7795
7864
  /** 当前选中集的原始条目(`{ type, index, item, ... }`,与指针载荷同一份口径),不做整理、不读包围盒 */
@@ -8577,11 +8646,17 @@ export interface GisViewEngineOptions {
8577
8646
  onCursor?: (coordinate: [number, number] | null) => void
8578
8647
  onHover?: (payload: GisViewHoverPayload) => void
8579
8648
  /**
8649
+ * 点击 / 框选路径(真实点击 / Ctrl 多选 / 框选(含 selectInBox)/ 空白清空)与 selectAt 每次成功操作都发;
8650
+ * selectFeatures / deselect / focusOn({ select }) 等按引用接口只在选中集实际变化时发。
8651
+ * 要统一监听所有来源并且避免点击同一要素时重复通知,请用 onSelectChange。
8652
+ * 真实点击的顺序是 onClick → onSelect → onSelectChange;Ctrl / multiSelect 取反与框选没有 onClick,
8653
+ * 顺序是 onSelect → onSelectChange。单通道选中时载荷顶层带 channelId / group / groups,多通道看 channelContexts。
8654
+ * items 里的回线只有标量归属,不重复挂 group / groups;两条回调共享同一批对象引用。
8580
8655
  * 载荷为 null(没有选中任何要素)时的补充读数:mode 说明这一下是哪一种选中方式 ——
8581
8656
  * 'multi' 是 Ctrl 点击取反取没了、'box' 是框选没框到东西;originalEvent 是那一次指针事件
8582
8657
  * (载荷里没有它时靠这一份读修饰键)。其余清空路径不带第二个参数
8583
8658
  */
8584
- onSelect?: (payload: GisViewSelectPayload | null, detail?: { mode?: 'single' | 'multi' | 'box'; originalEvent?: Event | null }) => void
8659
+ onSelect?: (payload: GisViewSelectPayload | null, detail?: { mode?: 'single' | 'multi' | 'box'; originalEvent?: Event | null; defer?: boolean }) => void
8585
8660
  onClick?: (payload: GisViewClickPayload | null) => void
8586
8661
  /** 点中多成员聚合圆(引擎不选中成员,普通点击回调不会同时触发) */
8587
8662
  onClusterClick?: (payload: GisViewClusterClickPayload, event: Event) => void
@@ -8628,6 +8703,8 @@ export interface GisViewEngine {
8628
8703
  describe(selection: GisViewFeatureKey): GisViewPickResult | null
8629
8704
  /** 批量把要素下标还原成拾取结果,框选与受控选中都用它 */
8630
8705
  describeAll(selection: GisViewFeatureKey[]): GisViewPickResult[]
8706
+ /** 批量还原并补通道上下文:单通道摊平 channelId / group / groups,多通道给 channelContexts */
8707
+ describeSelection(selection: GisViewFeatureKey[], preferredGroupId?: string | number): GisViewDescribedSelection
8631
8708
  /** 按画布 CSS 像素矩形框选,返回框内要素;第二段兼容旧的 Event 或 { selectionKinds, originalEvent } */
8632
8709
  selectInBox(box: GisViewRect, options?: GisViewSelectInBoxOptions | Event | null): GisViewPickResult[]
8633
8710
  /** 拐点增删改,insertIndex 缺省时按直线上离目标最近的线段插入 */
@@ -8856,6 +8933,8 @@ export interface GisViewEngine {
8856
8933
  pick(x: number, y: number): GisViewHitResult | null
8857
8934
  /** 与组件实例的 pickAt 同一份:按浏览器客户端坐标拾取(引擎不等 DOM 事件,直接给 clientX / clientY) */
8858
8935
  pickAtClient(clientX: number, clientY: number): GisViewHitResult | null
8936
+ /** 与组件实例的 selectAt 同一份:按客户端坐标走一次普通单击选中(通道按 channelSelectMode 摊开) */
8937
+ selectAtClient(clientX: number, clientY: number): GisViewSelectPayload | null
8859
8938
  /** 程序化悬停(客户端坐标):让指针「停」在这儿,悬停高亮 / 光标 / onHover 一起更新,返回这一次的读数 */
8860
8939
  hoverAtClient(clientX: number, clientY: number): GisViewHoverPayload | null
8861
8940
  /** 取消程序化悬停:清掉高亮与读数并补发 onHover(null) */