From 02c14c9c57dbde72d9c771bd8b0fab1cd023047d Mon Sep 17 00:00:00 2001
From: cloudflight <cloudflight@126.com>
Date: 星期一, 13 一月 2025 09:09:22 +0800
Subject: [PATCH] 上下游纵断面分析

---
 WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/02-transfer/HydroQ3dTransferHelper.cs |  282 ++++++++++++++++----------------------------------------
 1 files changed, 82 insertions(+), 200 deletions(-)

diff --git a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/02-transfer/HydroQ3dTransferHelper.cs b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/02-transfer/HydroQ3dTransferHelper.cs
index 25663c0..3d7d1ca 100644
--- a/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/02-transfer/HydroQ3dTransferHelper.cs
+++ b/WinFrmUI/Yw.WinFrmUI.Hydro.Core/00-core/02-transfer/HydroQ3dTransferHelper.cs
@@ -16,6 +16,40 @@
                 return default;
             }
             var vm = new NetworkViewModel();
+
+            if (rhs.Reservoirs != null && rhs.Reservoirs.Count > 0)
+            {
+                foreach (var reservoir in rhs.Reservoirs)
+                {
+                    var reservoirViewModel = new ReservoirViewModel();
+                    reservoirViewModel.ID = reservoir.Code;
+                    reservoirViewModel.Name = reservoir.Name;
+                    reservoirViewModel.Position3D = new PointF3D((float)reservoir.Position3d.X, (float)reservoir.Position3d.Y, (float)reservoir.Position3d.Z);
+                    vm.Nodes.Add(reservoirViewModel);
+                }
+            }
+            if (rhs.Tanks != null && rhs.Tanks.Count > 0)
+            {
+                foreach (var tank in rhs.Tanks)
+                {
+                    var tankViewModel = new TankViewModel();
+                    tankViewModel.ID = tank.Code;
+                    tankViewModel.Name = tank.Name;
+                    tankViewModel.Position3D = new PointF3D((float)tank.Position3d.X, (float)tank.Position3d.Y, (float)tank.Position3d.Z);
+                    vm.Nodes.Add(tankViewModel);
+                }
+            }
+            if (rhs.Waterboxs != null && rhs.Waterboxs.Count > 0)
+            {
+                foreach (var waterbox in rhs.Waterboxs)
+                {
+                    var waterboxViewModel = new TankViewModel();
+                    waterboxViewModel.ID = waterbox.Code;
+                    waterboxViewModel.Name = waterbox.Name;
+                    waterboxViewModel.Position3D = new PointF3D((float)waterbox.Position3d.X, (float)waterbox.Position3d.Y, (float)waterbox.Position3d.Z);
+                    vm.Nodes.Add(waterboxViewModel);
+                }
+            }
             if (rhs.Junctions != null && rhs.Junctions.Count > 0)
             {
                 foreach (var junction in rhs.Junctions)
@@ -47,6 +81,28 @@
                     hydrantViewModel.Name = hydrant.Name;
                     hydrantViewModel.Position3D = new PointF3D((float)hydrant.Position3d.X, (float)hydrant.Position3d.Y, (float)hydrant.Position3d.Z);
                     vm.Nodes.Add(hydrantViewModel);
+                }
+            }
+            if (rhs.Coolings != null && rhs.Coolings.Count > 0)
+            {
+                foreach (var cooling in rhs.Coolings)
+                {
+                    var coolingViewModel = new JunctionViewModel();
+                    coolingViewModel.ID = cooling.Code;
+                    coolingViewModel.Name = cooling.Name;
+                    coolingViewModel.Position3D = new PointF3D((float)cooling.Position3d.X, (float)cooling.Position3d.Y, (float)cooling.Position3d.Z);
+                    vm.Nodes.Add(coolingViewModel);
+                }
+            }
+            if (rhs.Bluntheads != null && rhs.Bluntheads.Count > 0)
+            {
+                foreach (var blunthead in rhs.Bluntheads)
+                {
+                    var bluntheadViewModel = new JunctionViewModel();
+                    bluntheadViewModel.ID = blunthead.Code;
+                    bluntheadViewModel.Name = blunthead.Name;
+                    bluntheadViewModel.Position3D = new PointF3D((float)blunthead.Position3d.X, (float)blunthead.Position3d.Y, (float)blunthead.Position3d.Z);
+                    vm.Nodes.Add(bluntheadViewModel);
                 }
             }
             if (rhs.Elbows != null && rhs.Elbows.Count > 0)
