chenn
2025-04-11 c74c5c27380a2967971e22336d05b635d691e483
WinFrmUI/DPumpHydr.WinFrmUI.Volute/³öË®Éè¼Æ/ctrlSetOutflowParas.cs
@@ -107,6 +107,12 @@
                return _sharp_type;
            }
        }
        bool _isxml = false;
        public bool Isxml
        {
            get { return _isxml; }
            set { _isxml = value; }
        }
        private void InitialOutflowStyle()
        {
            if (_parasControlCenter == null)
@@ -114,8 +120,8 @@
            tabPage1.Controls.Clear();
            if (_link_type == eOutflowLinkStyle.直线圆弧 && _sharp_type != eOutflowShapeStyle.侧面出口_直线连接)
            {
            if (_link_type == eOutflowLinkStyle.直线圆弧 && _sharp_type != eOutflowShapeStyle.侧面对齐出口)
            {
                if (_sharp_type == eOutflowShapeStyle.中心出口)
                {
                    metroTile出口图片.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238);
@@ -123,7 +129,7 @@
                    tabPage1.Controls.Add(_parasControlArcCenter);
                    return;
                }
                if (_sharp_type == eOutflowShapeStyle.侧面出口_曲线连接)
                if (_sharp_type == eOutflowShapeStyle.侧面出口)
                {
                    metroTile出口图片.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238);
                    _parasControlArcSide.SetA_state(true);
@@ -133,17 +139,17 @@
            }
            switch (_sharp_type)
            {
                case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.中心出口:
                case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.中心出口:
                    metroTile出口图片.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238);
                    _parasControlCenter.SetA_state(false);
                    tabPage1.Controls.Add(_parasControlCenter);
                    return;
                case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_曲线连接:
                case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口:
                    metroTile出口图片.BackgroundImage = GlobalResource.BuildImage("Side-exit-curve.png", 878, 238);
                    _parasControlCurve.SetA_state(true);
                    tabPage1.Controls.Add(_parasControlCurve);
                    return;
                case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_直线连接:
                case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面对齐出口:
                    metroTile出口图片.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238);
                    tabPage1.Controls.Add(_parasControlLine);
                    return;
@@ -159,24 +165,37 @@
            ViewModel.HdrBaseInfo hdrBaseInfo,
            ViewModel.GeomBaseInfo geomBaseInfo,
            ViewModel.SectionBundleInfo sectionBundleInfo,
            ViewModel.OutflowParas  outflowParas)
            ViewModel.OutflowParas outflowParas)
        {
            if (IsSameBaseParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo))
            {//判断是否修改了
                if (_isxml)
                {
                    _isxml = false;
                }
                return 0;//0表示没有变化
            }
            this._hdrBaseInfo = hdrBaseInfo;
            this._geomBaseInfo = geomBaseInfo;
            this._sectionBundleInfo = sectionBundleInfo;
            if(outflowParas != null)
            if (outflowParas != null)
            {
                _sharp_type = outflowParas.ShapeStyle;
                _link_type = outflowParas.LinkStyle;
            }
            //
            InitialCtrlDefaultParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo, outflowParas);
            if (_link_type == eOutflowLinkStyle.曲线)
            {
                checkBox圆弧连接.Checked = false;
            }
            else
            {
                checkBox圆弧连接.Checked = true;
            }
            if (_sharp_type == eOutflowShapeStyle.未知)
            {
@@ -185,11 +204,28 @@
            }
            else
            {
                if(_link_type == eOutflowLinkStyle.直线圆弧 )
                {
                    comboBoxType.Items.Clear();
                    comboBoxType.Items.AddRange(new string[] { "中心出口", "侧面出口" });
                    checkBox圆弧连接.Checked = true;
                    checkBox曲线.Checked = false;
                }else if(_link_type == eOutflowLinkStyle.曲线)
                {
                    comboBoxType.Items.Clear();
                    comboBoxType.Items.AddRange(new string[] { "中心出口", "侧面出口", "侧面对齐出口" });
                    checkBox圆弧连接.Checked = false;
                    checkBox曲线.Checked = true;
                }
                comboBoxType.SelectedIndex = (int)_sharp_type;
                InitialOutflowStyle();
                RefreshModel();
            }
            }
            if (_isxml)
            {
                _isxml = false;
            }
            return 1;
        }
@@ -203,7 +239,7 @@
            double outer_dia = 4.5 * Math.Pow(hdrBaseInfo.Q / 3600 / hdrBaseInfo.n, 1 / 3.0) * 1000;
            //侧面曲线
            OutflowParas outflowParas侧面曲线 = null;
            if(outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.侧面出口_曲线连接)
            if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.侧面出口)
            {
                outflowParas侧面曲线 = outflowParas;
            }
