using System;
|
using System.Collections.Generic;
|
using System.Windows.Forms;
|
using DPumpHydr.WinFrmUI.RLT.Docking.Crown;
|
using HydrEngineCSharp;
|
|
namespace DPumpHydr.WinFrmUI.Volute
|
{
|
public partial class OccDesignBaseCtrl : UserControl
|
{
|
protected HydrEngineCSharp.CDisplayView pDisplayView;
|
protected string strTurbopumpTopoShapeName = "ÎÏ¿ÇÉè¼Æx";
|
|
|
|
public OccDesignBaseCtrl()
|
{
|
InitializeComponent();
|
|
//this.DefaultDockArea = RLT.Enum.Crown.DockArea.Document;
|
//this._isDispCloseIcon = false ;//²»ÄܹرÕ
|
|
|
|
this.MouseDown += OnMouseDown;
|
this.MouseMove += OnMouseMove;
|
this.MouseUp += OnMouseUp;
|
this.MouseWheel += OnMouseWheel;
|
|
|
//string strTurbopumpTopoShapeName = "ÎÏ¿ÇÉè¼Æ" + (m_nNum++).ToString();
|
//bool bSucc = pDisplayView.addTurbopumpTopoShape(strTurbopumpTopoShapeName);
|
//if (bSucc)
|
//{
|
// m_nCreateCurve = 1;
|
// //MessageBox.Show("¿ªÊ¼ÎÏ¿ÇÉè¼Æ");
|
//}
|
|
|
|
}
|
|
|
protected override void OnPaint(PaintEventArgs e)
|
{
|
// »æÖÆ´úÂë
|
pDisplayView.OCCDraw();
|
}
|
|
protected override void OnResize(EventArgs e)
|
{
|
base.OnResize(e);
|
// ³ß´ç¸Ä±äʱµÄ´úÂë
|
if (pDisplayView != null)
|
{
|
pDisplayView.OCCResize();
|
}
|
}
|
|
|
|
|
|
protected void OnMouseDown(object sender, MouseEventArgs e)
|
{
|
if (e.Button == MouseButtons.Left)
|
{
|
// Êó±ê×ó¼ü°´ÏµIJÙ×÷
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.LButtonDown(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Middle)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MButtonDown(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Right)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.RButtonDown(nF, pLT_PtInt2D);
|
}
|
}
|
|
protected void OnMouseUp(object sender, MouseEventArgs e)
|
{
|
if (e.Button == MouseButtons.Left)
|
{
|
// Êó±ê×ó¼ü°´ÏµIJÙ×÷
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.LButtonUp(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Middle)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MButtonUp(nF, pLT_PtInt2D);
|
}
|
else if (e.Button == MouseButtons.Right)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.RButtonUp(nF, pLT_PtInt2D);
|
}
|
}
|
// Êó±ê¹öÂֵIJÙ×÷
|
protected void OnMouseWheel(object sender, MouseEventArgs e)
|
{
|
// e.Delta ·µ»Ø¹öÂֵĹö¶¯Öµ
|
// Èç¹û e.Delta > 0 Ôò±íʾ¹öÂÖÏòÉÏ
|
// Èç¹û e.Delta < 0 Ôò±íʾ¹öÂÖÏòÏÂ
|
|
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MouseWheel(nF, (short)e.Delta, pLT_PtInt2D);
|
}
|
// Êó±êµÄ²Ù×÷
|
protected void OnMouseMove(object sender, MouseEventArgs e)
|
{
|
HydrEngineCSharp.LT_PtInt2D pLT_PtInt2D = new HydrEngineCSharp.LT_PtInt2D(e.X, e.Y);
|
uint nF = 0;
|
pDisplayView.MouseMove(nF, pLT_PtInt2D);
|
}
|
|
|
public void SetViewDirect(DPumpHydr.Model.eViewDirect vd)
|
{
|
if (vd == Model.eViewDirect.TOP)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.TOPVIEW);
|
|
if (vd == Model.eViewDirect.FRONT)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.FRONTVIEW);
|
|
if (vd == Model.eViewDirect.BACK)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.BACKVIEW);
|
|
if (vd == Model.eViewDirect.INI)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.INITVIEW);
|
|
if (vd == Model.eViewDirect.LEFT)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.LEFTVIEW);
|
|
if (vd == Model.eViewDirect.RIGHT)
|
pDisplayView.SetViewDirect(HydrEngineCSharp.VIEWDIRECT.RIGHTVIEW);
|
}
|
protected bool _is3D = true;
|
|
|
public void ClearAll()
|
{
|
//pDisplayView.DeleteObject(strTurbopumpTopoShapeName);
|
//pDisplayView.addTurbopumpTopoShape(strTurbopumpTopoShapeName);
|
}
|
public virtual void Initial( )
|
{
|
}
|
|
#region 1-8 ½ØÃæÉè¼Æ
|
bool _isFirstSectShape18 = true;
|
/// <summary>
|
///
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
public void RefreshAllSectShape18(ViewModel.SectionBundleInfo bundle)
|
{
|
if (_isFirstSectShape18)
|
{
|
CreateSectShape18(bundle);
|
}
|
else
|
{
|
EditSectShape18(bundle);
|
}
|
_isFirstSectShape18 = false;
|
}
|
protected void CreateSectShape18(ViewModel.SectionBundleInfo bundle)
|
{
|
//pDisplayView.Update3DViews(_is3D);
|
|
double dStartAngle = -HydrDisplayEngineBridge.PI_4;
|
|
double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8;
|
for (int i = 8; i >=1; i--)
|
{
|
var theSectionParam = bundle.ToSectionShapePara(i);
|
|
double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius;
|
dGama_Left = theSectionParam.Gama_Left;
|
dGama_Right = theSectionParam.Gama_Right;
|
dH = theSectionParam.H;
|
dR_out = theSectionParam.R_out;
|
dR_Left = theSectionParam.R_Left;
|
dR_Right = theSectionParam.R_Right;
|
dBaseWidth = theSectionParam.BaseWidth;
|
dBaseCircleRadius = theSectionParam.BaseCircleRadius;
|
|
string wstrShapeNameI = string.Format("SectShape_{0}", theSectionParam.Index);
|
|
|
HydrProperties theHydrProperties = new HydrProperties();
|
HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomSection);
|
HydrGeomSection pHydrGeomCurve = theHydrGeomCurve as HydrGeomSection;
|
if (pHydrGeomCurve == null)
|
{
|
continue;
|
}
|
|
|
|
theHydrProperties.SetShapeName(wstrShapeNameI);
|
pHydrGeomCurve.SetHydrProperties(theHydrProperties);
|
pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius);
|
//if (_is3D)
|
{
|
double dAngle = ( 8 - theSectionParam.Index ) * dDetAngle + dStartAngle;
|
BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0);
|
BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0);
|
theMatrix.postMult(theMatrix1);
|
pHydrGeomCurve.SetMatrix(theMatrix);
|
}
|
|
pDisplayView.addVoluteCurve( theSectionParam.Index, pHydrGeomCurve);
|
}
|
|
|
if (_is3D)
|
{
|
string wstrVoluteName = "VolueBodyShape";
|
bool bSucc = pDisplayView.buildVoluteShape(wstrVoluteName);
|
if (bSucc)
|
{
|
Invalidate(true);
|
pDisplayView.FitAll3DViews(true);
|
}
|
}
|
else
|
{
|
Invalidate(true);
|
pDisplayView.FitAll3DViews(true);
|
}
|
}
|
|
|
|
protected void EditSectShape18(ViewModel.SectionBundleInfo bundle)
|
{
|
pDisplayView.Update3DViews(_is3D);
|
|
double dStartAngle = -HydrDisplayEngineBridge.PI_4;
|
|
double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8;
|
for (int i = 1; i <= 8; i++)
|
{
|
var theSectionParam = bundle.ToSectionShapePara(i);
|
|
double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius;
|
dGama_Left = theSectionParam.Gama_Left;
|
dGama_Right = theSectionParam.Gama_Right;
|
dH = theSectionParam.H;
|
dR_out = theSectionParam.R_out;
|
dR_Left = theSectionParam.R_Left;
|
dR_Right = theSectionParam.R_Right;
|
dBaseWidth = theSectionParam.BaseWidth;
|
dBaseCircleRadius = theSectionParam.BaseCircleRadius;
|
|
string wstrShapeNameI = string.Format("SectShape_{0}", theSectionParam.Index);
|
|
|
HydrProperties theHydrProperties = new HydrProperties();
|
HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomSection);
|
HydrGeomSection pHydrGeomCurve = theHydrGeomCurve as HydrGeomSection;
|
if (pHydrGeomCurve == null)
|
{
|
continue;
|
}
|
|
|
|
theHydrProperties.SetShapeName(wstrShapeNameI);
|
pHydrGeomCurve.SetHydrProperties(theHydrProperties);
|
pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius);
|
//if (_is3D)
|
{
|
double dAngle = (8 - theSectionParam.Index) * dDetAngle + dStartAngle;
|
BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0);
|
BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0);
|
theMatrix.postMult(theMatrix1);
|
pHydrGeomCurve.SetMatrix(theMatrix);
|
}
|
|
pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve);
|
}
|
|
|
|
Invalidate(true);
|
|
|
}
|
|
public void RefreshSingleSectShape18(ViewModel.SectionShapePara theSectionParam)
|
{
|
pDisplayView.Update3DViews(true );
|
|
double dStartAngle = -HydrDisplayEngineBridge.PI_4;
|
|
double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8;
|
|
|
double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius;
|
dGama_Left = theSectionParam.Gama_Left;
|
dGama_Right = theSectionParam.Gama_Right;
|
dH = theSectionParam.H;
|
dR_out = theSectionParam.R_out;
|
dR_Left = theSectionParam.R_Left;
|
dR_Right = theSectionParam.R_Right;
|
dBaseWidth = theSectionParam.BaseWidth;
|
dBaseCircleRadius = theSectionParam.BaseCircleRadius;
|
|
string wstrShapeNameI = string.Format("SectShape_{0}", theSectionParam.Index);
|
|
|
HydrProperties theHydrProperties = new HydrProperties();
|
HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomSection);
|
HydrGeomSection pHydrGeomCurve = theHydrGeomCurve as HydrGeomSection;
|
if (pHydrGeomCurve == null)
|
{
|
return;
|
}
|
|
|
|
theHydrProperties.SetShapeName(wstrShapeNameI);
|
pHydrGeomCurve.SetHydrProperties(theHydrProperties);
|
pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius);
|
//if (_is3D)
|
{
|
double dAngle = (8 - theSectionParam.Index) * dDetAngle + dStartAngle;
|
BcGeMatrix theMatrix = BcGeMatrix.translate(0, dBaseCircleRadius, 0);
|
BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0);
|
theMatrix.postMult(theMatrix1);
|
pHydrGeomCurve.SetMatrix(theMatrix);
|
}
|
|
pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve);
|
|
|
Invalidate(true);
|
}
|
|
|
|
|
#endregion
|
protected double theRad = 70.0;
|
protected double theHigh = 350.0;
|
protected double theOffset = 0.0;
|
protected double m_dTopValue = 1.0;
|
protected double m_dBtmValue = 1.0;
|
protected string ShapeNameOutflowBody = "OutflowBody";
|
protected bool CreateOutflowBodyConnect()
|
{
|
int nConnectSectionId = 1;
|
bool bSucc = pDisplayView.setConnectBaseCurve(nConnectSectionId);
|
if (bSucc && this._is3D)
|
{
|
string wstrShapeName = "Á¬½Ó";
|
Invalidate(true);
|
pDisplayView.FitAll3DViews(true);
|
pDisplayView.buildVoluteConnectShape(wstrShapeName);
|
}
|
|
|
|
double dAngle = 0.0;
|
int nBtmSectionId = 8;
|
|
|
|
HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomCircle);
|
HydrProperties theHydrProperties = new HydrProperties();
|
theHydrProperties.SetShapeName(ShapeNameOutflowBody);
|
theHydrGeomCurve.SetHydrProperties(theHydrProperties);
|
|
|
double dOuterTopValue = m_dTopValue;
|
double dOuterBtmValue = m_dBtmValue;
|
double dOuterOffset = theOffset;
|
double dOuterHigh = theHigh;
|
double dOuterRad = theRad;
|
BcIfcGeomCircle pHydrGeomCurve = theHydrGeomCurve as BcIfcGeomCircle;
|
if (pHydrGeomCurve != null)
|
{
|
pHydrGeomCurve.SetIfcGeomCircle(theRad);
|
|
BcGeMatrix theMatrix = BcGeMatrix.translate(0, theOffset, theHigh);
|
BcGeMatrix theMatrix1 = BcGeMatrix.rotate(-dAngle, 1.0, 0.0, 0.0);
|
theMatrix.postMult(theMatrix1);
|
pHydrGeomCurve.SetMatrix(theMatrix);
|
}
|
return pDisplayView.setVoluteOuterCurve(nBtmSectionId, pHydrGeomCurve);
|
|
}
|
|
}
|
}
|