@gis_victory/gismap 2.0.23 → 2.0.25
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/dist/App.vue.d.ts +2 -0
- package/dist/adapters/index.d.ts +13 -0
- package/dist/adapters/mapbox/MapboxAdapter.d.ts +44 -0
- package/dist/adapters/types.d.ts +216 -0
- package/dist/api/BaseController.d.ts +6 -0
- package/dist/api/CommonController.d.ts +51 -0
- package/dist/components/MapCompass/index.vue.d.ts +2 -0
- package/dist/components/MapContainer/index.d.ts +2 -0
- package/dist/components/MapContainer/index.vue.d.ts +344 -0
- package/dist/components/MapLayer/components/CustomLayerDialog.vue.d.ts +22 -0
- package/dist/components/MapLayer/components/LayerTab.vue.d.ts +2179 -0
- package/dist/components/MapLayer/index.d.ts +2 -0
- package/dist/components/MapLayer/index.vue.d.ts +2287 -0
- package/dist/components/MapLegend/index.d.ts +2 -0
- package/dist/components/MapLegend/index.vue.d.ts +14 -0
- package/dist/components/MapMeasure/index.vue.d.ts +2 -0
- package/dist/components/MapPrint/MapPrintPanel.vue.d.ts +21 -0
- package/dist/components/MapPrint/MapPrintService.d.ts +155 -0
- package/dist/components/MapPrint/index.vue.d.ts +37 -0
- package/dist/components/MapQueryResult/index.vue.d.ts +29 -0
- package/dist/components/MapQueryResult/popup.vue.d.ts +16 -0
- package/dist/components/MapSearch/index.d.ts +2 -0
- package/dist/components/MapSearch/index.vue.d.ts +56 -0
- package/dist/components/MapSwitch/index.d.ts +2 -0
- package/dist/components/MapSwitch/index.vue.d.ts +37 -0
- package/dist/components/MapTools/index.d.ts +2 -0
- package/dist/components/MapTools/index.vue.d.ts +40 -0
- package/dist/components/MobileMapLayer/BaseLayerSwitch.vue.d.ts +16 -0
- package/dist/components/MobileMapLayer/index.vue.d.ts +9 -0
- package/dist/components/Widgets/PopupBar/BarItem.vue.d.ts +75 -0
- package/dist/components/Widgets/PopupBar/index.vue.d.ts +21 -0
- package/dist/composables/index.d.ts +13 -0
- package/dist/composables/useControl.d.ts +39 -0
- package/dist/composables/useDraw.d.ts +49 -0
- package/dist/composables/useLayer.d.ts +57 -0
- package/dist/composables/useMap.d.ts +111 -0
- package/dist/composables/useMarker.d.ts +55 -0
- package/dist/composables/useMeasure.d.ts +49 -0
- package/dist/composables/useSearch.d.ts +20 -0
- package/dist/config/api.config.d.ts +40 -0
- package/dist/config/gismap.config.d.ts +156 -0
- package/dist/core/ManagerRegistry.d.ts +75 -0
- package/dist/core/PluginSystem.d.ts +71 -0
- package/dist/core/StateStore.d.ts +96 -0
- package/dist/core/TypedEventEmitter.d.ts +67 -0
- package/dist/core/di/Container.d.ts +61 -0
- package/dist/core/di/decorators.d.ts +32 -0
- package/dist/core/di/index.d.ts +7 -0
- package/dist/core/di/types.d.ts +59 -0
- package/dist/core/event/EventBus.d.ts +101 -0
- package/dist/core/event/index.d.ts +5 -0
- package/dist/core/event/types.d.ts +215 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/state/Store.d.ts +145 -0
- package/dist/core/state/index.d.ts +6 -0
- package/dist/core/state/types.d.ts +134 -0
- package/dist/domain/index.d.ts +8 -0
- package/dist/domain/layer/LayerEntity.d.ts +90 -0
- package/dist/domain/layer/LayerService.d.ts +128 -0
- package/dist/domain/marker/MarkerEntity.d.ts +77 -0
- package/dist/domain/marker/MarkerService.d.ts +105 -0
- package/dist/domain/types.d.ts +66 -0
- package/dist/examples/DrawDemo.vue.d.ts +2 -0
- package/dist/examples/DrawPanel.vue.d.ts +2 -0
- package/dist/examples/Map.vue.d.ts +74 -0
- package/dist/examples/MapDemoExample.vue.d.ts +2 -0
- package/dist/examples/MeasureDemo.vue.d.ts +2 -0
- package/dist/examples/MeasurePanel.vue.d.ts +2 -0
- package/dist/examples/SplitScreenDrawDemo.vue.d.ts +7 -0
- package/dist/examples/SplitScreenDrawPanel.vue.d.ts +12 -0
- package/dist/examples/SplitScreenPanel.vue.d.ts +12 -0
- package/dist/examples/TdtControlPanel.vue.d.ts +2 -0
- package/dist/examples/TiandituDemo.vue.d.ts +2 -0
- package/dist/gismap.css +1 -1
- package/dist/index.es.js +1 -1
- package/dist/main.d.ts +0 -0
- package/dist/manager/IconManager.d.ts +18 -0
- package/dist/manager/LayerManager.d.ts +50 -0
- package/dist/manager/MaskManager.d.ts +52 -0
- package/dist/manager/PlaceholderManager.d.ts +28 -0
- package/dist/manager/PopupManager.d.ts +13 -0
- package/dist/manager/QuickSearchManager.d.ts +24 -0
- package/dist/manager/RadarManager.d.ts +46 -0
- package/dist/manager/SplitScreenDrawManager.d.ts +75 -0
- package/dist/manager/SplitScreenManager.d.ts +81 -0
- package/dist/manager/TDTManager.d.ts +33 -0
- package/dist/manager/TemplateManager.d.ts +52 -0
- package/dist/manager/TerrainManager.d.ts +39 -0
- package/dist/manager/layer/MarkerLayer.d.ts +89 -0
- package/dist/manager/layer/VectorLayer.d.ts +30 -0
- package/dist/manager/mapbox/DrawManager.d.ts +153 -0
- package/dist/manager/mapbox/MeasureManager.d.ts +158 -0
- package/dist/router/index.d.ts +2 -0
- package/dist/services/MapContext.d.ts +171 -0
- package/dist/services/index.d.ts +5 -0
- package/dist/types/IEvents.d.ts +178 -0
- package/dist/types/IGISMap.d.ts +234 -0
- package/dist/types/IManager.d.ts +113 -0
- package/dist/types/IMapSearch.d.ts +28 -0
- package/dist/types/IState.d.ts +259 -0
- package/dist/types/ITemplate.d.ts +35 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/utils/hooks/layout.d.ts +4 -0
- package/dist/utils/http/axios.d.ts +3 -0
- package/dist/utils/http/config.d.ts +3 -0
- package/dist/utils/http/request.d.ts +46 -0
- package/dist/utils/index.d.ts +49 -0
- package/package.json +1 -1
- package/dist/index.umd.js +0 -1
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { StateListener, StateSelector, IStateStore, ITimeTravelStore, IPersistableStore } from './types';
|
|
2
|
+
/** 状态存储配置 */
|
|
3
|
+
export interface StoreOptions<T> {
|
|
4
|
+
/** 初始状态 */
|
|
5
|
+
initialState: T;
|
|
6
|
+
/** 状态名称(用于调试) */
|
|
7
|
+
name?: string;
|
|
8
|
+
/** 启用严格模式(只允许通过 setState 修改) */
|
|
9
|
+
strict?: boolean;
|
|
10
|
+
}
|
|
11
|
+
/** 基础状态存储 */
|
|
12
|
+
export declare class Store<T extends Record<string, any>> implements IStateStore<T> {
|
|
13
|
+
protected state: T;
|
|
14
|
+
protected listeners: Set<StateListener<T>>;
|
|
15
|
+
protected name: string;
|
|
16
|
+
protected strict: boolean;
|
|
17
|
+
protected disposed: boolean;
|
|
18
|
+
constructor(options: StoreOptions<T>);
|
|
19
|
+
/**
|
|
20
|
+
* 获取当前状态
|
|
21
|
+
*/
|
|
22
|
+
getState(): T;
|
|
23
|
+
/**
|
|
24
|
+
* 获取特定键的值
|
|
25
|
+
*/
|
|
26
|
+
get<K extends keyof T>(key: K): T[K];
|
|
27
|
+
/**
|
|
28
|
+
* 更新状态
|
|
29
|
+
*/
|
|
30
|
+
setState(partial: Partial<T>): void;
|
|
31
|
+
/**
|
|
32
|
+
* 设置特定键的值
|
|
33
|
+
*/
|
|
34
|
+
set<K extends keyof T>(key: K, value: T[K]): void;
|
|
35
|
+
/**
|
|
36
|
+
* 订阅状态变化
|
|
37
|
+
*/
|
|
38
|
+
subscribe(listener: StateListener<T>): () => void;
|
|
39
|
+
/**
|
|
40
|
+
* 订阅特定键的变化
|
|
41
|
+
*/
|
|
42
|
+
subscribeKey<K extends keyof T>(key: K, listener: (value: T[K], prevValue: T[K]) => void): () => void;
|
|
43
|
+
/**
|
|
44
|
+
* 使用选择器获取值
|
|
45
|
+
*/
|
|
46
|
+
select<R>(selector: StateSelector<T, R>): R;
|
|
47
|
+
/**
|
|
48
|
+
* 重置状态
|
|
49
|
+
*/
|
|
50
|
+
reset(): void;
|
|
51
|
+
/**
|
|
52
|
+
* 销毁
|
|
53
|
+
*/
|
|
54
|
+
dispose(): void;
|
|
55
|
+
/**
|
|
56
|
+
* 通知监听器
|
|
57
|
+
*/
|
|
58
|
+
protected notifyListeners(prevState: T): void;
|
|
59
|
+
/**
|
|
60
|
+
* 浅比较两个状态
|
|
61
|
+
*/
|
|
62
|
+
protected isEqual(a: T, b: T): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 确保未销毁
|
|
65
|
+
*/
|
|
66
|
+
protected ensureNotDisposed(): void;
|
|
67
|
+
}
|
|
68
|
+
/** 支持时间旅行的状态存储 */
|
|
69
|
+
export declare class TimeTravelStore<T extends Record<string, any>> extends Store<T> implements ITimeTravelStore<T> {
|
|
70
|
+
private history;
|
|
71
|
+
private future;
|
|
72
|
+
private maxHistorySize;
|
|
73
|
+
private isRestoring;
|
|
74
|
+
constructor(options: StoreOptions<T> & {
|
|
75
|
+
maxHistorySize?: number;
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* 撤销
|
|
79
|
+
*/
|
|
80
|
+
undo(): void;
|
|
81
|
+
/**
|
|
82
|
+
* 重做
|
|
83
|
+
*/
|
|
84
|
+
redo(): void;
|
|
85
|
+
/**
|
|
86
|
+
* 是否可以撤销
|
|
87
|
+
*/
|
|
88
|
+
canUndo(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* 是否可以重做
|
|
91
|
+
*/
|
|
92
|
+
canRedo(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* 清空历史
|
|
95
|
+
*/
|
|
96
|
+
clearHistory(): void;
|
|
97
|
+
/**
|
|
98
|
+
* 获取历史大小
|
|
99
|
+
*/
|
|
100
|
+
getHistorySize(): number;
|
|
101
|
+
/**
|
|
102
|
+
* 重置状态
|
|
103
|
+
*/
|
|
104
|
+
reset(): void;
|
|
105
|
+
/**
|
|
106
|
+
* 更新状态(重写以支持历史记录)
|
|
107
|
+
*/
|
|
108
|
+
setState(partial: Partial<T>): void;
|
|
109
|
+
}
|
|
110
|
+
/** 支持持久化的状态存储 */
|
|
111
|
+
export declare class PersistableStore<T extends Record<string, any>> extends Store<T> implements IPersistableStore<T> {
|
|
112
|
+
readonly storageKey: string;
|
|
113
|
+
private storage;
|
|
114
|
+
constructor(options: StoreOptions<T> & {
|
|
115
|
+
storageKey: string;
|
|
116
|
+
storage?: Storage;
|
|
117
|
+
});
|
|
118
|
+
/**
|
|
119
|
+
* 持久化状态
|
|
120
|
+
*/
|
|
121
|
+
persist(): void;
|
|
122
|
+
/**
|
|
123
|
+
* 从存储恢复
|
|
124
|
+
*/
|
|
125
|
+
restore(): void;
|
|
126
|
+
/**
|
|
127
|
+
* 清除持久化数据
|
|
128
|
+
*/
|
|
129
|
+
clearPersisted(): void;
|
|
130
|
+
/**
|
|
131
|
+
* 重置状态
|
|
132
|
+
*/
|
|
133
|
+
reset(): void;
|
|
134
|
+
}
|
|
135
|
+
/** 创建状态存储 */
|
|
136
|
+
export declare function createStore<T extends Record<string, any>>(options: StoreOptions<T>): Store<T>;
|
|
137
|
+
/** 创建支持时间旅行的状态存储 */
|
|
138
|
+
export declare function createTimeTravelStore<T extends Record<string, any>>(options: StoreOptions<T> & {
|
|
139
|
+
maxHistorySize?: number;
|
|
140
|
+
}): TimeTravelStore<T>;
|
|
141
|
+
/** 创建支持持久化的状态存储 */
|
|
142
|
+
export declare function createPersistableStore<T extends Record<string, any>>(options: StoreOptions<T> & {
|
|
143
|
+
storageKey: string;
|
|
144
|
+
storage?: Storage;
|
|
145
|
+
}): PersistableStore<T>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 状态管理模块统一导出
|
|
3
|
+
*/
|
|
4
|
+
export { Store, TimeTravelStore, PersistableStore, createStore, createTimeTravelStore, createPersistableStore, } from './Store';
|
|
5
|
+
export type { StateListener, StateSelector, StateMutation, IStateStore, ITimeTravelStore, IPersistableStore, ViewState, LayerState, MarkerState, PopupState, SourceState, MapState, } from './types';
|
|
6
|
+
export { DEFAULT_VIEW_STATE, createDefaultMapState } from './types';
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { LngLat, Style } from '@gis_victory/mapbox-gl';
|
|
2
|
+
/** 状态变更监听器 */
|
|
3
|
+
export type StateListener<T> = (state: T, prevState: T) => void;
|
|
4
|
+
/** 选择器函数 */
|
|
5
|
+
export type StateSelector<T, R> = (state: T) => R;
|
|
6
|
+
/** 状态变更描述 */
|
|
7
|
+
export interface StateMutation<T = any> {
|
|
8
|
+
type: string;
|
|
9
|
+
payload: T;
|
|
10
|
+
timestamp: number;
|
|
11
|
+
}
|
|
12
|
+
/** 状态存储接口 */
|
|
13
|
+
export interface IStateStore<T extends Record<string, any> = Record<string, any>> {
|
|
14
|
+
/** 获取当前状态 */
|
|
15
|
+
getState(): T;
|
|
16
|
+
/** 获取部分状态 */
|
|
17
|
+
get<K extends keyof T>(key: K): T[K];
|
|
18
|
+
/** 更新状态 */
|
|
19
|
+
setState(partial: Partial<T>): void;
|
|
20
|
+
/** 设置特定键值 */
|
|
21
|
+
set<K extends keyof T>(key: K, value: T[K]): void;
|
|
22
|
+
/** 订阅状态变化 */
|
|
23
|
+
subscribe(listener: StateListener<T>): () => void;
|
|
24
|
+
/** 订阅特定键的变化 */
|
|
25
|
+
subscribeKey<K extends keyof T>(key: K, listener: (value: T[K], prevValue: T[K]) => void): () => void;
|
|
26
|
+
/** 使用选择器订阅 */
|
|
27
|
+
select<R>(selector: StateSelector<T, R>): R;
|
|
28
|
+
/** 重置状态 */
|
|
29
|
+
reset(): void;
|
|
30
|
+
/** 销毁 */
|
|
31
|
+
dispose(): void;
|
|
32
|
+
}
|
|
33
|
+
/** 可时间旅行的状态存储 */
|
|
34
|
+
export interface ITimeTravelStore<T extends Record<string, any> = Record<string, any>> extends IStateStore<T> {
|
|
35
|
+
/** 撤销 */
|
|
36
|
+
undo(): void;
|
|
37
|
+
/** 重做 */
|
|
38
|
+
redo(): void;
|
|
39
|
+
/** 是否可以撤销 */
|
|
40
|
+
canUndo(): boolean;
|
|
41
|
+
/** 是否可以重做 */
|
|
42
|
+
canRedo(): boolean;
|
|
43
|
+
/** 清空历史 */
|
|
44
|
+
clearHistory(): void;
|
|
45
|
+
/** 获取历史长度 */
|
|
46
|
+
getHistorySize(): number;
|
|
47
|
+
}
|
|
48
|
+
/** 可持久化的状态存储 */
|
|
49
|
+
export interface IPersistableStore<T extends Record<string, any> = Record<string, any>> extends IStateStore<T> {
|
|
50
|
+
/** 持久化键 */
|
|
51
|
+
readonly storageKey: string;
|
|
52
|
+
/** 保存到存储 */
|
|
53
|
+
persist(): void;
|
|
54
|
+
/** 从存储恢复 */
|
|
55
|
+
restore(): void;
|
|
56
|
+
/** 清除持久化数据 */
|
|
57
|
+
clearPersisted(): void;
|
|
58
|
+
}
|
|
59
|
+
/** 视图状态 */
|
|
60
|
+
export interface ViewState {
|
|
61
|
+
center: LngLat;
|
|
62
|
+
zoom: number;
|
|
63
|
+
pitch: number;
|
|
64
|
+
bearing: number;
|
|
65
|
+
padding?: any;
|
|
66
|
+
}
|
|
67
|
+
/** 图层状态 */
|
|
68
|
+
export interface LayerState {
|
|
69
|
+
id: string;
|
|
70
|
+
type: string;
|
|
71
|
+
visible: boolean;
|
|
72
|
+
opacity: number;
|
|
73
|
+
minzoom?: number;
|
|
74
|
+
maxzoom?: number;
|
|
75
|
+
metadata?: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
/** 标记状态 */
|
|
78
|
+
export interface MarkerState {
|
|
79
|
+
id: string;
|
|
80
|
+
position: LngLat;
|
|
81
|
+
visible: boolean;
|
|
82
|
+
draggable?: boolean;
|
|
83
|
+
metadata?: Record<string, any>;
|
|
84
|
+
}
|
|
85
|
+
/** 弹窗状态 */
|
|
86
|
+
export interface PopupState {
|
|
87
|
+
id: string;
|
|
88
|
+
position: LngLat;
|
|
89
|
+
visible: boolean;
|
|
90
|
+
content?: string;
|
|
91
|
+
metadata?: Record<string, any>;
|
|
92
|
+
}
|
|
93
|
+
/** 数据源状态 */
|
|
94
|
+
export interface SourceState {
|
|
95
|
+
id: string;
|
|
96
|
+
type: 'geojson' | 'vector' | 'raster' | 'raster-dem' | 'image' | 'video';
|
|
97
|
+
loaded: boolean;
|
|
98
|
+
}
|
|
99
|
+
/** 完整地图状态 */
|
|
100
|
+
export interface MapState {
|
|
101
|
+
/** 视图状态 */
|
|
102
|
+
view: ViewState;
|
|
103
|
+
/** 图层状态映射 */
|
|
104
|
+
layers: Map<string, LayerState>;
|
|
105
|
+
/** 标记状态映射 */
|
|
106
|
+
markers: Map<string, MarkerState>;
|
|
107
|
+
/** 弹窗状态映射 */
|
|
108
|
+
popups: Map<string, PopupState>;
|
|
109
|
+
/** 数据源状态映射 */
|
|
110
|
+
sources: Map<string, SourceState>;
|
|
111
|
+
/** 当前激活的弹窗ID */
|
|
112
|
+
activePopupId: string | null;
|
|
113
|
+
/** 选中的要素 */
|
|
114
|
+
selectedFeatures: any[];
|
|
115
|
+
/** 地图是否加载完成 */
|
|
116
|
+
loaded: boolean;
|
|
117
|
+
/** 地图是否就绪 */
|
|
118
|
+
ready: boolean;
|
|
119
|
+
/** 当前样式 */
|
|
120
|
+
style: Style | null;
|
|
121
|
+
/** 容器元素 */
|
|
122
|
+
container: HTMLElement | null;
|
|
123
|
+
/** 交互状态 */
|
|
124
|
+
interaction: {
|
|
125
|
+
isDragging: boolean;
|
|
126
|
+
isZooming: boolean;
|
|
127
|
+
isRotating: boolean;
|
|
128
|
+
cursor: string;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
/** 默认视图状态 */
|
|
132
|
+
export declare const DEFAULT_VIEW_STATE: ViewState;
|
|
133
|
+
/** 创建默认地图状态 */
|
|
134
|
+
export declare function createDefaultMapState(): MapState;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { IEntity, IVisible, IConfigurable, EntityId } from '../types';
|
|
2
|
+
/** 图层类型 */
|
|
3
|
+
export type LayerType = 'background' | 'fill' | 'line' | 'symbol' | 'raster' | 'circle' | 'fill-extrusion' | 'heatmap' | 'hillshade' | 'sky' | 'model';
|
|
4
|
+
/** 数据源类型 */
|
|
5
|
+
export type SourceType = 'geojson' | 'vector' | 'raster' | 'raster-dem' | 'image' | 'video';
|
|
6
|
+
/** 图层配置 */
|
|
7
|
+
export interface LayerConfig {
|
|
8
|
+
id?: EntityId;
|
|
9
|
+
type: LayerType;
|
|
10
|
+
source?: string | SourceConfig;
|
|
11
|
+
sourceLayer?: string;
|
|
12
|
+
minzoom?: number;
|
|
13
|
+
maxzoom?: number;
|
|
14
|
+
layout?: Record<string, any>;
|
|
15
|
+
paint?: Record<string, any>;
|
|
16
|
+
filter?: any[];
|
|
17
|
+
metadata?: Record<string, any>;
|
|
18
|
+
beforeId?: string;
|
|
19
|
+
}
|
|
20
|
+
/** 数据源配置 */
|
|
21
|
+
export interface SourceConfig {
|
|
22
|
+
id?: EntityId;
|
|
23
|
+
type: SourceType;
|
|
24
|
+
data?: any;
|
|
25
|
+
url?: string;
|
|
26
|
+
tiles?: string[];
|
|
27
|
+
tileSize?: number;
|
|
28
|
+
minzoom?: number;
|
|
29
|
+
maxzoom?: number;
|
|
30
|
+
bounds?: [number, number, number, number];
|
|
31
|
+
scheme?: 'xyz' | 'tms';
|
|
32
|
+
attribution?: string;
|
|
33
|
+
}
|
|
34
|
+
/** 图层实体 */
|
|
35
|
+
export declare class LayerEntity implements IEntity, IVisible, IConfigurable<LayerConfig> {
|
|
36
|
+
readonly id: EntityId;
|
|
37
|
+
readonly type: LayerType;
|
|
38
|
+
private _visible;
|
|
39
|
+
private _opacity;
|
|
40
|
+
private _config;
|
|
41
|
+
private _source?;
|
|
42
|
+
private _metadata;
|
|
43
|
+
constructor(config: LayerConfig);
|
|
44
|
+
get visible(): boolean;
|
|
45
|
+
show(): void;
|
|
46
|
+
hide(): void;
|
|
47
|
+
toggle(): boolean;
|
|
48
|
+
get opacity(): number;
|
|
49
|
+
setOpacity(value: number): void;
|
|
50
|
+
get config(): LayerConfig;
|
|
51
|
+
updateConfig(updates: Partial<LayerConfig>): void;
|
|
52
|
+
get source(): SourceConfig | undefined;
|
|
53
|
+
setSource(source: SourceConfig): void;
|
|
54
|
+
get sourceId(): string | undefined;
|
|
55
|
+
get minzoom(): number | undefined;
|
|
56
|
+
get maxzoom(): number | undefined;
|
|
57
|
+
isVisibleAtZoom(zoom: number): boolean;
|
|
58
|
+
setMetadata(key: string, value: any): void;
|
|
59
|
+
getMetadata(key: string): any;
|
|
60
|
+
toJSON(): Record<string, any>;
|
|
61
|
+
/**
|
|
62
|
+
* 从 JSON 创建实例
|
|
63
|
+
*/
|
|
64
|
+
static fromJSON(json: Record<string, any>): LayerEntity;
|
|
65
|
+
/**
|
|
66
|
+
* 克隆图层
|
|
67
|
+
*/
|
|
68
|
+
clone(newId?: string): LayerEntity;
|
|
69
|
+
}
|
|
70
|
+
/** 图层组 */
|
|
71
|
+
export declare class LayerGroup {
|
|
72
|
+
readonly id: EntityId;
|
|
73
|
+
name: string;
|
|
74
|
+
private layers;
|
|
75
|
+
private _visible;
|
|
76
|
+
private _expanded;
|
|
77
|
+
constructor(id?: EntityId, name?: string);
|
|
78
|
+
get visible(): boolean;
|
|
79
|
+
show(): void;
|
|
80
|
+
hide(): void;
|
|
81
|
+
get expanded(): boolean;
|
|
82
|
+
expand(): void;
|
|
83
|
+
collapse(): void;
|
|
84
|
+
addLayer(layer: LayerEntity): void;
|
|
85
|
+
removeLayer(layerId: EntityId): boolean;
|
|
86
|
+
getLayer(layerId: EntityId): LayerEntity | undefined;
|
|
87
|
+
getLayers(): LayerEntity[];
|
|
88
|
+
hasLayer(layerId: EntityId): boolean;
|
|
89
|
+
clear(): void;
|
|
90
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { IDomainService, EntityId } from '../types';
|
|
2
|
+
import { LayerEntity, LayerGroup, LayerConfig, SourceConfig } from './LayerEntity';
|
|
3
|
+
import { IEventBus, CoreMapEvents } from '../../core/event';
|
|
4
|
+
import { IStateStore, MapState } from '../../core/state';
|
|
5
|
+
/** 图层服务配置 */
|
|
6
|
+
export interface LayerServiceConfig {
|
|
7
|
+
eventBus: IEventBus<CoreMapEvents>;
|
|
8
|
+
stateStore: IStateStore<MapState>;
|
|
9
|
+
}
|
|
10
|
+
/** 图层领域服务 */
|
|
11
|
+
export declare class LayerService implements IDomainService {
|
|
12
|
+
private layers;
|
|
13
|
+
private groups;
|
|
14
|
+
private sources;
|
|
15
|
+
private layerOrder;
|
|
16
|
+
private eventBus;
|
|
17
|
+
private stateStore;
|
|
18
|
+
private initialized;
|
|
19
|
+
constructor(config: LayerServiceConfig);
|
|
20
|
+
initialize(): void;
|
|
21
|
+
dispose(): void;
|
|
22
|
+
/**
|
|
23
|
+
* 添加图层
|
|
24
|
+
*/
|
|
25
|
+
addLayer(config: LayerConfig, beforeId?: string): LayerEntity;
|
|
26
|
+
/**
|
|
27
|
+
* 移除图层
|
|
28
|
+
*/
|
|
29
|
+
removeLayer(layerId: EntityId): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 获取图层
|
|
32
|
+
*/
|
|
33
|
+
getLayer(layerId: EntityId): LayerEntity | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* 获取所有图层
|
|
36
|
+
*/
|
|
37
|
+
getLayers(): LayerEntity[];
|
|
38
|
+
/**
|
|
39
|
+
* 检查图层是否存在
|
|
40
|
+
*/
|
|
41
|
+
hasLayer(layerId: EntityId): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* 更新图层
|
|
44
|
+
*/
|
|
45
|
+
updateLayer(layerId: EntityId, updates: Partial<LayerConfig>): LayerEntity;
|
|
46
|
+
/**
|
|
47
|
+
* 显示图层
|
|
48
|
+
*/
|
|
49
|
+
showLayer(layerId: EntityId): void;
|
|
50
|
+
/**
|
|
51
|
+
* 隐藏图层
|
|
52
|
+
*/
|
|
53
|
+
hideLayer(layerId: EntityId): void;
|
|
54
|
+
/**
|
|
55
|
+
* 切换图层可见性
|
|
56
|
+
*/
|
|
57
|
+
toggleLayer(layerId: EntityId): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* 设置图层透明度
|
|
60
|
+
*/
|
|
61
|
+
setLayerOpacity(layerId: EntityId, opacity: number): void;
|
|
62
|
+
/**
|
|
63
|
+
* 创建图层组
|
|
64
|
+
*/
|
|
65
|
+
createGroup(name: string, id?: EntityId): LayerGroup;
|
|
66
|
+
/**
|
|
67
|
+
* 获取图层组
|
|
68
|
+
*/
|
|
69
|
+
getGroup(groupId: EntityId): LayerGroup | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* 删除图层组
|
|
72
|
+
*/
|
|
73
|
+
removeGroup(groupId: EntityId): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* 添加图层到组
|
|
76
|
+
*/
|
|
77
|
+
addLayerToGroup(layerId: EntityId, groupId: EntityId): void;
|
|
78
|
+
/**
|
|
79
|
+
* 注册数据源
|
|
80
|
+
*/
|
|
81
|
+
registerSource(source: SourceConfig): void;
|
|
82
|
+
/**
|
|
83
|
+
* 添加数据源
|
|
84
|
+
*/
|
|
85
|
+
addSource(source: SourceConfig): void;
|
|
86
|
+
/**
|
|
87
|
+
* 获取数据源
|
|
88
|
+
*/
|
|
89
|
+
getSource(sourceId: EntityId): SourceConfig | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* 移除数据源
|
|
92
|
+
*/
|
|
93
|
+
removeSource(sourceId: EntityId): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* 移动图层到指定位置
|
|
96
|
+
*/
|
|
97
|
+
moveLayer(layerId: EntityId, beforeId?: string): void;
|
|
98
|
+
/**
|
|
99
|
+
* 获取图层顺序
|
|
100
|
+
*/
|
|
101
|
+
getLayerOrder(): EntityId[];
|
|
102
|
+
/**
|
|
103
|
+
* 根据类型获取图层
|
|
104
|
+
*/
|
|
105
|
+
getLayersByType(type: string): LayerEntity[];
|
|
106
|
+
/**
|
|
107
|
+
* 获取可见图层
|
|
108
|
+
*/
|
|
109
|
+
getVisibleLayers(): LayerEntity[];
|
|
110
|
+
/**
|
|
111
|
+
* 获取可查询的图层
|
|
112
|
+
*/
|
|
113
|
+
getQueryableLayers(): LayerEntity[];
|
|
114
|
+
/**
|
|
115
|
+
* 显示所有图层
|
|
116
|
+
*/
|
|
117
|
+
showAll(): void;
|
|
118
|
+
/**
|
|
119
|
+
* 隐藏所有图层
|
|
120
|
+
*/
|
|
121
|
+
hideAll(): void;
|
|
122
|
+
/**
|
|
123
|
+
* 移除所有图层
|
|
124
|
+
*/
|
|
125
|
+
removeAll(): void;
|
|
126
|
+
private updateState;
|
|
127
|
+
private syncFromState;
|
|
128
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { IEntity, IVisible, IConfigurable, EntityId, GeoCoordinate } from '../types';
|
|
2
|
+
import { LngLat } from '@gis_victory/mapbox-gl';
|
|
3
|
+
/** 标记锚点位置 */
|
|
4
|
+
export type MarkerAnchor = 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
5
|
+
/** 标记配置 */
|
|
6
|
+
export interface MarkerConfig {
|
|
7
|
+
id?: EntityId;
|
|
8
|
+
position: GeoCoordinate | [number, number] | LngLat;
|
|
9
|
+
element?: HTMLElement;
|
|
10
|
+
html?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
iconName?: string;
|
|
13
|
+
iconUrl?: string;
|
|
14
|
+
offset?: [number, number];
|
|
15
|
+
anchor?: MarkerAnchor;
|
|
16
|
+
rotation?: number;
|
|
17
|
+
rotationAlignment?: 'map' | 'viewport' | 'auto';
|
|
18
|
+
pitchAlignment?: 'map' | 'viewport' | 'auto';
|
|
19
|
+
draggable?: boolean;
|
|
20
|
+
scale?: number;
|
|
21
|
+
color?: string;
|
|
22
|
+
popup?: PopupConfig;
|
|
23
|
+
metadata?: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
/** 弹窗配置 */
|
|
26
|
+
export interface PopupConfig {
|
|
27
|
+
id?: EntityId;
|
|
28
|
+
content?: string | HTMLElement;
|
|
29
|
+
html?: string;
|
|
30
|
+
closeButton?: boolean;
|
|
31
|
+
closeOnClick?: boolean;
|
|
32
|
+
closeOnMove?: boolean;
|
|
33
|
+
maxWidth?: string;
|
|
34
|
+
anchor?: MarkerAnchor;
|
|
35
|
+
offset?: number | [number, number];
|
|
36
|
+
}
|
|
37
|
+
/** 标记实体 */
|
|
38
|
+
export declare class MarkerEntity implements IEntity, IVisible, IConfigurable<MarkerConfig> {
|
|
39
|
+
readonly id: EntityId;
|
|
40
|
+
private _position;
|
|
41
|
+
private _visible;
|
|
42
|
+
private _config;
|
|
43
|
+
private _draggable;
|
|
44
|
+
private _dragging;
|
|
45
|
+
private _popup?;
|
|
46
|
+
private _popupVisible;
|
|
47
|
+
private _metadata;
|
|
48
|
+
constructor(config: MarkerConfig);
|
|
49
|
+
get position(): GeoCoordinate;
|
|
50
|
+
setPosition(position: GeoCoordinate | [number, number] | LngLat): void;
|
|
51
|
+
get lngLat(): [number, number];
|
|
52
|
+
get visible(): boolean;
|
|
53
|
+
show(): void;
|
|
54
|
+
hide(): void;
|
|
55
|
+
toggle(): boolean;
|
|
56
|
+
get draggable(): boolean;
|
|
57
|
+
setDraggable(value: boolean): void;
|
|
58
|
+
get dragging(): boolean;
|
|
59
|
+
startDrag(): void;
|
|
60
|
+
endDrag(): void;
|
|
61
|
+
get popup(): PopupConfig | undefined;
|
|
62
|
+
setPopup(config: PopupConfig): void;
|
|
63
|
+
get popupVisible(): boolean;
|
|
64
|
+
openPopup(): void;
|
|
65
|
+
closePopup(): void;
|
|
66
|
+
togglePopup(): boolean;
|
|
67
|
+
get config(): MarkerConfig;
|
|
68
|
+
updateConfig(updates: Partial<MarkerConfig>): void;
|
|
69
|
+
setMetadata(key: string, value: any): void;
|
|
70
|
+
getMetadata(key: string): any;
|
|
71
|
+
toJSON(): Record<string, any>;
|
|
72
|
+
/**
|
|
73
|
+
* 从 JSON 创建实例
|
|
74
|
+
*/
|
|
75
|
+
static fromJSON(json: Record<string, any>): MarkerEntity;
|
|
76
|
+
private normalizePosition;
|
|
77
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { IDomainService, EntityId } from '../types';
|
|
2
|
+
import { MarkerEntity, MarkerConfig } from './MarkerEntity';
|
|
3
|
+
import { IEventBus, CoreMapEvents } from '../../core/event';
|
|
4
|
+
import { IStateStore, MapState } from '../../core/state';
|
|
5
|
+
/** 标记服务配置 */
|
|
6
|
+
export interface MarkerServiceConfig {
|
|
7
|
+
eventBus: IEventBus<CoreMapEvents>;
|
|
8
|
+
stateStore: IStateStore<MapState>;
|
|
9
|
+
}
|
|
10
|
+
/** 标记领域服务 */
|
|
11
|
+
export declare class MarkerService implements IDomainService {
|
|
12
|
+
private markers;
|
|
13
|
+
private eventBus;
|
|
14
|
+
private stateStore;
|
|
15
|
+
private initialized;
|
|
16
|
+
constructor(config: MarkerServiceConfig);
|
|
17
|
+
initialize(): void;
|
|
18
|
+
dispose(): void;
|
|
19
|
+
/**
|
|
20
|
+
* 添加标记
|
|
21
|
+
*/
|
|
22
|
+
addMarker(config: MarkerConfig): MarkerEntity;
|
|
23
|
+
/**
|
|
24
|
+
* 移除标记
|
|
25
|
+
*/
|
|
26
|
+
removeMarker(markerId: EntityId): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 获取标记
|
|
29
|
+
*/
|
|
30
|
+
getMarker(markerId: EntityId): MarkerEntity | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* 获取所有标记
|
|
33
|
+
*/
|
|
34
|
+
getMarkers(): MarkerEntity[];
|
|
35
|
+
/**
|
|
36
|
+
* 检查标记是否存在
|
|
37
|
+
*/
|
|
38
|
+
hasMarker(markerId: EntityId): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 更新标记
|
|
41
|
+
*/
|
|
42
|
+
updateMarker(markerId: EntityId, updates: Partial<MarkerConfig>): MarkerEntity;
|
|
43
|
+
/**
|
|
44
|
+
* 设置标记位置
|
|
45
|
+
*/
|
|
46
|
+
setPosition(markerId: EntityId, position: [number, number]): void;
|
|
47
|
+
/**
|
|
48
|
+
* 移动标记(带动画)
|
|
49
|
+
*/
|
|
50
|
+
moveMarker(markerId: EntityId, position: [number, number], _animate?: boolean): void;
|
|
51
|
+
/**
|
|
52
|
+
* 显示标记
|
|
53
|
+
*/
|
|
54
|
+
showMarker(markerId: EntityId): void;
|
|
55
|
+
/**
|
|
56
|
+
* 隐藏标记
|
|
57
|
+
*/
|
|
58
|
+
hideMarker(markerId: EntityId): void;
|
|
59
|
+
/**
|
|
60
|
+
* 切换标记可见性
|
|
61
|
+
*/
|
|
62
|
+
toggleMarker(markerId: EntityId): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* 打开标记弹窗
|
|
65
|
+
*/
|
|
66
|
+
openPopup(markerId: EntityId): void;
|
|
67
|
+
/**
|
|
68
|
+
* 关闭标记弹窗
|
|
69
|
+
*/
|
|
70
|
+
closePopup(markerId: EntityId): void;
|
|
71
|
+
/**
|
|
72
|
+
* 切换弹窗
|
|
73
|
+
*/
|
|
74
|
+
togglePopup(markerId: EntityId): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* 设置标记可拖拽
|
|
77
|
+
*/
|
|
78
|
+
setDraggable(markerId: EntityId, draggable: boolean): void;
|
|
79
|
+
/**
|
|
80
|
+
* 开始拖拽
|
|
81
|
+
*/
|
|
82
|
+
startDrag(markerId: EntityId): void;
|
|
83
|
+
/**
|
|
84
|
+
* 结束拖拽
|
|
85
|
+
*/
|
|
86
|
+
endDrag(markerId: EntityId): void;
|
|
87
|
+
/**
|
|
88
|
+
* 显示所有标记
|
|
89
|
+
*/
|
|
90
|
+
showAll(): void;
|
|
91
|
+
/**
|
|
92
|
+
* 隐藏所有标记
|
|
93
|
+
*/
|
|
94
|
+
hideAll(): void;
|
|
95
|
+
/**
|
|
96
|
+
* 移除所有标记
|
|
97
|
+
*/
|
|
98
|
+
removeAll(): void;
|
|
99
|
+
/**
|
|
100
|
+
* 获取范围内的标记
|
|
101
|
+
*/
|
|
102
|
+
getMarkersInBounds(bounds: [[number, number], [number, number]]): MarkerEntity[];
|
|
103
|
+
private updateState;
|
|
104
|
+
private syncFromState;
|
|
105
|
+
}
|