@@ -115,51 +171,6 @@
                     vm.Nodes.Add(pressmeterViewModel);
                 }
             }
-            if (rhs.Bluntheads != null && rhs.Bluntheads.Count > 0)
-            {
-                foreach (var blunthead in rhs.Bluntheads)
-                {
-                    var bluntheadViewModel = new JunctionViewModel();
-                    bluntheadViewModel.ID = blunthead.Code;
-                    bluntheadViewModel.Name = blunthead.Name;
-                    bluntheadViewModel.Position3D = new PointF3D((float)blunthead.Position3d.X, (float)blunthead.Position3d.Y, (float)blunthead.Position3d.Z);
-                    vm.Nodes.Add(bluntheadViewModel);
-                }
-            }
-
-            if (rhs.Reservoirs != null && rhs.Reservoirs.Count > 0)
-            {
-                foreach (var reservoir in rhs.Reservoirs)
-                {
-                    var reservoirViewModel = new ReservoirViewModel();
-                    reservoirViewModel.ID = reservoir.Code;
-                    reservoirViewModel.Name = reservoir.Name;
-                    reservoirViewModel.Position3D = new PointF3D((float)reservoir.Position3d.X, (float)reservoir.Position3d.Y, (float)reservoir.Position3d.Z);
-                    vm.Nodes.Add(reservoirViewModel);
-                }
-            }
-            if (rhs.Tanks != null && rhs.Tanks.Count > 0)
-            {
-                foreach (var tank in rhs.Tanks)
-                {
-                    var tankViewModel = new TankViewModel();
-                    tankViewModel.ID = tank.Code;
-                    tankViewModel.Name = tank.Name;
-                    tankViewModel.Position3D = new PointF3D((float)tank.Position3d.X, (float)tank.Position3d.Y, (float)tank.Position3d.Z);
-                    vm.Nodes.Add(tankViewModel);
-                }
-            }
-            if (rhs.Waterboxs != null && rhs.Waterboxs.Count > 0)
-            {
-                foreach (var waterbox in rhs.Waterboxs)
-                {
-                    var waterboxViewModel = new TankViewModel();
-                    waterboxViewModel.ID = waterbox.Code;
-                    waterboxViewModel.Name = waterbox.Name;
-                    waterboxViewModel.Position3D = new PointF3D((float)waterbox.Position3d.X, (float)waterbox.Position3d.Y, (float)waterbox.Position3d.Z);
-                    vm.Nodes.Add(waterboxViewModel);
-                }
-            }
 
             if (rhs.Pipes != null && rhs.Pipes.Count > 0)
             {
@@ -183,18 +194,6 @@
                     translationViewModel.StartNode = vm.Nodes.Find(x => x.ID == translation.StartCode);
                     translationViewModel.EndNode = vm.Nodes.Find(x => x.ID == translation.EndCode);
                     vm.Links.Add(translationViewModel);
-                }
-            }
-            if (rhs.Exchangers != null && rhs.Exchangers.Count > 0)
-            {
-                foreach (var exchanger in rhs.Exchangers)
-                {
-                    var exchangerViewModel = new PipeViewModel();
-                    exchangerViewModel.ID = exchanger.Code;
-                    exchangerViewModel.Name = exchanger.Name;
-                    exchangerViewModel.StartNode = vm.Nodes.Find(x => x.ID == exchanger.StartCode);
-                    exchangerViewModel.EndNode = vm.Nodes.Find(x => x.ID == exchanger.EndCode);
-                    vm.Links.Add(exchangerViewModel);
                 }
             }
 
