From 9a7e74591a70bc1be9c9995b5cab4cbfafaa8996 Mon Sep 17 00:00:00 2001 From: chenn <gu.beic@qq.com> Date: 星期二, 01 四月 2025 17:58:03 +0800 Subject: [PATCH] 圆弧直线取消注释;引用dll更改 --- WinFrmUI/DPumpHydr.WinFrmUI.Volute/出水设计/ctrlSetOutflowParas.cs | 708 +++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 644 insertions(+), 64 deletions(-) diff --git "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowParas.cs" "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowParas.cs" index 3446a52..89807af 100644 --- "a/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowParas.cs" +++ "b/WinFrmUI/DPumpHydr.WinFrmUI.Volute/\345\207\272\346\260\264\350\256\276\350\256\241/ctrlSetOutflowParas.cs" @@ -5,10 +5,9 @@ using System.Drawing; using System.IO; using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Text; using System.Windows.Forms; -using DPumpHydr.WinFrmUI.Volute.ViewModel; +using DPumpHydr.WinFrmUI.Volute.ViewModel; namespace DPumpHydr.WinFrmUI.Volute { @@ -17,110 +16,691 @@ public ctrlSetOutflowParas() { InitializeComponent(); - + + _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.鏈煡; + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鏇茬嚎; + + + _parasControlCenter = new SetOutflowParasCtrl1() { Name = "SetOutflowParasCtrlCenter" }; + _parasControlCenter.OnRefreshShape += (para) => + { + if (OnRefreshShape2D != null) + return OnRefreshShape2D(para); + else + return false; + }; + _parasControlCenter.Dock = DockStyle.Top; + + _parasControlLine = new SetOutflowParasCtrl2() { Name = "SetOutflowParasCtrlLine" }; + _parasControlLine.OnRefreshShape += (para) => + { + if (OnRefreshShape2D != null) + return OnRefreshShape2D(para); + else + return false; + }; + _parasControlLine.Dock = DockStyle.Top; + + _parasControlCurve = new SetOutflowParasCtrl1() { Name = "SetOutflowParasCtrlCurve" }; + _parasControlCurve.OnRefreshShape += (para) => + { + if (OnRefreshShape2D != null) + return OnRefreshShape2D(para); + else + return false; + }; + _parasControlCurve.Dock = DockStyle.Top; + + _parasControlArcCenter = new SetOutflowParaArcCtrl() { Name = "SetOutflowParaArcCtrlCenter" }; + _parasControlArcCenter.OnRefreshShape += (para) => + { + if (OnRefreshShape2D != null) + return OnRefreshShape2D(para); + else + return false; + }; + _parasControlArcCenter.Dock = DockStyle.Top; + + _parasControlArcSide = new SetOutflowParaArcCtrl() { Name = "SetOutflowParaArcCtrlSide" }; + _parasControlArcCenter.OnRefreshShape += (para) => + { + if (OnRefreshShape2D != null) + return OnRefreshShape2D(para); + else + return false; + }; + _parasControlArcSide.Dock = DockStyle.Top; + + + this.ctrlSection910Posi1.OnMoveSectPosi += (sect_index, posi) => + { + if (this.OnMoveSectPosi != null) + { + OnMoveSectPosi.Invoke(sect_index, posi); + } + }; + + + BuildAllTips(); } - eOutflowStyle _stype = eOutflowStyle.鏈煡; - //ViewModel.OtuflowParas _otuflowParas = null; - ViewModel.OtuflowParas _otuflowParas = new OtuflowParas() { Offset = 10, High = 420, Dia = 80, TopValue_left = 80, BtmValue_left = 80, BtmValue_reight = 80, TopValue_reight = 80, H1 = 10, H2 = 10, Septalradius = 10 }; - sidelineExitControl _sidelineExitControl = null; - sideCurveExitControl _sideCurveExitControl = null; - public void SetBindingData(eOutflowStyle style) + + public Func<ViewModel.OutflowParas, ViewModel.OutflowParasCalcReponse> OnRefreshShape3D = null; + public Func<ViewModel.OutflowParas, bool> OnRefreshShape2D = null; + + + //鎺т欢 + //鏇茬嚎閾炬帴鎺т欢 + SetOutflowParasCtrl1 _parasControlCenter = null; + SetOutflowParasCtrl2 _parasControlLine = null; + SetOutflowParasCtrl1 _parasControlCurve = null; + //鍦嗗姬杩炴帴鎺т欢 + SetOutflowParaArcCtrl _parasControlArcCenter = null; + SetOutflowParaArcCtrl _parasControlArcSide = null; + + DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.鏈煡; + DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鏇茬嚎; + public DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle CurrentOutflowShapeStyle { - if(_stype == style) + get + { + return _sharp_type; + } + } + bool _isxml = false; + public bool Isxml + { + get { return _isxml; } + set { _isxml = value; } + } + private void InitialOutflowStyle() + { + if (_parasControlCenter == null) return; - _stype = style; - - var control = InitialParasControl( ); - if (control is sidelineExitControl) - { - _sidelineExitControl = (sidelineExitControl)control; + tabPage1.Controls.Clear(); - _sidelineExitControl.SetBindingData(_otuflowParas); - if (_stype == eOutflowStyle.涓績鍑哄彛_鍨傜洿娉曞叞闈㈡祦鍑�) + if (_link_type == eOutflowLinkStyle.鐩寸嚎鍦嗗姬 && _sharp_type != eOutflowShapeStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴) + { + if (_sharp_type == eOutflowShapeStyle.涓績鍑哄彛) { - _sidelineExitControl.SetA_state(false); + metroTile鍑哄彛鍥剧墖.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238); + _parasControlArcCenter.SetA_state(false); + tabPage1.Controls.Add(_parasControlArcCenter); + return; } - else + if (_sharp_type == eOutflowShapeStyle.渚ч潰鍑哄彛) { - _sidelineExitControl.SetA_state(true); + metroTile鍑哄彛鍥剧墖.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238); + _parasControlArcSide.SetA_state(true); + tabPage1.Controls.Add(_parasControlArcSide); + return; } } - if (control is sideCurveExitControl) + switch (_sharp_type) { - _sideCurveExitControl = (sideCurveExitControl)control; - _sideCurveExitControl.SetBindingData(_otuflowParas); + 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.渚ч潰鍑哄彛: + 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.渚ч潰鍑哄彛_鐩寸嚎杩炴帴: + metroTile鍑哄彛鍥剧墖.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238); + tabPage1.Controls.Add(_parasControlLine); + return; + default: + throw new ArgumentException("Invalid control type"); } - } - public ViewModel.OtuflowParas GetBindingData(out string error) + + ViewModel.HdrBaseInfo _hdrBaseInfo = null; + ViewModel.GeomBaseInfo _geomBaseInfo = null; + ViewModel.SectionBundleInfo _sectionBundleInfo = null; + public int InitialParas( + ViewModel.HdrBaseInfo hdrBaseInfo, + ViewModel.GeomBaseInfo geomBaseInfo, + ViewModel.SectionBundleInfo sectionBundleInfo, + ViewModel.OutflowParas outflowParas) + { + if (IsSameBaseParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo)) + {//鍒ゆ柇鏄惁淇敼浜� + return 0;//0琛ㄧず娌℃湁鍙樺寲 + } + this._hdrBaseInfo = hdrBaseInfo; + this._geomBaseInfo = geomBaseInfo; + this._sectionBundleInfo = sectionBundleInfo; + + 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.鏈煡) + { + _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.涓績鍑哄彛; + comboBoxType.SelectedIndex = 0; + } + else + { + comboBoxType.SelectedIndex = (int)_sharp_type; + if (_isxml) + { + InitialOutflowStyle(); + _isxml = false; + + } + InitialOutflowStyle(); + + RefreshModel(); + } + + return 1; + } + + private void InitialCtrlDefaultParas( + ViewModel.HdrBaseInfo hdrBaseInfo, + ViewModel.GeomBaseInfo geomBaseInfo, + ViewModel.SectionBundleInfo sectionBundleInfo, + ViewModel.OutflowParas outflowParas) + { + //鍑哄彛鐩村緞鏍囧噯鍖� + 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.渚ч潰鍑哄彛) + { + outflowParas渚ч潰鏇茬嚎 = outflowParas; + } + else + { + outflowParas渚ч潰鏇茬嚎 = new OutflowParas(); + outflowParas渚ч潰鏇茬嚎.Offset = ((int)((geomBaseInfo.D3 / 2 + sectionBundleInfo.H[8]) * 1.6 / 3 / 5) + 1) * 5; + outflowParas渚ч潰鏇茬嚎.H1 = 5; + outflowParas渚ч潰鏇茬嚎.H2 = 5; + outflowParas渚ч潰鏇茬嚎.Dia = GetStdDia(outer_dia); + double height3 = 5 * (int)(((geomBaseInfo.D3 / 2 + sectionBundleInfo.H[8] / 2) * 1.5 + outflowParas渚ч潰鏇茬嚎.Dia / 2) / 5 + 1); + outflowParas渚ч潰鏇茬嚎.Heigh = height3; + outflowParas渚ч潰鏇茬嚎.Septalradius = 2; + } + _parasControlCurve.InitialParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo); + _parasControlCurve.IsInvokeRefreshShapeAble = false; + _parasControlCurve.SetBindingData(outflowParas渚ч潰鏇茬嚎); + _parasControlCurve.IsInvokeRefreshShapeAble = true; + //涓績鍑哄彛 + OutflowParas outflowParas涓績鍑哄彛 = null; + if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.涓績鍑哄彛 && outflowParas.LinkStyle == eOutflowLinkStyle.鏇茬嚎) + { + outflowParas涓績鍑哄彛 = outflowParas; + } + else + { + outflowParas涓績鍑哄彛 = new OutflowParas(); + outflowParas涓績鍑哄彛.Offset = 0; + outflowParas涓績鍑哄彛.H1 = 5; + outflowParas涓績鍑哄彛.H2 = 5; + outflowParas涓績鍑哄彛.Dia = GetStdDia(outer_dia); + double height1 = 5 * (int)((((geomBaseInfo.D3 / 2 + sectionBundleInfo.H[8] / 2) * 1.4141 + outflowParas涓績鍑哄彛.Dia / 2) / 5) + 1); + outflowParas涓績鍑哄彛.Heigh = height1; + outflowParas涓績鍑哄彛.Septalradius = 2; + } + _parasControlCenter.InitialParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo); + _parasControlCenter.IsInvokeRefreshShapeAble = false; + _parasControlCenter.SetBindingData(outflowParas涓績鍑哄彛); + _parasControlCenter.IsInvokeRefreshShapeAble = true; + + //渚ч潰鐩寸嚎 + OutflowParas outflowParas渚ч潰鐩寸嚎 = null; + if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴 && outflowParas.LinkStyle == eOutflowLinkStyle.鏇茬嚎) + { + 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); + if (height2 < geomBaseInfo.D3 / 2) + { + height2 = geomBaseInfo.D3 * 0.75; + } + outflowParas渚ч潰鐩寸嚎.Heigh = height2; + outflowParas渚ч潰鐩寸嚎.Septalradius = 3; + } + _parasControlLine.InitialParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo); + _parasControlLine.IsInvokeRefreshShapeAble = false; + _parasControlLine.SetBindingData(outflowParas渚ч潰鐩寸嚎); + _parasControlLine.IsInvokeRefreshShapeAble = true; + + //鍦嗗姬涓績 + OutflowParas outflowParas鍦嗗姬涓績 = null; + if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.涓績鍑哄彛 && outflowParas.LinkStyle == eOutflowLinkStyle.鐩寸嚎鍦嗗姬) + { + outflowParas鍦嗗姬涓績 = outflowParas; + } + else + { + outflowParas鍦嗗姬涓績 = new OutflowParas(); + outflowParas鍦嗗姬涓績.Offset = 0; + outflowParas鍦嗗姬涓績.H1 = 5; + outflowParas鍦嗗姬涓績.H2 = 5; + outflowParas鍦嗗姬涓績.Dia = GetStdDia(outer_dia); + double height4 = 5 * (int)((((geomBaseInfo.D3 / 2 + sectionBundleInfo.H[8] / 2) * 1.4141 + outflowParas鍦嗗姬涓績.Dia / 2) / 5) + 1); + outflowParas鍦嗗姬涓績.Heigh = height4; + outflowParas鍦嗗姬涓績.Septalradius = 3; + outflowParas鍦嗗姬涓績.R1 = (int)((outflowParas鍦嗗姬涓績.Dia * 11 / 10 / 10) + 1) * 10; + outflowParas鍦嗗姬涓績.R2 = (int)(outflowParas鍦嗗姬涓績.Dia * 3 / 4 / 10) * 10; + } + _parasControlArcCenter.InitialParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo); + _parasControlArcCenter.IsInvokeRefreshShapeAble = false; + _parasControlArcCenter.SetBindingData(outflowParas鍦嗗姬涓績); + _parasControlArcCenter.IsInvokeRefreshShapeAble = true; + + //鍦嗗姬渚ч潰 + OutflowParas outflowParas鍦嗗姬渚ч潰 = null; + if (outflowParas != null && outflowParas.ShapeStyle == eOutflowShapeStyle.渚ч潰鍑哄彛 && outflowParas.LinkStyle == eOutflowLinkStyle.鐩寸嚎鍦嗗姬) + { + outflowParas鍦嗗姬渚ч潰 = outflowParas; + } + else + { + outflowParas鍦嗗姬渚ч潰 = new OutflowParas(); + outflowParas鍦嗗姬渚ч潰.Offset = ((int)((geomBaseInfo.D3 / 2 + sectionBundleInfo.H[8]) * 1.6 / 3 / 5) + 1) * 5; + outflowParas鍦嗗姬渚ч潰.H1 = 5; + outflowParas鍦嗗姬渚ч潰.H2 = 5; + outflowParas鍦嗗姬渚ч潰.Dia = GetStdDia(outer_dia); + double height5 = 5 * (int)(((geomBaseInfo.D3 / 2 + sectionBundleInfo.H[8] / 2) * 1.5 + outflowParas渚ч潰鏇茬嚎.Dia / 2) / 5 + 1); + outflowParas鍦嗗姬渚ч潰.Heigh = height5; + outflowParas鍦嗗姬渚ч潰.Septalradius = 3; + outflowParas鍦嗗姬渚ч潰.R1 = (int)(((geomBaseInfo.D3 / 2 + sectionBundleInfo.H[8]) * 2.0 / 10) + 1) * 10; ; + outflowParas鍦嗗姬渚ч潰.R2 = outflowParas鍦嗗姬渚ч潰.CalR2(hdrBaseInfo, geomBaseInfo, sectionBundleInfo); + } + _parasControlArcSide.InitialParas(hdrBaseInfo, geomBaseInfo, sectionBundleInfo); + _parasControlArcSide.IsInvokeRefreshShapeAble = false; + _parasControlArcSide.SetBindingData(outflowParas鍦嗗姬渚ч潰); + _parasControlArcSide.IsInvokeRefreshShapeAble = true; + } + + private bool IsSameBaseParas( + ViewModel.HdrBaseInfo hdrBaseInfo, + ViewModel.GeomBaseInfo geomBaseInfo, + ViewModel.SectionBundleInfo sectionBundleInfo) + { + if (this._hdrBaseInfo == null) + return false; + if (this._geomBaseInfo == null) + return false; + if (this._sectionBundleInfo == null) + return false; + if (!this._hdrBaseInfo.IsSame(hdrBaseInfo)) + return false; + if (!this._geomBaseInfo.IsSame(geomBaseInfo)) + return false; + if (!this._sectionBundleInfo.IsSame(sectionBundleInfo)) + return false; + + this._hdrBaseInfo = hdrBaseInfo; + this._geomBaseInfo = geomBaseInfo; + this._sectionBundleInfo = sectionBundleInfo; + + return true; + } + private static double GetStdDia(double mm) + { + //var iFlangeCodeList = new int[] {10,15,20,25,32, + // 40,50,65,80,100, + // 125,150,200,250,300, + // 350,400,450,500,600, + // 700,800,900,1000,1200, + // 1400,1600,1800,2000,5000,100000}; + //var iFlangeCodeList = new Double[] {6,8,10,15,20,25,32,40,50,65,80,100,125,150,175, + // 200,225,250,300,350,400,450,500,550,600,650,700,750,800,900,1000, + // 1100,1200,1300,1400,1500,1600,1800,2000,2200,2400,2600,2800,3000, + // 3200,3400,3600,3800,4000,5000,100000}; + var stdDia = mm; + if (mm > 0 && mm < 7) stdDia = 6; + if (mm >= 7 && mm < 9) stdDia = 8; + if (mm >= 9 && mm < 11) stdDia = 10; + if (mm >= 11 && mm < 17.5) stdDia = 15; + if (mm >= 17.5 && mm < 22.5) stdDia = 20; + if (mm >= 22.5 && mm < 28.5) stdDia = 25; + if (mm >= 28.5 && mm < 36) stdDia = 32; + if (mm >= 36 && mm < 45) stdDia = 40; + if (mm >= 45 && mm < 57.5) stdDia = 50; + if (mm >= 57.5 && mm < 72.5) stdDia = 65; + if (mm >= 72.5 && mm < 90) stdDia = 80; + if (mm >= 90 && mm < 112.5) stdDia = 100; + if (mm >= 112.5 && mm < 137.5) stdDia = 125; + if (mm >= 137.5 && mm < 162.5) stdDia = 150; + if (mm >= 162.5 && mm < 187.5) stdDia = 175; + if (mm >= 187.5 && mm < 212.5) stdDia = 200; + if (mm >= 212.5 && mm < 237.5) stdDia = 225; + if (mm >= 237.5 && mm < 275) stdDia = 250; + if (mm >= 275 && mm < 325) stdDia = 300; + if (mm >= 325 && mm < 375) stdDia = 350; + if (mm >= 375 && mm < 425) stdDia = 400; + if (mm >= 425 && mm < 475) stdDia = 450; + if (mm >= 475 && mm < 525) stdDia = 500; + if (mm >= 525 && mm < 575) stdDia = 550; + if (mm >= 575 && mm < 625) stdDia = 600; + if (mm >= 625 && mm < 675) stdDia = 650; + if (mm >= 675 && mm < 725) stdDia = 700; + if (mm >= 725 && mm < 775) stdDia = 750; + if (mm >= 775 && mm < 850) stdDia = 800; + if (mm >= 850 && mm < 950) stdDia = 900; + if (mm >= 950 && mm < 1050) stdDia = 1000; + if (mm >= 1050 && mm < 1150) stdDia = 1100; + if (mm >= 1150 && mm < 1250) stdDia = 1200; + if (mm >= 1250 && mm < 1350) stdDia = 1300; + if (mm >= 1350 && mm < 1450) stdDia = 1400; + if (mm >= 1450 && mm < 1550) stdDia = 1500; + if (mm >= 1550 && mm < 1700) stdDia = 1600; + if (mm >= 1700 && mm < 1900) stdDia = 1800; + if (mm >= 1900 && mm < 2100) stdDia = 2000; + if (mm >= 2100 && mm < 2300) stdDia = 2200; + if (mm >= 2300 && mm < 2500) stdDia = 2400; + if (mm >= 2500 && mm < 2700) stdDia = 2600; + if (mm >= 2700 && mm < 2900) stdDia = 2800; + if (mm >= 2900 && mm < 3100) stdDia = 3000; + if (mm >= 3100 && mm < 3300) stdDia = 3200; + if (mm >= 3300 && mm < 3500) stdDia = 3400; + if (mm >= 3500 && mm < 3700) stdDia = 3600; + if (mm >= 3700 && mm < 3900) stdDia = 3800; + if (mm >= 3900 && mm < 4100) stdDia = 4000; + + //for (int i = 0; i < iFlangeCodeList.Count() - 1; i++) + //{ + // if (mm <= iFlangeCodeList[i]) + // return iFlangeCodeList[i]; + //} + + + //return iFlangeCodeList.Last(); + return stdDia; + } + // + public ViewModel.OutflowParas GetBindingData(out string error) { error = ""; - if(_stype == eOutflowStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴) + ViewModel.OutflowParas _outflowParas = null; + if (_link_type == eOutflowLinkStyle.鐩寸嚎鍦嗗姬 && _sharp_type != eOutflowShapeStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴) { - _otuflowParas = _sideCurveExitControl.GetBindingData(out error); - if(_otuflowParas == null) + if (_sharp_type == eOutflowShapeStyle.涓績鍑哄彛) { - return null; + if (_parasControlArcCenter == null) + return null; + _outflowParas = _parasControlArcCenter.GetBindingData(out error); + } + if (_sharp_type == eOutflowShapeStyle.渚ч潰鍑哄彛) + { + if (_parasControlArcSide == null) + return null; + _outflowParas = _parasControlArcSide.GetBindingData(out error); } } else { - _otuflowParas = _sidelineExitControl.GetBindingData(out error); - if (_otuflowParas == null) + switch (_sharp_type) { - return null; + case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.涓績鍑哄彛: + if (_parasControlCenter == null) + return null; + _outflowParas = _parasControlCenter.GetBindingData(out error); + break; + case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.渚ч潰鍑哄彛: + _outflowParas = _parasControlCurve.GetBindingData(out error); + break; + case DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴: + _outflowParas = _parasControlLine.GetBindingData(out error); + break; + default: + return null; } } - return _otuflowParas; - } - private Control InitialParasControl( ) - { - - Control newControl = null; - switch (_stype) + + if (_outflowParas == null) { - case eOutflowStyle.涓績鍑哄彛_鍨傜洿娉曞叞闈㈡祦鍑�: - newControl = new sidelineExitControl(); - metroTile鎵╂暎绠″舰鐘�.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238); - break; - case eOutflowStyle.渚ч潰鍑哄彛_鏇茬嚎杩炴帴: - newControl = new sidelineExitControl(); - metroTile鎵╂暎绠″舰鐘�.BackgroundImage = GlobalResource.BuildImage("Side-exit-curve.png", 878, 238); - break; - case eOutflowStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴: - newControl = new sideCurveExitControl(); - metroTile鎵╂暎绠″舰鐘�.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238); - break; - default: - throw new ArgumentException("Invalid control type"); + return null; } - panel.Controls.Clear(); - panel.Controls.Add(newControl); - newControl.Dock = DockStyle.Top; - return newControl; + _outflowParas.ShapeStyle = _sharp_type; + _outflowParas.LinkStyle = _link_type; + + return _outflowParas; + } + + public void SetBindingData(ViewModel.OutflowParas paras) + { + if (paras == null) + return; + if (_sectionBundleInfo == null) + { + throw new Exception("鏈垵濮嬪寲ctrlSetOutflowParas鎺т欢"); + } + this._sharp_type = paras.ShapeStyle; + this._link_type = paras.LinkStyle; + var paras1 = new ViewModel.OutflowParas(paras); + var paras2 = new ViewModel.OutflowParas(paras); + var paras3 = new ViewModel.OutflowParas(paras); + var paras4 = new ViewModel.OutflowParas(paras); + var paras5 = new ViewModel.OutflowParas(paras); + _parasControlCenter.SetBindingData(paras1); + if (paras2.ShapeStyle == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.涓績鍑哄彛) + { + paras2.Offset = (int)((_geomBaseInfo.D3 + _sectionBundleInfo.H[8]) / 2 + 0.5); + } + else if (paras3.ShapeStyle == eOutflowShapeStyle.渚ч潰鍑哄彛) + { + paras3.Offset = (int)(((_geomBaseInfo.D3 / 2 + _sectionBundleInfo.H[8]) * 1.6 / 3 / 5) + 1) * 5; + } + + _parasControlLine.SetBindingData(paras2); + _parasControlCurve.SetBindingData(paras3); + _parasControlArcCenter.SetBindingData(paras4); + _parasControlArcSide.SetBindingData(paras5); + + if (_sharp_type == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.涓績鍑哄彛) + { + comboBoxType.SelectedIndex = 0; + } + else if (_sharp_type == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.渚ч潰鍑哄彛) + { + comboBoxType.SelectedIndex = 1; + } + else if (_sharp_type == DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴) + { + comboBoxType.SelectedIndex = 2; + } + if(_link_type == eOutflowLinkStyle.鐩寸嚎鍦嗗姬) + { + checkBox鍦嗗姬杩炴帴.Checked = true; + } + else + { + checkBox鍦嗗姬杩炴帴.Checked = false; + } + InitialOutflowStyle(); } - public Func<bool> OnRefreshShape = null; + private void BuildAllTips() { - metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.metroTile鎵╂暎绠″舰鐘�, "鏂潰鍥�"); + metroToolTip绗叚姝ユ彁绀�.SetToolTip(this.metroTile鍑哄彛鍥剧墖, "鏂潰鍥�"); } - public void ShowPage() + public void ShowPage(DPumpHydr.ViewModel.eWizardStepDiretion step_direction) { - OnRefreshShape(); + //if (step_direction == DPumpHydr.ViewModel.eWizardStepDiretion.鍓嶈繘) + //{ + // var resp = OnRefreshShape3D(_outflowParas); + // if (resp != null) + // { + // if (_stype == eOutflowStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴) + // { + // _sideCurveExitControl.SetBindingData(resp); + // } + // else + // { + // _sidelineExitControl.SetBindingData(resp); + // } + // } + //} + //else + //{ + + //} } private void mBtn鏇存柊妯″瀷_Click(object sender, EventArgs e) { - OnRefreshShape(); + RefreshModel(); + } + + 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 (_sharp_type == eOutflowShapeStyle.涓績鍑哄彛) + { + _parasControlArcCenter.SetBindingData(resp); + } + else if (_sharp_type == eOutflowShapeStyle.渚ч潰鍑哄彛) + { + _parasControlArcSide.SetBindingData(resp); + } + + } + else + { + if (_sharp_type == eOutflowShapeStyle.渚ч潰鍑哄彛_鐩寸嚎杩炴帴) + { + _parasControlLine.SetBindingData(resp); + } + else if (_sharp_type == eOutflowShapeStyle.渚ч潰鍑哄彛) + { + _parasControlCurve.SetBindingData(resp); + } + else + { + _parasControlCenter.SetBindingData(resp); + } + } + } + } + public Action<int, double> OnMoveSectPosi = null; + internal void SetSect9Posi(double sect9Posi) + { + ctrlSection910Posi1.SetSect9Posi(sect9Posi); + } + internal void SetSect10Posi(double sect9Posi) + { + ctrlSection910Posi1.SetSect10Posi(sect9Posi); + } + + private void comboBoxType_SelectedIndexChanged(object sender, EventArgs e) + { + if (comboBoxType.SelectedIndex == 0) + { + _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.涓績鍑哄彛; + checkBox鍦嗗姬杩炴帴.Enabled = true; + checkBox鍦嗗姬杩炴帴.Visible = true; + if (checkBox鍦嗗姬杩炴帴.Checked) + { + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鐩寸嚎鍦嗗姬; + } + else + { + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鏇茬嚎; + } + } + else if (comboBoxType.SelectedIndex == 1) + { + _sharp_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowShapeStyle.渚ч潰鍑哄彛; + checkBox鍦嗗姬杩炴帴.Enabled = true; + checkBox鍦嗗姬杩炴帴.Visible = true; + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鏇茬嚎; + if (checkBox鍦嗗姬杩炴帴.Checked) + { + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鐩寸嚎鍦嗗姬; + } + else + { + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鏇茬嚎; + } + } + else if (comboBoxType.SelectedIndex == 2) + { + _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(); + } + + private void btnNextStep_Click(object sender, EventArgs e) + { + NextStep(); + } + + private void checkBox鍦嗗姬杩炴帴_CheckedChanged(object sender, EventArgs e) + { + if (!checkBox鍦嗗姬杩炴帴.Checked) + { + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鏇茬嚎; + } + else + { + _link_type = DPumpHydr.WinFrmUI.Volute.ViewModel.eOutflowLinkStyle.鐩寸嚎鍦嗗姬; + } + if (_isxml) + { + InitialOutflowStyle(); + return; + } + + InitialOutflowStyle(); + + RefreshModel(); } } } -- Gitblit v1.9.3