tx
2025-04-11 e8260697137f503aa0170b7a36170fd7168e9b80
WinFrmUI/DPumpHydr.WinFrmUI.Volute/MainViewPage_³ö¿Ú_Ë®Ìå.cs
@@ -5,8 +5,6 @@
using System.Text;
using System.Linq;
using HydrEngineCSharp;
using System.Net.NetworkInformation;
using DPumpHydr.WinFrmUI.Volute.ViewModel;
namespace DPumpHydr.WinFrmUI.Volute
{
@@ -20,8 +18,7 @@
        /// </summary>
        /// <returns></returns>
        private bool SaveParaStep3()
        {
        {
            return true;
        }
        /// <summary>
@@ -33,15 +30,89 @@
            if (_sectionBundleInfo == null)
                return;
            this._occDesign2dCtrl.SetAllSectionCurveVisible(false);
            this._occDesign3dCtrl.SetAllSectionCurveVisible(false);
            CreateOutflowStepCtrl();
            if (_ctrlSetOutflowParas == null)
            this._occDesign2dCtrl.SetAllSectionCurveVisible(false);
            this._occDesign3dCtrl.SetAllSectionCurveVisible(RbtnChk截面18.Checked);
            if (last_step_id >= this._stepTreeDockPanel.Step_ID_Thickness)
            {
                this._occDesign3dCtrl.setWaterBodyOpacity(
         DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.R,
         DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.G,
         DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256);
                this._occDesign3dCtrl.SetThicknessBodyVisible(false);
            }
            else
            {
                InitilOutflowStepCtrl(last_step_id);
            }
            this._sectAreaDockPanel.RefreshControl();
            this._sectAreaDockPanel.Visible = true;
            DockStepParaCtrl(_ctrlSetOutflowParas);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="last_step_id"></param>
        private void InitilOutflowStepCtrl(long last_step_id)
        {
            var ret = _ctrlSetOutflowParas.InitialParas(
                _hdrBaseInfo,
                _geomBaseInfo,
                _sectionBundleInfo,
                _outflowParas);
            if(ret == 0 && _outflowParas != null)
            {//基础参数没有任何变化
                RefreshWaterBody3D(_outflowParas);
//                this._occDesign3dCtrl.setWaterBodyOpacity(
//DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.R,
//DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.G,
//DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256);
//                this._occDesign3dCtrl.SetWaterBodyVisible(true);
                //                this._occDesign3dCtrl.SetThicknessBodyVisible(false);
            }
            else if(ret == 1)
            {
                _ctrlSetOutflowParas.SetSect9Posi(_sect9Posi);
                _ctrlSetOutflowParas.SetSect10Posi(_sect10Posi);
                DPumpHydr.ViewModel.eWizardStepDiretion step_direction = DPumpHydr.ViewModel.eWizardStepDiretion.前进;
                if (last_step_id > this._stepTreeDockPanel.Step_ID_Outflow_Paras)
                    step_direction = DPumpHydr.ViewModel.eWizardStepDiretion.后退;
                _ctrlSetOutflowParas.ShowPage(step_direction);
                string error = "";
                _outflowParas = _ctrlSetOutflowParas.GetBindingData(out error);
                this._occDesign3dCtrl.setWaterBodyOpacity(
             DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.R,
             DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.G,
             DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256);
                this._occDesign3dCtrl.SetThicknessBodyVisible(false);
            }
        }
        /// <summary>
        ///
        /// </summary>
        private void CreateOutflowStepCtrl()
        {
            if (_ctrlSetOutflowParas != null)
                return;
                _ctrlSetOutflowParas = new ctrlSetOutflowParas();
                _ctrlSetOutflowParas.Name = "ctrlSetOutflowStyle";
                _ctrlSetOutflowParas.OnRefreshShape2D += RefreshWaterBody2D ;
                _ctrlSetOutflowParas.OnRefreshShape2D += RefreshWaterBody2D;
                _ctrlSetOutflowParas.OnRefreshShape3D += RefreshWaterBody3D;
                _ctrlSetOutflowParas.OnNextStep += () =>
                {
@@ -63,68 +134,14 @@
                    }
                };
            }
            else
            {
                //this._occDesign3dCtrl.SetOutflowStyle(  );
                //if (this._occDesign2dCtrl.SetOutflowStyle(_outflowType))
                //{
                //}
                //if (_outflowType == ViewModel.eOutflowStyle.侧面出口_直线连接)
                //{
                //    if (_ctrlSetOutflowParas.CurrentOutflowStyle != ViewModel.eOutflowStyle.侧面出口_直线连接)
                //    {
                //        _occDesign2dCtrl.ClearAll();
                //        _occDesign3dCtrl.ClearAll();
                //        this.RefreshSectShapeWhole18(this._sectionBundleInfo);
                //    }
                //}
                //else
                //{
                //    if (_ctrlSetOutflowParas.CurrentOutflowStyle == ViewModel.eOutflowStyle.侧面出口_直线连接)
                //    {
                //        _occDesign2dCtrl.ClearAll();
                //        _occDesign3dCtrl.ClearAll();
                //        this.RefreshSectShapeWhole18(this._sectionBundleInfo);
                //    }
                //}
                //_ctrlSetOutflowParas.SetBindingData(_outflowType, _hdrBaseInfo, _geomBaseInfo, _sectionBundleInfo);
            }
            _ctrlSetOutflowParas.InitialParas(_hdrBaseInfo, _geomBaseInfo, _sectionBundleInfo);
            _ctrlSetOutflowParas.SetSect9Posi(_sect9Posi);
            _ctrlSetOutflowParas.SetSect10Posi(_sect10Posi);
            DPumpHydr.ViewModel.eWizardStepDiretion step_direction = DPumpHydr.ViewModel.eWizardStepDiretion.前进;
            if (last_step_id > this._stepTreeDockPanel.Step_ID_Outflow_Paras)
                step_direction = DPumpHydr.ViewModel.eWizardStepDiretion.后退;
            _ctrlSetOutflowParas.ShowPage(step_direction);
            this._sectAreaDockPanel.RefreshControl();
            this._sectAreaDockPanel.Visible = true;
            DockStepParaCtrl(_ctrlSetOutflowParas);
            string error = "";
            _outflowParas = _ctrlSetOutflowParas.GetBindingData(out error);
            this._occDesign3dCtrl.setWaterBodyOpacity(
         DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.R,
         DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.G,
         DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256);
            this._occDesign3dCtrl.SetThicknessBodyVisible(false);
        }
        private bool _isHaveCreateWaterBody3d = false;
        HydrEngineCSharp.WaterBodyOuterParam m_theWaterBodyOuterParam;
        private void RefreshOuterParam(DPumpHydr.WinFrmUI.Volute.ViewModel.OutflowParas outflowParas)
