tangxu
2024-12-29 f7ec23b2fe6e8e48bbb32b8c9321b64529622406
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.IO;
using System.Text;
using System.Linq;
using HydrEngineCSharp; 
 
namespace DPumpHydr.WinFrmUI.Volute
{
    public partial class MainViewPage
    {
        OccDesign3DCtrl _occDesign3dCtrl;
        OccDesign2DCtrl _occDesign2dCtrl;
        DesignMainDockPanel _designMainDockPanel;
 
        private void InitialDesginPanel()
        {
            this._occDesign3dCtrl = new OccDesign3DCtrl();
            this._occDesign3dCtrl.Size = new System.Drawing.Size(1000, 1000);
            this._occDesign3dCtrl.Name = "OccDesignCtrl3d";
            this._occDesign3dCtrl.Dock = DockStyle.Fill; 
            this._occDesign3dCtrl.Initial( );
 
            this._occDesign2dCtrl = new OccDesign2DCtrl();
            this._occDesign2dCtrl.Size = new System.Drawing.Size(1000, 1000);
            this._occDesign2dCtrl.Name = "OccDesignCtrl2d";
            this._occDesign2dCtrl.Dock = DockStyle.Fill; 
            this._occDesign2dCtrl.Initial( );
 
            this._designMainDockPanel = new DesignMainDockPanel();
            this._designMainDockPanel.Size = new System.Drawing.Size(1000, 1000);
            this._designMainDockPanel.Name = "OccDesignCtrl";
            this._designMainDockPanel.Dock = DockStyle.Fill;
            this._designMainDockPanel.DockText = "设计视图";
            _designMainDockPanel.SetOccCtrl(_occDesign3dCtrl, _occDesign2dCtrl);
 
            MainDockPanel.AddContent(_designMainDockPanel);
 
        }
        /// <summary>
        /// 更新1-8
        /// </summary>
        /// <param name="bundle"></param>
        private void RefreshSectShapeWhole18(ViewModel.SectionBundleInfo bundle)
        {
            this._occDesign3dCtrl.RefreshAllSectShape18(bundle);
            this._occDesign2dCtrl.RefreshAllSectShape18(bundle);
 
            this._sectAreaDockPanel.SetBindingData(bundle);
 
        }
        //更新单个断面
        private void RefreshSectShapeSingle18(ViewModel.SectionShapePara para)
        {
            this._sectionBundleInfo.FromSectionShapePara(para);
 
            this._occDesign3dCtrl.RefreshSingleSectShape18(para);
 
            this._occDesign2dCtrl.RefreshSingleSectShape18(para);
 
            this._sectAreaDockPanel.SetBindingData(para);
        }
 
        private WaterBodyOuterParam m_theWaterBodyOuterParam;
        private bool CreateWaterBody3D(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas)
        {
            this._outflowParas = outflowParas;
            if (_ctrlSetOutflowStyle == null || outflowParas == null)
            {
                return false ;
            }
            if (outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 ||
         outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0)
                return false;
 
            if (m_theWaterBodyOuterParam != null)
            {
                return EditWaterBody3D(outflowParas);
            }
            
            m_theWaterBodyOuterParam = new WaterBodyOuterParam(); 
 
            m_theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset);
            m_theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh);
            m_theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia/2);
            m_theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Right);
            m_theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Right);
            m_theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Left);
            m_theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Left);
            m_theWaterBodyOuterParam.SetH1(outflowParas.H1);
            m_theWaterBodyOuterParam.SetH2(outflowParas.H2);
            m_theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius);
 
            var   m_theHydrGeomSplineParam = this._occDesign2dCtrl.Create2DWaterBody(m_theWaterBodyOuterParam);
            if (m_theHydrGeomSplineParam != null && !m_theHydrGeomSplineParam.IsEmpty())
            {
                this._occDesign3dCtrl.Create3DWaterBody(m_theWaterBodyOuterParam, m_theHydrGeomSplineParam);
            }
 
            return true;
        }
        private bool CreateWaterBody2D(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas)
        {
            if (_ctrlSetOutflowStyle == null || outflowParas == null)
            {
                return false;
            }
            if (  outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 ||
                outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0)
                return false;
 
            if (m_theWaterBodyOuterParam != null)
            {
                return EditWaterBody2D(outflowParas);
            }
 
            m_theWaterBodyOuterParam = new WaterBodyOuterParam();
 
            m_theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset);
            m_theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh);
            m_theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2);
            m_theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Right);
            m_theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Right);
            m_theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Left);
            m_theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Left);
            m_theWaterBodyOuterParam.SetH1(outflowParas.H1);
            m_theWaterBodyOuterParam.SetH2(outflowParas.H2);
            m_theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius);
 
              this._occDesign2dCtrl.Create2DWaterBody(m_theWaterBodyOuterParam);
 
 
            return true;
        }
 
        private bool EditWaterBody3D(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas)
        {
            if (outflowParas.Tangent_Top_Right <= 0 || outflowParas.Tangent_Btm_Right <= 0 ||
                outflowParas.Tangent_Top_Left <= 0 || outflowParas.Tangent_Btm_Left <= 0)
                return false ;
            m_theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset);
            m_theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh);
            m_theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2);
            m_theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Right);
            m_theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Right);
            m_theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Left);
            m_theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Left);
            m_theWaterBodyOuterParam.SetH1(outflowParas.H1);
            m_theWaterBodyOuterParam.SetH2(outflowParas.H2);
            m_theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius);
            var  m_theHydrGeomSplineParam = this._occDesign2dCtrl.Create2DWaterBody(m_theWaterBodyOuterParam);
            this._occDesign3dCtrl.Edit3DWaterBody(m_theWaterBodyOuterParam, m_theHydrGeomSplineParam);
 
            return true;
        }
        private bool EditWaterBody2D(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas 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;
            m_theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset);
            m_theWaterBodyOuterParam.SetOuterHigh(outflowParas.Heigh);
            m_theWaterBodyOuterParam.SetOuterRad(outflowParas.Dia / 2);
            m_theWaterBodyOuterParam.SetTopValue1(outflowParas.Tangent_Top_Right);
            m_theWaterBodyOuterParam.SetBtmValue1(outflowParas.Tangent_Btm_Right);
            m_theWaterBodyOuterParam.SetTopValue2(outflowParas.Tangent_Top_Left);
            m_theWaterBodyOuterParam.SetBtmValue2(outflowParas.Tangent_Btm_Left);
            m_theWaterBodyOuterParam.SetH1(outflowParas.H1);
            m_theWaterBodyOuterParam.SetH2(outflowParas.H2);
            m_theWaterBodyOuterParam.SetRadConner(outflowParas.Septalradius);
              this._occDesign2dCtrl.Create2DWaterBody(m_theWaterBodyOuterParam);
    
            return true;
        }
    }
}