using System;
|
using System.Collections.Generic;
|
using System.ComponentModel;
|
using System.Data;
|
using System.Drawing;
|
using System.IO;
|
using System.Linq;
|
using System.Text;
|
using System.Threading.Tasks;
|
using System.Windows.Forms;
|
using DPumpHydr.WinFrmUI.Volute.ViewModel;
|
using static System.Runtime.InteropServices.JavaScript.JSType;
|
|
namespace DPumpHydr.WinFrmUI.Volute
|
{
|
public partial class ctrlSetOutflowParas : ParasInfoBaseCtrl
|
{
|
public ctrlSetOutflowParas()
|
{
|
InitializeComponent();
|
|
BuildAllTips();
|
}
|
eOutflowStyle _stype = eOutflowStyle.未知;
|
public Func<OtuflowParas, bool> OnRefreshShape3D = null;
|
public Func<OtuflowParas, bool> OnRefreshShape2D = null;
|
ViewModel.OtuflowParas _outflowParas = null;
|
|
//控件
|
SetOutflowParasCtrl1 _sidelineExitControl = null;
|
SetOutflowParasCtrl2 _sideCurveExitControl = null;
|
public void SetOutflowStyle(eOutflowStyle style)
|
{
|
if (_stype == style)
|
return;
|
|
_stype = style;
|
|
panel.Controls.Clear();
|
switch (_stype)
|
{
|
case eOutflowStyle.中心出口_垂直法兰面流出:
|
metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Central-exit.png", 878, 238);
|
|
if (_sidelineExitControl == null)
|
{
|
_sidelineExitControl = new SetOutflowParasCtrl1();
|
_sidelineExitControl.OnChangeParas += (para) =>
|
{
|
if(OnRefreshShape2D != null)
|
OnRefreshShape2D(para);
|
};
|
_sidelineExitControl.Dock = DockStyle.Top;
|
}
|
_sidelineExitControl.SetA_state(false);
|
panel.Controls.Add(_sidelineExitControl);
|
return;
|
case eOutflowStyle.侧面出口_曲线连接:
|
metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Side-exit-curve.png", 878, 238);
|
if (_sidelineExitControl == null)
|
{
|
_sidelineExitControl = new SetOutflowParasCtrl1();
|
_sidelineExitControl.OnChangeParas += (para) =>
|
{
|
if (OnRefreshShape2D != null)
|
OnRefreshShape2D(para);
|
};
|
_sidelineExitControl.Dock = DockStyle.Top;
|
}
|
|
_sidelineExitControl.SetA_state(true);
|
panel.Controls.Add(_sidelineExitControl);
|
return;
|
case eOutflowStyle.侧面出口_直线连接:
|
metroTile扩散管形状.BackgroundImage = GlobalResource.BuildImage("Side-exit-straight-line.png", 878, 238);
|
|
if (_sideCurveExitControl == null)
|
_sideCurveExitControl = new SetOutflowParasCtrl2();
|
_sideCurveExitControl.Dock = DockStyle.Top;
|
panel.Controls.Add(_sideCurveExitControl);
|
return;
|
default:
|
throw new ArgumentException("Invalid control type");
|
}
|
}
|
|
public void InitialParas(
|
eOutflowStyle style,
|
ViewModel.HdrBaseInfo hdrBaseInfo ,
|
ViewModel.GeomBaseInfo geomBaseInfo ,
|
ViewModel.SectionBundleInfo sectionBundleInfo )
|
{
|
SetOutflowStyle(style);
|
//出口直径标准化
|
double outer_dia = 4.5 * Math.Pow(hdrBaseInfo.Q / 3600 / hdrBaseInfo.n, 1 / 3.0) * 1000;
|
double height = 10 * (int)((geomBaseInfo.D3 * 1.3 + sectionBundleInfo.H[8] + 15) / 10);
|
|
double a = 0;
|
if (style == eOutflowStyle.中心出口_垂直法兰面流出)
|
{
|
a = 0;
|
}
|
else
|
{
|
a = (int)((geomBaseInfo.D3 + sectionBundleInfo.H[8]) / 2);
|
}
|
|
_outflowParas = new OtuflowParas();
|
_outflowParas.Offset = a;
|
_outflowParas.Heigh = height;
|
_outflowParas.H1 = 5;
|
_outflowParas.H2 = 5;
|
_outflowParas.Dia = GetStdDia(outer_dia);
|
_outflowParas.Septalradius = 10;
|
if (_stype == eOutflowStyle.侧面出口_直线连接)
|
{
|
_sideCurveExitControl.SetBindingData(_outflowParas);
|
}
|
else
|
{
|
_sidelineExitControl.IsInvokeAble = false;
|
_sidelineExitControl.SetBindingData(_outflowParas);
|
_sidelineExitControl.IsInvokeAble = 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};
|
|
for (int i = 0; i < iFlangeCodeList.Count() - 1; i++)
|
{
|
if (mm < iFlangeCodeList[i])
|
return iFlangeCodeList[i];
|
}
|
|
|
return iFlangeCodeList.Last();
|
}
|
//
|
public ViewModel.OtuflowParas GetBindingData(out string error)
|
{
|
error = "";
|
if (_stype == eOutflowStyle.侧面出口_直线连接)
|
{
|
_outflowParas = _sideCurveExitControl.GetBindingData(out error);
|
}
|
else
|
{
|
_outflowParas = _sidelineExitControl.GetBindingData(out error);
|
}
|
|
return _outflowParas;
|
}
|
|
public void SetBindingData(eOutflowStyle style, ViewModel.OtuflowParas paras)
|
{
|
SetOutflowStyle(style);
|
if (_stype == eOutflowStyle.侧面出口_直线连接)
|
{
|
_sideCurveExitControl.SetBindingData( _outflowParas);
|
}
|
else
|
{
|
_sidelineExitControl.SetBindingData(_outflowParas);
|
}
|
|
|
}
|
|
|
|
|
private void BuildAllTips()
|
{
|
metroToolTip第六步提示.SetToolTip(this.metroTile扩散管形状, "断面图");
|
}
|
|
public void ShowPage()
|
{
|
OnRefreshShape3D(_outflowParas);
|
}
|
|
|
|
private void mBtn更新模型_Click(object sender, EventArgs e)
|
{
|
string error;
|
OnRefreshShape3D(GetBindingData(out error));
|
}
|
}
|
}
|