From 28bde0bd83096c1c9588c5b098acdb02411ce560 Mon Sep 17 00:00:00 2001
From: lsh <lsh@163.com>
Date: 星期二, 04 三月 2025 13:59:26 +0800
Subject: [PATCH] *
---
src/main/java/com/zy/asrs/utils/Utils.java | 480 +++++++++++++++++++----------------------------------------
1 files changed, 155 insertions(+), 325 deletions(-)
diff --git a/src/main/java/com/zy/asrs/utils/Utils.java b/src/main/java/com/zy/asrs/utils/Utils.java
index 37cf61d..07c66a4 100644
--- a/src/main/java/com/zy/asrs/utils/Utils.java
+++ b/src/main/java/com/zy/asrs/utils/Utils.java
@@ -130,335 +130,165 @@
return new double[]{x, y};
}
-
- public static double[] getRgvPos(double a,double b) {
- // a 鏄�婚暱搴�
- // b 鏄綋鍓嶄綅缃�
-
- // 璁$畻鐐圭殑鍧愭爣
- double x = 0;
- double y = 0;
- if (b > 217480 && b <= 217980) { // 133 绔欑偣 217730
- x = 110;
- y = 878;
- } else if (b > 217980 && b <= 257168) {
- x = 138;
- y = 878;
- } else if (b > 257168 && b <= 257668) { // 132 绔欑偣 257418
- x = 165;
- y = 878;
- } else if (b > 257668 && b <= 276817) {
- x = 193;
- y = 878;
- } else if (b > 276817 && b <= 277317) { // 131 绔欑偣 277067
- x = 220;
- y = 878;
- } else if (b > 277317 && b <= 306570) {
- x = 248;
- y = 878;
- } else if (b > 306570 && b <= 307070) { // 130 绔欑偣 306820
- x = 275;
- y = 878;
- } else if (b > 307070 && b <= 336388) {
- x = 303;
- y = 878;
- } else if (b > 336388 && b <= 336888) { // 129 绔欑偣 336638
- x = 330;
- y = 878;
- } else if (b > 336888 && b <= 366061) {
- x = 358;
- y = 878;
- } else if (b > 366061 && b <= 366561) { // 128 绔欑偣 366311
- x = 385;
- y = 878;
- } else if (b > 366561 && b <= 380856) {
- x = 413;
- y = 878;
- } else if (b > 380856 && b <= 381356) { // 127 绔欑偣 381106
- x = 440;
- y = 878;
- } else if (b > 381356 && b <= 396018) {
- x = 468;
- y = 878;
- } else if (b > 396018 && b <= 396518) { // 126 绔欑偣 396268
- x = 495;
- y = 878;
- } else if (b > 396518 && b <= 425518) {
- x = 523;
- y = 878;
- } else if (b > 425518 && b <= 426018) { // 125 绔欑偣 425768
- x = 550;
- y = 878;
- } else if (b > 426018 && b <= 455264) {
- x = 578;
- y = 878;
- } else if (b > 455264 && b <= 455764) { // 124 绔欑偣 455514
- x = 605;
- y = 878;
- } else if (b > 455764 && b <= 470117) {
- x = 633;
- y = 878;
- } else if (b > 470117 && b <= 470617) { // 123 绔欑偣 470367
- x = 660;
- y = 878;
- } else if (b > 470617 && b <= 484977) {
- x = 688;
- y = 878;
- } else if (b > 484977 && b <= 485477) { // 122 绔欑偣 485227
- x = 715;
- y = 878;
- } else if (b > 485477 && b <= 514662) {
- x = 743;
- y = 878;
- } else if (b > 514662 && b <= 515162) { // 121 绔欑偣 514912
- x = 770;
- y = 878;
- } else if (b > 515162 && b <= 544432) {
- x = 798;
- y = 878;
- } else if (b > 544432 && b <= 544932) { // 120 绔欑偣 544682
- x = 825;
- y = 878;
- } else if (b > 544932 && b <= 559284) {
- x = 853;
- y = 878;
- } else if (b > 559284 && b <= 559784) { // 119 绔欑偣 559534
- x = 880;
- y = 878;
- } else if (b > 559784 && b <= 574073) {
- x = 908;
- y = 878;
- } else if (b > 574073 && b <= 574573) { // 118 绔欑偣 574323
- x = 935;
- y = 878;
- } else if (b > 574573 && b <= 603793) {
- x = 963;
- y = 878;
- } else if (b > 603793 && b <= 604293) { // 117 绔欑偣 604043
- x = 990;
- y = 878;
- } else if (b > 604293 && b <= 633730) {
- x = 1018;
- y = 878;
- } else if (b > 633730 && b <= 634230) { // 116 绔欑偣 633980
- x = 1045;
- y = 878;
- } else if (b > 634230 && b <= 634730) {
- x = 1073;
- y = 878;
- } else if (b > 634730 && b <= 679853) {
- x = 1073;
- y = 878;
-
- } else if (b > 679853 && b <= 680353) { // 116 鎷愮偣 680103
- x = 1115;
- y = 878;
-
-
- } else if (b > 680353 && b <= 731300) {
- x = 1215;
- y = 565;
-
- } else if (b > 731300 && b <= 746783) { // 115 鎷愮偣 731550
- x = 1215;
- y = 775;
-
- } else if (b > 746783 && b <= 762266) {
- x = 1215;
- y = 680;
- } else if (b > 762266 && b <= 777750) {
- x = 1215;
- y = 610;
-
- } else if (b > 777750 && b <= 779750) {
- x = 1215;
- y = 565;
- } else if (b > 779750 && b <= 780250) { // 115 绔欑偣 780000
- x = 1215;
- y = 520;
- } else if (b > 780250 && b <= 799750) {
- x = 1215;
- y = 475;
- } else if (b > 799750 && b <= 800250) { // 114 绔欑偣 800000
- x = 1215;
- y = 430;
- } else if (b > 800250 && b <= 864750) {
- x = 1215;
- y = 385;
- } else if (b > 864750 && b <= 865250) { // 113 绔欑偣 865000
- x = 1215;
- y = 340;
- } else if (b > 856250 && b <= 890750) {
- x = 1215;
- y = 295;
- } else if (b > 890750 && b <= 891250) { // 112 绔欑偣 891000
- x = 1215;
- y = 250;
- } else if (b > 891250 && b <= 972450) {
- x = 1215;
- y = 205;
- } else if (b > 972450 && b <= 972950) {
- x = 1215;
- y = 125;
-
- } else if (b > 972950 && b <= 1016193) { // 椤剁偣
- x = 1164;
- y = 80;
- } else if (b > 1016193 && b <= 1063563) {
- x = 1115;
- y = 125;
-
- } else if (b > 1063563 && b <= 1064063) { // 111 绔欑偣 1063813
- x = 1115;
- y = 150;
- } else if (b > 1064063 && b <= 1077711) {
- x = 1115;
- y = 175;
- } else if (b > 1077711 && b <= 1078211) { // 110 绔欑偣 1077961
- x = 1115;
- y = 200;
- } else if (b > 1078211 && b <= 1104788) {
- x = 1115;
- y = 225;
- } else if (b > 1104788 && b <= 1105288) { // 109 绔欑偣 1105038
- x = 1115;
- y = 250;
- } else if (b > 1105288 && b <= 1119213) {
- x = 1115;
- y = 275;
- } else if (b > 1119213 && b <= 1119713) { // 108 绔欑偣 1119463
- x = 1115;
- y = 300;
- } else if (b > 1119713 && b <= 1145902) {
- x = 1115;
- y = 325;
- } else if (b > 1145902 && b <= 1146402) { // 107 绔欑偣 1146152
- x = 1115;
- y = 350;
- } else if (b > 1146402 && b <= 1160380) {
- x = 1115;
- y = 375;
- } else if (b > 1160380 && b <= 1160880) { // 106 绔欑偣 1160630
- x = 1115;
- y = 400;
- } else if (b > 1160880 && b <= 1187314) {
- x = 1115;
- y = 425;
- } else if (b > 1187314 && b <= 1187814) { // 105 绔欑偣 1187564
- x = 1115;
- y = 450;
- } else if (b > 1187814 && b <= 1201849) {
- x = 1115;
- y = 475;
- } else if (b > 1201849 && b <= 1202349) { // 104 绔欑偣 1202099
- x = 1115;
- y = 500;
- } else if (b > 1202349 && b <= 1228831) {
- x = 1115;
- y = 525;
- } else if (b > 1228831 && b <= 1229331) { // 103 绔欑偣 1229081
- x = 1115;
- y = 550;
- } else if (b > 1229331 && b <= 1243204) {
- x = 1115;
- y = 575;
- } else if (b > 1243204 && b <= 1243704) { // 102 绔欑偣 1243454
- x = 1115;
- y = 600;
- } else if (b > 1243704 && b <= 1269708) {
- x = 1115;
- y = 625;
- } else if (b > 1269708 && b <= 1284750) { // 101 绔欑偣 1269958
- x = 1115;
- y = 650;
- } else if (b > 1284750 && b <= 1285250) { // 101 鎷愮偣
- x = 1115;
- y = 720;
-
- } else if (b > 1285250 && b <= 1322829) { // 101 鎷愮偣
- x = 1100;
- y = 750;
-
-
- } else if (b > 1322829 && b <= 1323329) {
- x = 1075;
- y = 775;
- } else if (b > 1323329 && b <= 1371551) {
- x = 1025;
- y = 775;
- } else if (b > 1371551 && b <= 1372051) {
- x = 975;
- y = 775;
- } else if (b > 1372051 && b <= 1420273) {
- x = 925;
- y = 775;
- } else if (b > 1420273 && b <= 1420773) {
- x = 875;
- y = 775;
- } else if (b > 1420773 && b <= 1468995) {
- x = 825;
- y = 775;
- } else if (b > 1468995 && b <= 1469495) {
- x = 775;
- y = 650;
- } else if (b > 1469495 && b <= 1517717) {
- x = 725;
- y = 650;
- } else if (b > 1517717 && b <= 1518217) {
- x = 675;
- y = 775;
- } else if (b > 1566439 && b <= 1566939) {
- x = 575;
- y = 775;
- } else if (b > 1566939 && b <= 1614661) {
- x = 525;
- y = 775;
- } else if (b > 1614661 && b <= 1615161) {
- x = 475;
- y = 775;
- } else if (b > 1615161 && b <= 1662883) {
- x = 425;
- y = 775;
- } else if (b > 1662883 && b <= 1663383) {
- x = 375;
- y = 775;
- } else if (b > 1663383 && b <= 1711105) {
- x = 325;
- y = 775;
- } else if (b > 1711105 && b <= 1711605) {
- x = 275;
- y = 775;
- } else if (b > 1711605 && b <= 1736500) {
- x = 225;
- y = 775;
- } else if (b > 1736500 && b <= 1737000) {
- x = 175;
- y = 775;
- } else if (b > 0 && b <= 47822) {
- x = 125;
- y = 775;
- } else if (b > 47822 && b <= 73050) {
- x = 75;
- y = 775;
- } else if (b > 73050 && b <= 73550) {
- x = 65;
- y = 775;
-
-
- } else if (b > 134400 && b <= 134900) {
- x = 25;
- y = 830;
- } else if (b > 134900 && b <= 196000) {
- x = 65;
- y = 878;
- } else if (b > 196000 && b <= 217480) {
- x = 83;
- y = 878;
+ public static double[] getRgvPosNew(Integer devNo,double a, double b) {
+ double[] rgvPosNew = getRgvPosNew(a, b);
+ switch (devNo){
+ case 101:
+ case 102:
+ case 103:
+ case 104:
+ case 105:
+ case 106:
+ case 107:
+ case 108:
+ case 109:
+ case 110:
+ case 111:
+ rgvPosNew[0] = rgvPosNew[0] - 30;
+ rgvPosNew[1] = rgvPosNew[1];
+ break;
+ case 112:
+ case 113:
+ case 114:
+ case 115:
+ rgvPosNew[0] = rgvPosNew[0] + 10;
+ rgvPosNew[1] = rgvPosNew[1];
+ break;
+ case 116:
+ case 117:
+ case 118:
+ case 119:
+ case 120:
+ case 121:
+ case 122:
+ case 123:
+ case 124:
+ case 125:
+ case 126:
+ case 127:
+ case 128:
+ case 129:
+ case 130:
+ case 131:
+ case 132:
+ case 133:
+ rgvPosNew[0] = rgvPosNew[0];
+ rgvPosNew[1] = rgvPosNew[1] + 30;
+ break;
+ case 134:
+ rgvPosNew[0] = rgvPosNew[0];
+ rgvPosNew[1] = rgvPosNew[1] - 10;
+ break;
}
+ return rgvPosNew;
+
+ }
+ public static double[] getRgvPosNew(double a, double b) {
+ // 瀹氫箟鍖洪棿鍙婂搴旂殑鍑犱綍鍙傛暟锛堟柊澧炲渾寮у弬鏁帮級
+ // 缁撴瀯锛歿start, end, 绫诲瀷, 鍙傛暟...}
+ // 绫诲瀷璇存槑锛�0-鐩寸嚎锛�1-鍦嗗姬锛堥渶瑕佸渾蹇冨潗鏍囷級
+ Object[][] intervals = {
+ // 鐩寸嚎鍖洪棿锛�0-134400锛�
+ {0.0, 134400.0, 0, 390.0, 775.0, 25.0, 775.0},
+
+ // 寮х嚎鍖洪棿锛堟嫄鐐�-杞集-133锛変繚鎸佽礉濉炲皵鏇茬嚎
+ {134400.0, 134900.0, 1, 25.0, 775.0, 65.0, 882.0, 25.0, 882.0},
+
+ // 鐩寸嚎鍖洪棿
+ {134900.0, 680103.0,0, 65.0, 885.0, 1115.0, 882.0},
+
+// // 寮х嚎鍖洪棿锛堟嫄鐐�116-115锛夛紝鎺у埗鐐瑰亣璁句负(1125, 882)
+// {680103, 731550, 1115, 882, 1215, 775, 1125, 882},
+
+ // 鍦嗗姬鍖洪棿锛堟嫄鐐�116-115锛夋柊鍙傛暟锛氬渾蹇�(1115,775)
+ {680103.0, 731550.0, 2, 1115.0, 882.0, 1215.0, 775.0, 1115.0, 775.0}, // 淇缁堢偣鍧愭爣
+
+ // 鐩寸嚎鍖洪棿
+ {731550.0, 972950.0,0, 1215.0, 775.0, 1215.0, 125.0},
+ // 寮х嚎鍖洪棿锛堟嫄鐐�112-椤剁偣锛夛紝鎺у埗鐐瑰亣璁句负(1215, 80)
+ {972950.0, 1016193.0,0, 1215.0, 125.0, 1164.0, 80.0},
+ // 寮х嚎鍖洪棿锛堟嫄鐐�-椤剁偣-111锛夛紝鎺у埗鐐瑰亣璁句负(1164, 125)
+ {1016193.0, 1063563.0,0, 1164.0, 80.0, 1115.0, 125.0},
+ // 鐩寸嚎鍖洪棿
+ {1063563.0, 1315250.0,0, 1115.0, 150.0, 1115.0, 720.0},
+ // 寮х嚎鍖洪棿锛堟嫄鐐�101-杞集锛夛紝鎺у埗鐐瑰亣璁句负(1115, 750)
+ {1315250.0, 1322829.0,0, 1115.0, 720.0, 1100.0, 750.0},
+ // 鐩寸嚎鍖洪棿
+ {1322829.0, 1737000.0,0, 1090.0, 775.0, 390.0, 775.0},
+ };
+
+ for (Object[] interval : intervals) {
+ double start = (Double) interval[0];
+ double end = (Double) interval[1];
+ int type = (Integer) interval[2];
+
+ if (b >= start && b <= end) {
+ double t = (b - start) / (end - start);
+
+ // 鏍规嵁涓嶅悓绫诲瀷璁$畻鍧愭爣
+ switch (type) {
+ case 0: // 鐩寸嚎
+ return linearInterpolation(interval, t);
+ case 1: // 璐濆灏旀洸绾�
+ return bezierInterpolation(interval, t);
+ case 2: // 鍦嗗姬
+ return circularInterpolation(interval, t);
+ }
+ }
+ }
+ return new double[]{0, 0};
+ }
- return new double[]{x, y};
+ // 鐩寸嚎鎻掑��
+ private static double[] linearInterpolation(Object[] interval, double t) {
+ double x1 = (Double) interval[3];
+ double y1 = (Double) interval[4];
+ double x2 = (Double) interval[5];
+ double y2 = (Double) interval[6];
+ return new double[]{
+ x1 + t * (x2 - x1),
+ y1 + t * (y2 - y1)
+ };
+ }
+
+ // 璐濆灏旀洸绾挎彃鍊�
+ private static double[] bezierInterpolation(Object[] interval, double t) {
+ double x0 = (Double) interval[3];
+ double y0 = (Double) interval[4];
+ double x2 = (Double) interval[5];
+ double y2 = (Double) interval[6];
+ double cx = (Double) interval[7];
+ double cy = (Double) interval[8];
+ return new double[]{
+ Math.pow(1-t, 2)*x0 + 2*(1-t)*t*cx + t*t*x2,
+ Math.pow(1-t, 2)*y0 + 2*(1-t)*t*cy + t*t*y2
+ };
+ }
+
+ // 鍦嗗姬鎻掑�硷紙鏂板锛�
+ private static double[] circularInterpolation(Object[] interval, double t) {
+ // 鍙傛暟瑙f瀽
+ double startX = (Double) interval[3];
+ double startY = (Double) interval[4];
+ double endX = (Double) interval[5];
+ double endY = (Double) interval[6];
+ double centerX = (Double) interval[7];
+ double centerY = (Double) interval[8];
+
+ // 璁$畻璧峰瑙掑害鍜岀粓姝㈣搴�
+ double startAngle = Math.atan2(startY - centerY, startX - centerX);
+ double endAngle = Math.atan2(endY - centerY, endX - centerX);
+
+ // 瑙掑害鎻掑��
+ double currentAngle = startAngle + t * (endAngle - startAngle);
+ double radius = Math.hypot(startX - centerX, startY - centerY);
+
+ return new double[]{
+ centerX + radius * Math.cos(currentAngle),
+ centerY + radius * Math.sin(currentAngle)
+ };
}
}
--
Gitblit v1.9.1