@@ -223,153 +222,36 @@
                 }
             }
 
+            if (rhs.Exchangers != null && rhs.Exchangers.Count > 0)
+            {
+                foreach (var exchanger in rhs.Exchangers)
+                {
+                    var exchangerViewModel = new PipeViewModel();
+                    exchangerViewModel.ID = exchanger.Code;
+                    exchangerViewModel.Name = exchanger.Name;
+                    exchangerViewModel.StartNode = vm.Nodes.Find(x => x.ID == exchanger.StartCode);
+                    exchangerViewModel.EndNode = vm.Nodes.Find(x => x.ID == exchanger.EndCode);
+                    vm.Links.Add(exchangerViewModel);
+                }
+            }
+            if (rhs.Compressors != null && rhs.Compressors.Count > 0)
+            {
+                foreach (var compressor in rhs.Compressors)
+                {
+                    var compresorViewModel = new PipeViewModel();
+                    compresorViewModel.ID = compressor.Code;
+                    compresorViewModel.Name = compressor.Name;
+                    compresorViewModel.StartNode = vm.Nodes.Find(x => x.ID == compressor.StartCode);
+                    compresorViewModel.EndNode = vm.Nodes.Find(x => x.ID == compressor.EndCode);
+                    vm.Links.Add(compresorViewModel);
+                }
+            }
+
+
             return vm;
         }
 
 
