WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/02-bimface/XhsProjectSimulationBimfaceCtrl.cs
@@ -482,6 +482,26 @@ #endregion #region ä¸å¡æ°´æµå¨ç» /// <summary> /// å 载水æµå¨ç» /// </summary> public async Task LoadFlowEffect(LogicFlowEffect obj) { await _bimfaceInteropContainer?.LoadFlowEffect(obj); } /// <summary> /// å 载水æµå¨ç»å表 /// </summary> public async Task LoadFlowEffectList(List<LogicFlowEffect> obj) { await _bimfaceInteropContainer?.LoadFlowEffectList(obj); } #endregion #region è¿æ¥æä»¶é¢è² private const string _linkComponentColor = "#008B00";//è¿æ¥æä»¶é¢è² WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.Designer.cs
@@ -84,6 +84,7 @@ controlContainerBottom = new DevExpress.XtraBars.Docking.ControlContainer(); svgImg32 = new DevExpress.Utils.SvgImageCollection(components); rmSet = new DevExpress.XtraBars.Ribbon.RadialMenu(components); barButtonItem1 = new DevExpress.XtraBars.BarButtonItem(); ((ISupportInitialize)ribbonControl1).BeginInit(); ((ISupportInitialize)tabPane1).BeginInit(); tabPane1.SuspendLayout(); @@ -98,9 +99,9 @@ // ribbonControl1.ExpandCollapseItem.Id = 0; ribbonControl1.ItemPanelStyle = DevExpress.XtraBars.Ribbon.RibbonItemPanelStyle.Classic; ribbonControl1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { ribbonControl1.ExpandCollapseItem, barBtnHydroCheck, barBtnHydroCalcu, barBtnHydroExportInp, barBtnSave, barBtnHydroParterList, barBtnFastShowHidden, barBtnMatchingList, barBtnUnMatchingList, barBtnSetList, barBtnSetPumpList, barBtnSetValveList, barBtnSetPipeList, barBtnSetElbowsList, barBtnSetThreelinkList, barBtnSetFourlinkList, barBtnSetTranslationList, barBtnSetExchangerList, barBtnSetJunctionList, barBtnParallelAnaly, barBtnSearch, barBtnGradingSet, barBtnGradingApply, barBtnRefresh, barBtnSetMark, barBtnSetReservoirList, barBtnSetTankList, barBtnSetWaterboxList, barBtnSetBluntheadList, barBtnSetNozzleList, barBtnSetHydrantList, barBtnSetMeterList, barBtnSetCompressorList, barBtnSetFlowmeterList, barBtnSetPressmeterList }); ribbonControl1.Items.AddRange(new DevExpress.XtraBars.BarItem[] { ribbonControl1.ExpandCollapseItem, barBtnHydroCheck, barBtnHydroCalcu, barBtnHydroExportInp, barBtnSave, barBtnHydroParterList, barBtnFastShowHidden, barBtnMatchingList, barBtnUnMatchingList, barBtnSetList, barBtnSetPumpList, barBtnSetValveList, barBtnSetPipeList, barBtnSetElbowsList, barBtnSetThreelinkList, barBtnSetFourlinkList, barBtnSetTranslationList, barBtnSetExchangerList, barBtnSetJunctionList, barBtnParallelAnaly, barBtnSearch, barBtnGradingSet, barBtnGradingApply, barBtnRefresh, barBtnSetMark, barBtnSetReservoirList, barBtnSetTankList, barBtnSetWaterboxList, barBtnSetBluntheadList, barBtnSetNozzleList, barBtnSetHydrantList, barBtnSetMeterList, barBtnSetCompressorList, barBtnSetFlowmeterList, barBtnSetPressmeterList, barButtonItem1 }); ribbonControl1.Location = new Point(0, 0); ribbonControl1.MaxItemId = 51; ribbonControl1.MaxItemId = 52; ribbonControl1.Name = "ribbonControl1"; ribbonControl1.Pages.AddRange(new DevExpress.XtraBars.Ribbon.RibbonPage[] { ribbonPage1 }); ribbonControl1.ShowApplicationButton = DevExpress.Utils.DefaultBoolean.False; @@ -382,6 +383,7 @@ pageGroupModel.ItemLinks.Add(barBtnHydroParterList); pageGroupModel.ItemLinks.Add(barBtnSetList); pageGroupModel.ItemLinks.Add(barBtnSetMark); pageGroupModel.ItemLinks.Add(barButtonItem1); pageGroupModel.Name = "pageGroupModel"; pageGroupModel.Text = "模å"; // @@ -513,6 +515,13 @@ rmSet.Ribbon = ribbonControl1; rmSet.BeforePopup += rmSet_BeforePopup; // // barButtonItem1 // barButtonItem1.Caption = "barButtonItem1"; barButtonItem1.Id = 51; barButtonItem1.Name = "barButtonItem1"; barButtonItem1.ItemClick += barButtonItem1_ItemClick; // // XhsProjectSimulationCorePage // Appearance.BackColor = SystemColors.Control; @@ -592,5 +601,6 @@ private DevExpress.XtraBars.BarButtonItem barBtnSetCompressorList; private DevExpress.XtraBars.BarButtonItem barBtnSetFlowmeterList; private DevExpress.XtraBars.BarButtonItem barBtnSetPressmeterList; private DevExpress.XtraBars.BarButtonItem barButtonItem1; } } WinFrmUI/HStation.WinFrmUI.Xhs.Core/03-simulation/06-simulation/XhsProjectSimulationCorePage.cs
@@ -1996,5 +1996,28 @@ } #endregion private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { var pipes = _hydroInfo.Pipes; var list = pipes.Select(x => { return new Yw.WinFrmUI.Bimface.LogicFlowEffect() { Id = x.Code, Rotation = 90, Speed = 0.1d }; }).ToList(); _bimfaceCtrl?.LoadFlowEffectList(list); //var obj = new LogicFlowEffect() //{ // Id = "757125", // Rotation = 90, // Speed = 0.1d //}; //_bimfaceCtrl?.LoadFlowEffect(obj); } } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/00-core/05-logic-flow/LogicFlowEffect.cs
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,28 @@ namespace Yw.WinFrmUI.Bimface { /// <summary> /// ä¸å¡æµåå¨ç» /// </summary> public class LogicFlowEffect { /// <summary> /// ç¼ç /// </summary> [JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)] public string Id { get; set; } /// <summary> /// æè½¬è§åº¦ /// </summary> [JsonProperty("rotation", NullValueHandling = NullValueHandling.Ignore)] public int Rotation { get; set; } /// <summary> /// é度 /// </summary> [JsonProperty("speed", NullValueHandling = NullValueHandling.Ignore)] public double Speed { get; set; } } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/01-interop/01-interop3d/BimfaceInterop3dContainer.cs
@@ -468,5 +468,36 @@ #endregion #region ä¸å¡æ°´æµå¨ç» /// <summary> /// å 载水æµå¨ç» /// </summary> public async Task LoadFlowEffect(LogicFlowEffect obj) { if (!_isViewInitialized) { return; } await this.webViewControl1.EvaluateScriptAsync("loadFlowEffect", obj); } /// <summary> /// å 载水æµå¨ç»å表 /// </summary> public async Task LoadFlowEffectList(List<LogicFlowEffect> obj) { if (!_isViewInitialized) { return; } await this.webViewControl1.EvaluateScriptAsync("loadFlowEffectList", obj); } #endregion } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/01-interop/01-interop3d/IBimfaceInterop3dContainer.cs
@@ -178,5 +178,19 @@ #endregion #region èªå®ä¹æ°´æµå¨ç» /// <summary> /// å 载水æµå¨ç» /// </summary> Task LoadFlowEffect(LogicFlowEffect obj); /// <summary> /// å 载水æµå¨ç»å表 /// </summary> Task LoadFlowEffectList(List<LogicFlowEffect> obj); #endregion } } WinFrmUI/Yw.WinFrmUI.Bimface.Core/Yw.WinFrmUI.Bimface.Core.csproj
@@ -28,6 +28,7 @@ <None Remove="bimface\css\Panel.css" /> <None Remove="bimface\css\Tailwind.css" /> <None Remove="bimface\html\Interop3d.html" /> <None Remove="bimface\img\flowEffect.png" /> <None Remove="bimface\js\Background.js" /> <None Remove="bimface\js\CameraStatus.js" /> <None Remove="bimface\js\ComponentsBlink.js" /> @@ -40,9 +41,9 @@ <None Remove="bimface\js\GetComponents.js" /> <None Remove="bimface\js\Layer.js" /> <None Remove="bimface\js\LogicCalcuCustomLabel.js" /> <None Remove="bimface\js\LogicFlowEffect.js" /> <None Remove="bimface\js\LogicMarkLeadLabel.js" /> <None Remove="bimface\js\Panel.js" /> <None Remove="bimface\js\PipeFlow.js" /> <None Remove="bimface\js\SelectedComponents.js" /> <None Remove="bimface\js\WalkThrough.js" /> <None Remove="bimface\js\Zoom.js" /> @@ -56,6 +57,9 @@ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> <Content Include="bimface\html\Interop3d.html"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> <Content Include="bimface\img\flowEffect.png"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> <Content Include="bimface\js\Background.js"> @@ -100,7 +104,7 @@ <Content Include="bimface\js\Panel.js"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> <Content Include="bimface\js\PipeFlow.js"> <Content Include="bimface\js\LogicFlowEffect.js"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </Content> <Content Include="bimface\js\WalkThrough.js"> WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/html/Interop3d.html
@@ -67,9 +67,10 @@ webAppConfig.domElement = dom4Show; // è®¾ç½®å ¨å±åä½ webAppConfig.globalUnit = Glodon.Bimface.Common.Units.LengthUnits.Millimeter; //åæ¶å·¥å ·æ¡ webAppConfig.Toolbars = []; // å¼å¯æè´¨æ¿æ¢ webAppConfig.enableReplaceMaterial = true; // å建WebApplication var app = new Glodon.Bimface.Application.WebApplication3D(webAppConfig); // æ·»å å¾ æ¾ç¤ºç模å @@ -131,6 +132,7 @@ <script src="../js/ComponentsColor.js"></script> <script src="../js/LogicMarkLeadLabel.js"></script> <script src="../js/LogicCalcuCustomLabel.js"></script> <script src="../js/LogicFlowEffect.js"></script> <script src="js/CameraStatus.js"></script> <script src="js/GetComponents.js"></script> WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/img/flowEffect.png
WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/js/LogicFlowEffect.js
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,147 @@  let _flowAnimationContainer;//æ°´æµå¨ç»å®¹å¨ let _flowImgSrc = "https://static.bimface.com/attach/34d0d3aeb2e348aea5f3203b760ca667_flow5.png";//æ°´æµæè´¨å¾ç let _flowImgLocal = "../img/flowEffect.png";//æ¬å°æ°´æµæè´¨å¾ç let _flowEffectList = new Set();//æ°´æµå¨ç»å表 //å 载水æµå¨ç» function loadFlowEffect(item) { unloadFlowMaterial(); let flowMaterial = createFlowMaterial(item); let flowEffect = createFlowEffect(flowMaterial, item); flowEffect.play(); renderFlowEffect(); } //å 载水æµå¨ç»å表 function loadFlowEffectList(data) { unloadFlowMaterial(); if (data != null && data.length > 0) { data.forEach((x, index) => { let flowMaterial = createFlowMaterial(x); createFlowEffect(flowMaterial, x); }); playFlowEffect(); renderFlowEffect(); } } //éè¿idå¸è½½æ°´æµæè´¨ function unloadFlowMaterialById(id) { if (_flowEffectList.size > 0) { let flowEffectId = getFlowEffectId(id); let flowEffect = null; _flowEffectList.forEach(x => { if (x.getId() == flowEffectId) { flowEffect = x; } }); if (flowEffect != null) { //flowEffect.stop(); _flowEffectList.delete(flowEffect); let flowMaterialId = getFlowMaterialId(id); initialFlowAnimationContainer(); let flowMaterial = _flowAnimationContainer.getMaterialById(flowMaterialId) if (flowMaterial != null) { flowMaterial.clearOverrideComponentsMaterial(); _flowAnimationContainer.removeMaterialById(flowMaterialId) } } } } //å¸è½½æ°´æµæè´¨ function unloadFlowMaterial() { if (_flowEffectList.size > 0) { //_flowEffectList.forEach(x => { // x.stop(); //}); _flowEffectList.clear(); initialFlowAnimationContainer(); let allMaterialList = _flowAnimationContainer.getAllMaterials(); if (allMaterialList != null && allMaterialList.length > 0) { allMaterialList.foreach(x => { x.clearOverrideComponentsMaterial(); }); } _flowAnimationContainer.clear(); } } //åå§åæ°´æµå¨ç»å®¹å¨ function initialFlowAnimationContainer() { if (_flowAnimationContainer == null) { // æé æ°´æµæè´¨å®¹å¨ _flowAnimationContainer = new Glodon.Bimface.Plugins.Material.MaterialContainer(); } } //åå»ºæ°´æµæè´¨ function createFlowMaterial(item) { initialFlowAnimationContainer(); // æé æè´¨é ç½® let flowMaterialConfig = new Glodon.Bimface.Plugins.Material.MaterialConfig(); flowMaterialConfig.viewer = _viewer; flowMaterialConfig.src = _flowImgSrc; flowMaterialConfig.rotation = item.rotation; flowMaterialConfig.offset = [0, 0]; flowMaterialConfig.scale = [0.1524, 0.1524]; flowMaterialConfig.id = getFlowMaterialId(item.id); // æé æè´¨å¯¹è±¡ let flowMaterial = new Glodon.Bimface.Plugins.Material.Material(flowMaterialConfig); _flowAnimationContainer.addMaterial(flowMaterial); flowMaterial.overrideComponentsMaterialById([item.id]);//æ°ç» return flowMaterial; } //å建水æµå¨ç» function createFlowEffect(material, item) { // æé æ°´æµå¨ç»é ç½® let flowEffectConfig = new Glodon.Bimface.Plugins.Animation.FlowEffectConfig(); flowEffectConfig.material = material; flowEffectConfig.speed = [item.speed, 0]; flowEffectConfig.viewer = _viewer; flowEffectConfig.id = getFlowEffectId(item.id); //æé æ°´æµå¨ç» let flowEffect = new Glodon.Bimface.Plugins.Animation.FlowEffect(flowEffectConfig); _flowEffectList.add(flowEffect); return flowEffect; } //è·åæ°´æµå¨ç»id function getFlowEffectId(id) { return "flow-effect-" + id; } //è·åæ°´æµæè´¨id function getFlowMaterialId(id) { return "flow-material-" + id; } //å¼å§æ°´æµå¨ç» function playFlowEffect() { if (_flowEffectList.size > 0) { _flowEffectList.forEach(x => x.play()); } } //åæ¢æ°´æµå¨ç» function stopFlowEffect() { if (_flowEffectList.size > 0) { _flowEffectList.forEach(x => x.stop()); } } //éç»æ°´æµå¨ç» function renderFlowEffect() { // 渲æä¸ç»´æ¨¡åï¼å è½½å¾çèµæºéè¦æ¶é´ï¼æ¤å¤è®¾å®äº500msçå»¶è¿ setTimeout("_viewer.render()", 500); } WinFrmUI/Yw.WinFrmUI.Bimface.Core/bimface/js/PipeFlow.js
ÎļþÒÑɾ³ý