From 4d317e08d281b9e5e2cf742788c3d4b5b6bb9b38 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@63.com> Date: 星期三, 15 十二月 2021 13:48:55 +0800 Subject: [PATCH] # --- static/js/object/Route.js | 21 ++++++++++++++++----- static/js/app.js | 17 ++++++++--------- static/js/data/Asrs.js | 1 - static/js/object/CrnTask.js | 19 +++++++++++++------ 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index 8545e93..7004db9 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -280,7 +280,6 @@ for (let crnData of CrnDatas) { let crnTask = getArrVal(this.crnTasks, "crnNo", crnData.crnNo); if (null == crnTask) { - // let crnFork = getArrVal(this.objects, "name", wrkMast.crnNo + "-fork"); this.crnTasks.push(new CrnTask(crnData)); } else { if(!crnTask.run) { @@ -378,14 +377,14 @@ }); } this.initModelMove = function () { - console.log(this.wrkTasks) - for (var wrkMast of this.wrkTasks) { - this.crnBody = getArrVal(this.objects, "name", wrkMast.crnNo + "-body"); - // 鍙栬揣鐐瑰畾浣� - let sourceLocPosition = getBinPosition(wrkMast.sourceLocNo); - let points = [new THREE.Vector3(this.crnBody.position.x, this.crnBody.position.y, this.crnBody.position.z), sourceLocPosition]; - this.curve = new Route(points); - } + console.log(this.crnTasks) + // for (var wrkMast of this.wrkTasks) { + // this.crnBody = getArrVal(this.objects, "name", wrkMast.crnNo + "-body"); + // // 鍙栬揣鐐瑰畾浣� + // let sourceLocPosition = getBinPosition(wrkMast.sourceLocNo); + // let points = [new THREE.Vector3(this.crnBody.position.x, this.crnBody.position.y, this.crnBody.position.z), sourceLocPosition]; + // this.curve = new Route(points); + // } } this.modelMove = function () { diff --git a/static/js/data/Asrs.js b/static/js/data/Asrs.js index 25a16e7..e540b02 100644 --- a/static/js/data/Asrs.js +++ b/static/js/data/Asrs.js @@ -25,7 +25,6 @@ url: 'http://localhost:9090/jkwcs/three/query/crn/cache/v1', type: "GET", data: {}, - async: false, success: function (res) { CrnDatas = res.data; } diff --git a/static/js/object/CrnTask.js b/static/js/object/CrnTask.js index 3670542..ce2ed87 100644 --- a/static/js/object/CrnTask.js +++ b/static/js/object/CrnTask.js @@ -2,7 +2,6 @@ function CrnTask(crnData) { let that = this; - // 璁块棶鍏湁灞炴�э紝闇�瑕佸湪鍙橀噺鍚嶅墠鍔犱笂this. that.crnNo = 0; that.run = false; // 涓婁竴鏁版嵁 @@ -11,6 +10,7 @@ that.preX = 0; that.preY = 0; that.preZ = 0; + that.prePosition = null; that.preForkPos = -1; // -1, "涓嶅湪瀹氫綅" 0, "璐у弶鍘熶綅" 1, "璐у弶鍦ㄥ乏渚ц繙" 2, "璐у弶鍦ㄥ乏渚�" 3, "璐у弶鍦ㄥ彸渚�" 4, "璐у弶鍦ㄥ彸渚ц繙" // 褰撳墠鏁版嵁 that.bay = 1 ; @@ -18,9 +18,9 @@ that.x = 0; that.y = 0; that.z = 0; + that.position = null; that.forkPos = -1; - // 鏋勯�犲嚱鏁� let init = function () { that.crnNo = crnData.crnNo; that.bay = crnData.bay; @@ -28,21 +28,25 @@ that.x = crnData.position.x; that.y = crnData.position.y; that.z = crnData.position.z; + that.position = crnData.position; that.forkPos = crnData.forkPos; }; init(); - // 瀵瑰鍑芥暟 that.modify = function (crnData) { if (that.run || that.crnNo === 0) { console.error(that.crnNo + "鍙峰爢鍨涙満鏇存柊澶辫触"); } else { + if (JSON.stringify(crnData.position) === JSON.stringify(that.position)) { + return; + } // 涓婁竴娆� that.preBay = that.bay; that.preLev = that.lev; that.preX = that.x; that.preY = that.y; that.preY = that.y; + that.prePosition = JSON.parse(JSON.stringify(that.position)); that.preForkPos = that.forkPos; // 褰撳墠 that.bay = crnData.bay; @@ -50,12 +54,15 @@ that.x = crnData.position.x; that.y = crnData.position.y; that.z = crnData.position.z; + that.position = crnData.position; that.forkPos = crnData.forkPos; // create Route ------------------------------------------------ - // new Route(); // body + let bodyRoute = new Route([that.prePosition, that.position]); // body // new Route(); // load - that.run = true; - console.log(that); + // console.log(bodyRoute); + // console.log("pre" + JSON.stringify(that.prePosition)); + // console.log(JSON.stringify(that.position)); + // that.run = true; } } diff --git a/static/js/object/Route.js b/static/js/object/Route.js index 9388143..3521d37 100644 --- a/static/js/object/Route.js +++ b/static/js/object/Route.js @@ -33,11 +33,22 @@ // return new THREE.CatmullRomCurve3(curvePoints,false,'centripetal',0.000000001); - return new THREE.LineCurve3(option[0],new THREE.Vector3( - option[0].x, - option[0].y, - option[1].z - )); + // return new THREE.LineCurve3(option[0],new THREE.Vector3( + // option[0].x, + // option[0].y, + // option[1].z + // )); + + for (let i = 0;i<option.length;i++) { + curvePoints.push( + new THREE.Vector3( + option[i].x, + option[i].y, + option[i].z + ) + ); + } + return new THREE.CatmullRomCurve3(curvePoints,false,'centripetal',0.000000001); -- Gitblit v1.9.1