@metagl/sdk-render 1.0.4 → 1.0.6

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.
@@ -1,3 +1,4 @@
1
+ import * as Cesium from 'cesium';
1
2
  import { Cartesian3, Color, Viewer, PostProcessStage, Cartesian4, Rectangle, Cesium3DTileset, ClippingPolygonCollection } from 'cesium';
2
3
  import { Render as Render$1 } from '@/system/RenderCore';
3
4
 
@@ -26,9 +27,11 @@ interface RenderSystem {
26
27
  /**
27
28
  * DirectionalLightConfig
28
29
  * @param enabled - 是否启用
29
- * @param direction - 方向
30
+ * @param followSun - 是否跟随太阳(自动模式)
31
+ * @param direction - 方向(手动模式)
30
32
  * @param intensity - 强度
31
33
  * @param color - 颜色
34
+ * @param ambientIntensity - 环境光强度
32
35
  */
33
36
  interface DirectionalLightConfig {
34
37
  enabled?: boolean;
@@ -40,53 +43,55 @@ interface DirectionalLightConfig {
40
43
  }
41
44
  /**
42
45
  * LightingSystem
43
- * @param viewer - Viewer
44
- * @param config - DirectionalLightConfig
46
+ *
47
+ * 两种完全独立互斥的光照模式:
48
+ * - auto (followSun=true):仅启用 globe.enableLighting,使用 Cesium 内置太阳光
49
+ * 方向由 viewer.clock.currentTime 自动驱动,不创建自定义 DirectionalLight
50
+ * - manual (followSun=false):创建自定义 DirectionalLight,通过 XYZ 方向控制
51
+ *
52
+ * 切换模式时必须先 disable() 清理旧状态再 enable()
45
53
  */
46
54
  declare class LightingSystem implements RenderSystem {
47
55
  private viewer;
48
56
  private config;
49
57
  private isEnabled;
50
- private originalSettings?;
58
+ private originalGlobeLighting;
59
+ private originalLight;
60
+ private originalLightSaved;
51
61
  /**
52
- * 默认配置 - 从 EnvironmentDefaults 统一管理
62
+ * 默认配置
53
63
  */
54
64
  private static DEFAULT_CONFIG;
55
- /**
56
- * 构造函数
57
- * @param viewer - Viewer
58
- * @param config - DirectionalLightConfig
59
- */
60
65
  constructor(viewer: Viewer, config?: DirectionalLightConfig);
61
66
  /**
62
- * 初始化
67
+ * 初始化 — 保存原始场景光照状态
63
68
  */
64
69
  initialize(): void;
65
70
  /**
66
- * 保存原始设置
71
+ * 启用光照系统
72
+ * - auto 模式:仅启用 globe.enableLighting(Cesium 内置太阳光)
73
+ * - manual 模式:创建自定义 DirectionalLight
67
74
  */
68
- private saveOriginalSettings;
75
+ enable(): void;
69
76
  /**
70
- * 启用方向光
77
+ * 根据当前 config.followSun 应用对应光照模式
71
78
  */
72
- enable(): void;
79
+ private _applyCurrentMode;
73
80
  /**
74
- * 禁用方向光
81
+ * 禁用光照系统,恢复原始场景状态
75
82
  */
76
83
  disable(): void;
77
84
  /**
78
85
  * 更新配置
79
- * @param config - DirectionalLightConfig
86
+ * 若系统已启用,立即重新应用光照模式
80
87
  */
81
88
  update(config: Partial<DirectionalLightConfig>): void;
82
89
  /**
83
90
  * 获取状态
84
- * @returns boolean
85
91
  */
86
92
  getStatus(): boolean;
87
93
  /**
88
94
  * 获取配置
89
- * @returns DirectionalLightConfig
90
95
  */
91
96
  getConfig(): DirectionalLightConfig;
92
97
  /**
@@ -596,6 +601,15 @@ interface PostProcessingConfig {
596
601
  contrast?: number;
597
602
  /** 饱和度(1.0 = 原始,0 = 灰度,>1 增强,范围 0~3.0)*/
598
603
  saturation?: number;
604
+ /**
605
+ * 暗部提亮(Shadows Lift)
606
+ * 将最暗区域的黑点向上提,使阴影不死黑,产生"透亮/通透"感
607
+ * 0.0 = 不提亮(默认黑色保持纯黑)
608
+ * 0.04 = 轻微提亮(推荐,建筑阴影面变深灰而非黑)
609
+ * 0.10 = 明显提亮(场景整体亮度感知提升)
610
+ * 范围:0 ~ 0.15
611
+ */
612
+ shadowsLift?: number;
599
613
  /** 色温 Kelvin(6500K = 日光中性,<6500K 暖色,>6500K 冷色,范围 3000~12000)*/
600
614
  temperature?: number;
601
615
  /** 色调(0 = 中性,-1 偏洋红,+1 偏绿,范围 -1~1)*/
@@ -730,8 +744,14 @@ declare class PostProcessingSystem implements RenderSystem {
730
744
  * 色彩调整 Shader
731
745
  * 输入:白平衡后的 sRGB [0,1]
732
746
  *
733
- * 在 sRGB 空间做 contrast + saturation,与 Lightroom/达芬奇行为一致。
747
+ * 在 sRGB 空间做 contrast + saturation + shadowsLift,与 Lightroom/达芬奇行为一致。
734
748
  * 不做 gamma pow(),避免双重 gamma 过曝。
749
+ *
750
+ * shadowsLift(暗部提亮 / Shadows Lift):
751
+ * 对暗部区域(亮度 < 0.35)做黑点提升,使深黑变为深灰。
752
+ * 公式:color += lift * (1.0 - color) * shadowFactor
753
+ * 其中 shadowFactor = smoothstep(0.35, 0.0, lum),保证只影响暗部。
754
+ * 这是让建筑阴影面"透气"的关键 —— UE 的暗部从不死黑。
735
755
  */
736
756
  private getColorAdjustmentShader;
737
757
  /**
@@ -1284,6 +1304,286 @@ declare class LayerSystem implements RenderSystem {
1284
1304
  destroy(): void;
1285
1305
  }
1286
1306
 
1307
+ interface ViewshedConfig {
1308
+ position: Cesium.Cartesian3;
1309
+ heading: number;
1310
+ pitch: number;
1311
+ distance: number;
1312
+ hfov: number;
1313
+ vfov: number;
1314
+ showFrustum?: boolean;
1315
+ texelSnap?: boolean;
1316
+ minHeight?: number;
1317
+ near?: number;
1318
+ visibleColor?: Cesium.Color;
1319
+ hiddenColor?: Cesium.Color;
1320
+ }
1321
+ /**
1322
+ * 视域分析系统 - 支持多视域实例和多视锥体模式
1323
+ */
1324
+ declare class ViewshedAnalysisSystem implements RenderSystem {
1325
+ private render;
1326
+ private viewer;
1327
+ private scene;
1328
+ private viewshedInstances;
1329
+ private activeViewshedId;
1330
+ private enabled;
1331
+ private eventListeners;
1332
+ private _position;
1333
+ private _heading;
1334
+ private _pitch;
1335
+ private _distance;
1336
+ private _near;
1337
+ private _far;
1338
+ private _fovH;
1339
+ private _fovV;
1340
+ private _visibleColor;
1341
+ private _hiddenColor;
1342
+ private _twoPostionsEditing;
1343
+ private _positionEditing;
1344
+ private _rotationEditing;
1345
+ constructor(render: any);
1346
+ initialize(): void;
1347
+ enable(): void;
1348
+ disable(): void;
1349
+ update(config: any): void;
1350
+ getStatus(): boolean;
1351
+ destroy(): void;
1352
+ /**
1353
+ * 创建新的视域分析实例
1354
+ */
1355
+ createViewshed(config?: Partial<ViewshedConfig>): string;
1356
+ /**
1357
+ * 删除视域分析实例
1358
+ */
1359
+ removeViewshed(id: string): void;
1360
+ /**
1361
+ * 显示指定视域
1362
+ */
1363
+ showViewshed(id: string): void;
1364
+ /**
1365
+ * 隐藏指定视域
1366
+ */
1367
+ hideViewshed(id: string): void;
1368
+ /**
1369
+ * 获取所有视域实例
1370
+ */
1371
+ getAllViewsheds(): string[];
1372
+ /**
1373
+ * 获取当前激活的视域ID
1374
+ */
1375
+ getActiveViewshedId(): string | null;
1376
+ /**
1377
+ * 更新视域位置
1378
+ */
1379
+ updatePosition(id: string, position: Cartesian3): void;
1380
+ /**
1381
+ * 更新视域方向
1382
+ */
1383
+ updateOrientation(id: string, heading: number, pitch: number): void;
1384
+ /**
1385
+ * 使用 direction 和 up 向量更新视域方向(参考 DirectionCameraBinding)
1386
+ */
1387
+ updateViewshedOrientation(id: string, position: Cesium.Cartesian3, direction: Cesium.Cartesian3, up: Cesium.Cartesian3): void;
1388
+ /**
1389
+ * 更新可视距离
1390
+ */
1391
+ updateDistance(id: string, distance: number): void;
1392
+ /**
1393
+ * 获取两点编辑状态(兼容旧 API)
1394
+ */
1395
+ getTwoPostionsEditing(): boolean;
1396
+ /**
1397
+ * 设置两点编辑状态(兼容旧 API)
1398
+ * 拾取绘制功能:用户点击两个点来定义视域方向
1399
+ */
1400
+ setTwoPostionsEditing(value: boolean): void;
1401
+ private _pickingEntities;
1402
+ private _pickingPosition0;
1403
+ private _pickingPosition1;
1404
+ /**
1405
+ * 创建拾取可视化(点和箭头线)
1406
+ */
1407
+ private createPickingVisualization;
1408
+ /**
1409
+ * 移除拾取可视化
1410
+ */
1411
+ private removePickingVisualization;
1412
+ /**
1413
+ * 更新拾取可视化
1414
+ */
1415
+ private updatePickingVisualization;
1416
+ /**
1417
+ * 开始拾取模式
1418
+ */
1419
+ private _pickingHandler;
1420
+ private _pickingMouseMoveHandler;
1421
+ private _pickingRightClickHandler;
1422
+ private _pickingPositions;
1423
+ private startPicking;
1424
+ private stopPicking;
1425
+ /**
1426
+ * 获取位置编辑状态(兼容旧 API)
1427
+ */
1428
+ getPositionEditing(): boolean;
1429
+ /**
1430
+ * 设置位置编辑状态(兼容旧 API)
1431
+ */
1432
+ setPositionEditing(value: boolean): void;
1433
+ /**
1434
+ * 获取旋转编辑状态(兼容旧 API)
1435
+ */
1436
+ getRotationEditing(): boolean;
1437
+ /**
1438
+ * 设置旋转编辑状态(兼容旧 API)
1439
+ */
1440
+ setRotationEditing(value: boolean): void;
1441
+ /**
1442
+ * 获取当前视域实例(兼容旧 API)
1443
+ */
1444
+ getViewshed(): any;
1445
+ /**
1446
+ * 设置近裁(兼容旧 API)
1447
+ */
1448
+ setNear(value: number): void;
1449
+ /**
1450
+ * 设置远裁(兼容旧 API)
1451
+ */
1452
+ setFar(value: number): void;
1453
+ /**
1454
+ * 设置水平广角(兼容旧 API)
1455
+ */
1456
+ setFovH(value: number): void;
1457
+ /**
1458
+ * 设置垂直广角(兼容旧 API)
1459
+ */
1460
+ setFovV(value: number): void;
1461
+ /**
1462
+ * 开始视域分析(兼容旧 API)
1463
+ */
1464
+ start(): void;
1465
+ /**
1466
+ * 取消视域分析(兼容旧 API)
1467
+ */
1468
+ cancel(): void;
1469
+ /**
1470
+ * 从相机位置创建视域
1471
+ */
1472
+ createFromCurrentCamera(): string | null;
1473
+ /**
1474
+ * 设置当前位置为相机位置
1475
+ */
1476
+ setPositionWithCurrentCamera(): void;
1477
+ on(event: string, callback: Function): void;
1478
+ off(event: string, callback: Function): void;
1479
+ private emitEvent;
1480
+ /**
1481
+ * 简化版视域分析实现(用于不支持完整 ShadowMap 的环境)
1482
+ */
1483
+ private static createSimplifiedViewshed;
1484
+ }
1485
+
1486
+ interface SingleViewshedConfig {
1487
+ position: Cesium.Cartesian3;
1488
+ heading: number;
1489
+ pitch: number;
1490
+ distance: number;
1491
+ hfov: number;
1492
+ vfov: number;
1493
+ showFrustum?: boolean;
1494
+ minHeight?: number;
1495
+ near?: number;
1496
+ }
1497
+ /**
1498
+ * 单视域分析系统 - 使用 LACDT.Obj.Viewshed
1499
+ */
1500
+ declare class SingleViewshedSystem implements RenderSystem {
1501
+ private render;
1502
+ private viewer;
1503
+ private scene;
1504
+ private viewshed;
1505
+ private enabled;
1506
+ constructor(render: any);
1507
+ initialize(): void;
1508
+ enable(): void;
1509
+ disable(): void;
1510
+ update(config: any): void;
1511
+ getStatus(): boolean;
1512
+ destroy(): void;
1513
+ /**
1514
+ * 创建单视域实例
1515
+ */
1516
+ createViewshed(config?: Partial<SingleViewshedConfig>): string;
1517
+ /**
1518
+ * 获取视域实例
1519
+ */
1520
+ getViewshed(): any;
1521
+ /**
1522
+ * 显示视域
1523
+ */
1524
+ showViewshed(): void;
1525
+ /**
1526
+ * 隐藏视域
1527
+ */
1528
+ hideViewshed(): void;
1529
+ /**
1530
+ * 获取两点编辑状态
1531
+ */
1532
+ getTwoPostionsEditing(): boolean;
1533
+ /**
1534
+ * 设置两点编辑状态(拾取模式)
1535
+ */
1536
+ setTwoPostionsEditing(value: boolean): void;
1537
+ /**
1538
+ * 获取位置编辑状态
1539
+ */
1540
+ getPositionEditing(): boolean;
1541
+ /**
1542
+ * 设置位置编辑状态
1543
+ */
1544
+ setPositionEditing(value: boolean): void;
1545
+ /**
1546
+ * 获取旋转编辑状态
1547
+ */
1548
+ getRotationEditing(): boolean;
1549
+ /**
1550
+ * 设置旋转编辑状态
1551
+ */
1552
+ setRotationEditing(value: boolean): void;
1553
+ /**
1554
+ * 设置近裁
1555
+ */
1556
+ setNear(value: number): void;
1557
+ /**
1558
+ * 设置远裁
1559
+ */
1560
+ setFar(value: number): void;
1561
+ /**
1562
+ * 设置水平广角
1563
+ */
1564
+ setFovH(value: number): void;
1565
+ /**
1566
+ * 设置垂直广角
1567
+ */
1568
+ setFovV(value: number): void;
1569
+ /**
1570
+ * 从当前相机创建视域
1571
+ */
1572
+ createFromCurrentCamera(): string | null;
1573
+ /**
1574
+ * 设置当前位置为相机位置
1575
+ */
1576
+ setPositionWithCurrentCamera(): void;
1577
+ /**
1578
+ * 开始视域分析
1579
+ */
1580
+ start(): void;
1581
+ /**
1582
+ * 取消视域分析
1583
+ */
1584
+ cancel(): void;
1585
+ }
1586
+
1287
1587
  /**
1288
1588
  * 工具箱系统
1289
1589
  */
@@ -1291,6 +1591,8 @@ declare class ToolboxSystem implements RenderSystem {
1291
1591
  private tools;
1292
1592
  private eventListeners;
1293
1593
  private measurementSystem;
1594
+ private viewshedAnalysisSystem;
1595
+ private singleViewshedSystem;
1294
1596
  private render;
1295
1597
  private currentTileset;
1296
1598
  constructor(render: Render);
@@ -1330,6 +1632,18 @@ declare class ToolboxSystem implements RenderSystem {
1330
1632
  * 获取测量工具
1331
1633
  */
1332
1634
  getMeasurementTools(): ToolItem[];
1635
+ /**
1636
+ * 获取视域分析系统
1637
+ */
1638
+ getViewshedAnalysisSystem(): ViewshedAnalysisSystem | undefined;
1639
+ /**
1640
+ * 获取单视域分析系统
1641
+ */
1642
+ getSingleViewshedSystem(): SingleViewshedSystem | undefined;
1643
+ /**
1644
+ * 获取分析工具
1645
+ */
1646
+ getAnalysisTools(): ToolItem[];
1333
1647
  /**
1334
1648
  * 执行工具
1335
1649
  */
@@ -1974,94 +2288,6 @@ declare class TilesetSearchSystem implements RenderSystem {
1974
2288
  destroy(): void;
1975
2289
  }
1976
2290
 
1977
- /**
1978
- * 光照配置
1979
- */
1980
- interface LightingPresetConfig {
1981
- enabled: boolean;
1982
- followSun: boolean;
1983
- intensity: number;
1984
- ambientIntensity: number;
1985
- color: string;
1986
- }
1987
- /**
1988
- * 阴影配置
1989
- */
1990
- interface ShadowPresetConfig {
1991
- enabled: boolean;
1992
- softShadows: boolean;
1993
- size: number;
1994
- darkness: number;
1995
- softness: number;
1996
- }
1997
- /**
1998
- * 大气配置
1999
- */
2000
- interface AtmospherePresetConfig {
2001
- enabled: boolean;
2002
- intensity: number;
2003
- rayleighIntensity: number;
2004
- mieIntensity: number;
2005
- absorptionIntensity: number;
2006
- }
2007
- /**
2008
- * 云层配置
2009
- */
2010
- interface CloudsPresetConfig {
2011
- enabled: boolean;
2012
- cover: number;
2013
- base: number;
2014
- top: number;
2015
- windSpeed: number;
2016
- lightIntensity: number;
2017
- }
2018
- /**
2019
- * 雾效配置
2020
- */
2021
- interface FogPresetConfig {
2022
- enabled: boolean;
2023
- type: 'none' | 'distance' | 'height' | 'both';
2024
- distanceIntensity: number;
2025
- heightIntensity: number;
2026
- color: string;
2027
- }
2028
- /**
2029
- * 后处理配置
2030
- */
2031
- interface PostProcessingPresetConfig {
2032
- enabled: boolean;
2033
- brightness: number;
2034
- contrast: number;
2035
- saturation: number;
2036
- gamma: number;
2037
- }
2038
- /**
2039
- * 水体配置
2040
- */
2041
- interface WaterPresetConfig {
2042
- enabled: boolean;
2043
- color: string;
2044
- opacity: number;
2045
- waveStrength: number;
2046
- waveSpeed: number;
2047
- }
2048
- /**
2049
- * 预设配置结构(扁平化,便于序列化)
2050
- */
2051
- interface EnvironmentPresetConfig {
2052
- time: {
2053
- hour: number;
2054
- minute: number;
2055
- };
2056
- lighting: LightingPresetConfig;
2057
- shadow: ShadowPresetConfig;
2058
- atmosphere: AtmospherePresetConfig;
2059
- clouds: CloudsPresetConfig;
2060
- fog: FogPresetConfig;
2061
- postProcessing: PostProcessingPresetConfig;
2062
- water: WaterPresetConfig;
2063
- }
2064
-
2065
2291
  /**
2066
2292
  * 渲染引擎配置接口
2067
2293
  */
@@ -2080,6 +2306,7 @@ interface RenderConfig {
2080
2306
  water?: WaterConfig;
2081
2307
  enableAll?: boolean;
2082
2308
  visible?: boolean;
2309
+ preset?: string;
2083
2310
  }
2084
2311
  /**
2085
2312
  * 渲染引擎类
@@ -2097,6 +2324,7 @@ declare class Render {
2097
2324
  private heightFogSystem;
2098
2325
  private postProcessingSystem;
2099
2326
  private cameraListenerSystem;
2327
+ private presetSystem;
2100
2328
  private waterSystem;
2101
2329
  private layerSystem;
2102
2330
  private toolboxSystem;
@@ -2120,6 +2348,30 @@ declare class Render {
2120
2348
  private ensurePostProcessStageOrder;
2121
2349
  private registerSystems;
2122
2350
  private initialize;
2351
+ /**
2352
+ * 全局场景质量提升
2353
+ * 一次性配置,不受任何系统开关影响,始终生效
2354
+ *
2355
+ * 主要解决"不够透亮"问题:
2356
+ * 1. perFragmentAtmosphere — 逐像素大气计算,地平线过渡更精细
2357
+ * 2. scene.atmosphere — 统一调整天空与地球大气的亮度/饱和度
2358
+ * 3. scene.globe 大气参数 — 让地球表面雾蒙蒙感减少,更透亮
2359
+ * 4. lightingFactor — 提升散射光对地面的贡献
2360
+ */
2361
+ private applyGlobalSceneQuality;
2362
+ /**
2363
+ * 应用场景预设
2364
+ * @param presetId 预设 ID,见 SCENE_PRESETS
2365
+ */
2366
+ applyPreset(presetId: string): void;
2367
+ /**
2368
+ * 清除当前预设,关闭所有环境系统
2369
+ */
2370
+ clearPreset(): void;
2371
+ /**
2372
+ * 获取当前激活的预设 ID,未激活时返回 null
2373
+ */
2374
+ getActivePreset(): string | null;
2123
2375
  /**
2124
2376
  * 启用所有系统
2125
2377
  */
@@ -2206,22 +2458,6 @@ declare class Render {
2206
2458
  building: BuildingSystem;
2207
2459
  tilesetSearch: TilesetSearchSystem;
2208
2460
  };
2209
- /**
2210
- * 应用环境预设(通过预设ID)
2211
- * RenderCore 统一的预设驱动入口
2212
- *
2213
- * 策略:预设中的 enabled 字段表示该预设是否应该启用该系统
2214
- * 当用户点击预设时,自动启用预设定义的系统
2215
- */
2216
- applyEnvironmentPreset(presetId: string, enableSystems?: boolean): boolean;
2217
- /**
2218
- * 将 EnvironmentPresetConfig 映射并应用到各 System
2219
- * 字段映射的唯一权威实现(lighting/atmosphere/clouds/fog → 对应系统名称)
2220
- *
2221
- * @param config 预设配置
2222
- * @param autoEnableSystems 是否自动启用预设中定义的系统
2223
- */
2224
- applyEnvironmentConfig(config: EnvironmentPresetConfig, autoEnableSystems?: boolean): void;
2225
2461
  /**
2226
2462
  * 销毁渲染引擎
2227
2463
  */
@@ -2373,13 +2609,12 @@ declare class EnvironmentControl {
2373
2609
  private createPanelHeader;
2374
2610
  private createPanelContent;
2375
2611
  private createConfigManagementSection;
2376
- private getPresetIcon;
2377
2612
  private initEventListeners;
2378
2613
  private switchTab;
2379
2614
  private initConfigEventListeners;
2380
- private initPresetCardListeners;
2381
- private handlePresetSelect;
2382
- private applyPresetConfig;
2615
+ private initPresetListeners;
2616
+ /** 根据 render.getActivePreset() 同步预设卡片高亮状态 */
2617
+ private refreshActivePreset;
2383
2618
  private handleConfigImport;
2384
2619
  private handleConfigExport;
2385
2620
  private updateAllControlPanels;
@@ -2387,7 +2622,6 @@ declare class EnvironmentControl {
2387
2622
  private handleDisableAllEffects;
2388
2623
  private handleConfigReset;
2389
2624
  private showNotification;
2390
- private applyDefaultPresets;
2391
2625
  private resetAll;
2392
2626
  togglePanel(visible?: boolean): void;
2393
2627
  private clearPanel;
@@ -2490,10 +2724,20 @@ declare class LightingControl extends BaseControlPanel {
2490
2724
  private updateModeState;
2491
2725
  /**
2492
2726
  * 应用模式设置
2727
+ *
2728
+ * 两种光照模式完全独立互斥:
2729
+ * - auto:仅使用 Cesium 内置太阳光(globe.enableLighting),由时钟驱动,无自定义 DirectionalLight
2730
+ * - manual:使用自定义 DirectionalLight,由 XYZ 滑块控制方向
2731
+ *
2732
+ * 切换模式时必须先 disable 清理旧状态再重新 enable
2493
2733
  */
2494
2734
  private applyModeSettings;
2495
2735
  /**
2496
- * 应用光照设置
2736
+ * 将手动模式下的滑块方向值同步到系统
2737
+ */
2738
+ private applyManualDirectionToSystem;
2739
+ /**
2740
+ * 应用光照设置(强度/颜色/环境光,不涉及模式切换)
2497
2741
  */
2498
2742
  private applyLightingSettings;
2499
2743
  /**
@@ -2508,14 +2752,6 @@ declare class LightingControl extends BaseControlPanel {
2508
2752
  * 更新太阳位置
2509
2753
  */
2510
2754
  private updateSunPosition;
2511
- /**
2512
- * 从方向向量计算高度角和方位角
2513
- */
2514
- private vectorToElevationAzimuth;
2515
- /**
2516
- * 更新手动方向
2517
- */
2518
- private updateManualDirection;
2519
2755
  /**
2520
2756
  * 应用时间预设
2521
2757
  * 输入时间为北京时间(UTC+8),需要转换为UTC时间
@@ -2527,8 +2763,11 @@ declare class LightingControl extends BaseControlPanel {
2527
2763
  */
2528
2764
  private applyCustomTime;
2529
2765
  /**
2530
- * 从时钟同步时间选择器
2531
- * UTC时间转北京时间(UTC+8)
2766
+ * 分钟数转时间字符串 HH:MM
2767
+ */
2768
+ private minutesToTimeString;
2769
+ /**
2770
+ * 从时钟同步时间滑块(UTC → 北京时间)
2532
2771
  */
2533
2772
  private syncTimePickerFromClock;
2534
2773
  /**
@@ -3368,7 +3607,12 @@ declare class LayerControl extends PanelBase {
3368
3607
  */
3369
3608
  declare class ToolboxControl extends PanelBase {
3370
3609
  private toolboxSystem;
3610
+ private viewshedAnalysisSystem;
3611
+ private singleViewshedSystem;
3371
3612
  private isExpanded;
3613
+ private viewshedPanel;
3614
+ private viewshedUpdateInterval;
3615
+ private currentViewshedToolAlias;
3372
3616
  constructor(render: Render$1, config?: PanelConfig);
3373
3617
  /**
3374
3618
  * 初始化面板
@@ -3398,6 +3642,10 @@ declare class ToolboxControl extends PanelBase {
3398
3642
  * 创建裁切工具分类
3399
3643
  */
3400
3644
  private createClippingCategory;
3645
+ /**
3646
+ * 创建分析工具分类
3647
+ */
3648
+ private createAnalysisCategory;
3401
3649
  /**
3402
3650
  * 创建裁切工具控件
3403
3651
  */
@@ -3447,6 +3695,35 @@ declare class ToolboxControl extends PanelBase {
3447
3695
  * 显示通知
3448
3696
  */
3449
3697
  private showNotification;
3698
+ /**
3699
+ * 显示可视域分析面板
3700
+ * @param tool 工具项
3701
+ */
3702
+ private showViewshedPanel;
3703
+ /**
3704
+ * 绑定可视域分析面板事件
3705
+ */
3706
+ private bindViewshedPanelEvents;
3707
+ /**
3708
+ * 重置所有视域分析按钮状态
3709
+ */
3710
+ private resetViewshedButtonStates;
3711
+ /**
3712
+ * 更新视域分析按钮状态
3713
+ */
3714
+ private updateViewshedButtonState;
3715
+ /**
3716
+ * 启动视域分析UI更新
3717
+ */
3718
+ private startViewshedUIUpdate;
3719
+ /**
3720
+ * 停止视域分析UI更新
3721
+ */
3722
+ private stopViewshedUIUpdate;
3723
+ /**
3724
+ * 隐藏可视域分析面板
3725
+ */
3726
+ private hideViewshedPanel;
3450
3727
  /**
3451
3728
  * 刷新面板
3452
3729
  */
@@ -3811,6 +4088,229 @@ declare class CameraUrlManager {
3811
4088
  destroy(): void;
3812
4089
  }
3813
4090
 
4091
+ /**
4092
+ * 矩形区域定义
4093
+ */
4094
+ interface RainBounds {
4095
+ /** 左上角经度 */
4096
+ west: number;
4097
+ /** 左上角纬度 */
4098
+ north: number;
4099
+ /** 右下角经度 */
4100
+ east: number;
4101
+ /** 右下角纬度 */
4102
+ south: number;
4103
+ }
4104
+ /**
4105
+ * 下雨系统配置接口
4106
+ */
4107
+ interface RainConfig {
4108
+ /** 是否启用下雨系统 */
4109
+ enabled: boolean;
4110
+ /** 雨滴发射率 (个/秒) */
4111
+ emissionRate: number;
4112
+ /** 雨滴大小 */
4113
+ particleSize: number;
4114
+ /** 最小生命周期(秒) */
4115
+ minimumParticleLife: number;
4116
+ /** 最大生命周期(秒) */
4117
+ maximumParticleLife: number;
4118
+ /** 最小速度 */
4119
+ minimumSpeed: number;
4120
+ /** 最大速度 */
4121
+ maximumSpeed: number;
4122
+ /** 雨滴颜色 */
4123
+ color: Color;
4124
+ /** 重力因子(负值向下,正值向上) */
4125
+ gravity: number;
4126
+ /** 下雨区域范围(矩形) */
4127
+ bounds?: RainBounds;
4128
+ /** 相机高度超过此值时隐藏雨滴(单位:米),默认5000 */
4129
+ hideAltitude?: number;
4130
+ /** 雨滴纹理图片路径,默认 './image/rain.png' */
4131
+ imagePath?: string;
4132
+ /** 雨滴纹理类型: 'rain' | 'hail' | 'snow' */
4133
+ imageType?: 'rain' | 'hail' | 'snow';
4134
+ }
4135
+ /**
4136
+ * 默认下雨配置
4137
+ */
4138
+ declare const defaultRainConfig: RainConfig;
4139
+ /**
4140
+ * 下雨系统类
4141
+ * 负责管理场景中的局部下雨效果
4142
+ */
4143
+ declare class RainSystem implements RenderSystem {
4144
+ private viewer;
4145
+ private config;
4146
+ private rainParticleSystems;
4147
+ private isInitialized;
4148
+ private isEnabled;
4149
+ private rainImage;
4150
+ private hideAltitude;
4151
+ private lastAltitudeCheck;
4152
+ private readonly altitudeCheckInterval;
4153
+ private shaderRainStage;
4154
+ private useShaderRain;
4155
+ private shaderRainHeight;
4156
+ private currentImageType;
4157
+ private weatherIconElement;
4158
+ private weatherIconVisible;
4159
+ constructor(viewer: Viewer, config?: Partial<RainConfig>);
4160
+ /**
4161
+ * 初始化下雨系统
4162
+ */
4163
+ initialize(): void;
4164
+ /**
4165
+ * 在指定矩形范围内创建下雨效果
4166
+ */
4167
+ private createRainSystemsInBounds;
4168
+ /**
4169
+ * 创建网格点的下雨粒子系统
4170
+ */
4171
+ private createGridRainSystem;
4172
+ /**
4173
+ * 计算发射器模型矩阵
4174
+ * 让发射方向向下(旋转使发射器朝向地面)
4175
+ */
4176
+ private computeEmitterModelMatrix;
4177
+ /**
4178
+ * 创建雨滴纹理图像 - 使用 Canvas 程序生成细长的雨丝
4179
+ */
4180
+ private createRainImage;
4181
+ /**
4182
+ * 创建 Canvas 雨滴纹理
4183
+ */
4184
+ private createCanvashailImage;
4185
+ private createCanvasSnowImage;
4186
+ /**
4187
+ * 设置雨滴纹理类型
4188
+ * @param type 纹理类型: 'rain' | 'hail' | 'snow'
4189
+ */
4190
+ setRainImageType(type: 'rain' | 'hail' | 'snow'): void;
4191
+ /**
4192
+ * 设置自定义雨滴纹理路径
4193
+ * @param imagePath 纹理图片路径,如 './image/rain.png'
4194
+ */
4195
+ setRainImage(imagePath: string): void;
4196
+ /**
4197
+ * 创建着色器雨效(后期处理方式)
4198
+ * 参考 natureSimulate.js 的 FS_Rain 实现,兼容 WebGL 2.0
4199
+ */
4200
+ private createShaderRainStage;
4201
+ /**
4202
+ * 根据相机高度切换雨效模式
4203
+ * 500米以内使用着色器雨效,500米以上使用粒子系统
4204
+ */
4205
+ private switchRainEffectMode;
4206
+ /**
4207
+ * 获取相机正下方地形的海拔高度
4208
+ */
4209
+ private getTerrainHeightBelowCamera;
4210
+ /**
4211
+ * 应用重力效果 - 雨滴下落
4212
+ */
4213
+ private applyGravity;
4214
+ /**
4215
+ * 根据相机高度更新雨滴可见性
4216
+ * 当相机高度超过 hideAltitude 时隐藏雨滴,拉近时重新显示
4217
+ * 同时更新天气图标的显示状态
4218
+ */
4219
+ updateCameraVisibility(): void;
4220
+ /**
4221
+ * 创建天气图标 DOM 元素
4222
+ */
4223
+ private createWeatherIcon;
4224
+ /**
4225
+ * 获取当前天气类型的图标信息
4226
+ */
4227
+ private getWeatherIconInfo;
4228
+ /**
4229
+ * 显示天气图标
4230
+ */
4231
+ private showWeatherIcon;
4232
+ /**
4233
+ * 隐藏天气图标
4234
+ */
4235
+ private hideWeatherIcon;
4236
+ /**
4237
+ * 更新天气图标显示内容
4238
+ */
4239
+ private updateWeatherIconContent;
4240
+ /**
4241
+ * 启用下雨系统
4242
+ */
4243
+ enable(): void;
4244
+ /**
4245
+ * 设置相机高度追踪
4246
+ * 在每一帧渲染后检测相机高度,超过阈值时隐藏雨滴
4247
+ * 同时根据高度切换着色器雨效和粒子系统
4248
+ */
4249
+ private cameraTrackingCallback;
4250
+ /**
4251
+ * 设置相机追踪
4252
+ */
4253
+ private setupCameraTracking;
4254
+ /**
4255
+ * 禁用下雨系统
4256
+ */
4257
+ disable(): void;
4258
+ /**
4259
+ * 更新系统配置 - 实时天气数据更新的统一公共接口
4260
+ * 支持不同天气状态间的动态平滑过渡(例如强度由小雨转大雨,或类型由雨转雪)
4261
+ * @param config 部分配置参数,将与现有配置合并
4262
+ */
4263
+ update(config: Partial<RainConfig>): void;
4264
+ /**
4265
+ * 更新下雨区域范围
4266
+ * @param bounds 新的区域范围
4267
+ */
4268
+ private updateBounds;
4269
+ /**
4270
+ * 平滑过渡到新的天气强度
4271
+ * @param targetEmissionRate 目标发射率
4272
+ * @param duration 过渡持续时间(毫秒)
4273
+ */
4274
+ transitionToIntensity(targetEmissionRate: number, duration?: number): void;
4275
+ /**
4276
+ * 平滑过渡到新的天气类型
4277
+ * @param targetType 目标天气类型
4278
+ * @param duration 过渡持续时间(毫秒)
4279
+ */
4280
+ transitionToType(targetType: 'rain' | 'hail' | 'snow', duration?: number): void;
4281
+ /**
4282
+ * 获取系统状态
4283
+ */
4284
+ getStatus(): boolean;
4285
+ /**
4286
+ * 设置相机隐藏高度
4287
+ * @param altitude 相机高度超过此值时隐藏雨滴(单位:米)
4288
+ */
4289
+ setHideAltitude(altitude: number): void;
4290
+ /**
4291
+ * 获取当前相机高度
4292
+ */
4293
+ getCurrentCameraHeight(): number;
4294
+ /**
4295
+ * 设置是否启用着色器雨效模式
4296
+ * @param enabled 是否启用着色器雨效(相机低于500米时自动切换)
4297
+ */
4298
+ setShaderRainEnabled(enabled: boolean): void;
4299
+ /**
4300
+ * 设置着色器雨效切换高度
4301
+ * @param height 相机高度低于此值时切换到着色器雨效(单位:米)
4302
+ */
4303
+ setShaderRainHeight(height: number): void;
4304
+ /**
4305
+ * 销毁系统
4306
+ */
4307
+ destroy(): void;
4308
+ /**
4309
+ * 获取当前配置
4310
+ */
4311
+ getConfig(): RainConfig;
4312
+ }
4313
+
3814
4314
  declare global {
3815
4315
  interface Window {
3816
4316
  LACDT?: Record<string, any>;
@@ -3851,6 +4351,8 @@ declare const render: {
3851
4351
  TilesetManager: typeof TilesetManager;
3852
4352
  /** URL相机寻址管理 */
3853
4353
  CameraUrlManager: typeof CameraUrlManager;
4354
+ /** 下雨天气系统 */
4355
+ RainSystem: typeof RainSystem;
3854
4356
  };
3855
4357
 
3856
- export { AtmosphereControl, type AtmosphereScatteringConfig, AtmosphereScatteringSystem, BuildingControl, BuildingSystem, CameraListener, type CameraListenerConfig, CameraListenerSystem, type CameraListenerSystemConfig, type CameraParams, CameraUrlManager, type CameraUrlManagerConfig, type DirectionalLightConfig, type DistanceFogConfig, DistanceFogSystem, EnvironmentControl, FogControl, type HeightFogConfig, HeightFogSystem, LayerControl, LayerSystem, LightingControl, LightingSystem, PlottingControl, type PostProcessingConfig, PostProcessingControl, PostProcessingSystem, Render, type RenderConfig, RenderControl, type ShadowConfig, ShadowControl, ShadowSystem, SidebarControl, TilesetManager, TilesetSearchControl, ToolboxControl, ToolboxSystem, VolumetricCloudControl, type VolumetricCloudsConfig, VolumetricCloudsSystem, type WaterConfig, WaterControl, WaterSystem, render };
4358
+ export { AtmosphereControl, type AtmosphereScatteringConfig, AtmosphereScatteringSystem, BuildingControl, BuildingSystem, CameraListener, type CameraListenerConfig, CameraListenerSystem, type CameraListenerSystemConfig, type CameraParams, CameraUrlManager, type CameraUrlManagerConfig, type DirectionalLightConfig, type DistanceFogConfig, DistanceFogSystem, EnvironmentControl, FogControl, type HeightFogConfig, HeightFogSystem, LayerControl, LayerSystem, LightingControl, LightingSystem, PlottingControl, type PostProcessingConfig, PostProcessingControl, PostProcessingSystem, type RainBounds, type RainConfig, RainSystem, Render, type RenderConfig, RenderControl, type ShadowConfig, ShadowControl, ShadowSystem, SidebarControl, TilesetManager, TilesetSearchControl, ToolboxControl, ToolboxSystem, VolumetricCloudControl, type VolumetricCloudsConfig, VolumetricCloudsSystem, type WaterConfig, WaterControl, WaterSystem, defaultRainConfig, render };