import assert from 'node:assert/strict' import { JulianDate } from 'cesium' import { syncPipeLayer, clearPipeLayer } from '../../../src/modules/cockpit/services/cesiumPipeLayer.js' const sources=[] const viewer={dataSources:{getByName:name=>sources.filter(s=>s.name===name),add:async s=>{sources.push(s);return s}}} const pipe=(code,industry,networkLevel=0)=>({code,industry,networkLevel,diameter:400,positions:[[110.39,28.44],[110.3901,28.44]]}) const network={pipes:[pipe('gas','GAS',1),pipe('water','WATER_SUPPLY',1),pipe('sewage','DRAINAGE',0),pipe('rain','DRAINAGE',1)],components:[{code:'well',industry:'MANHOLE',kind:'other',position:[110.39,28.44],label:''}]} await syncPipeLayer(viewer,network) const t=JulianDate.now(),entities=sources[0].entities const color=id=>entities.getById(id).polyline.material.color.getValue(t) assert.ok(color('pipe:gas').red>color('pipe:gas').green*2,'gas visible guide must be red') assert.ok(color('pipe:water').blue>color('pipe:water').red*2) assert.ok(color('pipe:sewage').green>color('pipe:sewage').blue*1.5) assert.ok(color('pipe:rain').blue>.8&&color('pipe:rain').green>.8) const well=entities.getById('component:well') const wellColor=well.point.color.getValue(t) assert.ok(wellColor.blue>.8&&wellColor.red>.5&&wellColor.green<.6,'manhole is independent purple') assert.equal(well.label.text.getValue(t),'窨井') const rainBefore=entities.getById('pipe:rain').polyline network.pipes[3]={...network.pipes[3],networkLevel:0} await syncPipeLayer(viewer,network) assert.notStrictEqual(entities.getById('pipe:rain').polyline,rainBefore,'network-level-only update must recolor') assert.ok(color('pipe:rain').green>color('pipe:rain').blue*1.5) await clearPipeLayer(viewer) console.log('PASS real Cesium source guide colors, special manhole symbol, and network-level-only recolor')