From 34903ae3ab0c55efff3ba5a40a4b25cbcae04a75 Mon Sep 17 00:00:00 2001
From: Junjie <540245094@qq.com>
Date: 星期一, 18 十二月 2023 16:54:04 +0800
Subject: [PATCH] #map latest test
---
src/main/webapp/views/console4.html | 93 ++++++++++++++++++++++++++++------------------
1 files changed, 56 insertions(+), 37 deletions(-)
diff --git a/src/main/webapp/views/console4.html b/src/main/webapp/views/console4.html
index d6737c5..ada2d4e 100644
--- a/src/main/webapp/views/console4.html
+++ b/src/main/webapp/views/console4.html
@@ -14,7 +14,7 @@
<script type="text/javascript" src="../static/vue/js/vue.min.js"></script>
<script type="text/javascript" src="../static/vue/element/element.js"></script>
<script src="../static/js/gsap.min.js"></script>
- <script src="../static/js/pixi.min.js"></script>
+ <script src="../static/js/pixi-legacy.min.js"></script>
<style>
*{
margin: 0;
@@ -249,8 +249,8 @@
const shuttle = new PIXI.Sprite(resources.shuttle.texture);
shuttle.width = width
shuttle.height = height
- shuttle.x = item.point.x * width;//鏇存柊鍧愭爣x
- shuttle.y = item.point.y * height;//鏇存柊鍧愭爣y
+ shuttle.x = (item.wcsPoint.y - 0) * width;//鏇存柊鍧愭爣x
+ shuttle.y = (item.wcsPoint.x - 1) * height;//鏇存柊鍧愭爣y
shuttle.updateMoveStatus = true;//鍔ㄧ敾鎵ц瀹屾垚
shuttle.interactive = true; // 蹇呴』瑕佽缃墠鑳芥帴鏀朵簨浠�
shuttle.buttonMode = true; // 璁╁厜鏍囧湪hover鏃跺彉涓烘墜鍨嬫寚閽�
@@ -544,15 +544,17 @@
return false;//涓や釜闆嗗悎闀垮害涓嶄竴鑷�
}
+ let flag = false;
list1.forEach((item,index) => {
for (var i = 0; i < list2.length; i++) {
- if (item.shuttleNo != list2[i].shuttleNo) {
- return false;//鎵句笉鍒板皬杞﹀彿
+ if (item.shuttleNo == list2[i].shuttleNo) {
+ flag = true;
+ break;
}
}
});
- return true;
+ return flag;
},
findShuttlePathDiffList(list1, list2) {
//妫�娴嬮泦鍚�1閲岄潰鐨勫皬杞﹂璁¤矾寰勬槸鍚﹀湪闆嗗悎2涓湁鍙樺姩
@@ -567,7 +569,7 @@
let item = list1[index];
for (var i = 0; i < list2.length; i++) {
if (item.shuttleNo != list2[i].shuttleNo) {
- return false;//鎵句笉鍒板皬杞﹀彿
+ continue;//鎵句笉鍒板皬杞﹀彿
}
if (item.moveAdvancePath == null) {
@@ -578,7 +580,7 @@
list2[i].moveAdvancePath = [];
}
- if (item.moveAdvancePath.length != list2[i].moveAdvancePath.length) {
+ if (!(item.moveAdvancePath.length == list2[i].moveAdvancePath.length)) {
return false;//灏忚溅棰勮璺緞闀垮害涓嶄竴鑷�
}
}
@@ -653,12 +655,12 @@
if (shuttle.updateMoveStatus) {//鍔ㄧ敾鎵ц瀹屾垚鎵嶅彲缁х画鎵ц鍔ㄧ敾
shuttle.updateMoveStatus = false;//鍔ㄧ敾鎵ц涓�
// 璁$畻涓ょ偣涔嬮棿鐨勮窛绂�1
- const distance = Math.sqrt(Math.pow((item.point.x * width) - shuttle.x, 2) + Math.pow((item.point.y * height) - shuttle.y, 2));
+ const distance = Math.sqrt(Math.pow((item.wcsPoint.x * width) - shuttle.x, 2) + Math.pow((item.wcsPoint.y * height) - shuttle.y, 2));
gsap.killTweensOf(shuttle); // 鏉�姝绘墍鏈夐拡瀵�".class"鐨勫姩鐢�
gsap.to(shuttle, {
- x: item.point.x * width, // 鐩爣浣嶇疆
- y: item.point.y * height, // 鐩爣浣嶇疆
- duration: distance / 100, // 鍔ㄧ敾鎸佺画鏃堕棿锛堢锛�
+ x: (item.wcsPoint.y - 0) * width, // 鐩爣浣嶇疆
+ y: (item.wcsPoint.x - 1) * height, // 鐩爣浣嶇疆
+ duration: 0.2, // 鍔ㄧ敾鎸佺画鏃堕棿锛堢锛�
ease: "power1.inOut", // 缂撳姩绫诲瀷
onComplete: () => {
shuttle.updateMoveStatus = true;//鍔ㄧ敾鎵ц瀹屾垚
@@ -822,7 +824,7 @@
moveAdvancePath.forEach((path, idx) => {
let locNo = that.getLocNoByXYZ(path.x, path.y, path.z);
if (!pixiShuttleMoveAdvancePathMap.has(locNo)) {
- let graphics = getGraphics(0x9966ff, width, height, path.y * width, path.x * height);
+ let graphics = getGraphics(0x9966ff, width, height, path.y * width, (path.x - 1) * height);
let shuttleNos = [shuttleNo];
// 鍒涘缓鏂囨湰瀵硅薄
const style = new PIXI.TextStyle({
@@ -845,38 +847,55 @@
})
if (pixiShuttleMoveAdvancePathList[shuttleNo] == null) {
- pixiShuttleMoveAdvancePathList[shuttleNo] = [locNo];
- } else {
- pixiShuttleMoveAdvancePathList[shuttleNo].push(locNo);
+ let locNos = new Set()
+ locNos.add(locNo);
+ pixiShuttleMoveAdvancePathList[shuttleNo] = locNos;
+ }else {
+ pixiShuttleMoveAdvancePathList[shuttleNo].add(locNo);
+ }
+ }else {
+ let pathMap = pixiShuttleMoveAdvancePathMap.get(locNo)
+ let shuttleNos = pathMap.shuttleNos;
+ shuttleNos.push(shuttleNo);
+ pathMap.textObj.text = JSON.stringify(shuttleNos);
+ pixiShuttleMoveAdvancePathMap.set(locNo, pathMap);
+ if (pixiShuttleMoveAdvancePathList[shuttleNo] == null) {
+ let locNos = new Set()
+ locNos.add(locNo);
+ pixiShuttleMoveAdvancePathList[shuttleNo] = locNos;
+ }else {
+ pixiShuttleMoveAdvancePathList[shuttleNo].add(locNo);
}
}
});
},
removeMoveAdvancePath(shuttleNo) {//鍒犻櫎棰勮璺緞
let locNos = pixiShuttleMoveAdvancePathList[shuttleNo];
- locNos.forEach((locNo,index) => {
- let pathMap = pixiShuttleMoveAdvancePathMap.get(locNo);
- if (pathMap != null) {
- let shuttleNos = pathMap.shuttleNos;
- let shuttleNosNew = [];
- shuttleNos.forEach((shuttle, idx) => {
- if (shuttle != shuttleNo) {
- shuttleNosNew.push(shuttle);
- }
- });
+ if (locNos != null) {
+ locNos.forEach((locNo,index) => {
+ let pathMap = pixiShuttleMoveAdvancePathMap.get(locNo);
+ if (pathMap != null) {
+ let shuttleNos = pathMap.shuttleNos;
+ let shuttleNosNew = [];
+ shuttleNos.forEach((shuttle, idx) => {
+ if (shuttle != shuttleNo) {
+ shuttleNosNew.push(shuttle);
+ }
+ });
- if (shuttleNosNew.length === 0) {
- //棰勮璺緞娌℃湁灏忚溅锛岀洿鎺ュ垹闄よ矾寰�
- objectsContainer2.removeChild(pathMap.sprite);
- pixiShuttleMoveAdvancePathMap.delete(locNo)
- }else {
- //棰勮璺緞瀛樺湪鍏朵粬灏忚溅锛屾洿鏂版枃瀛椾俊鎭�
- pathMap.textObj.text = JSON.stringify(shuttleNosNew);
- pathMap.shuttleNos = shuttleNosNew;
- pixiShuttleMoveAdvancePathMap.set(locNo, pathMap);
+ if (shuttleNosNew.length === 0) {
+ //棰勮璺緞娌℃湁灏忚溅锛岀洿鎺ュ垹闄よ矾寰�
+ objectsContainer2.removeChild(pathMap.sprite);
+ pixiShuttleMoveAdvancePathMap.delete(locNo)
+ }else {
+ //棰勮璺緞瀛樺湪鍏朵粬灏忚溅锛屾洿鏂版枃瀛椾俊鎭�
+ pathMap.textObj.text = JSON.stringify(shuttleNosNew);
+ pathMap.shuttleNos = shuttleNosNew;
+ pixiShuttleMoveAdvancePathMap.set(locNo, pathMap);
+ }
}
- }
- })
+ })
+ }
},
}
})
--
Gitblit v1.9.1