@@ -245,29 +281,29 @@
            _parasControlCenter.IsInvokeRefreshShapeAble = true;
            //侧面直线
            OutflowParas outflowParas侧面直线 = null;
            if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.侧面出口_直线连接 && outflowParas.LinkStyle == eOutflowLinkStyle.曲线)
            OutflowParas outflowParas侧面对齐 = null;
            if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.侧面对齐出口 )
            {
                outflowParas侧面直线 = outflowParas;
                outflowParas侧面对齐 = outflowParas;
            }
            else
            {
                outflowParas侧面直线 = new OutflowParas();
                outflowParas侧面直线.Offset = (int)((geomBaseInfo.D3 + sectionBundleInfo.H[8]) / 2 + 0.5);
                outflowParas侧面直线.H1 = 5;
                outflowParas侧面直线.H2 = 5;
                outflowParas侧面直线.Dia = GetStdDia(outer_dia);
                double height2 = 5 * (int)(((outflowParas侧面直线.Dia - Math.Sqrt(4 * sectionBundleInfo.Area[8] / Math.PI)) / (2 * Math.Tan(4 * Math.PI / 180))) / 5 + 0.5);
                outflowParas侧面对齐 = new OutflowParas();
                outflowParas侧面对齐.Offset = (int)((geomBaseInfo.D3 + sectionBundleInfo.H[8]) / 2 + 0.5);
                outflowParas侧面对齐.H1 = 5;
                outflowParas侧面对齐.H2 = 5;
                outflowParas侧面对齐.Dia = GetStdDia(outer_dia);
                double height2 = 5 * (int)(((outflowParas侧面对齐.Dia - Math.Sqrt(4 * sectionBundleInfo.Area[8] / Math.PI)) / (2 * Math.Tan(4 * Math.PI / 180))) / 5 + 0.5);
                if (height2 < geomBaseInfo.D3 / 2)
                {
                    height2 = geomBaseInfo.D3 * 0.75;
                }
                outflowParas侧面直线.Heigh = height2;
                outflowParas侧面直线.Septalradius = 3;
                outflowParas侧面对齐.Heigh = height2;
                outflowParas侧面对齐.Septalradius = 3;
            }
            _parasControlLine.InitialParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo);
            _parasControlLine.IsInvokeRefreshShapeAble = false;
            _parasControlLine.SetBindingData(outflowParas侧面直线);
            _parasControlLine.SetBindingData(outflowParas侧面对齐);
            _parasControlLine.IsInvokeRefreshShapeAble = true;
            //圆弧中心
@@ -296,7 +332,7 @@
            //圆弧侧面
            OutflowParas outflowParas圆弧侧面 = null;
            if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.侧面出口_曲线连接 && outflowParas.LinkStyle == eOutflowLinkStyle.直线圆弧)
            if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.侧面出口 && outflowParas.LinkStyle == eOutflowLinkStyle.直线圆弧)
            {
                outflowParas圆弧侧面 = outflowParas;
            }
