需求:项目中的canvas图要对应线下的实体仓库,但线上图是线下的迷你版所以并不能真正的按线下的XY走;只能线上按好线和图,把XY对应的所有点告诉后台,后台传给我startNode,endNode做为起点和结束然后根据这个点位绘制出一条路径线


父组件获取接口
- methods: {
- // 获取小车路径
- getAgvLine() {
- this.setIntervalVal = setInterval(() => {
- api.getAgvLine().then(res => {
- this.forkliftDataInit = res.map(item => {
- console.log("获取小车成功", item.carId, item);
- return {
- ...item,
- position: this.setAnimation(item)
- };
- });
- });
- }, 1000);
- },}
setAnimation方法写在了mixin文件中;
carAnimation.js
- /*
- * @Author: 周云芳 164591357@qq.com
- * @Date: 2022-09-19 08:57:02
- * @LastEditors: 周云芳 164591357@qq.com
- * @LastEditTime: 2022-09-19 10:47:20
- * @FilePath: \idps-detection-city\src\views\condition\mixins\carAnimation.js
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- */
- const CarAnimationMixin = {
- methods: {
- setAnimation(item) {
- let directionX = null,
- directionY = null,
- rotateX = 0,
- rotateY = 0,
- currentY = item.currentPosition.top,
- currentX = item.currentPosition.left, //当前坐标
- lastY = item.lastPosition.top, //上一步的坐标
- lastX = item.lastPosition.left;
- if (Number(currentY) != Number(lastY)) {
- //判断Y轴方向当前xy是否和上一步的xy坐标相等
- directionX = Number(currentY) > Number(lastY) ? "bottom" : "top"; //判断转向
- console.log("走Y", directionX);
- if (directionX == "top") {
- rotateX = "180";
- currentY = Number(currentY);
- } else if (directionX == "bottom") {
- rotateX = "0";
- currentY = Number(currentY);
- }
- let position = {
- transform: `rotate(${rotateX}deg)`,
- top: currentY + "px",
- left: currentX + "px"
- };
- return position;
- } else if (Number(currentX) != Number(lastX)) {
- directionY = Number(currentX) > Number(lastX) ? "right" : "left";
- console.log("directionY--X->", directionY);
- if (directionY == "left") {
- rotateY = "90";
- currentX = Number(currentX);
- } else if (directionY == "right") {
- rotateY = "270";
- currentX = Number(currentX);
- }
- let position = {
- transform: `rotate(${rotateY}deg)`,
- top: currentY + "px",
- left: currentX + "px"
- };
- return position;
- }
- //针对停止车辆的位置摆放
- if (currentY == lastY && currentX == lastX) {
- let position = {
- transform: `rotate(${rotateY}deg)`,
- top: currentY + "px",
- left: currentX + "px"
- };
- return position;
- }
- }
- }
- };
- export default CarAnimationMixin;
对应的线路图

