人生啊人生 3 hónapja
szülő
commit
aa77745d7a

+ 79 - 1
user_web/src/components/QvSimulation/QvThreeWorldEvent/js/QvPipeEvent.js

@@ -331,10 +331,11 @@ export class QvPipeEvent {
         ];
 
         let getPipelineIssuesArray = this.getPipelineIssuesArray(studentTaskIdList);
-
         console.log(
             "getPipelineIssuesArray ===>", getPipelineIssuesArray
         );
+
+        this.pipelineIssuesMeshUpdate(getPipelineIssuesArray);
         
     }
     
@@ -446,7 +447,84 @@ export class QvPipeEvent {
     }
 
 
+    /**
+     * 根据管段的顺序,找到对应的物体,进行移动到指定的坐标
+     * array         管段的排序数据
+     */
+    pipelineIssuesMeshUpdate = function(array) {
+        
+        let thisClass = this;
+        let objThreeWorldEventMain = this.objThreeWorldEventMain;
+
+        let objIframeEdit = objThreeWorldEventMain.objIframeEdit;
+        let objIframe = objThreeWorldEventMain.objIframe;
+        let objScene = objThreeWorldEventMain.objScene;
+        let BABYLON = objThreeWorldEventMain.BABYLON;
+        let ChengGuangYuanJing = objIframe.ChengGuangYuanJing;
+
+        // 每个管段 相差 x = 29.94 的距离,起始坐标 x = -260 [ 端头1 -289.94 ] , y = -13 , z = -30
+        // let startX = -260;
+        // let startX = -289.94;
+        let startX = -319.88;
+        let distanceX = 29.94;
+
+        /**
+         * 由于一些管段会出现错位的问题,所以要进行,坐标偏移特殊处理
+         * 出现的次数
+         */
+        let distanceXBoolSum = 0;
+
+        // 开始根据数组的排序,来移动对应的管道到合适的位置
+        for (let i = 0; i < array.length; i++) {
+            
+            let thisArray = array[i];
+            let name = thisArray.name;
+            
+            if (thisClass.pipelineProblemsJson[name] != null && thisClass.pipelineProblemsJson[name] != undefined) {
+
+                let objPipelineProblemsJson = thisClass.pipelineProblemsJson[name];
+                let exhibitionCode = objPipelineProblemsJson.exhibitionCode;
+                
+                let objMesh = ChengGuangYuanJing.CommonVal.find().objScene.getMeshById(exhibitionCode);
+                
+                if (objMesh != null && objMesh != undefined) {
+                    
+                    let thisMesh = objMesh;
+                    
+                    // 确认当前可进行移动的主物体
+                    if (objMesh._parentContainer != null && objMesh._parentContainer != undefined) {
+                        let _parentContainer = objMesh._parentContainer;
+                        
+                        if (_parentContainer.meshes != null && _parentContainer.meshes != undefined) {
+                            thisMesh = _parentContainer.meshes[0];
+                        }
+                        
+                    }
+
+                    let newX = startX + distanceX * i;
+
+                    // // 一些管段特殊处理
+                    // if (name == "管道问题点-变形段") {
+                    //     // distanceXBoolSum += 1;
+                    //     console.log(
+                    //         name,
+                    //         thisMesh.id
+                    //     );
+                    // }
+
+                    // 触发整体偏移逻辑
+                    newX = newX - (distanceX * distanceXBoolSum);
 
+                    thisMesh.position.x = newX;
+                    
+                }
+
+            }
+            
+        }
+
+
+    }