gis-view-webgl2 0.1.12 → 0.1.13

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 (30) hide show
  1. package/dist/gis-view.css +1 -1
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.d.ts +250 -4
  4. package/dist/index.js +1 -1
  5. package/docs/AI/345/257/271/350/257/235/346/261/207/346/200/273.md +63 -11
  6. package/docs/GisView.md +6 -6
  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 +69 -11
  8. package/docs/demos/api-index.js +6 -2
  9. package/docs/demos/gis-view-demo/demo.css +56 -0
  10. package/docs/demos/gis-view-demo/panels/StylePanels.vue +22 -1
  11. package/docs/demos/gis-view-demo/panels/ViewPanels.vue +2 -1
  12. package/docs/demos/gis-view-demo/useGisViewDemo.js +168 -4
  13. package/docs/index.html +2 -2
  14. package/docs/internals/15-03-/351/200/220/350/275/256/350/256/260/345/275/225-/346/200/247/350/203/275/344/270/216/344/277/256/345/244/215-/344/270/213.md +72 -1
  15. package/docs/manual/03-/351/205/215/347/275/256/351/241/271.md +58 -4
  16. 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 +1 -1
  17. package/docs/manual/08-/351/200/211/344/270/255/344/270/216/346/213/220/347/202/271.md +9 -4
  18. package/docs/manual/11-/346/240/267/345/274/217/344/270/216/350/247/204/345/210/231.md +2 -0
  19. package/docs/manual/13-/345/212/250/346/225/210/344/270/216/345/233/276/345/205/203.md +219 -1
  20. package/docs/manual/14-/350/247/206/345/233/276/344/270/216/347/255/233/351/200/211.md +3 -1
  21. package/docs/manual/15-/345/257/274/345/207/272/344/270/216/351/233/206/346/210/220.md +2 -2
  22. package/docs/manual/16-/345/256/236/344/276/213/346/226/271/346/263/225/346/200/273/350/241/250.md +2 -1
  23. package/docs/manual/17-/345/217/202/346/225/260/351/200/237/346/237/245.md +3 -1
  24. package/docs/manual/18-/351/200/220/346/226/271/346/263/225/347/244/272/344/276/213.md +8 -0
  25. package/docs/steps/selftest-demos.html +3 -3
  26. package/docs/steps/selftest-docs.html +4 -4
  27. package/docs/steps/selftest-features.html +736 -0
  28. package/docs/steps/selftest-perf.html +296 -25
  29. package/docs/steps/selftest-select.html +182 -1
  30. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -822,6 +822,225 @@ export interface GisViewEngineHeatDensity {
822
822
  /** 一次烘焙的耗时(毫秒) */
823
823
  ms: number
824
824
  }
