Merge branch 'master' of https://git.code.tencent.com/jl-framework/rtss_simulation into HEAD
# Conflicts: # repository/repository_manager.go
This commit is contained in:
commit
3c08644dde
@ -19,6 +19,8 @@ type PsdCircuit struct {
|
||||
//屏蔽门表示继电器
|
||||
MGJ *ecs.Entry
|
||||
MPLJ *ecs.Entry
|
||||
//一些不知道如何使用的继电器,为了使得采集、驱动逻辑正常,先构建出来
|
||||
UnusedJ []*ecs.Entry
|
||||
}
|
||||
|
||||
var PsdInterlockDriveCircuitType = ecs.NewComponentType[PsdInterlockDriveCircuit]()
|
||||
|
@ -59,6 +59,8 @@ func loadPsdCircuit(world ecs.World, entry *ecs.Entry, psd *repository.Psd, entr
|
||||
circuit.MGJ = NewRelayEntity(world, relay, entryMap)
|
||||
case "XMPLJ", "SMPLJ":
|
||||
circuit.MPLJ = NewRelayEntity(world, relay, entryMap)
|
||||
default:
|
||||
circuit.UnusedJ = append(circuit.UnusedJ, NewRelayEntity(world, relay, entryMap))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,14 @@ type Platform struct {
|
||||
station *Station
|
||||
}
|
||||
|
||||
func NewPlatform(id string) *Platform {
|
||||
return &Platform{Identity: identity{
|
||||
id: id,
|
||||
deviceType: proto.DeviceType_DeviceType_Platform,
|
||||
}}
|
||||
func NewPlatform(id string, code string) *Platform {
|
||||
return &Platform{
|
||||
Identity: identity{
|
||||
id: id,
|
||||
deviceType: proto.DeviceType_DeviceType_Platform,
|
||||
},
|
||||
code: code,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Platform) Code() string {
|
||||
|
@ -3,12 +3,11 @@ package repository
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"joylink.club/rtsssimulation/repository/model/proto"
|
||||
"joylink.club/rtsssimulation/util/number"
|
||||
"log/slog"
|
||||
"math"
|
||||
"strconv"
|
||||
|
||||
"joylink.club/rtsssimulation/repository/model/proto"
|
||||
"joylink.club/rtsssimulation/util/number"
|
||||
)
|
||||
|
||||
var repositoryMap = make(map[string]*Repository)
|
||||
@ -112,7 +111,6 @@ func buildModels(source *proto.Repository, repository *Repository) error {
|
||||
m := newPsd(protoData.Id, protoData.AsdAmount, protoData.AsdGroups)
|
||||
repository.psdMap[m.Id()] = m
|
||||
}
|
||||
|
||||
for _, protoData := range source.Lights {
|
||||
m := NewLight(protoData.Id, protoData.Code)
|
||||
repository.lightMap[m.Id()] = m
|
||||
@ -121,7 +119,6 @@ func buildModels(source *proto.Repository, repository *Repository) error {
|
||||
m := NewAlarm(protoData.Id, protoData.Code)
|
||||
repository.alarmMap[m.Id()] = m
|
||||
}
|
||||
|
||||
for _, protoData := range source.Mkxs {
|
||||
m := NewMkx(protoData.Id)
|
||||
repository.mkxMap[m.Id()] = m
|
||||
@ -130,6 +127,10 @@ func buildModels(source *proto.Repository, repository *Repository) error {
|
||||
m := NewKey(protoData.Id, protoData.Code, protoData.Gear)
|
||||
repository.keyMap[m.Id()] = m
|
||||
}
|
||||
for _, protoData := range source.Platforms {
|
||||
m := NewPlatform(protoData.Id, protoData.Code)
|
||||
repository.platformMap[m.Id()] = m
|
||||
}
|
||||
err := repository.generateCoordinateInfo(source.MainCoordinateSystem)
|
||||
for _, protoData := range source.CentralizedStationRefs {
|
||||
repository.centralizedMap[protoData.StationId] = protoData
|
||||
@ -174,12 +175,29 @@ func buildModelRelationship(source *proto.Repository, repository *Repository) er
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = buildPlatformRelationShip(source, repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = buildCentralizedStationRelationShip(source, repository)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func buildPlatformRelationShip(source *proto.Repository, repo *Repository) error {
|
||||
for _, protoData := range source.Platforms {
|
||||
platform := repo.platformMap[protoData.Id]
|
||||
station := repo.stationMap[protoData.StationId]
|
||||
if station == nil {
|
||||
return fmt.Errorf("站台[id:%s]关联的车站[id:%s]不存在", platform.Id(), protoData.StationId)
|
||||
}
|
||||
platform.station = station
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func buildCentralizedStationRelationShip(source *proto.Repository, repo *Repository) error {
|
||||
for _, stationRef := range source.CentralizedStationRefs {
|
||||
stationId := stationRef.StationId
|
||||
@ -204,6 +222,11 @@ func buildMkxRelationShip(source *proto.Repository, repo *Repository) error {
|
||||
func buildPsdRelationShip(source *proto.Repository, repo *Repository) error {
|
||||
for _, protoData := range source.Psds {
|
||||
psd := repo.psdMap[protoData.Id]
|
||||
platform := repo.platformMap[protoData.PlatformId]
|
||||
if platform == nil {
|
||||
return fmt.Errorf("屏蔽门[id:%s]关联的站台[id:%s]不存在", psd.Id(), protoData.PlatformId)
|
||||
}
|
||||
psd.platform = platform
|
||||
for _, group := range protoData.ElectronicComponentGroups {
|
||||
var components []IGroupedElectronicComponent
|
||||
for _, id := range group.GetComponentIds() {
|
||||
|
Loading…
Reference in New Issue
Block a user