子组件引入并获取传入的值进行绘制小车要走的线路
-
- watch: {
- forkliftDataInit: {
- handler(params) {
- // if (!params) return;
- if (params && params.length > 0) {
- this.forkliftData = JSON.parse(JSON.stringify(params));
- setTimeout(() => {
- this.canvasMain();
- }, 0);
- }
- },
- immediate: true,
- deep: true
- }
- },
- methods: {
- // 叉车线路图
- canvasMain() {
- if (this.ctxMain) {
- this.ctxMain.clearRect(0, 0, this.canvasWidth, 467); //清除画布
- }
- var c = document.getElementById("main_canvas");
- this.ctxMain = c.getContext("2d");
- this.ctxMain.strokeStyle = "#666";
- this.ctxMain.lineWidth = 2;
- //1. 使用`font`设置字体。
- // this.ctxMain.font = "20px serif";
- //2. 使用`fillStyle`设置字体颜色。
- // this.ctxMain.fillStyle = "red";
- // 货区A0
- this.ctxMain.beginPath();
- this.ctxMain.lineTo(307, 50);
- this.ctxMain.lineTo(307, 150);
- this.ctxMain.strokeStyle = this.getColor("J0");
- // this.ctxMain.fillText("J0", 310, 100);
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("J0")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(300, 55);
- this.ctxMain.lineTo(307, 45);
- this.ctxMain.lineTo(314, 55);
- this.ctxMain.strokeStyle = this.getArrow("J0");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- // 货区1和货区2的中间线
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(307, 150);
- this.ctxMain.lineTo(364, 150);
- this.ctxMain.strokeStyle = this.getColor("main-hq");
- this.ctxMain.font = "16px serif";
- // this.ctxMain.fillText("main-hq", 310, 140);
-
- this.ctxMain.stroke();
- //中间主线-1
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(364, 150);
- this.ctxMain.lineTo(420, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z1");
- // this.ctxMain.fillText("main-z1", 364, 165);
- this.ctxMain.stroke();
- //中间主线-2
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(420, 150);
- this.ctxMain.lineTo(448, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z2");
- // this.ctxMain.fillText("main-z2", 420, 165);
-
- this.ctxMain.stroke();
- //中间主线-2-1
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(448, 150);
- this.ctxMain.lineTo(478, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z2-1");
- // this.ctxMain.fillText("main-z2-1", 448, 145);
-
- this.ctxMain.stroke();
- //中间主线-3
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(478, 150);
- this.ctxMain.lineTo(557, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z3");
- // this.ctxMain.fillText("main-z3", 478, 165);
-
- this.ctxMain.stroke();
- //中间主线-4
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(557, 150);
- this.ctxMain.lineTo(628, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z4");
- // this.ctxMain.fillText("main-z4", 557, 140);
-
- this.ctxMain.stroke();
- //中间主线-5
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(628, 150);
- this.ctxMain.lineTo(720, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z5");
- // this.ctxMain.fillText("main-z5", 628, 140);
-
- this.ctxMain.stroke();
- //中间主线-6
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(720, 150);
- // this.ctxMain.lineTo(this.canvasWidth - 450, 150);
- this.ctxMain.lineTo(764, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z6");
- // this.ctxMain.fillText("main-z6", 720, 140);
-
- this.ctxMain.stroke();
- //中间主线-7
- this.ctxMain.beginPath();
- // this.ctxMain.moveTo(this.canvasWidth - 450, 150);
- // this.ctxMain.lineTo(this.canvasWidth - 390, 150);
- this.ctxMain.moveTo(764, 150);
- this.ctxMain.lineTo(842, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z7");
- // this.ctxMain.fillText("main-z7", 760, 165);
-
- this.ctxMain.stroke();
- // 中间主线-8
- this.ctxMain.beginPath();
- // this.ctxMain.moveTo(this.canvasWidth - 390, 150);
- // this.ctxMain.lineTo(this.canvasWidth - 340, 150);
- this.ctxMain.moveTo(this.canvasWidth - 390, 150);
- this.ctxMain.lineTo(this.canvasWidth - 340, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z8");
- // this.ctxMain.fillText("main-z8", this.canvasWidth - 390, 165);
-
- this.ctxMain.stroke();
- //中间主线-9
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 340, 150);
- this.ctxMain.lineTo(this.canvasWidth - 291, 150);
- this.ctxMain.font = "14px serif";
- this.ctxMain.strokeStyle = this.getColor("main-z9");
- // this.ctxMain.fillText("main-z9", this.canvasWidth - 340, 145);
-
- this.ctxMain.stroke();
- //中间主线-10
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 291, 150);
- this.ctxMain.lineTo(this.canvasWidth - 270, 150);
- this.ctxMain.strokeStyle = this.getColor("main-z10");
- // this.ctxMain.fillText("mainz10", this.canvasWidth - 291, 145);
-
- this.ctxMain.stroke();
- //A4-4
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(307, 150);
- this.ctxMain.lineTo(307, 226);
- this.ctxMain.strokeStyle = this.getColor("A4-4");
- // this.ctxMain.fillText("A4-4", 290, 226);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A4-4")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(302, 216);
- this.ctxMain.lineTo(307, 226);
- this.ctxMain.lineTo(312, 216);
- this.ctxMain.strokeStyle = this.getArrow("A4-4");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A4-3
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(364, 150);
- this.ctxMain.lineTo(364, 226);
- this.ctxMain.strokeStyle = this.getColor("A4-3");
- // this.ctxMain.fillText("A4-3", 356, 226);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A4-3")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(359, 216);
- this.ctxMain.lineTo(364, 226);
- this.ctxMain.lineTo(369, 216);
- this.ctxMain.strokeStyle = this.getArrow("A4-3");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A4-2
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(420, 150);
- this.ctxMain.lineTo(420, 226);
- this.ctxMain.strokeStyle = this.getColor("A4-2");
- // this.ctxMain.fillText("A4-2", 410, 230);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A4-2")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(415, 216);
- this.ctxMain.lineTo(420, 226);
- this.ctxMain.lineTo(425, 216);
- this.ctxMain.strokeStyle = this.getArrow("A4-2");
-
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A4-1
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(478, 150);
- this.ctxMain.lineTo(478, 226);
- this.ctxMain.strokeStyle = this.getColor("A4-1");
- // this.ctxMain.fillText("A4-1", 478, 260);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A4-1")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(473, 216);
- this.ctxMain.lineTo(478, 226);
- this.ctxMain.lineTo(483, 216);
- this.ctxMain.strokeStyle = this.getArrow("A4-1");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A5-2
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(557, 150);
- this.ctxMain.lineTo(557, 230);
- // this.ctxMain.lineTo(560, 230);
- // this.ctxMain.lineTo(560, 230);
- this.ctxMain.strokeStyle = this.getColor("A5-2");
- // this.ctxMain.fillText("A5-2", 557, 230);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A5-2")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(552, 220);
- this.ctxMain.lineTo(557, 230);
- this.ctxMain.lineTo(562, 220);
- this.ctxMain.strokeStyle = this.getArrow("A5-2");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A5-1
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(628, 150);
- this.ctxMain.lineTo(628, 230);
- this.ctxMain.strokeStyle = this.getColor("A5-1");
- // this.ctxMain.fillText("A5-1", 628, 230);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A5-1")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(623, 220);
- this.ctxMain.lineTo(628, 230);
- this.ctxMain.lineTo(633, 220);
- this.ctxMain.strokeStyle = this.getArrow("A5-1");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A1
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(448, 150);
- this.ctxMain.lineTo(448, 86);
- this.ctxMain.strokeStyle = this.getColor("A1");
- // this.ctxMain.fillText("A1", 448, 86);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A1")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(438, 100);
- this.ctxMain.lineTo(448, 80);
- this.ctxMain.lineTo(458, 100);
- this.ctxMain.strokeStyle = this.getArrow("A1");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A2
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(628, 150);
- this.ctxMain.lineTo(628, 92);
- this.ctxMain.strokeStyle = this.getColor("A2");
- // this.ctxMain.fillText("A2", 628, 92);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A2")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(622, 100);
- this.ctxMain.lineTo(628, 90);
- this.ctxMain.lineTo(634, 100);
- this.ctxMain.strokeStyle = this.getArrow("A2");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A3
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 270, 150);
- this.ctxMain.lineTo(this.canvasWidth - 210, 150);
- this.ctxMain.strokeStyle = this.getColor("A3");
- // this.ctxMain.fillText("A3", this.canvasWidth - 230, 165);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A3")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 215, 144);
- this.ctxMain.lineTo(this.canvasWidth - 205, 150);
- this.ctxMain.lineTo(this.canvasWidth - 215, 156);
- this.ctxMain.strokeStyle = this.getArrow("A3");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- //A6
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 270, 150);
- this.ctxMain.lineTo(this.canvasWidth - 270, 246);
- this.ctxMain.lineTo(this.canvasWidth - 210, 246);
- this.ctxMain.strokeStyle = this.getColor("A6");
- this.ctxMain.font = "30px serif";
- // this.ctxMain.fillText("A6", this.canvasWidth - 285, 240);
-
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("A6")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 215, 240);
- this.ctxMain.lineTo(this.canvasWidth - 205, 246);
- this.ctxMain.lineTo(this.canvasWidth - 215, 252);
- this.ctxMain.strokeStyle = this.getArrow("A6");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- // 叉车3
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 288, 95);
- this.ctxMain.lineTo(this.canvasWidth - 294, 95);
- this.ctxMain.lineTo(this.canvasWidth - 291, 95);
- this.ctxMain.lineTo(this.canvasWidth - 291, 150);
- this.ctxMain.strokeStyle = this.getColor("C3");
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("C3")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 299, 103);
- this.ctxMain.lineTo(this.canvasWidth - 291, 93);
- this.ctxMain.lineTo(this.canvasWidth - 284, 103);
- this.ctxMain.strokeStyle = this.getArrow("C3");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- // 叉车2
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 337, 95);
- this.ctxMain.lineTo(this.canvasWidth - 343, 95);
- this.ctxMain.lineTo(this.canvasWidth - 340, 95);
- this.ctxMain.lineTo(this.canvasWidth - 340, 150);
- this.ctxMain.strokeStyle = this.getColor("C2");
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("C2")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 348, 103);
- this.ctxMain.lineTo(this.canvasWidth - 340, 93);
- this.ctxMain.lineTo(this.canvasWidth - 332, 103);
- this.ctxMain.strokeStyle = this.getArrow("C2");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- // 叉车1
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 387, 95);
- this.ctxMain.lineTo(this.canvasWidth - 393, 95);
- this.ctxMain.lineTo(this.canvasWidth - 390, 95);
- this.ctxMain.lineTo(this.canvasWidth - 390, 150);
- this.ctxMain.strokeStyle = this.getColor("C1");
- this.ctxMain.stroke();
- // 箭头
- if (this.getArrow("C1")) {
- this.ctxMain.beginPath();
- this.ctxMain.moveTo(this.canvasWidth - 398, 103);
- this.ctxMain.lineTo(this.canvasWidth - 390, 93);
- this.ctxMain.lineTo(this.canvasWidth - 382, 103);
- this.ctxMain.strokeStyle = this.getArrow("C1");
- this.ctxMain.lineWidth = 4;
- this.ctxMain.stroke();
- this.ctxMain.lineWidth = 2;
- }
- },
- //获取箭头的状态和颜色
- getArrow(type) {
- if (!this.forkliftData) return;
- let color = "";
- let ccData = {
- endNode1: "",
- endNode2: "",
- endNode3: ""
- };
- this.forkliftData.forEach(item => {
- if (item.carId == "1") {
- ccData.endNode1 = item.endNode;
- } else if (item.carId == "2") {
- ccData.endNode2 = item.endNode;
- } else if (item.carId == "3") {
- ccData.endNode3 = item.endNode;
- }
- });
- if (ccData.endNode1 == type) {
- color = "#00FF00";
- } else if (ccData.endNode2 == type) {
- color = "#00ffff";
- } else if (ccData.endNode3 == type) {
- color = "#FFE13B";
- } else {
- color = false;
- }
- return color;
- },
- //获取线条的颜色
- getColor(type) {
- //type为AO,A1...
- if (!this.forkliftData) return;
- let color = "";
- let C1 = {},
- C2 = {},
- C3 = {};
- // 车子开开始的位置和结束的位置
- this.forkliftData.forEach(item => {
- if (item.carId == "1") {
- C1.startNode = item.startNode;
- C1.endNode = item.endNode;
- } else if (item.carId == "2") {
- C2.startNode = item.startNode;
- C2.endNode = item.endNode;
- } else if (item.carId == "3") {
- C3.startNode = item.startNode;
- C3.endNode = item.endNode;
- }
- });
- if (this.ccType(type, C1)) {
- //判断小车类型和开始或类型和结束位置相同
- color = "#00FF00";
- } else if (this.ccType(type, C2)) {
- //计算线条的数据返回True
- color = "#00ffff";
- } else if (this.ccType(type, C3)) {
- color = "#FFE13B";
- } else {
- color = "#666";
- }
- // if (this.ccType(type, C1)) {
- // this.trolley1.push(type);
- // }
- // if (this.ccType(type, C2)) {
- // this.trolley2.push(type);
- // }
- // if (this.ccType(type, C3)) {
- // this.trolley3.push(type);
- // }
- return color;
- },
- //计算线条的数据
- ccType(type, cc) {
- //type为AO,A1...,cc=叉车开始及结束位置 {startNode: 'C2', endNode: 'A4-1'}
- let status = false;
- if (type.indexOf("main") < 0) {
- if (cc.startNode == type || cc.endNode == type) {
- status = true;
- }
- } else {
- if (type == "main-hq" && this.mainHq(cc)) {
- status = true;
- }
- if (type == "main-z1" && this.mainZ1(cc)) {
- status = true;
- }
- if (type == "main-z2" && this.mainZ2(cc)) {
- status = true;
- }
- if (type == "main-z2-1" && this.mainZ21(cc)) {
- status = true;
- }
- if (type == "main-z3" && this.mainZ3(cc)) {
- status = true;
- }
- if (type == "main-z4" && this.mainZ4(cc)) {
- status = true;
- }
- if (type == "main-z5" && this.mainZ5(cc)) {
- status = true;
- }
- if (type == "main-z6" && this.mainZ6(cc)) {
- status = true;
- }
- if (type == "main-z7" && this.mainZ7(cc)) {
- status = true;
- }
- if (type == "main-z8" && this.mainZ8(cc)) {
- status = true;
- }
- if (type == "main-z9" && this.mainZ9(cc)) {
- status = true;
- }
- if (type == "main-z10" && this.mainZ10(cc)) {
- status = true;
- }
- if (type == "main-A7" && this.mainA7(cc)) {
- status = true;
- }
- }
- return status;
- },
- mainHq(cc) {
- let status = false;
- let left = ["J0", "A4-4"];
- let right = [
- "AAA",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A2",
- "A3",
- "A5-2",
- "A5-1",
- "A6",
- "A7",
- "C1",
- "C2",
- "C3",
- "cc4",
- "A8"
- ];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ1(cc) {
- let status = false;
- let left = ["J0", "AAA", "A4-4", "A4-3"];
- let right = [
- "A4-2",
- "A4-1",
- "A1",
- "A2",
- "A3",
- "A5-2",
- "A5-1",
- "A6",
- "A7",
- "C1",
- "C2",
- "C3",
- "cc4",
- "A8"
- ];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ2(cc) {
- let status = false;
- let left = ["J0", "AAA", "A4-4", "A4-3", "A4-2"];
- let right = [
- "A4-1",
- "A1",
- "A2",
- "A3",
- "A5-2",
- "A5-1",
- "A6",
- "A7",
- "C1",
- "C2",
- "C3",
- "cc4",
- "A8"
- ];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ21(cc) {
- let status = false;
- let left = ["J0", "AAA", "A1", "A4-4", "A4-3", "A4-2"];
- let right = [
- "A4-1",
- "A2",
- "A3",
- "A5-2",
- "A5-1",
- "A6",
- "A7",
- "C1",
- "C2",
- "C3",
- "cc4",
- "A8"
- ];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ3(cc) {
- let status = false;
- let left = ["J0", "AAA", "A4-4", "A4-3", "A4-2", "A4-1", "A1"];
- let right = [
- "A2",
- "A3",
- "A5-2",
- "A5-1",
- "A6",
- "A7",
- "C1",
- "C2",
- "C3",
- "cc4",
- "A8"
- ];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ4(cc) {
- let status = false;
- let left = ["J0", "AAA", "A4-4", "A4-3", "A4-2", "A4-1", "A1", "A5-2"];
- let right = [
- "A2",
- "A3",
- "A5-1",
- "A6",
- "A7",
- "C1",
- "C2",
- "C3",
- "cc4",
- "A8"
- ];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ5(cc) {
- let status = false;
- let left = [
- "J0",
- "AAA",
- "A4-4",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A5-2",
- "A5-1",
- "A2"
- ];
- let right = ["A3", "A6", "A7", "C1", "C2", "C3", "cc4", "A8"];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ6(cc) {
- let status = false;
- let left = [
- "J0",
- "AAA",
- "A4-4",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A5-2",
- "A5-1",
- "A2",
- "A7",
- "A8"
- ];
- let right = ["A3", "A6", "C1", "C2", "C3", "cc4"];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ7(cc) {
- let status = false;
- let left = [
- "J0",
- "AAA",
- "A4-4",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A5-2",
- "A5-1",
- "A2",
- "A7",
- "A8"
- ];
- let right = ["A3", "A6", "C2", "C3", "C1"];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ8(cc) {
- let status = false;
- let left = [
- "J0",
- "AAA",
- "A4-4",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A5-2",
- "A5-1",
- "A2",
- "A7",
- "A8",
- "C1"
- ];
- let right = ["A3", "A6", "C3", "C2"];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ9(cc) {
- let status = false;
- let left = [
- "J0",
- "AAA",
- "A4-4",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A5-2",
- "A5-1",
- "A2",
- "A7",
- "A8",
- "C1",
- "C2"
- ];
- let right = ["A3", "A6", "C3"];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainZ10(cc) {
- let status = false;
- let left = [
- "J0",
- "AAA",
- "A4-4",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A5-2",
- "A5-1",
- "A2",
- "A7",
- "A8",
- "C1",
- "C2",
- "C3",
- "cc4"
- ];
- let right = ["A3", "A6"];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- mainA7(cc) {
- let status = false;
- let left = [
- "J0",
- "AAA",
- "A4-4",
- "A4-3",
- "A4-2",
- "A4-1",
- "A1",
- "A5-2",
- "A5-1",
- "A2",
- "C1",
- "C2",
- "C3",
- "cc4",
- "A3",
- "A6"
- ];
- let right = ["A7", "A8"];
- if (
- (left.indexOf(cc.startNode) >= 0 && right.indexOf(cc.endNode) >= 0) ||
- (left.indexOf(cc.endNode) >= 0 && right.indexOf(cc.startNode) >= 0)
- ) {
- status = true;
- }
- return status;
- },
- }