@@ -140,45 +157,90 @@
            double dBtmValue2 = outflowParas.Tangent_Btm_Right;
            double dRadConner = outflowParas.Septalradius;
            double dRadConnerAngle = this._geomBaseInfo.FAI0;
            double R1 = outflowParas.R1;
            double R2 = outflowParas.R2;
            dRadConnerAngle = dRadConnerAngle * HydrDisplayEngineBridge.PI / 180.0;
            if (m_theWaterBodyOuterParam == null)
                m_theWaterBodyOuterParam = HydrDisplayEngineBridge.CreateWaterBodyOuter(WaterBodyOuterType.EWaterBodyOuterSp);
            if (outflowParas.LinkStyle == ViewModel.eOutflowLinkStyle.直线圆弧 && outflowParas.ShapeStyle != ViewModel.eOutflowShapeStyle.侧面对齐出口)
            {
                if (m_theWaterBodyOuterParam == null || !(m_theWaterBodyOuterParam is HydrEngineCSharp.WaterBodyOuterArcParam))
                m_theWaterBodyOuterParam = HydrDisplayEngineBridge.CreateWaterBodyOuter(WaterBodyOuterType.EWaterBodyOuterArc);
            }
            else
            {
                if (m_theWaterBodyOuterParam == null || !(m_theWaterBodyOuterParam is HydrEngineCSharp.WaterBodyOuterSpParam))
                    m_theWaterBodyOuterParam = HydrDisplayEngineBridge.CreateWaterBodyOuter(WaterBodyOuterType.EWaterBodyOuterSp);
            }
            HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterSpParam;
            pHydrGeomCurve.SetOuterOffset(dOuterOffset);
            pHydrGeomCurve.SetOuterHigh(dOuterHigh);
            pHydrGeomCurve.SetOuterRad(dOuterRad);
            pHydrGeomCurve.SetH1(dH1);
            pHydrGeomCurve.SetH2(dH2);
            pHydrGeomCurve.SetRadConner(dRadConner);
            pHydrGeomCurve.SetRadConnerAngle(dRadConnerAngle);
            pHydrGeomCurve.SetTopValue1(dTopValue1);
            pHydrGeomCurve.SetBtmValue1(dBtmValue1);
            pHydrGeomCurve.SetTopValue2(dTopValue2);
            pHydrGeomCurve.SetBtmValue2(dBtmValue2);
            // HydrEngineCSharp.WaterBodyOuterArcParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterArcParam;
            if (outflowParas.LinkStyle == ViewModel.eOutflowLinkStyle.直线圆弧 && outflowParas.ShapeStyle != ViewModel.eOutflowShapeStyle.侧面对齐出口)
            {
                HydrEngineCSharp.WaterBodyOuterArcParam pHydrGeomCurveArc = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterArcParam;
                pHydrGeomCurveArc.SetOuterOffset(dOuterOffset);
                pHydrGeomCurveArc.SetOuterHigh(dOuterHigh);
                pHydrGeomCurveArc.SetOuterRad(dOuterRad);
                pHydrGeomCurveArc.SetH1(dH1);
                pHydrGeomCurveArc.SetH2(dH2);
                pHydrGeomCurveArc.SetRadConner(dRadConner);
                pHydrGeomCurveArc.SetRadConnerAngle(dRadConnerAngle);
                pHydrGeomCurveArc.SetR1(R1);
                pHydrGeomCurveArc.SetR2(R2);
            }
            else
            {
                HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterSpParam;
                pHydrGeomCurve.SetOuterOffset(dOuterOffset);
                pHydrGeomCurve.SetOuterHigh(dOuterHigh);
                pHydrGeomCurve.SetOuterRad(dOuterRad);
                pHydrGeomCurve.SetH1(dH1);
                pHydrGeomCurve.SetH2(dH2);
                pHydrGeomCurve.SetRadConner(dRadConner);
                pHydrGeomCurve.SetRadConnerAngle(dRadConnerAngle);
                pHydrGeomCurve.SetTopValue1(dTopValue1);
                pHydrGeomCurve.SetBtmValue1(dBtmValue1);
                pHydrGeomCurve.SetTopValue2(dTopValue2);
                pHydrGeomCurve.SetBtmValue2(dBtmValue2);
            }
        }
        private bool RefreshWaterBody2D(  DPumpHydr.WinFrmUI.Volute.ViewModel.OutflowParas outflowParas)
        private bool RefreshWaterBody2D(DPumpHydr.WinFrmUI.Volute.ViewModel.OutflowParas outflowParas)
        {
            if (outflowParas == null || outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 ||
                outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0)
            if (outflowParas == null)
                return false;
            if (outflowParas.LinkStyle != ViewModel.eOutflowLinkStyle.直线圆弧 || outflowParas.ShapeStyle == ViewModel.eOutflowShapeStyle.侧面对齐出口)
            {
                if (outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 ||
                               outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0)
                    return false;
            }
            if (outflowParas.LinkStyle == ViewModel.eOutflowLinkStyle.直线圆弧 && outflowParas.ShapeStyle != ViewModel.eOutflowShapeStyle.侧面对齐出口)
            {
                if (outflowParas.R1 <= 0 || outflowParas.R2 <= 0)
                    return false;
            }
            RefreshOuterParam(outflowParas);
            HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterSpParam;
            RefreshOuterParam(outflowParas); //WaterBodyOuterParam
            if (outflowParas.LinkStyle == ViewModel.eOutflowLinkStyle.直线圆弧 && outflowParas.ShapeStyle != ViewModel.eOutflowShapeStyle.侧面对齐出口)
            {
                HydrEngineCSharp.WaterBodyOuterArcParam pHydrGeomCurveArc = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterArcParam;
                this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurveArc);
            }
            else
            {
                HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterSpParam;
            this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
            }
            //if (_isHaveCreateWaterBody2d == true)
            //{
            //    this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
            //}
             this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
            return true;
            return true;
        }
        private ViewModel.OutflowParasCalcReponse RefreshWaterBody3D(DPumpHydr.WinFrmUI.Volute.ViewModel.OutflowParas outflowParas)
