bluestar-maplibre 1.0.24
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/blue-star/maplibre/src/bluestar.d.ts +312 -0
- package/dist/blue-star/maplibre/src/components/imageRender/imageRender.d.ts +239 -0
- package/dist/blue-star/maplibre/src/components/render.d.ts +47 -0
- package/dist/blue-star/maplibre/src/components/wegRender/lib/defaultConfig.d.ts +198 -0
- package/dist/blue-star/maplibre/src/components/wegRender/lib/index.d.ts +10 -0
- package/dist/blue-star/maplibre/src/components/wegRender/lib/layerManager.d.ts +100 -0
- package/dist/blue-star/maplibre/src/components/wegRender/lib/propertyController.d.ts +165 -0
- package/dist/blue-star/maplibre/src/components/wegRender/lib/types.d.ts +120 -0
- package/dist/blue-star/maplibre/src/components/wegRender/wegRender.d.ts +471 -0
- package/dist/blue-star/maplibre/src/components/wegRender2/lib/defaultConfig.d.ts +52 -0
- package/dist/blue-star/maplibre/src/components/wegRender2/lib/index.d.ts +3 -0
- package/dist/blue-star/maplibre/src/components/wegRender2/lib/layerManager2.d.ts +65 -0
- package/dist/blue-star/maplibre/src/components/wegRender2/lib/propertyController2.d.ts +23 -0
- package/dist/blue-star/maplibre/src/components/wegRender2/lib/types.d.ts +199 -0
- package/dist/blue-star/maplibre/src/components/wegRender2/wegRender2.d.ts +95 -0
- package/dist/blue-star/maplibre/src/index.d.ts +102 -0
- package/dist/blue-star/maplibre/src/interface/dataType.d.ts +36 -0
- package/dist/blue-star/maplibre/src/interface/position.d.ts +102 -0
- package/dist/blue-star/maplibre/src/map.d.ts +65 -0
- package/dist/blue-star/maplibre/src/style.json.d.ts +23 -0
- package/dist/blue-star/maplibre/src/util/DOMControlTool.d.ts +165 -0
- package/dist/blue-star/maplibre/src/util/WegRGBImage.d.ts +88 -0
- package/dist/blue-star/maplibre/src/util/createColorRamp.d.ts +72 -0
- package/dist/blue-star/maplibre/src/vue/bubble-manager.vue.d.ts +34 -0
- package/dist/blue-star/maplibre/src/vue/bubble.vue.d.ts +39 -0
- package/dist/blue-star/maplibre/src/vue/component.d.ts +296 -0
- package/dist/blue-star/maplibre/src/vue/hook.d.ts +84 -0
- package/dist/blue-star/maplibre/src/vue/tool/components/render/components/color-bar/components/color-bar-edit/lib/color-presets.d.ts +8 -0
- package/dist/blue-star/maplibre/src/xmap/xmap.d.ts +575 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4632 -0
- package/dist/style.css +1 -0
- package/dist/types/types.d.ts +9 -0
- package/package.json +13 -0
- package/readme.md +69 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import { ComponentInternalInstance } from 'vue';
|
|
2
|
+
import { WegFile, EventListenControl } from 'bluestar-util';
|
|
3
|
+
import { XMap, XMapOptions } from './xmap/xmap';
|
|
4
|
+
import { WegRenderer, WegRenderOption } from './components/wegRender/wegRender';
|
|
5
|
+
import { WegRenderer2, WegRender2Options } from './components/wegRender2/wegRender2';
|
|
6
|
+
import { ImageRender, ImageRenderData, ImageRenderOptions } from './components/imageRender/imageRender';
|
|
7
|
+
import { BlueStarLoaded } from './vue/hook';
|
|
8
|
+
/**
|
|
9
|
+
* BlueStar 配置接口
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* // 基本配置
|
|
14
|
+
* const config: BlueStarConfig = {
|
|
15
|
+
* domId: 'map-container',
|
|
16
|
+
* config: {
|
|
17
|
+
* center: [120, 30],
|
|
18
|
+
* zoom: 4
|
|
19
|
+
* }
|
|
20
|
+
* };
|
|
21
|
+
*
|
|
22
|
+
* // 使用 Vue ref
|
|
23
|
+
* const mapDom = ref<HTMLDivElement>();
|
|
24
|
+
* const config: BlueStarConfig = {
|
|
25
|
+
* domId: mapDom,
|
|
26
|
+
* incomponent: false, // 非组件模式
|
|
27
|
+
* config: { /* ... *\/ }
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export interface BlueStarConfig {
|
|
32
|
+
/** 地图容器 DOM 元素或 ID */
|
|
33
|
+
domId: HTMLDivElement | string;
|
|
34
|
+
/** 是否在 Vue 组件内使用(默认 true) */
|
|
35
|
+
incomponent?: boolean;
|
|
36
|
+
/** MapLibre GL 地图配置项 */
|
|
37
|
+
config: XMapOptions;
|
|
38
|
+
}
|
|
39
|
+
/** 地图事件控制器(已废弃,使用 listener 替代) */
|
|
40
|
+
export declare const mapController: EventListenControl;
|
|
41
|
+
/**
|
|
42
|
+
* BlueStar 核心类
|
|
43
|
+
*
|
|
44
|
+
* 基于 MapLibre GL JS 的高级封装,提供气象数据可视化功能
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* **核心功能:**
|
|
48
|
+
* - 地图初始化和生命周期管理
|
|
49
|
+
* - Weg 气象数据渲染
|
|
50
|
+
* - 图片叠加渲染
|
|
51
|
+
* - 图层管理和排序
|
|
52
|
+
* - 事件监听系统
|
|
53
|
+
* - Vue 组件集成
|
|
54
|
+
*
|
|
55
|
+
* **使用示例:**
|
|
56
|
+
* ```typescript
|
|
57
|
+
* // 示例 1:独立使用(非 Vue 组件)
|
|
58
|
+
* const blueStar = new BlueStar({
|
|
59
|
+
* domId: 'map-container',
|
|
60
|
+
* incomponent: false,
|
|
61
|
+
* config: {
|
|
62
|
+
* center: [120, 30],
|
|
63
|
+
* zoom: 4
|
|
64
|
+
* }
|
|
65
|
+
* }, (blueStar, interceptor) => {
|
|
66
|
+
* console.log('地图已加载');
|
|
67
|
+
*
|
|
68
|
+
* // 渲染 Weg 数据
|
|
69
|
+
* const renderer = blueStar.renderWeg(wegFile, {
|
|
70
|
+
* colorRamp: [...],
|
|
71
|
+
* gridValue: true
|
|
72
|
+
* });
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* // 示例 2:在 Vue 组件中使用
|
|
76
|
+
* import { Map } from 'bluestar-maplibre';
|
|
77
|
+
*
|
|
78
|
+
* <template>
|
|
79
|
+
* <Map :config="mapConfig" @load="onMapLoad" />
|
|
80
|
+
* </template>
|
|
81
|
+
*
|
|
82
|
+
* <script setup lang="ts">
|
|
83
|
+
* const onMapLoad = (blueStar: BlueStar, interceptor) => {
|
|
84
|
+
* // 地图操作
|
|
85
|
+
* blueStar.viewer.flyTo({ center: [116.4, 39.9] });
|
|
86
|
+
* };
|
|
87
|
+
* </script>
|
|
88
|
+
*
|
|
89
|
+
* // 示例 3:图层排序控制
|
|
90
|
+
* const blueStar = new BlueStar(config, callback);
|
|
91
|
+
* blueStar.setLayerLevelRule(['baselayer', 'heatmap', 'contour', 'vector']);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
export declare class BlueStar {
|
|
95
|
+
/** MapLibre GL 地图实例(通过 viewer 访问) */
|
|
96
|
+
viewer: XMap;
|
|
97
|
+
/** 地图容器 DOM 元素或 ID */
|
|
98
|
+
domId: HTMLDivElement | string;
|
|
99
|
+
/** 地图是否已准备就绪 */
|
|
100
|
+
ready: boolean;
|
|
101
|
+
/** 事件监听器注册表 */
|
|
102
|
+
listener: any;
|
|
103
|
+
/** 浮窗组件实例列表 */
|
|
104
|
+
bubbleList: ComponentInternalInstance[];
|
|
105
|
+
/**
|
|
106
|
+
* 创建 BlueStar 实例
|
|
107
|
+
*
|
|
108
|
+
* @param blueStarConfig - BlueStar 配置对象
|
|
109
|
+
* @param onLoaded - 地图加载完成后的回调函数
|
|
110
|
+
*
|
|
111
|
+
* @remarks
|
|
112
|
+
* **重要注意事项:**
|
|
113
|
+
* - 如果在 Vue 组件中使用(incomponent=true),会自动处理挂载和卸载
|
|
114
|
+
* - onLoaded 回调会传入 BlueStar 实例和请求拦截器
|
|
115
|
+
* - 地图加载是异步的,回调会在地图完全初始化后执行
|
|
116
|
+
*/
|
|
117
|
+
constructor(blueStarConfig: BlueStarConfig, onLoaded: any);
|
|
118
|
+
/**
|
|
119
|
+
* 初始化浮窗点击事件处理
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
private initBubbleClick;
|
|
123
|
+
/**
|
|
124
|
+
* 销毁地图实例并释放资源
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* // 手动销毁
|
|
129
|
+
* blueStar.destroy();
|
|
130
|
+
*
|
|
131
|
+
* // Vue 组件中会自动调用
|
|
132
|
+
* onUnmounted(() => {
|
|
133
|
+
* blueStar.destroy();
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
destroy(): void;
|
|
138
|
+
/**
|
|
139
|
+
* 渲染 Weg 气象网格数据
|
|
140
|
+
*
|
|
141
|
+
* @param weg - Weg 格式的气象数据
|
|
142
|
+
* @param config - 渲染配置选项
|
|
143
|
+
* @returns WegRenderer 实例,用于后续控制
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* // 温度场渲染
|
|
148
|
+
* const tempRenderer = blueStar.renderWeg(tempData, {
|
|
149
|
+
* colorRamp: [
|
|
150
|
+
* { value: -20, color: '#0000ff' },
|
|
151
|
+
* { value: 40, color: '#ff0000' }
|
|
152
|
+
* ],
|
|
153
|
+
* contour: [0, 5, 10, 15, 20],
|
|
154
|
+
* gridValue: true,
|
|
155
|
+
* alpha: 0.7
|
|
156
|
+
* });
|
|
157
|
+
*
|
|
158
|
+
* // 风场渲染(带粒子)
|
|
159
|
+
* const windRenderer = blueStar.renderWeg(windData, {
|
|
160
|
+
* colorRamp: [...],
|
|
161
|
+
* direction: true,
|
|
162
|
+
* particle: true,
|
|
163
|
+
* particleSpeed: 0.5
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* // 动态调整
|
|
167
|
+
* tempRenderer.fillFulling = true;
|
|
168
|
+
* windRenderer.particle = false;
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
renderWeg(weg: WegFile, config: WegRenderOption): WegRenderer;
|
|
172
|
+
/**
|
|
173
|
+
* 渲染 Weg 气象网格数据(xmap 原生参数版)
|
|
174
|
+
*
|
|
175
|
+
* 与 renderWeg 功能相同,但配置接口直接暴露 xmap 原生图层参数。
|
|
176
|
+
*
|
|
177
|
+
* @param weg - Weg 格式的气象数据
|
|
178
|
+
* @param config - 渲染配置选项(xmap 原生参数)
|
|
179
|
+
* @returns WegRenderer2 实例
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```typescript
|
|
183
|
+
* const renderer = blueStar.renderWeg2(windData, {
|
|
184
|
+
* fillFulling: true,
|
|
185
|
+
* direction: true,
|
|
186
|
+
* heatmap: {
|
|
187
|
+
* colorRamp: [{ value: 0, color: '#00f' }, { value: 10, color: '#f00' }],
|
|
188
|
+
* opacity: 0.8,
|
|
189
|
+
* },
|
|
190
|
+
* vector: {
|
|
191
|
+
* color: '#0aa1ed',
|
|
192
|
+
* cell: 4,
|
|
193
|
+
* },
|
|
194
|
+
* particleConfig: {
|
|
195
|
+
* size: 2,
|
|
196
|
+
* speed: 0.3,
|
|
197
|
+
* },
|
|
198
|
+
* });
|
|
199
|
+
*/
|
|
200
|
+
renderWeg2(weg: WegFile, config: WegRender2Options): WegRenderer2;
|
|
201
|
+
/**
|
|
202
|
+
* 渲染图片叠加层
|
|
203
|
+
*
|
|
204
|
+
* @param data - 图片数据或 WegFile
|
|
205
|
+
* @param option - 可选的渲染选项
|
|
206
|
+
* @returns ImageRender 实例
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* // 渲染雷达图
|
|
211
|
+
* const radarRender = blueStar.renderImage({
|
|
212
|
+
* url: 'https://example.com/radar.png',
|
|
213
|
+
* west: 115.0,
|
|
214
|
+
* south: 39.0,
|
|
215
|
+
* east: 117.0,
|
|
216
|
+
* north: 41.0
|
|
217
|
+
* }, {
|
|
218
|
+
* alpha: 0.7,
|
|
219
|
+
* linerValue: true
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* // 从 WegFile 生成图片
|
|
223
|
+
* const imageRender = blueStar.renderImage(wegFile, {
|
|
224
|
+
* alpha: 0.8
|
|
225
|
+
* });
|
|
226
|
+
*
|
|
227
|
+
* // 动态更换图片
|
|
228
|
+
* radarRender.setImage('new-radar.png');
|
|
229
|
+
*
|
|
230
|
+
* // 调整透明度
|
|
231
|
+
* radarRender.alpha = 0.5;
|
|
232
|
+
* ```
|
|
233
|
+
*/
|
|
234
|
+
renderImage(data: ImageRenderData | WegFile, option?: ImageRenderOptions): ImageRender;
|
|
235
|
+
/**
|
|
236
|
+
* 添加事件监听器
|
|
237
|
+
*
|
|
238
|
+
* @param event - 事件名称
|
|
239
|
+
* @param callback - 回调函数
|
|
240
|
+
* @param loadResult - 可选的加载结果对象
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```typescript
|
|
244
|
+
* // 监听地图就绪事件
|
|
245
|
+
* blueStar.addEventListener('BlueStar:ready', (blueStar, interceptor) => {
|
|
246
|
+
* console.log('地图已就绪');
|
|
247
|
+
* });
|
|
248
|
+
*
|
|
249
|
+
* // 监听其他自定义事件
|
|
250
|
+
* blueStar.addEventListener('custom:event', (data) => {
|
|
251
|
+
* console.log('自定义事件', data);
|
|
252
|
+
* });
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
addEventListener(event: string, callback: (...arg: any[]) => void, loadResult?: BlueStarLoaded): void;
|
|
256
|
+
/**
|
|
257
|
+
* 设置图层层级规则
|
|
258
|
+
*
|
|
259
|
+
* 控制不同类型图层的渲染顺序,规则越靠前越先渲染(在底层)
|
|
260
|
+
*
|
|
261
|
+
* @param levelRule - 层级规则数组,每项为图层名称前缀
|
|
262
|
+
*
|
|
263
|
+
* @example
|
|
264
|
+
* ```typescript
|
|
265
|
+
* // 设置图层顺序:底图 -> 色斑图 -> 等值线 -> 矢量箭头 -> 粒子
|
|
266
|
+
* blueStar.setLayerLevelRule([
|
|
267
|
+
* 'baselayer', // 底图图层
|
|
268
|
+
* 'heatmap', // 热力图/色斑图
|
|
269
|
+
* 'contour', // 等值线
|
|
270
|
+
* 'vector', // 矢量箭头
|
|
271
|
+
* 'particle' // 粒子效果
|
|
272
|
+
* ]);
|
|
273
|
+
*
|
|
274
|
+
* // 获取当前规则
|
|
275
|
+
* const rules = blueStar.getLayerLevelRule();
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* @remarks
|
|
279
|
+
* **重要注意事项:**
|
|
280
|
+
* - 图层 ID 格式:`{name}__{uuid}`
|
|
281
|
+
* - 规则匹配使用前缀匹配(startsWith)
|
|
282
|
+
* - 未匹配的图层保持原有顺序
|
|
283
|
+
* - 调用此方法会立即触发图层排序
|
|
284
|
+
*/
|
|
285
|
+
setLayerLevelRule(levelRule: string[]): void;
|
|
286
|
+
/**
|
|
287
|
+
* 执行图层排序
|
|
288
|
+
*
|
|
289
|
+
* 根据设置的层级规则重新排列图层顺序
|
|
290
|
+
*
|
|
291
|
+
* @remarks
|
|
292
|
+
* **内部实现:**
|
|
293
|
+
* - 过滤出所有自定义图层(包含 '__' 且不包含 'baselayer__')
|
|
294
|
+
* - 按照 levelRule 的顺序重新排列
|
|
295
|
+
* - 使用 moveLayer 方法调整图层顺序
|
|
296
|
+
*
|
|
297
|
+
* @internal
|
|
298
|
+
*/
|
|
299
|
+
sortLayer(): void;
|
|
300
|
+
/**
|
|
301
|
+
* 获取当前图层层级规则
|
|
302
|
+
*
|
|
303
|
+
* @returns 层级规则数组的副本
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```typescript
|
|
307
|
+
* const rules = blueStar.getLayerLevelRule();
|
|
308
|
+
* console.log('当前规则:', rules);
|
|
309
|
+
* ```
|
|
310
|
+
*/
|
|
311
|
+
getLayerLevelRule(): string[];
|
|
312
|
+
}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { WegFile } from 'bluestar-util';
|
|
2
|
+
import { RectangleRange } from '../../interface/position';
|
|
3
|
+
import { BlueStar } from '../../bluestar';
|
|
4
|
+
/**
|
|
5
|
+
* 图片渲染数据配置
|
|
6
|
+
* 定义在地图上渲染图片所需的地理范围和资源信息
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // 使用 URL 加载图片
|
|
11
|
+
* const imageData: ImageRenderData = {
|
|
12
|
+
* url: 'https://example.com/weather-map.png',
|
|
13
|
+
* west: 115.0,
|
|
14
|
+
* south: 39.0,
|
|
15
|
+
* east: 117.0,
|
|
16
|
+
* north: 41.0
|
|
17
|
+
* };
|
|
18
|
+
*
|
|
19
|
+
* // 使用本地 Blob URL
|
|
20
|
+
* const blobImageData: ImageRenderData = {
|
|
21
|
+
* uri: 'blob:http://localhost:3000/xxx',
|
|
22
|
+
* west: 120.0,
|
|
23
|
+
* south: 30.0,
|
|
24
|
+
* east: 122.0,
|
|
25
|
+
* north: 32.0
|
|
26
|
+
* };
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export interface ImageRenderData {
|
|
30
|
+
/**
|
|
31
|
+
* 图片 URI 资源位置
|
|
32
|
+
* 可以是 DataURL、Blob URL 或本地文件路径
|
|
33
|
+
*/
|
|
34
|
+
uri?: string;
|
|
35
|
+
/**
|
|
36
|
+
* 图片 URL 地址
|
|
37
|
+
* 网络图片或本地图片的 HTTP/HTTPS 链接
|
|
38
|
+
*/
|
|
39
|
+
url?: string;
|
|
40
|
+
/**
|
|
41
|
+
* 西边界经度(最小经度)
|
|
42
|
+
*/
|
|
43
|
+
west: number;
|
|
44
|
+
/**
|
|
45
|
+
* 南边界纬度(最小纬度)
|
|
46
|
+
*/
|
|
47
|
+
south: number;
|
|
48
|
+
/**
|
|
49
|
+
* 东边界经度(最大经度)
|
|
50
|
+
*/
|
|
51
|
+
east: number;
|
|
52
|
+
/**
|
|
53
|
+
* 北边界纬度(最大纬度)
|
|
54
|
+
*/
|
|
55
|
+
north: number;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* 图片渲染选项配置
|
|
59
|
+
*/
|
|
60
|
+
export interface ImageRenderOptions {
|
|
61
|
+
/**
|
|
62
|
+
* 图片透明度(0.0-1.0)
|
|
63
|
+
* @defaultValue 1.0
|
|
64
|
+
*/
|
|
65
|
+
alpha?: number;
|
|
66
|
+
/**
|
|
67
|
+
* 是否使用线性插值渲染
|
|
68
|
+
* - true: 线性插值,图像更平滑
|
|
69
|
+
* - false: 最近邻插值,保持像素化效果
|
|
70
|
+
* @defaultValue true
|
|
71
|
+
*/
|
|
72
|
+
linerValue?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 图片渲染器类
|
|
76
|
+
* 用于在地图上叠加地理参考图片
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // 创建图片渲染器
|
|
81
|
+
* const imageRender = new ImageRender(blueStar, {
|
|
82
|
+
* url: 'https://example.com/radar.png',
|
|
83
|
+
* west: 115.0,
|
|
84
|
+
* south: 39.0,
|
|
85
|
+
* east: 117.0,
|
|
86
|
+
* north: 41.0
|
|
87
|
+
* }, {
|
|
88
|
+
* alpha: 0.7,
|
|
89
|
+
* linerValue: true
|
|
90
|
+
* });
|
|
91
|
+
*
|
|
92
|
+
* // 更换图片
|
|
93
|
+
* imageRender.setImage('new-image.png');
|
|
94
|
+
*
|
|
95
|
+
* // 调整透明度
|
|
96
|
+
* imageRender.alpha = 0.5;
|
|
97
|
+
*
|
|
98
|
+
* // 销毁渲染器
|
|
99
|
+
* imageRender.destroy();
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @remarks
|
|
103
|
+
* **重要注意事项:**
|
|
104
|
+
* - 支持 WegFile 格式自动转换为图片
|
|
105
|
+
* - 使用 MapLibre GL 的 image source 类型
|
|
106
|
+
* - 图片会根据地理坐标进行投影变换
|
|
107
|
+
* - 使用后应调用 destroy() 释放资源
|
|
108
|
+
*/
|
|
109
|
+
export declare class ImageRender {
|
|
110
|
+
private bluestar;
|
|
111
|
+
/**
|
|
112
|
+
* MapLibre GL 地图实例
|
|
113
|
+
*/
|
|
114
|
+
private map;
|
|
115
|
+
/**
|
|
116
|
+
* 图片透明度(内部存储)
|
|
117
|
+
*/
|
|
118
|
+
private _alpha;
|
|
119
|
+
/**
|
|
120
|
+
* 图片源唯一标识符
|
|
121
|
+
*/
|
|
122
|
+
sourceId: string;
|
|
123
|
+
/**
|
|
124
|
+
* 图片图层唯一标识符
|
|
125
|
+
*/
|
|
126
|
+
imageLayerId: string;
|
|
127
|
+
/**
|
|
128
|
+
* 图片显示地理范围
|
|
129
|
+
*/
|
|
130
|
+
bound: RectangleRange;
|
|
131
|
+
/**
|
|
132
|
+
* 是否使用线性插值
|
|
133
|
+
*/
|
|
134
|
+
linerValue: boolean;
|
|
135
|
+
/**
|
|
136
|
+
* 当前图片 URI(用于内存管理)
|
|
137
|
+
*/
|
|
138
|
+
private uri;
|
|
139
|
+
/**
|
|
140
|
+
* 创建图片渲染器实例
|
|
141
|
+
* @param bluestar - BlueStar 实例
|
|
142
|
+
* @param imageRenderData - 图片渲染数据配置或 WegFile 对象
|
|
143
|
+
* @param imageRenderOptions - 可选的渲染选项配置
|
|
144
|
+
*/
|
|
145
|
+
constructor(bluestar: BlueStar, imageRenderData: ImageRenderData | WegFile, imageRenderOptions?: ImageRenderOptions);
|
|
146
|
+
/**
|
|
147
|
+
* 初始化图片渲染
|
|
148
|
+
* @param imageRenderData - 图片数据或 WegFile
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
151
|
+
private init;
|
|
152
|
+
/**
|
|
153
|
+
* 更换显示的图片
|
|
154
|
+
*
|
|
155
|
+
* @param imageUrl - 新图片的 URL 地址
|
|
156
|
+
* @param bound - 可选的新显示范围,不传则使用原有范围
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* // 仅更换图片
|
|
161
|
+
* imageRender.setImage('new-radar-image.png');
|
|
162
|
+
*
|
|
163
|
+
* // 同时更换图片和范围
|
|
164
|
+
* imageRender.setImage('new-image.png', {
|
|
165
|
+
* west: 116.0,
|
|
166
|
+
* south: 39.5,
|
|
167
|
+
* east: 117.5,
|
|
168
|
+
* north: 40.5
|
|
169
|
+
* });
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* @remarks
|
|
173
|
+
* **重要注意事项:**
|
|
174
|
+
* - 如果之前使用的是 Blob URL,会自动调用 URL.revokeObjectURL() 释放内存
|
|
175
|
+
* - bound 参数是可选的,不传则保持原有地理范围
|
|
176
|
+
*/
|
|
177
|
+
setImage(imageUrl: string, bound?: RectangleRange): void;
|
|
178
|
+
/**
|
|
179
|
+
* 设置 WegFile 数据(setter 语法糖)
|
|
180
|
+
* @param wegFile - WegFile 对象
|
|
181
|
+
*/
|
|
182
|
+
set data(wegFile: WegFile);
|
|
183
|
+
/**
|
|
184
|
+
* 设置 WegFile 数据并重新渲染
|
|
185
|
+
*
|
|
186
|
+
* @param wegFile - WegFile 格式的气象网格数据
|
|
187
|
+
*
|
|
188
|
+
* @example
|
|
189
|
+
* ```typescript
|
|
190
|
+
* // 方式 1:使用 setter 语法
|
|
191
|
+
* imageRender.data = wegFile;
|
|
192
|
+
*
|
|
193
|
+
* // 方式 2:直接调用方法
|
|
194
|
+
* await imageRender.setWegData(wegFile);
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
setWegData(wegFile: WegFile): Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* 设置图片透明度
|
|
200
|
+
* @param alpha - 透明度值(0.0-1.0)
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```typescript
|
|
204
|
+
* // 半透明效果
|
|
205
|
+
* imageRender.alpha = 0.5;
|
|
206
|
+
*
|
|
207
|
+
* // 完全不透明
|
|
208
|
+
* imageRender.alpha = 1.0;
|
|
209
|
+
*
|
|
210
|
+
* // 完全透明(隐藏)
|
|
211
|
+
* imageRender.alpha = 0.0;
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
set alpha(alpha: number);
|
|
215
|
+
/**
|
|
216
|
+
* 获取当前透明度值
|
|
217
|
+
* @returns 透明度值(0.0-1.0)
|
|
218
|
+
*/
|
|
219
|
+
get alpha(): number;
|
|
220
|
+
/**
|
|
221
|
+
* 销毁图片图层和源
|
|
222
|
+
* 释放相关资源
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* // 组件卸载时清理资源
|
|
227
|
+
* onUnmounted(() => {
|
|
228
|
+
* imageRender.destroy();
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
*
|
|
232
|
+
* @remarks
|
|
233
|
+
* **重要注意事项:**
|
|
234
|
+
* - 会移除对应的图层和源
|
|
235
|
+
* - 如果使用了 Blob URL,会自动释放内存
|
|
236
|
+
* - 销毁后不应再使用该实例
|
|
237
|
+
*/
|
|
238
|
+
destroy(): void;
|
|
239
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 渲染器基类
|
|
3
|
+
* 为所有渲染器提供统一的 ID 生成机制
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* // 创建带名称的渲染器
|
|
8
|
+
* const renderer = new Render('wegRenderer');
|
|
9
|
+
* const id1 = renderer.createId(); // "wegRenderer__xxx-xxx-xxx"
|
|
10
|
+
*
|
|
11
|
+
* // 创建不带名称的渲染器
|
|
12
|
+
* const anonymousRenderer = new Render();
|
|
13
|
+
* const id2 = anonymousRenderer.createId(); // "yyy-yyy-yyy"
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* **重要注意事项:**
|
|
18
|
+
* - 子类应该继承此类以获得唯一的图层/源 ID
|
|
19
|
+
* - ID 格式:`{name}__{uuid}` 或 `{uuid}`(当 name 为空时)
|
|
20
|
+
* - 使用 UUID v4 算法确保唯一性
|
|
21
|
+
*/
|
|
22
|
+
export declare class Render {
|
|
23
|
+
/**
|
|
24
|
+
* 渲染器名称标识
|
|
25
|
+
* 用于生成的 ID 前缀,便于调试和识别
|
|
26
|
+
*/
|
|
27
|
+
name: string;
|
|
28
|
+
/**
|
|
29
|
+
* 创建渲染器实例
|
|
30
|
+
* @param name - 渲染器名称(可选),用作 ID 前缀
|
|
31
|
+
*/
|
|
32
|
+
constructor(name?: string);
|
|
33
|
+
/**
|
|
34
|
+
* 创建唯一标识符
|
|
35
|
+
* 生成格式化的 UUID,带有可选的名称前缀
|
|
36
|
+
*
|
|
37
|
+
* @returns 唯一标识符字符串
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* const renderer = new Render('heatmap');
|
|
42
|
+
* const sourceId = renderer.createId();
|
|
43
|
+
* // 结果:"heatmap__a1b2c3d4-e5f6-7890-abcd-ef1234567890"
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
createId(): string;
|
|
47
|
+
}
|