825
+
826
+ /** 图例形态:ruler / continuous 是连续色带 + 刻度,piecewise 是分段色块 */
827
+ export type GisViewVisualMapType = 'ruler' | 'continuous' | 'piecewise'
828
+ export type GisViewVisualMapOrientation = 'vertical' | 'horizontal'
829
+ export type GisViewVisualMapPositionName = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
830
+ /** 落选值怎么处理:只退热力 / 连对应网架一起隐藏 / 不做内置效果 */
831
+ export type GisViewVisualMapOutOfRange = 'heatmap' | 'network' | 'none'
832
+ /** 图例四边定位:数字按 CSS 像素,字符串原样作为 CSS 长度(例如 '50%');缺省左下角 */
833
+ export interface GisViewVisualMapPosition {
834
+ top?: number | string
835
+ right?: number | string
836
+ bottom?: number | string
837
+ left?: number | string
838
+ }
839
+ /** 图例外层的内联样式:普通 CSS 属性或 --gis-view-visual-map-* 变量 */
840
+ export type GisViewVisualMapStyle = Record<string, string | number | null | undefined>
841
+
842
+ /** 分段图例的一段:范围写法与 ECharts 的 pieces 一致,支持 gte / gt / lte / lt / min / max */
843
+ export interface GisViewVisualMapPiece {
844
+ gte?: number
845
+ gt?: number
846
+ lte?: number
847
+ lt?: number
848
+ min?: number
849
+ max?: number
850
+ /** 自定义这一段显示的文字;不写按范围自动格式化 */
851
+ label?: string
852
+ /** 自定义这一段色块的颜色;不写按色带在区间中点的颜色取 */
853
+ color?: string
854
+ }
855
+
856
+ /** 图例 formatter 的读数:连续刻度与分段色块都会走同一份 */
857
+ export interface GisViewVisualMapFormatterInfo {
858
+ value: number
859
+ min: number
860
+ max: number
861
+ ratio: number
862
+ type: 'ruler' | 'piecewise'
863
+ target: GisViewHeatmapTarget
864
+ field: string
865
+ index?: number
866
+ piece?: GisViewVisualMapPiece
867
+ }
868
+
869
+ /** 自定义图例回调可用的读数与受控交互入口 */
870
+ export interface GisViewVisualMapRenderContext {
871
+ type: 'ruler' | 'piecewise'
872
+ target: GisViewHeatmapTarget
873
+ field: string
874
+ domain: [number, number]
875
+ colors: string[]
876
+ stops: number[] | null
877
+ opacity: number | [number, number]
878
+ orient: GisViewVisualMapOrientation
879
+ title: string
880
+ unit: string
881
+ ticks: GisViewVisualMapTick[]
882
+ pieces: GisViewVisualMapValuePiece[]
883
+ selectedMode: 'single' | 'multiple' | false
884
+ calculable: boolean
885
+ outOfRange: GisViewVisualMapOutOfRange
886
+ /** 当前选中的分段下标;连续尺恒为空数组 */
887
+ selected: number[]
888
+ /** 当前区间(数值,低值在前);未开启 calculable 时为 null */
889
+ range: [number, number] | null
890
+ /** 当前区间在色带上的比例(0 ~ 1,低比例在前) */
891
+ rangeRatios: [number, number] | null
892
+ root: HTMLElement
893
+ body: HTMLElement
894
+ titleElement: HTMLElement
895
+ /** 把 0 ~ 1 的色带比例换成数值 */
896
+ valueAt(ratio: number): number
897
+ /** 按图例的 precision / formatter / unit 格式化数值 */
898
+ formatValue(value: number): string
899
+ /** 设置分段选择;返回是否发生变化 */
900
+ setSelection(selected: number[] | Record<string, boolean>): boolean
901
+ /** 设置数值区间;返回是否发生变化 */
902
+ setRange(range: [number, number]): boolean
903
+ /** 分段图例清空选择,连续尺恢复完整区间 */
904
+ clearSelection(): boolean
905
+ /** 用当前状态主动触发 onChange */
906
+ emitChange(reason?: 'piece' | 'range' | 'api'): void
907
+ }
908
+
909
+ /** 图例交互回调:只有用户操作 / 自定义渲染主动调用时触发,受控配置更新不回声 */
910
+ export interface GisViewVisualMapChangePayload {
911
+ type: 'ruler' | 'piecewise'
912
+ target: GisViewHeatmapTarget
913
+ field: string
914
+ domain: [number, number]
915
+ interactive: boolean
916
+ selectedMode: 'single' | 'multiple' | false
917
+ calculable: boolean
918
+ outOfRange: GisViewVisualMapOutOfRange
919
+ selected: number[]
920
+ range: [number, number] | null
921
+ rangeRatios: [number, number] | null
922
+ element: HTMLElement
923
+ source: 'user' | 'api'
924
+ reason: 'piece' | 'range' | 'api'
925
+ originalEvent: Event | null
926
+ }
927
+
928
+ /**
929
+ * 图例(visualMap):参考 ECharts 的 visualMap,把热力图的色带画成带刻度的尺或分段色块。
930
+ * 配置对象本身即开关;不写时一个 DOM 节点都不产生。字段 / 值域 / 颜色默认跟随 heatmap,
931
+ * 也能在自己的配置里覆盖成一条独立图例。不写 target 时,展示值域取 heatmap 启用目标中
932
+ * 第一个能扫到数值的那一类,当前分段 / 区间却门控 heatmap 的全部启用目标(同一 field);
933
+ * 显式 target 才只作用这一类。默认继承主图热力的鹰眼图同步门控,显式 minimap.heatmap 仍独立。
934
+ * outOfRange 决定落选值是只回普通样式、连对应网架一起隐藏,还是不做内置效果;数据、筛选与分组不变。
935
+ */
936
+ export interface GisViewVisualMap {
937
+ /** 关掉这一份配置(等价于不配 visualMap) */
938
+ enabled?: boolean
939
+ /** 'ruler'(缺省,continuous 同义)连续尺 / 'piecewise' 分段色块 */
940
+ type?: GisViewVisualMapType
941
+ /**
942
+ * 展示值域使用哪一类要素:显式写只门控这一类;不写时跟随 heatmap 的全部启用目标,
943
+ * 展示值域按 point → line → channel 选第一个真正有数值的目标(都缺值时回落第一个启用目标)。
944
+ */
945
+ target?: GisViewHeatmapTarget
946
+ /** 取值字段:不写跟随 heatmap.field,没有 heatmap 时按 'value' 自动扫数据 */
947
+ field?: string
948
+ /** 显式值域 [起, 止];反向写就是颜色反向。不写 / 'auto' 按当前数据自动算 */
949
+ domain?: [number, number] | 'auto'
950
+ /** ECharts 写法的单端覆盖:只给一端时另一端仍按自动值域取 */
951
+ min?: number
952
+ max?: number
953
+ /** 渐变色(至少两段),不写跟随 heatmap.colors,最后回落到内置色带 */
954
+ colors?: string[]
955
+ /** 色标位置(0 ~ 1,与 colors 一一对应) */
956
+ stops?: number[]
957
+ /** 色带透明度,写法与 heatmap.opacity 一致 */
958
+ opacity?: number | [number, number]
959
+ title?: string
960
+ /** 每个数值后面追加的单位(自定义 formatter 时不自动追加) */
961
+ unit?: string
962
+ orient?: GisViewVisualMapOrientation
963
+ /** 四角名或四边定位对象,缺省 'bottom-left' */
964
+ position?: GisViewVisualMapPositionName | GisViewVisualMapPosition
965
+ /** 连续尺色带的宽度 / 高度(CSS 像素);横向时缺省 200 × 14,纵向时 14 × 160 */
966
+ width?: number
967
+ height?: number
968
+ /** 连续尺的刻度数,同时也是不写 pieces 时的自动分段数(2 ~ 12,缺省 5) */
969
+ tickCount?: number
970
+ /** 打开图例交互:分段可点选,连续尺默认出现可拖动的区间;当前选区会实时门控图例作用目标上同 field 的热力上色 / 光晕 / 密度;缺省 false */
971
+ interactive?: boolean
972
+ /** 落选值处理:'heatmap'(缺省,只退热力、网架回普通样式)/ 'network'(对应点 / 独立线路 / 通道从画布与拾取中隐藏,未写 target 时三类同时生效)/ 'none'(只保留 onChange) */
973
+ outOfRange?: GisViewVisualMapOutOfRange
974
+ /** 分段选择方式:single 单选 / multiple(或 true)多选;不写时 interactive 默认 multiple */
975
+ selectedMode?: 'single' | 'multiple' | boolean | null
976
+ /** 初始选中分段:下标数组,或按下标 / 标签映射的布尔对象;未选中的分段不参与图例作用目标上同 field 的热力;不写默认全选 */
977
+ selected?: number[] | Record<string, boolean> | null
978
+ /** 连续尺初始区间 [低, 高];区间外的值不参与图例作用目标上同 field 的热力;不写且 calculable 时是完整值域 */
979
+ range?: [number, number] | null
980
+ /** 连续尺是否显示可拖动的区间手柄;interactive 时缺省 true,显式 false 可关掉 */
981
+ calculable?: boolean
982
+ /** 数字固定小数位;不写按值域跨度自动选 */
983
+ precision?: number
984
+ /**
985
+ * 文字格式:函数收到数值与读数;字符串支持 {value} / {min} / {max} / {unit} / {title} / {field}
986
+ * 占位符。函数返回空串时这一项仍占位,只是不显示文字。
987
+ */
988
+ formatter?: string | ((value: number, info: GisViewVisualMapFormatterInfo) => string)
989
+ /** piecewise 的分段;不写按值域与 tickCount 等分 */
990
+ pieces?: GisViewVisualMapPiece[]
991
+ /**
992
+ * 完全自定义图例:返回 DOM 节点 / DocumentFragment / HTML 字符串,或直接往 context.body 里追加节点。
993
+ * 内置标题会隐藏;容器定位与 pointer-events 仍沿用图例根节点。
994
+ */
995
+ render?: (context: GisViewVisualMapRenderContext) => Node | string | null | void
996
+ /** 分段点选 / 区间拖动后的回调;图例自身已同步门控热力,这里用于额外业务联动;受控配置更新不会反过来触发它 */
997
+ onChange?: (payload: GisViewVisualMapChangePayload) => void
998
+ /** 挂载容器(元素或选择器),不写挂到组件根节点;选择器找不到时也回落到组件根节点 */
999
+ container?: string | HTMLElement
1000
+ /** 追加在根节点上的 class(位置 / 颜色也可以用 CSS 变量整体覆盖) */
1001
+ className?: string
1002
+ /** 直接写在这层 DOM 上的内联样式 */
1003
+ style?: GisViewVisualMapStyle
1004
+ }
1005
+
1006
+ /** 图例上一根刻度的读数 */
1007
+ export interface GisViewVisualMapTick {
1008
+ value: number
1009
+ ratio: number
1010
+ label: string
1011
+ }
1012
+
1013
+ /** 图例上一个分段的读数 */
1014
+ export interface GisViewVisualMapValuePiece {
1015
+ low: number | null
1016
+ high: number | null
1017
+ label: string
1018
+ color: string
1019
+ ratio: number
1020
+ }
1021
+
1022
+ /** getVisualMap() 的读数:值域、色带与当前显示的刻度 / 分段 */
1023
+ export interface GisViewVisualMapReadout {
1024
+ type: 'ruler' | 'piecewise'
1025
+ /** 实际用于展示值域的目标;未写 target 且前一类缺值时可能是 line / channel */
1026
+ target: GisViewHeatmapTarget
1027
+ field: string
1028
+ domain: [number, number]
1029
+ colors: string[]
1030
+ orient: GisViewVisualMapOrientation
1031
+ title: string
1032
+ unit: string
1033
+ interactive: boolean
1034
+ selectedMode: 'single' | 'multiple' | false
1035
+ calculable: boolean
1036
+ outOfRange: GisViewVisualMapOutOfRange
1037
+ selected: number[]
1038
+ range: [number, number] | null
1039
+ rangeRatios: [number, number] | null
1040
+ ticks: GisViewVisualMapTick[]
1041
+ pieces: GisViewVisualMapValuePiece[]
1042
+ }
1043
+
825
1044
  /**
826
1045
  * 线路动画(沿线跑动的图标,ECharts 的 `lines.effect` 那一类):配在 options.effects.line 上作为全局缺省,
827
1046
  * 逐条线路用 lines[].effect 覆盖它 —— `false` / `null` 关掉这一条,`true` 用全局那一份(全局没配就用缺省值),
@@ -1259,6 +1478,7 @@ export type GisViewCascadeHighlightScope = 'points' | 'both'
1259
1478
  /**
1260
1479
  * 点击级联高亮:点击节点时高亮它和直接相连的节点 / 线路,点击线路或通道时高亮这条线的两端。
1261
1480
  * 它与选中集完全分开 —— 不写 selectionKeys、不改 selected,样式也不走悬停 / 选中那一套。
1481
+ * 通过 toggleSelect / Ctrl 取反 / deselect / selectFeatures 的 remove 或清空取消选中时,级联会一起收掉。
1262
1482
  * true 等价于 { enabled: true, scope: 'both' };不配或 false 都是关闭。
1263
1483
  */