-        /// <summary>
-        /// 杞崲
-        /// </summary>
-        /// <param name="info">妯″瀷淇℃伅</param>
-        /// <returns></returns>
-        public static object Transfer(Yw.Model.HydroModelInfo info)
-        {
-            if (info == null)
-            {
-                return default;
-            }
-            //var netWork = new HyView.MapViewNetWork();
-            //netWork.Nodes = new HyView.NodeViewModelList();
-            //netWork.Links = new HyView.LinkViewModelList();
-
-            //杩炴帴鑺傜偣
-            if (info.Junctions != null && info.Junctions.Count > 0)
-            {
-                foreach (var junction in info.Junctions)
-                {
-                    //var junctionModel = new HyView.JunctionViewModel();
-                    //junctionModel.ID = junction.Code;
-                    //junctionModel.Name = junction.Name;
-                    //junctionModel.X = (float)junction.Position3d.X;
-                    //junctionModel.Y = (float)junction.Position3d.Y;
-                    ////junctionModel.Z = (float)junction.Position3d.Z;
-                    //junctionModel.Position3D = new HyView.PointF3D((float)junction.Position3d.X, (float)junction.Position3d.Y, (float)junction.Position3d.Z);
-                    //junctionModel.Elev = (float)junction.Elev;
-                    //junctionModel.Demand = junction.Demand.HasValue ? (float)junction.Demand.Value : 0;
-                    //junctionModel.PatternID = junction.DemandPattern;
-                    ////junctionModel.Status = StatusType.DEFAULT;
-                    //netWork.Nodes.Add(junctionModel);
-
-                    //netWork.Nodes.Add(junctionModel);
-                }
-            }
-
-            //姘村簱
-            if (info.Reservoirs != null && info.Reservoirs.Count > 0)
-            {
-                foreach (var reservoir in info.Reservoirs)
-                {
-                    //var reservoirModel = new HyView.ReservoirViewModel();
-                    //reservoirModel.ID = reservoir.Code;
-                    //reservoirModel.Name = reservoir.Name;
-                    //reservoirModel.X = (float)reservoir.Position3d.X;
-                    //reservoirModel.Y = (float)reservoir.Position3d.Y;
-                    ////reservoirModel.Z = (float)reservoir.Position3d.Z;
-                    //reservoirModel.Demand = 0;
-                    //reservoirModel.Head = (float)reservoir.Head;
-                    //reservoirModel.PatternID = reservoir.HeadPattern;
-                    //reservoirModel.Position3D = new HyView.PointF3D((float)reservoir.Position3d.X, (float)reservoir.Position3d.Y, (float)reservoir.Position3d.Z);
-                    //netWork.Nodes.Add(reservoirModel);
-                }
-            }
-
-            //姘存睜
-            if (info.Tanks != null && info.Tanks.Count > 0)
-            {
-                foreach (var tank in info.Tanks)
-                {
-                    //var tankModel = new HyView.TankViewModel();
-                    //tankModel.ID = tank.Code;
-                    //tankModel.Name = tank.Name;
-                    //tankModel.X = (float)tank.Position3d.X;
-                    //tankModel.Y = (float)tank.Position3d.Y;
-                    ////tankModel.Z = (float)tank.Position3d.Z;
-                    //tankModel.Demand = 0;
-                    //tankModel.Diameter = (float)tank.Diameter;
-                    //tankModel.Elev = (float)tank.PoolElev;
-                    //tankModel.InitLevel = (float)tank.InitLevel;
-                    //tankModel.MinLevel = (float)tank.MinLevel;
-                    //tankModel.MaxLevel = (float)tank.MaxLevel;
-                    //tankModel.MinVol = (float)tank.MinVol;
-                    //tankModel.VolCurve = tank.VolCurve;
-                    //tankModel.Position3D = new HyView.PointF3D((float)tank.Position3d.X, (float)tank.Position3d.Y, (float)tank.Position3d.Z);
-                    //netWork.Nodes.Add(tankModel);
-                }
-            }
-
-            //绠¢亾
-            if (info.Pipes != null && info.Pipes.Count > 0)
-            {
-                foreach (var pipe in info.Pipes)
-                {
-                    //var pipeModel = new HyView.PipeViewModel();
-                    //pipeModel.ID = pipe.Code;
-                    //pipeModel.Name = pipe.Name;
-                    //// pipeModel.Status = StatusType.OPEN;
-                    //pipeModel.StartNode = netWork.Nodes.Find(x => x.ID == pipe.StartCode);
-                    //pipeModel.EndNode = netWork.Nodes.Find(x => x.ID == pipe.EndCode);
-                    //pipeModel.Diameter = (float)pipe.Diameter;
-                    //pipeModel.Length = (float)pipe.Length;
-                    //pipeModel.Roughness = (float)pipe.Roughness;
-                    //pipeModel.MinorLoss = (float)pipe.MinorLoss;
-
-                    //netWork.Links.Add(pipeModel);
-
-                }
-            }
-
-            //姘存车
-            if (info.Pumps != null && info.Pumps.Count > 0)
-            {
-                foreach (var pump in info.Pumps)
-                {
-                    //var pumpModel = new HyView.PumpViewModel();
-                    //pumpModel.ID = pump.Code;
-                    //pumpModel.Name = pump.Name;
-                    ////pumpModel.Status = StatusType.OPEN;
-                    //pumpModel.StartNode = netWork.Nodes.Find(x => x.ID == pump.StartCode);
-                    //pumpModel.EndNode = netWork.Nodes.Find(x => x.ID == pump.EndCode);
-                    //pumpModel.HeadCurve = pump.CurveQH;
-
-
-                    //netWork.Links.Add(pumpModel);
-
-                }
-            }
-
-            //闃�闂�
-            if (info.Valves != null && info.Valves.Count > 0)
-            {
-                foreach (var valve in info.Valves)
-                {
-                    //var valveModel = new HyView.ValveViewModel();
-                    //valveModel.ID = valve.Code;
-                    //valveModel.Name = valve.Name;
-                    ////valveModel.Status = StatusType.OPEN;
-                    //valveModel.StartNode = netWork.Nodes.Find(x => x.ID == valve.StartCode);
-                    //valveModel.EndNode = netWork.Nodes.Find(x => x.ID == valve.EndCode);
-                    //valveModel.Diameter = (float)valve.Diameter;
-                    //valveModel.Type = valve.ValveType;
-                    //valveModel.Setting = valve.ValveSetting;
-
-
-                    //netWork.Links.Add(valveModel);
-
-                }
-            }
-
-            return default;
-        }
 
     }
 }

--
Gitblit v1.9.3