* 将传输速率(Mbps)归一化为链路线宽(1.5–6px)。 * 使用对数映射,使低速率链路也有明显变化。 * @param {number} rateMbps - 传输速率(Mbps) * @returns {number} 线宽(px)
(rateMbps)
| 792 | * @returns {number} 线宽(px) |
| 793 | */ |
| 794 | _rateToLineWidth(rateMbps) { |
| 795 | const MIN_W = 1.5; |
| 796 | const MAX_W = 6.0; |
| 797 | const MAX_RATE = 1000; // 参考最大速率 1000 Mbps |
| 798 | if (!rateMbps || rateMbps <= 0) return MIN_W; |
| 799 | // 对数归一化:log(1 + rate) / log(1 + MAX_RATE) |
| 800 | const norm = Math.log1p(Math.min(rateMbps, MAX_RATE)) / Math.log1p(MAX_RATE); |
| 801 | return MIN_W + norm * (MAX_W - MIN_W); |
| 802 | }, |
| 803 | |
| 804 | /** |
| 805 | * 根据传输方式返回对应的链路颜色(Cesium.Color)。 |
nothing calls this directly
no outgoing calls
no test coverage detected