# BP_SubmarineCable 海底光缆蓝图详细规格 ## 蓝图信息 | 属性 | 值 | |------|-----| | 蓝图类型 | Actor | | 父类 | `Actor` | | 路径 | `Content/Blueprints/BP_SubmarineCable.uasset` | ## 组件列表 ``` BP_SubmarineCable ├── SceneRoot (场景根) │ ├── SplineComponent (路径样条) │ │ └── [动态] 点数量根据路径数据动态创建 │ ├── CableMesh (光缆几何体) │ │ └── SplineMeshComponent × N (多个样条网格) │ │ └── Material: M_Cable │ ├── FlowParticles (流向粒子) │ │ └── NiagaraComponent │ │ └── NS_DataFlow (粒子系统) │ └── EndPointMarkers (端点标记) │ ├── BP_DataPoint (起点标记) │ └── BP_DataPoint (终点标记) ``` ## 变量列表 | 变量名 | 类型 | 默认值 | 说明 | |--------|------|--------|------| | `CableId` | String | `""` | 光缆唯一标识 | | `Name` | String | `"Unknown Cable"` | 光缆名称 | | `CableType` | ESubmarineCableType | `Main` | 光缆类型 | | `Bandwidth` | Float | `1000.0` | 带宽 (Tbps) | | `Length` | Float | `0.0` | 长度 (公里) | | `Owner` | String | `""` | 运营商 | | `IsActive` | Boolean | `true` | 是否激活 | | `PathPoints` | Array | `[]` | 路径点数组 | | `StartPoint` | GeographicPoint | - | 起点 | | `EndPoint` | GeographicPoint | - | 终点 | | `CableColor` | LinearColor | (1.0, 0.8, 0.0, 1) | 光缆颜色 | ## 枚举定义 ### ESubmarineCableType | 枚举值 | 说明 | |--------|------| | `Main` | 主干光缆 | | `Branch` | 分支光缆 | | `Regional` | 区域光缆 | | `Private` | 私有光缆 | ## 组件详情 ### SplineComponent ``` 设置: ├─ 闭合: false (光缆通常不闭合) ├─ 插值: 曲线插值 └─ 点数: PathPoints.Length ``` ### SplineMeshComponent (用于渲染) ``` 每个段创建一个 SplineMeshComponent: ├─ StartLocation: 样条点[i] 的 UE 坐标 ├─ EndLocation: 样条点[i+1] 的 UE 坐标 ├─ StartTangent: 样条切线 ├─ EndTangent: 样条切线 └─ Material: M_Cable ``` ## 材质规格 ### M_Cable (光缆材质) | 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | `BaseColor` | Vector3 | (1.0, 0.8, 0.0) | 金黄色 | | `Metallic` | Float | `0.8` | 金属度 | | `Roughness` | Float | `0.3` | 粗糙度 | | `EmissiveStrength` | Float | `2.0` | 自发光强度 | | `PulseSpeed` | Float | `0.5` | 脉冲速度 | | `FlowDirection` | Float | `1.0` | 流向 (1=正向, -1=反向) | ### M_Cable_Inactive (非激活状态) ``` 基于 M_Cable: ├─ EmissiveStrength: 0.2 ├─ Saturation: 0.3 └─ Color: 灰色 ``` ## 粒子效果 (NS_DataFlow) ### 粒子系统参数 | 参数 | 类型 | 默认值 | 说明 | |------|------|--------|------| | `User.FlowColor` | LinearColor | (1.0, 0.8, 0.0, 1) | 粒子颜色 | | `User.FlowSpeed` | Float | `100.0` | 粒子速度 | | `User.FlowDensity` | Float | `1.0` | 粒子密度 | | `User.FlowDirection` | Float | `1.0` | 流向 | ### 粒子行为 ``` 1. 粒子沿样条路径移动 2. 速度 = Bandwidth / 1000 (归一化) 3. 颜色根据带宽变化: ├─ > 1000 Tbps: 绿色 (繁忙) ├─ 500-1000 Tbps: 青色 (正常) ├─ 100-500 Tbps: 黄色 (空闲) └─ < 100 Tbps: 红色 (低负载) ``` ## 函数 ### Initialize (Struct CableData) ``` 1. [解析] CableData 2. [设置] CableId = CableData["id"] 3. [设置] Name = CableData["name"] 4. [设置] Bandwidth = CableData["bandwidth"] 5. [设置] Length = CableData["length"] 6. [设置] Owner = CableData["owner"] 7. [获取] CableData["path"] → PathArray 8. [设置] PathPoints = ConvertToGeoPoints(PathArray) 9. [调用] BuildSpline() 10. [调用] UpdateMaterial() ``` ### BuildSpline ``` 1. [清空] SplineComponent.Points 2. [循环] For Each Point in PathPoints ├─ [计算] UEPosition = GeoUtils.LatLonToUE(Point) └─ [添加] SplineComponent.AddSplinePoint(UEPosition) 3. [循环] For i = 0 to PathPoints.Length - 2 ├─ [创建] SplineMeshComponent ├─ [设置] StartLocation = SplinePoint[i] ├─ [设置] EndLocation = SplinePoint[i+1] ├─ [设置] StartTangent = SplineTangent[i] ├─ [设置] EndTangent = SplineTangent[i+1] └─ [添加] 到 CableMeshComponents 数组 ``` ### UpdateMaterial ``` 1. [计算] FlowSpeed = Bandwidth / 1000 * 50 2. [获取] NiagaraComponent 3. [设置] User.FlowSpeed = FlowSpeed 4. [分支] Bandwidth ├─ > 1000: [设置] FlowColor = (0, 1, 0, 1) 绿色 ├─ 500-1000: [设置] FlowColor = (0, 1, 1, 1) 青色 ├─ 100-500: [设置] FlowColor = (1, 1, 0, 1) 黄色 └─ < 100: [设置] FlowColor = (1, 0, 0, 1) 红色 5. [设置] Material.FlowColor = FlowColor ``` ### UpdateData (Struct NewData) ``` 1. [设置] Bandwidth = NewData["bandwidth"] 2. [设置] IsActive = NewData["is_active"] 3. [调用] UpdateMaterial() 4. [调用] UpdateParticles() ``` ### SetFlowDirection (Float Direction) ``` 1. [设置] Material.FlowDirection = Direction 2. [设置] NiagaraComponent.FlowDirection = Direction 3. [分支] Direction > 0 ├─ [是]: [设置] StartMarker.Icon = 起点图标 └─ [否]: [设置] StartMarker.Icon = 终点图标 ``` ## 事件 ### OnBeginCursorOver ``` 1. [设置] CableMesh.OverlayMaterial = M_Highlight 2. [设置] HighlightStrength = 0.3 → 1.0 (渐变) 3. [创建/显示] Tooltip Widget └─ 显示: 名称、带宽、长度、运营商 ``` ### OnEndCursorOver ``` 1. [设置] CableMesh.OverlayMaterial = nullptr 2. [隐藏] Tooltip Widget ``` ### OnClicked ``` 1. [调用] FocusOnCable() 2. [调用] ShowCableDetails() ``` ### FocusOnCable ``` 1. [获取] Self.Bounds → CableBounds 2. [获取] CameraRig.Camera 3. [计算] ViewLocation = CableBounds.Center + (0, 0, 500000) 4. [调用] Camera.SetViewTargetWithBlend(ViewLocation) 5. [播放] Timeline "FlyToTarget" ``` ## 数据格式 ### 输入数据结构 ```json { "id": "cable_seamewe4", "name": "SEA-ME-WE 4", "source": "telegeography_cables", "data_type": "submarine_cable", "metadata": { "bandwidth": 2920.0, "length": 19650.0, "owner": "Telecom Italia", "cable_type": "Main", "is_active": true, "owners_list": [ "Telecom Italia", "Orange", "Singtel", "MCI" ], "rfs_date": "2005-12-15" }, "path": [ {"latitude": 1.3521, "longitude": 103.8198}, {"latitude": 3.1390, "longitude": 101.6869}, {"latitude": 5.4141, "longitude": 100.3297}, {"latitude": 13.7563, "longitude": 100.5018}, {"latitude": 21.4858, "longitude": 101.0400} ] } ``` ## 带宽颜色编码 | 带宽范围 | 颜色 | RGB | 含义 | |----------|------|-----|------| | > 2000 Tbps | 🟢 亮绿 | (0.2, 1.0, 0.2) | 高负载/骨干 | | 1000-2000 Tbps | 🟢 绿色 | (0.4, 1.0, 0.4) | 繁忙 | | 500-1000 Tbps | 🔵 青色 | (0.2, 1.0, 1.0) | 正常 | | 100-500 Tbps | 🟡 黄色 | (1.0, 1.0, 0.2) | 空闲 | | < 100 Tbps | 🔴 红色 | (1.0, 0.3, 0.3) | 低负载 | ## 光缆类型图标 | 类型 | 图标 | 颜色 | |------|------|------| | Main | ⬛ 主干 | 金色 | | Branch | ┊ 分支 | 银色 | | Regional | ∿ 区域 | 铜色 | | Private | 🔒 私有 | 灰色 | ## 性能优化 ### LOD 设置 ``` LOD0 (近距离): ├─ 高精度网格 ├─ 完整纹理 └─ 完整粒子 LOD1 (中距离): ├─ 中精度网格 ├─ 半分辨率纹理 └─ 简化粒子 LOD2 (远距离): ├─ 低精度网格 └─ 禁用粒子 ``` ### 视锥剔除 ``` ├─ 启用: true └─ 剔除距离: 50000 km ``` ## 知名海缆示例 | 名称 | 长度 | 带宽 | 起点 | 终点 | |------|------|------|------|------| | SEA-ME-WE 4 | 19,650 km | 2.92 Pbps | 新加坡 | 法国 | | SEA-ME-WE 5 | 20,000 km | 2.44 Pbps | 新加坡 | 法国 | | FASTER | 11,629 km | 6.08 Pbps | 日本 | 美国 | | Apollo | 13,000 km | 3.20 Pbps | 美国 | 法国 | | Pacific Light | 12,120 km | 2.88 Pbps | 香港 | 美国 | | Hainan to Singapore | 2,936 km | 6.0 Pbps | 海南 | 新加坡 |