using System;
|
using System.Collections.Generic;
|
using System.Windows.Forms;
|
using System.IO;
|
using System.Text;
|
using System.Linq;
|
using HydrEngineCSharp;
|
using System.Net.NetworkInformation;
|
using DPumpHydr.WinFrmUI.Volute.ViewModel;
|
|
namespace DPumpHydr.WinFrmUI.Volute
|
{
|
public partial class MainViewPage
|
{
|
ctrlSetOutflowParas _ctrlSetOutflowParas = null;
|
ViewModel.OutflowParas _outflowParas = null;
|
|
/// <summary>
|
///
|
/// </summary>
|
/// <returns></returns>
|
private bool SaveParaStep3()
|
{
|
|
return true;
|
}
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="last_step_id"></param>
|
private void EnterStep3(long last_step_id)
|
{
|
if (_sectionBundleInfo == null)
|
return;
|
|
this._occDesign2dCtrl.SetAllSectionCurveVisible(false);
|
this._occDesign3dCtrl.SetAllSectionCurveVisible(false);
|
|
|
if (_ctrlSetOutflowParas == null)
|
{
|
_ctrlSetOutflowParas = new ctrlSetOutflowParas();
|
_ctrlSetOutflowParas.Name = "ctrlSetOutflowStyle";
|
_ctrlSetOutflowParas.OnRefreshShape2D += RefreshWaterBody2D ;
|
_ctrlSetOutflowParas.OnRefreshShape3D += RefreshWaterBody3D;
|
_ctrlSetOutflowParas.OnNextStep += () =>
|
{
|
GoNextStep();
|
};
|
_ctrlSetOutflowParas.OnMoveSectPosi += (sect_index, posi) =>
|
{
|
if (sect_index == 9)
|
{
|
_sect9Posi = posi;
|
var SectArea9 = this._occDesign3dCtrl.GetSectArea9(_sect9Posi);
|
this._sectAreaDockPanel.SetArea9(SectArea9);
|
}
|
if (sect_index == 10)
|
{
|
_sect10Posi = posi;
|
var SectArea10 = this._occDesign3dCtrl.GetSectArea10(_sect10Posi);
|
this._sectAreaDockPanel.SetArea10(SectArea10);
|
}
|
};
|
|
}
|
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)
|
{
|
double dOuterRad = outflowParas.Dia * 0.5;
|
double dOuterHigh = outflowParas.Heigh;
|
double dOuterOffset = outflowParas.Offset;
|
double dH1 = outflowParas.H1;
|
double dH2 = outflowParas.H2;
|
double dTopValue1 = outflowParas.Tangent_Top_Left;
|
double dBtmValue1 = outflowParas.Tangent_Btm_Left;
|
double dTopValue2 = outflowParas.Tangent_Top_Right;
|
double dBtmValue2 = outflowParas.Tangent_Btm_Right;
|
double dRadConner = outflowParas.Septalradius;
|
double dRadConnerAngle = this._geomBaseInfo.FAI0;
|
dRadConnerAngle = dRadConnerAngle * HydrDisplayEngineBridge.PI / 180.0;
|
|
if (m_theWaterBodyOuterParam == null)
|
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);
|
}
|
|
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)
|
return false;
|
|
RefreshOuterParam(outflowParas);
|
HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterSpParam;
|
|
//if (_isHaveCreateWaterBody2d == true)
|
//{
|
// this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
|
//}
|
|
this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
|
|
|
|
return true;
|
|
}
|
|
private ViewModel.OutflowParasCalcReponse RefreshWaterBody3D(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)
|
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.侧面出口_直线连接)
|
{
|
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._sectAreaDockPanel.SetAreaOutletDia(outflowParas.Dia);
|
this._outflowParas = outflowParas;
|
RefreshOuterParam(outflowParas);
|
HydrEngineCSharp.WaterBodyOuterSpParam pHydrGeomCurve = m_theWaterBodyOuterParam as HydrEngineCSharp.WaterBodyOuterSpParam;
|
|
try
|
{
|
if (_isHaveCreateWaterBody3d == true)
|
{
|
this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
|
this._occDesign3dCtrl.Edit3DWaterBody(pHydrGeomCurve);
|
this._occDesign3dCtrl.SetWaterBodyVisible(true);
|
}
|
else
|
{
|
_isHaveCreateWaterBody3d = true;
|
|
this._occDesign2dCtrl.Create2DWaterBody(pHydrGeomCurve);
|
this._occDesign3dCtrl.Create3DWaterBody(pHydrGeomCurve);
|
this._occDesign3dCtrl.SetWaterBodyVisible(true);
|
}
|
return BuildRefreshWaterBodyReponse();
|
}
|
catch
|
{
|
DialogResult result = MessageBox.Show("创建失败,请问是否保存当前参数", "询问",
|
System.Windows.Forms.MessageBoxButtons.YesNo,
|
System.Windows.Forms.MessageBoxIcon.Warning);
|
if (result == DialogResult.Yes)
|
{
|
ExportXmlFile();
|
}
|
|
return null;
|
}
|
}
|
|
private double _sect9Posi = 0.25;
|
private double _sect10Posi = 0.65;
|
private ViewModel.OutflowParasCalcReponse BuildRefreshWaterBodyReponse()
|
{
|
ViewModel.OutflowParasCalcReponse rep = new ViewModel.OutflowParasCalcReponse();
|
rep.IsSuccess = true;
|
rep.SectArea9 = this._occDesign3dCtrl.GetSectArea9(_sect9Posi);
|
rep.SectArea10 = this._occDesign3dCtrl.GetSectArea10(_sect10Posi);
|
|
this._sectAreaDockPanel.SetArea9(rep.SectArea9);
|
this._sectAreaDockPanel.SetArea10(rep.SectArea10);
|
return rep;
|
}
|
}
|
}
|