文件名从 WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/02-transfer/HydroL3dTransferHelper.cs 修改 |
| | |
| | | 锘縰sing Yw.WinFrmUI.HydroL3d; |
| | | 锘縰sing Yw.WpfUI.Hydro; |
| | | |
| | | namespace Yw.WinFrmUI |
| | | namespace HStation.WinFrmUI |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public static class HydroL3dTransferHelper |
| | | public static class HydroL3d2TransferHelper |
| | | { |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | public static Network ToL3dNetworkViewModel(this Yw.Model.HydroModelInfo rhs) |
| | | public static NetworkL3d ToL3d2NetworkViewModel(this Yw.Model.HydroModelInfo rhs) |
| | | { |
| | | if (rhs == null) |
| | | { |
| | | return default; |
| | | } |
| | | var vm = new Network(); |
| | | var vm = new NetworkL3d(); |
| | | if (rhs.Junctions != null && rhs.Junctions.Count > 0) |
| | | { |
| | | foreach (var junction in rhs.Junctions) |
| | | { |
| | | var junctionViewModel = new Junction(); |
| | | var junctionViewModel = new JunctionL3d(); |
| | | junctionViewModel.Id = junction.Code; |
| | | junctionViewModel.Name = junction.Name; |
| | | junctionViewModel.Position = new Point3d(junction.Position3d.X, junction.Position3d.Y, junction.Position3d.Z); |
| | | junctionViewModel.Position = new PointL3d(junction.Position3d.X, junction.Position3d.Y, junction.Position3d.Z); |
| | | vm.Append(junctionViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var nozzle in rhs.Nozzles) |
| | | { |
| | | var nozzleViewModel = new Junction(); |
| | | var nozzleViewModel = new JunctionL3d(); |
| | | nozzleViewModel.Id = nozzle.Code; |
| | | nozzleViewModel.Name = nozzle.Name; |
| | | nozzleViewModel.Position = new Point3d(nozzle.Position3d.X, nozzle.Position3d.Y, nozzle.Position3d.Z); |
| | | nozzleViewModel.Position = new PointL3d(nozzle.Position3d.X, nozzle.Position3d.Y, nozzle.Position3d.Z); |
| | | vm.Append(nozzleViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var hydrant in rhs.Hydrants) |
| | | { |
| | | var hydrantViewModel = new Junction(); |
| | | var hydrantViewModel = new JunctionL3d(); |
| | | hydrantViewModel.Id = hydrant.Code; |
| | | hydrantViewModel.Name = hydrant.Name; |
| | | hydrantViewModel.Position = new Point3d(hydrant.Position3d.X, hydrant.Position3d.Y, hydrant.Position3d.Z); |
| | | hydrantViewModel.Position = new PointL3d(hydrant.Position3d.X, hydrant.Position3d.Y, hydrant.Position3d.Z); |
| | | vm.Append(hydrantViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var elbow in rhs.Elbows) |
| | | { |
| | | var elbowViewModel = new Junction(); |
| | | var elbowViewModel = new JunctionL3d(); |
| | | elbowViewModel.Id = elbow.Code; |
| | | elbowViewModel.Name = elbow.Name; |
| | | elbowViewModel.Position = new Point3d(elbow.Position3d.X, elbow.Position3d.Y, elbow.Position3d.Z); |
| | | elbowViewModel.Position = new PointL3d(elbow.Position3d.X, elbow.Position3d.Y, elbow.Position3d.Z); |
| | | vm.Append(elbowViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var threelink in rhs.Threelinks) |
| | | { |
| | | var threelinkViewModel = new Junction(); |
| | | var threelinkViewModel = new JunctionL3d(); |
| | | threelinkViewModel.Id = threelink.Code; |
| | | threelinkViewModel.Name = threelink.Name; |
| | | threelinkViewModel.Position = new Point3d(threelink.Position3d.X, threelink.Position3d.Y, threelink.Position3d.Z); |
| | | threelinkViewModel.Position = new PointL3d(threelink.Position3d.X, threelink.Position3d.Y, threelink.Position3d.Z); |
| | | vm.Append(threelinkViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var fourlink in rhs.Fourlinks) |
| | | { |
| | | var fourlinkViewModel = new Junction(); |
| | | var fourlinkViewModel = new JunctionL3d(); |
| | | fourlinkViewModel.Id = fourlink.Code; |
| | | fourlinkViewModel.Name = fourlink.Name; |
| | | fourlinkViewModel.Position = new Point3d(fourlink.Position3d.X, fourlink.Position3d.Y, fourlink.Position3d.Z); |
| | | fourlinkViewModel.Position = new PointL3d(fourlink.Position3d.X, fourlink.Position3d.Y, fourlink.Position3d.Z); |
| | | vm.Append(fourlinkViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var meter in rhs.Meters) |
| | | { |
| | | var meterViewModel = new Junction(); |
| | | var meterViewModel = new JunctionL3d(); |
| | | meterViewModel.Id = meter.Code; |
| | | meterViewModel.Name = meter.Name; |
| | | meterViewModel.Position = new Point3d(meter.Position3d.X, meter.Position3d.Y, meter.Position3d.Z); |
| | | meterViewModel.Position = new PointL3d(meter.Position3d.X, meter.Position3d.Y, meter.Position3d.Z); |
| | | vm.Append(meterViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var flowmeter in rhs.Flowmeters) |
| | | { |
| | | var flowmeterViewModel = new Junction(); |
| | | var flowmeterViewModel = new JunctionL3d(); |
| | | flowmeterViewModel.Id = flowmeter.Code; |
| | | flowmeterViewModel.Name = flowmeter.Name; |
| | | flowmeterViewModel.Position = new Point3d(flowmeter.Position3d.X, flowmeter.Position3d.Y, flowmeter.Position3d.Z); |
| | | flowmeterViewModel.Position = new PointL3d(flowmeter.Position3d.X, flowmeter.Position3d.Y, flowmeter.Position3d.Z); |
| | | vm.Append(flowmeterViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var pressmeter in rhs.Pressmeters) |
| | | { |
| | | var pressmeterViewModel = new Junction(); |
| | | var pressmeterViewModel = new JunctionL3d(); |
| | | pressmeterViewModel.Id = pressmeter.Code; |
| | | pressmeterViewModel.Name = pressmeter.Name; |
| | | pressmeterViewModel.Position = new Point3d(pressmeter.Position3d.X, pressmeter.Position3d.Y, pressmeter.Position3d.Z); |
| | | pressmeterViewModel.Position = new PointL3d(pressmeter.Position3d.X, pressmeter.Position3d.Y, pressmeter.Position3d.Z); |
| | | vm.Append(pressmeterViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var blunthead in rhs.Bluntheads) |
| | | { |
| | | var bluntheadViewModel = new Junction(); |
| | | var bluntheadViewModel = new JunctionL3d(); |
| | | bluntheadViewModel.Id = blunthead.Code; |
| | | bluntheadViewModel.Name = blunthead.Name; |
| | | bluntheadViewModel.Position = new Point3d(blunthead.Position3d.X, blunthead.Position3d.Y, blunthead.Position3d.Z); |
| | | bluntheadViewModel.Position = new PointL3d(blunthead.Position3d.X, blunthead.Position3d.Y, blunthead.Position3d.Z); |
| | | vm.Append(bluntheadViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var reservoir in rhs.Reservoirs) |
| | | { |
| | | var reservoirViewModel = new Reservoir(); |
| | | var reservoirViewModel = new ReservoirL3d(); |
| | | reservoirViewModel.Id = reservoir.Code; |
| | | reservoirViewModel.Name = reservoir.Name; |
| | | reservoirViewModel.Position = new Point3d(reservoir.Position3d.X, reservoir.Position3d.Y, reservoir.Position3d.Z); |
| | | reservoirViewModel.Position = new PointL3d(reservoir.Position3d.X, reservoir.Position3d.Y, reservoir.Position3d.Z); |
| | | vm.Append(reservoirViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var tank in rhs.Tanks) |
| | | { |
| | | var tankViewModel = new Tank(); |
| | | var tankViewModel = new TankL3d(); |
| | | tankViewModel.Id = tank.Code; |
| | | tankViewModel.Name = tank.Name; |
| | | tankViewModel.Position = new Point3d(tank.Position3d.X, tank.Position3d.Y, tank.Position3d.Z); |
| | | tankViewModel.Position = new PointL3d(tank.Position3d.X, tank.Position3d.Y, tank.Position3d.Z); |
| | | vm.Append(tankViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | foreach (var waterbox in rhs.Waterboxs) |
| | | { |
| | | var waterboxViewModel = new Tank(); |
| | | var waterboxViewModel = new TankL3d(); |
| | | waterboxViewModel.Id = waterbox.Code; |
| | | waterboxViewModel.Name = waterbox.Name; |
| | | waterboxViewModel.Position = new Point3d(waterbox.Position3d.X, waterbox.Position3d.Y, waterbox.Position3d.Z); |
| | | waterboxViewModel.Position = new PointL3d(waterbox.Position3d.X, waterbox.Position3d.Y, waterbox.Position3d.Z); |
| | | vm.Append(waterboxViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | var startNode = rhs.GetAllNodes().Find(x => x.Code == pipe.StartCode); |
| | | var endNode = rhs.GetAllNodes().Find(x => x.Code == pipe.EndCode); |
| | | var pipeViewModel = new Pipe(); |
| | | var pipeViewModel = new PipeL3d(); |
| | | pipeViewModel.Id = pipe.Code; |
| | | pipeViewModel.Name = pipe.Name; |
| | | pipeViewModel.StartPosition = new Point3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new Point3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | pipeViewModel.StartPosition = new PointL3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new PointL3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | vm.Append(pipeViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | var startNode = rhs.GetAllNodes().Find(x => x.Code == translation.StartCode); |
| | | var endNode = rhs.GetAllNodes().Find(x => x.Code == translation.EndCode); |
| | | var pipeViewModel = new Pipe(); |
| | | var pipeViewModel = new PipeL3d(); |
| | | pipeViewModel.Id = translation.Code; |
| | | pipeViewModel.Name = translation.Name; |
| | | pipeViewModel.StartPosition = new Point3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new Point3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | pipeViewModel.StartPosition = new PointL3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new PointL3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | vm.Append(pipeViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | var startNode = rhs.GetAllNodes().Find(x => x.Code == exchanger.StartCode); |
| | | var endNode = rhs.GetAllNodes().Find(x => x.Code == exchanger.EndCode); |
| | | var pipeViewModel = new Pipe(); |
| | | var pipeViewModel = new ValveL3d(); |
| | | pipeViewModel.Id = exchanger.Code; |
| | | pipeViewModel.Name = exchanger.Name; |
| | | pipeViewModel.StartPosition = new Point3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new Point3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | pipeViewModel.StartPosition = new PointL3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new PointL3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | vm.Append(pipeViewModel, out _); |
| | | } |
| | | } |
| | |
| | | { |
| | | var startNode = rhs.GetAllNodes().Find(x => x.Code == pump.StartCode); |
| | | var endNode = rhs.GetAllNodes().Find(x => x.Code == pump.EndCode); |
| | | var pipeViewModel = new Pipe(); |
| | | var pipeViewModel = new PumpL3d(); |
| | | pipeViewModel.Id = pump.Code; |
| | | pipeViewModel.Name = pump.Name; |
| | | pipeViewModel.StartPosition = new Point3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new Point3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | vm.Append(pipeViewModel, out _); |
| | | pipeViewModel.StartPosition = new PointL3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new PointL3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | vm.Append(pipeViewModel, msg: out _); |
| | | } |
| | | } |
| | | if (rhs.Valves != null && rhs.Valves.Count > 0) |
| | |
| | | { |
| | | var startNode = rhs.GetAllNodes().Find(x => x.Code == valve.StartCode); |
| | | var endNode = rhs.GetAllNodes().Find(x => x.Code == valve.EndCode); |
| | | var pipeViewModel = new Pipe(); |
| | | var pipeViewModel = new ValveL3d(); |
| | | pipeViewModel.Id = valve.Code; |
| | | pipeViewModel.Name = valve.Name; |
| | | pipeViewModel.StartPosition = new Point3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new Point3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | pipeViewModel.StartPosition = new PointL3d(startNode.Position3d.X, startNode.Position3d.Y, startNode.Position3d.Z); |
| | | pipeViewModel.EndPosition = new PointL3d(endNode.Position3d.X, endNode.Position3d.Y, endNode.Position3d.Z); |
| | | vm.Append(pipeViewModel, out _); |
| | | } |
| | | } |