@@ -186,71 +248,89 @@
            if (outflowParas == null || outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 ||
         outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0)
                return null;
            if (outflowParas.ShapeStyle == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_直线连接)
            {
                if (_occDesign2dCtrl.SectStartAngle != 0)
                {
                    this._occDesign2dCtrl.SectStartAngle = 0;
                    this._occDesign2dCtrl.ClearAll();
                    this._occDesign2dCtrl.RefreshAllSectShape18(this._sectionBundleInfo);
                    this._occDesign2dCtrl.HideSectCurve18();
                }
            }
            else
            {
                if (_occDesign2dCtrl.SectStartAngle == 0)
                {
                    _occDesign2dCtrl.SectStartAngle = 0;
                    _occDesign2dCtrl.ClearAll();
                    this._occDesign2dCtrl.RefreshAllSectShape18(this._sectionBundleInfo);
                    this._occDesign2dCtrl.HideSectCurve18();
                }
            }
            if (outflowParas.ShapeStyle == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_直线连接)
            double start_angle = OutflowStyleHelper.GetSectStartAngle(outflowParas.ShapeStyle);
            if (Math.Abs(_occDesign2dCtrl.SectStartAngle - start_angle) > 0.01)
            {
                if (_occDesign3dCtrl.SectStartAngle != 0)
                {
                    _isHaveCreateWaterBody3d = false;
                    _occDesign3dCtrl.SectStartAngle = 0;
                    _occDesign3dCtrl.ClearAll();
                    this._occDesign3dCtrl.RefreshAllSectShape18(this._sectionBundleInfo);
                    this._sectAreaDockPanel.SetArea18(_sectionBundleInfo);
                }
            }
            else
            {
                if (_occDesign3dCtrl.SectStartAngle == 0)
                {
                    _isHaveCreateWaterBody3d = false;
                    _occDesign3dCtrl.SectStartAngle = 0;
                    _occDesign3dCtrl.ClearAll();
                    this._occDesign3dCtrl.RefreshAllSectShape18(this._sectionBundleInfo);
                    this._sectAreaDockPanel.SetArea18(_sectionBundleInfo);
                }
                this._occDesign2dCtrl.SectStartAngle = start_angle;
                this._occDesign2dCtrl.ClearAll();
                this._occDesign2dCtrl.RefreshAllSectShape18(this._sectionBundleInfo);
                this._occDesign2dCtrl.HideSectCurve18();
                this._occDesign2dCtrl.SetAllSectionCurveVisible(false);
                _isHaveCreateWaterBody3d = false;
                this._occDesign3dCtrl.SectStartAngle = start_angle;
                this._occDesign3dCtrl.ClearAll();
                this._occDesign3dCtrl.RefreshAllSectShape18(this._sectionBundleInfo);
                this._occDesign3dCtrl.SetAllSectionCurveVisible(RbtnChk截面18.Checked);
                this._sectAreaDockPanel.SetArea18(_sectionBundleInfo);
            }
            this._sectAreaDockPanel.SetAreaOutletDia(outflowParas.Dia);
            this._outflowParas = outflowParas;
            RefreshOuterParam(outflowParas);
            HydrEngineCSharp.WaterBodyOuterArcParam pHydrGeomArcCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterArcParam;
            HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterSpParam;
            try
            {
                if (_isHaveCreateWaterBody3d == true)
                {
                    this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
                    this._occDesign3dCtrl.Edit3DWaterBody(pHydrGeomCurve);
                    this._occDesign3dCtrl.SetWaterBodyVisible(true);
                    if(_outflowParas.LinkStyle == ViewModel.eOutflowLinkStyle.直线圆弧 && _outflowParas.ShapeStyle != ViewModel.eOutflowShapeStyle.侧面对齐出口)
                    {
                        if (!this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomArcCurve))
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        if (this._occDesign3dCtrl.Edit3DWaterBody(pHydrGeomArcCurve).GetTipsId() != 1)
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        this._occDesign3dCtrl.SetWaterBodyVisible(true);
                    }
                    else
                    {
                        if (!this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve))
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        if (this._occDesign3dCtrl.Edit3DWaterBody(pHydrGeomCurve).GetTipsId() != 1)
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        this._occDesign3dCtrl.SetWaterBodyVisible(true);
                    }
                }
                else
                {
                    _isHaveCreateWaterBody3d = true;
                    this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
                    this._occDesign3dCtrl.Create3DWaterBody(pHydrGeomCurve);
                    this._occDesign3dCtrl.SetWaterBodyVisible(true);
                    if (_outflowParas.LinkStyle == ViewModel.eOutflowLinkStyle.直线圆弧 && _outflowParas.ShapeStyle != ViewModel.eOutflowShapeStyle.侧面对齐出口)
                    {
                        if (!this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomArcCurve))
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        if (this._occDesign3dCtrl.Create3DWaterBody(pHydrGeomArcCurve).GetTipsId() != 1)
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        this._occDesign3dCtrl.SetWaterBodyVisible(true);
                    }
                    else
                    {
                        if (!this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve))
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        if (this._occDesign3dCtrl.Create3DWaterBody(pHydrGeomCurve).GetTipsId() != 1)
                        {
                            _isHaveCreateWaterBody3d = false;
                        }
                        this._occDesign3dCtrl.SetWaterBodyVisible(true);
                    }
                }
                return BuildRefreshWaterBodyReponse();
            }
@@ -261,7 +341,7 @@
  System.Windows.Forms.MessageBoxIcon.Warning);
                if (result == DialogResult.Yes)
                {
                    ExportXmlFile();
                    ExportXmlFile();
                }
                return null;