lixiaojun
2025-04-09 9aa8106d88fc3070498493e2819922f7ac31746e
WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -2,10 +2,11 @@
using DevExpress.Mvvm.Native;
using DevExpress.Pdf.Native;
using Mapster;
using Yw.EPAnet;
using Yw.Epanet;
using Yw.Hydro;
using Yw.Model;
using Yw.Vmo;
using Yw.WinFrmUI.Bimface;
namespace HStation.WinFrmUI
{
@@ -115,7 +116,7 @@
        {
            base.InitialDataSource();
            ShowBimfaceCtrl();
            ShowQ3dCtrl();
            ShowL3d2Ctrl();
            ShowPropertyCtrl();
            InitialSvgImages();
        }
@@ -365,42 +366,42 @@
        #endregion BIM控件
        #region Q3d控件
        #region L3d2控件
        //Q3d 控件
        private XhsProjectSimulationQ3dCtrl _q3dCtrl = null;
        //L3d2控件
        private XhsProjectSimulationL3d2Ctrl _l3d2ctrl = null;
        //获取 Q3d 控件
        private XhsProjectSimulationQ3dCtrl GetQ3dCtrl()
        //获取L3d2控件
        private XhsProjectSimulationL3d2Ctrl GetL3d2Ctrl()
        {
            if (_hydroInfo == null)
            {
                return default;
            }
            if (_q3dCtrl == null)
            if (_l3d2ctrl == null)
            {
                _q3dCtrl = new XhsProjectSimulationQ3dCtrl();
                _q3dCtrl.Dock = DockStyle.Fill;
                _q3dCtrl.InitialData(() => _hydroInfo);
                _q3dCtrl.SelectedPartersChangedEvent += (codes) =>
                _l3d2ctrl = new XhsProjectSimulationL3d2Ctrl();
                _l3d2ctrl.Dock = DockStyle.Fill;
                _l3d2ctrl.InitialData(hydroInfoFunc: () => _hydroInfo);
                _l3d2ctrl.SelectedPartersChangedEvent += (codes) =>
                {
                    var visualListHelper = GetVisualListHelper();
                    var visuals = visualListHelper.GetVisualList(codes);
                    SelectVisual(visuals?.LastOrDefault(), eSimulationVisualSource.Q3d);
                };
            }
            return _q3dCtrl;
            return _l3d2ctrl;
        }
        //显示 Q3d 控件
        private void ShowQ3dCtrl()
        //显示L3d2控件
        private void ShowL3d2Ctrl()
        {
            var q3dCtrl = GetQ3dCtrl();
            var l3d2Ctrl = GetL3d2Ctrl();
            this.tabPageQ3d.Controls.Clear();
            this.tabPageQ3d.Controls.Add(q3dCtrl);
            this.tabPageQ3d.Controls.Add(l3d2Ctrl);
        }
        #endregion Q3d控件
        #endregion
        #region 属性控件
@@ -488,6 +489,13 @@
                    var gradingHelper = await GetGradingHelper();
                    gradingHelper.Set(visual);
                };
                _propertyCtrl.FlowDirectionPropertyValueChangedEvent += async (visual) =>
                {
                    //流向属性发生改变
                    //判断当前是否有流向展示,若有则更新流向,最好是更新单个流向
                    var flowDirectionHelper = await GetFlowEffectHelper();
                    flowDirectionHelper.Set(visual);
                };
            }
            return _propertyCtrl;
        }
@@ -512,7 +520,7 @@
        }
        //显示属性控件
        private async void ShowPropertyCtrl()
        private async Task ShowPropertyCtrl()
        {
            if (IsPropertyCtrlVisible)
            {
@@ -527,9 +535,9 @@
        }
        //设置属性控件
        private void SetPropertyCtrl(HydroVisualInfo visual)
        private async void SetPropertyCtrl(HydroVisualInfo visual)
        {
            ShowPropertyCtrl();
            await ShowPropertyCtrl();
            var visualVmListHelper = GetVisualVmListHelper();
            var vm = visualVmListHelper.GetVisual(visual);
            _propertyCtrl.SelectedObject = vm;
@@ -542,7 +550,7 @@
            _propertyCtrl?.UpdateRows();
        }
        #endregion 属性控件
        #endregion
        #region 选择构件
@@ -1761,7 +1769,42 @@
            markHelper.Set();
        }
        #endregion 模型标注
        #endregion
        #region 水流动画
        //水力动画辅助类
        private SimulationFlowEffectHelper _flowEffectHelper = null;
        //获取水流动画辅助类
        private async Task<SimulationFlowEffectHelper> GetFlowEffectHelper()
        {
            if (_flowEffectHelper == null)
            {
                var visualListHelper = GetVisualListHelper();
                var calcuResultHelper = GetCalcuResultHelper();
                var bimfaceCtrl = await GetBimfaceCtrl();
                _flowEffectHelper = new SimulationFlowEffectHelper(visualListHelper, calcuResultHelper, bimfaceCtrl);
            }
            return _flowEffectHelper;
        }
        //水流动画是否可见
        private async void barCkFlowEffect_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.barCkFlowEffect.Checked)
            {
                this.barCkGrading.Checked = false;
            }
            var flowEffectHelper = await GetFlowEffectHelper();
            flowEffectHelper.Visible = this.barCkFlowEffect.Checked;
            flowEffectHelper.Set();
        }
        #endregion
        #region 颜色分级
@@ -1838,6 +1881,10 @@
        //颜色分级展示
        private async void barCkGrading_CheckedChanged(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (this.barCkGrading.Checked)
            {
                this.barCkFlowEffect.Checked = false;
            }
            var gradingHelper = await GetGradingHelper();
            gradingHelper.Visible = this.barCkGrading.Checked;
            gradingHelper.Set();
@@ -2563,7 +2610,7 @@
                WaitFormHelper.ShowWaitForm(this, "正在计算分析中,请稍候...");
                await Task.Delay(3000);
                var calcuResult = _hydroInfo.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, isHead, allEvaluationList);
                var calcuResult = _hydroInfo.Calcu(isHead, allEvaluationList);
                WaitFormHelper.HideWaitForm();
                workingHelper.InitialData(hydroInfo, working, checkResult, calcuResult);
                if (calcuResult.Succeed)
@@ -2712,7 +2759,7 @@
            foreach (var working in allWorkingList)
            {
                baseHydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo);
                var calcuResult = baseHydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList);
                var calcuResult = baseHydroInfoRhs.Calcu(_calcuPressModeIsHead, allEvaluationList);
                var printWorking = new SimulationPrintWorkingViewModel(working);
                vm.WorkingList.Add(printWorking);
@@ -2743,7 +2790,7 @@
                foreach (var working in allWorkingList)
                {
                    hydroInfoRhs.UpdateWorkingInfo(working.WorkingInfo);
                    var calcuResult = hydroInfoRhs.Calcu(Yw.EPAnet.CalcuMode.MinorLoss, _calcuPressModeIsHead, allEvaluationList);
                    var calcuResult = hydroInfoRhs.Calcu(_calcuPressModeIsHead, allEvaluationList);
                    var printWorking = new SimulationPrintWorkingViewModel(working);
                    vm.Scheme.WorkingList.Add(printWorking);
@@ -3466,5 +3513,7 @@
        }
        #endregion 方案管理
    }
}