tangxu
2025-01-13 4f7cb65b079d88d5a829688b24d26d5145c5df47
WinFrmUI/DPumpHydr.WinFrmUI.Volute/Occ/OccDesignBaseCtrl.cs
@@ -145,30 +145,63 @@
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void RefreshAllSectShape18(ViewModel.SectionBundleInfo bundle)
        public List<int> RefreshAllSectShape18(ViewModel.SectionBundleInfo bundle)
        {
            if (_isFirstSectShape18)
            {
                CreateSectShape18(bundle);
                _isFirstSectShape18 = false;
                return CreateSectShape18(bundle);
            }
            else
            {
                EditSectShape18(bundle);
                return EditSectShape18(bundle);
            }
            _isFirstSectShape18 = false;
        }
        double GetSectStartAngle()
        {
            if (_stype == eOutflowStyle.未知 || _stype == eOutflowStyle.中心出口_垂直法兰面流出)
                return -HydrDisplayEngineBridge.PI_4;
            else
                return 0;
        }
        eOutflowStyle _stype = eOutflowStyle.中心出口_垂直法兰面流出;
        public bool SetOutflowStyle(eOutflowStyle style)
        {
            if (_stype == style)
                return false ;
            bool isNeedRebuild = false;
            if(style == eOutflowStyle.侧面出口_直线连接)
            {
                if(_stype != eOutflowStyle.侧面出口_直线连接)
                {
                    isNeedRebuild = true ;
                }
            }
            if (style != eOutflowStyle.侧面出口_直线连接)
            {
                if (_stype == eOutflowStyle.侧面出口_直线连接)
                {
                    isNeedRebuild = true;
                }
            }
            _stype = style;
            return isNeedRebuild;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bundle"></param>
        protected void CreateSectShape18(ViewModel.SectionBundleInfo bundle)
        protected List<int> CreateSectShape18(ViewModel.SectionBundleInfo bundle)
        {
            //pDisplayView.Update3DViews(_is3D);
            List<int> error_sect = new List<int>();
            double dStartAngle = -HydrDisplayEngineBridge.PI_4;
            double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8;
            double dStartAngle = GetSectStartAngle();
            double dDetAngle =   HydrDisplayEngineBridge.PI / 4;
            for (int i = 8; i >= 1; i--)
            {
                var theSectionParam = bundle.ToSectionShapePara(i);
@@ -183,7 +216,7 @@
                dBaseWidth = theSectionParam.BaseWidth;
                dBaseCircleRadius = theSectionParam.BaseCircleRadius;
                HydrProperties theHydrProperties = new HydrProperties();
@@ -200,36 +233,33 @@
                pHydrGeomCurve.SetHydrProperties(theHydrProperties);
                pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth);
                pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius);
                //if (_is3D)
                //{
                //    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);
                ToolTips tt = pDisplayView.addVoluteCurve(theSectionParam.Index, pHydrGeomCurve);
                if (tt == null || tt.GetTipsId() != 1)
                {
                    error_sect.Add(theSectionParam.Index);
                }
            }
            Invalidate(true);
            pDisplayView.FitAll3DViews(true);
            return error_sect;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="bundle"></param>
        protected void EditSectShape18(ViewModel.SectionBundleInfo bundle)
        public List<int> EditSectShape18(ViewModel.SectionBundleInfo bundle)
        {
            pDisplayView.Update3DViews(_is3D);
            List<int> error_sect = new List<int>();
            double dStartAngle = -HydrDisplayEngineBridge.PI_4;
            double dStartAngle = GetSectStartAngle();
            double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8;
            double dDetAngle =   HydrDisplayEngineBridge.PI / 4;
            for (int i = 1; i <= 8; i++)
            {
                var theSectionParam = bundle.ToSectionShapePara(i);
@@ -270,23 +300,32 @@
                //    pHydrGeomCurve.SetMatrix(theMatrix);
                //}
                pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve);
                ToolTips tt = pDisplayView.editVoluteCurve(wstrShapeNameI, pHydrGeomCurve);
                //pDisplayView.addVoluteCurve(theSectionParam.Index, pHydrGeomCurve);
                if (tt == null || tt.GetTipsId() != 1)
                {
                    error_sect.Add(theSectionParam.Index);
                }
            }
            Invalidate(true);
            return error_sect;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="theSectionParam"></param>
        public void RefreshSingleSectShape18(ViewModel.SectionShapePara theSectionParam)
        {
            pDisplayView.Update3DViews(true);
            double dStartAngle = -HydrDisplayEngineBridge.PI_4;
            double dStartAngle = GetSectStartAngle();
            double dDetAngle = 2 * HydrDisplayEngineBridge.PI / 8;
            double dDetAngle =   HydrDisplayEngineBridge.PI / 4;
            double dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth, dBaseCircleRadius;
@@ -299,7 +338,7 @@
            dBaseWidth = theSectionParam.BaseWidth;
            dBaseCircleRadius = theSectionParam.BaseCircleRadius;
            HydrProperties theHydrProperties = new HydrProperties();
            HydrGeomCurve theHydrGeomCurve = HydrDisplayEngineBridge.CreateGeomCurve(HydrCurveType.EHydrGeomSection);
            HydrGeomSection pHydrGeomCurve = theHydrGeomCurve as HydrGeomSection;
@@ -314,26 +353,44 @@
            pHydrGeomCurve.SetHydrProperties(theHydrProperties);
            pHydrGeomCurve.SetGeomSection(dGama_Left, dGama_Right, dH, dR_out, dR_Left, dR_Right, dBaseWidth);
            pHydrGeomCurve.SetMatrix(dAngle, dBaseCircleRadius);
            pDisplayView.editVoluteCurve(GlobalParas.BuildSectShapeName(theSectionParam.Index), pHydrGeomCurve);
            Invalidate(true);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="isVisible"></param>
        public void SetAllSectionCurveVisible(bool isVisible)
        {
            for (int i = 8; i >= 1; i--)
            {
                string wstrShapeNameI = string.Format("SectShape_{0}", i);
                if(isVisible)
                if (isVisible)
                    pDisplayView.showVoluteCurve(wstrShapeNameI);
                else
                    pDisplayView.hideVoluteCurve(wstrShapeNameI);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sectIndex"></param>
        public void HightLightSectCurve(int sectIndex)
        {
            for (int i = 1; i <= 8; i++)
            {
                if (i == sectIndex)
                    this.pDisplayView.setVoluteCurveClr(i, 255, 0, 255);
                else
                    this.pDisplayView.setVoluteCurveClr(i, 100, 149, 237);
            }
            Invalidate(true);
        }
        #endregion
@@ -341,7 +398,7 @@
        #region 水体
        public HydrGeomSplineParam Create2DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas )
        public HydrGeomSplineParam Create2DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas)
        {
            if (this._is3D)
                return null;
@@ -379,13 +436,13 @@
                return null;
            }
        }
        public void Create3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam)
        public ToolTips  Create3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam)
        {
            if (!this._is3D)
                return;
                return null;
            if (theHydrGeomSplineParam == null)
                return;
                return null;
            WaterBodyOuterParam theWaterBodyOuterParam = new WaterBodyOuterParam();
            theWaterBodyOuterParam.SetOuterOffset(outflowParas.Offset);
@@ -410,18 +467,20 @@
             DPumpHydr.WinFrmUI.Volute.GlobalParas.WaterBodyColor.B, 256);
            //  theHydrGeomCurve.SetHydrProperties(theHydrProperties);
            if (pDisplayView.hasBuildThicknessBody())
                pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody);
            pDisplayView.buildWaterBody(theHydrProperties, theHydrGeomSplineParam, theWaterBodyOuterParam);
                pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody);
           var tt = pDisplayView.buildWaterBody(theHydrProperties, theHydrGeomSplineParam, theWaterBodyOuterParam);
            Invalidate(true);
            pDisplayView.FitAll3DViews(true);
            return tt;
        }
        public void Edit3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam)
        public ToolTips Edit3DWaterBody(DPumpHydr.WinFrmUI.Volute.ViewModel.OtuflowParas outflowParas, HydrGeomSplineParam theHydrGeomSplineParam)
        {
            if (!this._is3D)
                return;
                return null;
            if (theHydrGeomSplineParam != null)
@@ -441,10 +500,18 @@
                if (pDisplayView.hasBuildThicknessBody())
                    pDisplayView.ClearTopoShape(TopoTypeDisplay.EThicknessBody);//
                pDisplayView.rebuildWaterBody(theHydrGeomSplineParam, theWaterBodyOuterParam);
                var tt =  pDisplayView.rebuildWaterBody(theHydrGeomSplineParam, theWaterBodyOuterParam);
                if (tt == null)
                    return null;
                if(tt.GetTipsId () != 1)
                {
                }
                Invalidate(true);
                //pDisplayView.FitAll3DViews(true);
                return tt;
            }
            return null;
        }
        /// <summary>
        /// 割舌的角度
@@ -457,5 +524,14 @@
        #endregion
        public bool  ClearAll()
        {
            _isFirstSectShape18 = true;
            var ret = pDisplayView.ClearTopoShape(TopoTypeDisplay.EAllBody);
            //bool bSucc = pDisplayView.BeginTurbopumpTopoShape(DPumpHydr.WinFrmUI.Volute.GlobalParas.RootTopoShapeName);
            return ret;
        }
    }
}