This repository has been archived on 2026-10-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

57 lines
2.0 KiB
Go
Raw Permalink Normal View History

package catalogs
import (
"encoding/json"
"os"
"path/filepath"
"sync"
)
var _ = json.RawMessage{}
var _ = sync.Mutex{}
var _ = os.ReadFile
var _ = filepath.Join
//
// 一个路口(红绿灯)的相位表一行 —— 数据来自捐赠端 PrivateServerPor 的
// Drmk.Server/Drmk.App/data/zonegraph_intersections.csv(171 行)。
//
//
// ⛑⛑ 2026-10-02 移植自捐赠端 `Drmk.Core/ClientData/Client4229938/IntersectionTable.cs`
// (逐字照搬解析逻辑,只把路径改成走 Paths.Intersections 配置)。
// 为什么需要它:主线以前 init 的 Intersections 恒为 [],客户端
// AetherIntersectionManager 建不出 IntersectionDataEntity ⇒ 不
// RegisterTrafficLight ⇒ **灯柱从来没被接管 ⇒ 不亮**。有了这张表才能
// ① init 里带上真路口、② 周期发 SyncAetherAIIntersectionUpdateDa(68819947) 切相位。
// ⛑ lane id 同源性已验证:本表 PeriodOpenLanes 里的车道 id 在主线
// vehicle_lanes.csv 里 **29/29 命中**(前 6 个路口抽样),距路口 16~26m
// ⇒ 与主线车流用的是同一份 zonegraph。
//
type TrafficIntersection4229938 struct {
ZoneIndex int32 `json:"zoneIndex"`
X float32 `json:"x"`
Y float32 `json:"y"`
Z float32 `json:"z"`
PeriodCount int32 `json:"periodCount"`
CurrentPeriodIndex byte `json:"currentPeriodIndex"`
NextPeriodIndex byte `json:"nextPeriodIndex"`
RailPeriodIndex byte `json:"railPeriodIndex"`
PeriodOpenLanes [][]int32 `json:"periodOpenLanes"`
// 这个路口涉及的全部车道(各相位放行车道的并集)。
AllLanes any `json:"allLanes"`
}
type IntersectionTable struct {
Cache []TrafficIntersection4229938 `json:"cache"`
All []TrafficIntersection4229938 `json:"all"`
Count int32 `json:"count"`
LaneOwner map[int32]int32 `json:"laneOwner"`
ZoneMap map[int32]int32 `json:"zoneMap"`
// 映射表命中了多少个路口(诊断用)。
ZoneMapHits int32 `json:"zoneMapHits"`
}
const (
IntersectionTable_ZoneMapRelativePath string = "Drmk.Server/Drmk.App/data/intersection_zone_map.csv"
)