1264
1484
  export interface GisViewCascadeHighlightOptions {
@@ -6329,6 +6549,7 @@ export interface GisViewOptionChangePayload {
6329
6549
  channels: boolean
6330
6550
  filter: boolean
6331
6551
  minimap: boolean
6552
+ visualMap: boolean
6332
6553
  features: boolean
6333
6554
  quality: boolean
6334
6555
  history: boolean
@@ -6708,6 +6929,14 @@ export interface GisViewOptions {
6708
6929
  * 鹰眼图默认沿用这一份,也能用 minimap.heatmap 单独换一份或关掉
6709
6930
  */
6710
6931
  heatmap?: GisViewHeatmap | null
6932
+ /**
6933
+ * 图例:参考 ECharts visualMap,把热力图的色带画成带刻度的连续尺(ruler / continuous)或分段色块(piecewise)。
6934
+ * 不写 / null 时零 DOM;默认跟随 heatmap 的字段、自动值域与颜色,也能独立给 domain / colors。
6935
+ * 不写 target 时展示值域取第一类有数值的目标,交互选区门控 heatmap 全部启用目标上同 field 的
6936
+ * 热力上色、光晕与密度;显式 target 只门控这一类。不删除数据、不改筛选;
6937
+ * 只改图例配置仍只重画这一层,不触发引擎场景重排或标签重排
6938
+ */
6939
+ visualMap?: GisViewVisualMap | null
6711
6940
  /**
6712
6941
  * 节点标签:配了就按这个配置渲染,内容、位置、数量与显隐都可配。
6713
6942
  * 写数组就是「一个节点上显示多条标签」:数组里每一条各自有内容 / 位置 / 样式 / 显隐,
@@ -6786,7 +7015,7 @@ export interface GisViewOptions {
6786
7015
  /**
6787
7016
  * 点击级联高亮(默认关):点击节点时亮起它和直接相连的节点;scope 为 both 时连线路一起亮,
6788
7017
  * 点击线路 / 通道回线时亮起两端节点。它不进选中集,样式与悬停 / 选中分开配置,
6789
- * 当前亮起的清单用 getCascadeHighlight() 读。
7018
+ * 当前亮起的清单用 getCascadeHighlight() 读;取消选中时同步收掉,不会留下级联残影。
6790
7019
  */
6791
7020
  cascadeHighlight?: GisViewCascadeHighlightInput
6792
7021
  /** 没有配置状态样式时,是否仍用尺寸 / 宽度增幅画出内置强调;默认 false(不配样式就不改变外观) */
@@ -6887,6 +7116,17 @@ export interface GisViewOptions {
6887
7116
  * 关着时多选仍走框选(boxSelect)与按住多选快捷键(默认 Ctrl / ⌘)。
6888
7117
  */
6889
7118
  multiSelect?: boolean
7119
+ /**
7120
+ * 再次选中即取消(**缺省关**):打开后,普通点击已在选中集里的要素会把它取消;
7121
+ * Ctrl / ⌘ 先选中、再普通点击同一要素也同样取消。单击 / 双击两种 selectTrigger 都适用,
7122
+ * 双击会按一次操作处理(第一下取反、第二下保持),不会因为双击的两下连点而反复切换。
7123
+ * 命中通道回线时按 channelSelectMode 决定取消单条回线 / 当前分组 / 整条通道,其他选中项保留;
7124
+ * 该组 / 通道只选中一部分、或点到组内另一条回线时,也按同一展开范围整体取消;
7125
+ * 该组 / 通道已经完整选中时,即使 channelSelectMode 为 line 也整组 / 整条取消。
7126
+ * 这条取消路径不受 selectionKinds 限制;取消生效时同一来源的点击级联也会一起收掉。
7127
+ * 与 multiSelect 同时打开时沿用 multiSelect 的累加取反口径;运行时走 updateOptions({ toggleSelect })。
7128
+ */
7129
+ toggleSelect?: boolean
6890
7130
  /**
6891
7131
  * 选中触发方式:缺省 'click'(单击选中);写 'dblClick' 后第一次点击只派发 onClick,
6892
7132
  * 第二次(双击判定命中)才更新选中集,并同时派发 onClick 与 onDblClick。
@@ -6898,7 +7138,7 @@ export interface GisViewOptions {
6898
7138
  * 另有 'lineEndpoints' / 'channelEndpoints' 只在框选时要求线路 / 通道两端节点都在框内;
6899
7139
  * 可写数组任意组合,'all' / true 全开,false / null 全关。
6900
7140
  * **不写时保留旧行为**:框选只收节点,Ctrl / 多选点击仍可收节点与线路;
6901
- * 写了之后框选与 Ctrl / 多选点击统一按这一份过滤(普通单选与接口 select 不受限制)。
7141
+ * 写了之后框选与 Ctrl / 多选点击统一按这一份过滤(普通单选、toggleSelect 的取消与接口 select 不受限制)。
6902
7142
  * 两个端点口径只影响框选,不会因为写进同一份数组就让 Ctrl 点击去猜端点。
6903
7143
  * 运行时走 updateOptions({ selectionKinds })。
6904
7144
  */
@@ -8165,6 +8405,10 @@ export interface GisViewInstance {
8165
8405
  getIdleTime(): number
8166
8406
  /** 鹰眼图根节点(没配 minimap 时为 null):拖动整张图 / 绑定自定义手势时拿它 */
8167
8407
  getMinimapElement(): HTMLElement | null
8408
+ /** 图例根节点(没配 visualMap 或 enabled: false 时为 null) */
8409
+ getVisualMapElement(): HTMLElement | null
8410
+ /** 当前图例读数:值域、色带与刻度 / 分段;没配时为 null */
8411
+ getVisualMap(): GisViewVisualMapReadout | null
8168
8412
  /** 鹰眼图自身的倍数:1 是「刚好铺满小图」 */
8169
8413
  getMinimapZoom(): number
8170
8414
  /** 设置鹰眼图的倍数(夹在 minimap.minZoom ~ maxZoom 之间),内容重新跟着数据范围居中 */
@@ -8310,7 +8554,7 @@ export interface GisViewInstance {
8310
8554
  * `deselect({ type: 'channel', channelId: 'channel-a' })` 取消整条通道的回线。
8311
8555
  * 一个目标都不给(不传 / 传 null)等于取消全部(与 selectFeatures(null) 同一件事),
8312
8556
  * 传空数组是「没有目标」,什么都不做;认不出来的条目跳过。改变选中集时发
8313
- * onSelect 与 onSelectChange(cause: api)。
8557
+ * onSelect 与 onSelectChange(cause: api);这一次真的移除了选中项时,点击级联也一起收掉。
8314
8558
  */
8315
8559
  deselect(refs?: GisViewSelectionRefs): GisViewInstance
8316
8560
  /**
@@ -8342,7 +8586,7 @@ export interface GisViewInstance {
8342
8586
  getSelectionData(): GisViewSelectionData
8343
8587
  /**
8344
8588
  * 当前点击级联高亮的读数:来源、scope 与亮着的节点 / 线路;没有级联高亮(或功能关着)时是 null。
8345
- * 它只读,不改变选中集;点空白处、换数据或关掉 cascadeHighlight 会收掉。
8589
+ * 它只读,不改变选中集;取消选中、点空白处、换数据或关掉 cascadeHighlight 会收掉。
8346
8590
  */
8347
8591
  getCascadeHighlight(): GisViewCascadeHighlightInfo | null
8348
8592
  /** 按画布 CSS 像素矩形框选;options.selectionKinds 可临时覆盖全局类型过滤 */
@@ -9098,6 +9342,8 @@ export interface GisViewEngineOptions {
9098
9342
  boxSelect?: boolean
9099
9343
  /** 多选开关(**缺省关**):打开后不用按修饰键,直接单击要素就取反累加(与按住 shortcuts.multiSelect 点击同一套行为) */
9100
9344
  multiSelect?: boolean
9345
+ /** 再次选中即取消(**缺省关**),语义见 GisViewOptions.toggleSelect */
9346
+ toggleSelect?: boolean
9101
9347
  /** 框选 / Ctrl 多选允许的要素类型,写法与缺省口径见 GisViewOptions.selectionKinds */
9102
9348
  selectionKinds?: GisViewSelectionKindsInput
9103
9349
  selectionBoxStyle?: GisViewSelectionBoxStyle | null