@@ -421,7 +457,7 @@
        {
            error = "";
            ViewModel.OutflowParas _outflowParas = null;
            if (_link_type == eOutflowLinkStyle.直线圆弧 && _sharp_type != eOutflowShapeStyle.侧面出口_直线连接)
            if (_link_type == eOutflowLinkStyle.直线圆弧 && _sharp_type != eOutflowShapeStyle.侧面对齐出口)
            {
                if (_sharp_type == eOutflowShapeStyle.中心出口)
                {
@@ -429,7 +465,7 @@
                        return null;
                    _outflowParas = _parasControlArcCenter.GetBindingData(out error);
                }
                if (_sharp_type == eOutflowShapeStyle.侧面出口_曲线连接)
                if (_sharp_type == eOutflowShapeStyle.侧面出口)
                {
                    if (_parasControlArcSide == null)
                        return null;
@@ -445,10 +481,10 @@
                            return null;
                        _outflowParas = _parasControlCenter.GetBindingData(out error);
                        break;
                    case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_曲线连接:
                    case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口:
                        _outflowParas = _parasControlCurve.GetBindingData(out error);
                        break;
                    case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_直线连接:
                    case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面对齐出口:
                        _outflowParas = _parasControlLine.GetBindingData(out error);
                        break;
                    default:
@@ -487,7 +523,7 @@
            {
                paras2.Offset = (int)((_geomBaseInfo.D3 + _sectionBundleInfo.H[8]) / 2 + 0.5);
            }
            else if (paras3.ShapeStyle == eOutflowShapeStyle.侧面出口_曲线连接)
            else if (paras3.ShapeStyle == eOutflowShapeStyle.侧面出口)
            {
                paras3.Offset = (int)(((_geomBaseInfo.D3 / 2 + _sectionBundleInfo.H[8]) * 1.6 / 3 / 5) + 1) * 5;
            }
@@ -501,15 +537,15 @@
            {
                comboBoxType.SelectedIndex = 0;
            }
            else if (_sharp_type == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_曲线连接)
            else if (_sharp_type == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口)
            {
                comboBoxType.SelectedIndex = 1;
            }
            else if (_sharp_type == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_直线连接)
            else if (_sharp_type == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面对齐出口)
            {
                comboBoxType.SelectedIndex = 2;
            }
            if(_link_type == eOutflowLinkStyle.直线圆弧)
            if (_link_type == eOutflowLinkStyle.直线圆弧)
            {
                checkBox圆弧连接.Checked = true;
            }
@@ -561,28 +597,32 @@
        private void RefreshModel()
        {
            string error;
            if (OnRefreshShape3D == null)
            {
                return;
            }
            var resp = OnRefreshShape3D(GetBindingData(out error));
            if (resp != null)
            {
                if (_link_type == eOutflowLinkStyle.直线圆弧 && _sharp_type != eOutflowShapeStyle.侧面出口_直线连接)
                if (_link_type == eOutflowLinkStyle.直线圆弧 && _sharp_type != eOutflowShapeStyle.侧面对齐出口)
                {
                    if (_sharp_type == eOutflowShapeStyle.中心出口)
                    {
                        _parasControlArcCenter.SetBindingData(resp);
                    }
                    else if (_sharp_type == eOutflowShapeStyle.侧面出口_曲线连接)
                    else if (_sharp_type == eOutflowShapeStyle.侧面出口)
                    {
                        _parasControlArcSide.SetBindingData(resp);
                    }
                }
                else
                {
                    if (_sharp_type == eOutflowShapeStyle.侧面出口_直线连接)
                    if (_sharp_type == eOutflowShapeStyle.侧面对齐出口)
                    {
                        _parasControlLine.SetBindingData(resp);
                    }
                    else if (_sharp_type == eOutflowShapeStyle.侧面出口_曲线连接)
                    else if (_sharp_type == eOutflowShapeStyle.侧面出口)
                    {
                        _parasControlCurve.SetBindingData(resp);
                    }
@@ -605,11 +645,11 @@
        private void comboBoxType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxType.SelectedIndex == 0)
            if (comboBoxType.SelectedItem.ToString() == "中心出口")
            {
                _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.中心出口;
                checkBox圆弧连接.Enabled = true;
                checkBox圆弧连接.Visible = true;
                //checkBox圆弧连接.Enabled = true;
                //checkBox圆弧连接.Visible = true;
                if (checkBox圆弧连接.Checked)
                {
                    _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.直线圆弧;
@@ -619,11 +659,11 @@
                    _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.曲线;
                }
            }
            else if (comboBoxType.SelectedIndex == 1)
            else if (comboBoxType.SelectedItem.ToString() == "侧面出口")
            {
                _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_曲线连接;
                checkBox圆弧连接.Enabled = false;
                checkBox圆弧连接.Visible = false;
                _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口;
                //checkBox圆弧连接.Enabled = true;
                //checkBox圆弧连接.Visible = true;
                _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.曲线;
                if (checkBox圆弧连接.Checked)
                {
@@ -633,15 +673,19 @@
                {
                    _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.曲线;
                }
              }
            else if (comboBoxType.SelectedIndex == 2)
            }
            else if (comboBoxType.SelectedItem.ToString() == "侧面对齐出口")
            {
                _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面出口_直线连接;
                checkBox圆弧连接.Enabled = false;
                checkBox圆弧连接.Visible = false;
                _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.侧面对齐出口;
                //checkBox圆弧连接.Enabled = false;
                //checkBox圆弧连接.Visible = false;
                _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.曲线;
            }
            if (_isxml)
            {
                InitialOutflowStyle();
                return;
            }
            InitialOutflowStyle();
            RefreshModel();
@@ -656,16 +700,48 @@
        {
            if (!checkBox圆弧连接.Checked)
            {
                checkBox曲线.Checked = true;
                _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.曲线;
                comboBoxType.Items.Clear();
                comboBoxType.Items.AddRange(new string[] { "中心出口", "侧面出口", "侧面对齐出口" });
            }
            else
            {
                checkBox曲线.Checked = false;
                _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.直线圆弧;
                comboBoxType.Items.Clear();
                comboBoxType.Items.AddRange(new string[] { "中心出口", "侧面出口" });
                if (comboBoxType.Text == "侧面对齐出口")
                {
                    comboBoxType.SelectedIndex = 0;
                    InitialOutflowStyle();
                    return;
                }
            }
            if (_isxml)
            {
                InitialOutflowStyle();
                return;
            }
            InitialOutflowStyle();
            RefreshModel();
        }
        private void checkBox曲线_CheckedChanged(object sender, EventArgs e)
        {
            if (!checkBox曲线.Checked)
            {
                checkBox圆弧连接.Checked = true;
                _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.直线圆弧;
            }
            else
            {
                checkBox圆弧连接.Checked = false;
                _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.曲线;
            }
        }
    }
}