@fleet-frontend/mower-maps 0.0.8 → 0.0.9-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/constants.d.ts +2 -25
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/styles.d.ts +3 -2
- package/dist/config/styles.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +1548 -1075
- package/dist/index.js +1546 -1073
- package/dist/processor/MapDataProcessor.d.ts +1 -1
- package/dist/processor/MapDataProcessor.d.ts.map +1 -1
- package/dist/processor/PathDataProcessor.d.ts +3 -18
- package/dist/processor/PathDataProcessor.d.ts.map +1 -1
- package/dist/processor/builder/AntennaDataBuilder.d.ts +2 -1
- package/dist/processor/builder/AntennaDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/BoundaryDataBuilder.d.ts +1 -1
- package/dist/processor/builder/BoundaryDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/ChannelDataBuilder.d.ts +1 -1
- package/dist/processor/builder/ChannelDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/ChargingPileDataBuilder.d.ts +1 -1
- package/dist/processor/builder/ChargingPileDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/ObstacleDataBuilder.d.ts +2 -1
- package/dist/processor/builder/ObstacleDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/PathDataBuilder.d.ts +6 -5
- package/dist/processor/builder/PathDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/PointDataBuilder.d.ts +2 -1
- package/dist/processor/builder/PointDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/SvgElementDataBuilder.d.ts +1 -1
- package/dist/processor/builder/SvgElementDataBuilder.d.ts.map +1 -1
- package/dist/processor/builder/VisionOffDataBuilder.d.ts +2 -1
- package/dist/processor/builder/VisionOffDataBuilder.d.ts.map +1 -1
- package/dist/processor/index.d.ts +2 -1
- package/dist/processor/index.d.ts.map +1 -1
- package/dist/render/AntennaManager.d.ts +7 -24
- package/dist/render/AntennaManager.d.ts.map +1 -1
- package/dist/render/BoundaryLabelsManager.d.ts +12 -20
- package/dist/render/BoundaryLabelsManager.d.ts.map +1 -1
- package/dist/render/ChargingPileManager.d.ts +10 -20
- package/dist/render/ChargingPileManager.d.ts.map +1 -1
- package/dist/render/MowerMapOverlay.d.ts +51 -8
- package/dist/render/MowerMapOverlay.d.ts.map +1 -1
- package/dist/render/MowerMapRenderer.d.ts.map +1 -1
- package/dist/render/{MowerPostionManager.d.ts → MowerPositionManager.d.ts} +14 -11
- package/dist/render/MowerPositionManager.d.ts.map +1 -0
- package/dist/render/SvgMapView.d.ts +15 -26
- package/dist/render/SvgMapView.d.ts.map +1 -1
- package/dist/render/layers/BoundaryBorderLayer.d.ts +7 -0
- package/dist/render/layers/BoundaryBorderLayer.d.ts.map +1 -1
- package/dist/render/layers/ChannelLayer.d.ts.map +1 -1
- package/dist/render/layers/DrawLayer.d.ts +1 -1
- package/dist/render/layers/DrawLayer.d.ts.map +1 -1
- package/dist/render/layers/PathLayer.d.ts +1 -0
- package/dist/render/layers/PathLayer.d.ts.map +1 -1
- package/dist/render/layers/SvgElementLayer.d.ts.map +1 -1
- package/dist/render/layers/index.d.ts +0 -1
- package/dist/render/layers/index.d.ts.map +1 -1
- package/dist/render/layers/types.d.ts +1 -36
- package/dist/render/layers/types.d.ts.map +1 -1
- package/dist/store/processMowingState.d.ts +4 -0
- package/dist/store/processMowingState.d.ts.map +1 -0
- package/dist/store/useSubBoundaryBorderStore.d.ts +9 -5
- package/dist/store/useSubBoundaryBorderStore.d.ts.map +1 -1
- package/dist/types/constants.d.ts +38 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/layers.d.ts +50 -0
- package/dist/types/layers.d.ts.map +1 -0
- package/dist/types/processor.d.ts +26 -0
- package/dist/types/processor.d.ts.map +1 -0
- package/dist/types/realTime.d.ts +27 -2
- package/dist/types/realTime.d.ts.map +1 -1
- package/dist/types/renderer.d.ts +27 -10
- package/dist/types/renderer.d.ts.map +1 -1
- package/dist/types/store.d.ts +22 -0
- package/dist/types/store.d.ts.map +1 -0
- package/dist/types/utils.d.ts +102 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/utils/boundaryUtils.d.ts +1 -29
- package/dist/utils/boundaryUtils.d.ts.map +1 -1
- package/dist/utils/common.d.ts +20 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/coordinates.d.ts +1 -7
- package/dist/utils/coordinates.d.ts.map +1 -1
- package/dist/utils/handleRealTime.d.ts +20 -10
- package/dist/utils/handleRealTime.d.ts.map +1 -1
- package/dist/utils/mapBounds.d.ts +1 -10
- package/dist/utils/mapBounds.d.ts.map +1 -1
- package/dist/utils/math.d.ts +3 -10
- package/dist/utils/math.d.ts.map +1 -1
- package/dist/utils/mower.d.ts +4 -4
- package/dist/utils/mower.d.ts.map +1 -1
- package/dist/utils/pathSegments.d.ts +1 -15
- package/dist/utils/pathSegments.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/render/MowerPostionManager.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -3,6 +3,135 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* 常量和枚举类型定义
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* 机器人状态枚举
|
|
11
|
+
*/
|
|
12
|
+
var RobotStatus;
|
|
13
|
+
(function (RobotStatus) {
|
|
14
|
+
RobotStatus[RobotStatus["PARKED"] = 1] = "PARKED";
|
|
15
|
+
RobotStatus[RobotStatus["CHARGING"] = 2] = "CHARGING";
|
|
16
|
+
RobotStatus[RobotStatus["STANDBY"] = 3] = "STANDBY";
|
|
17
|
+
RobotStatus[RobotStatus["MOWING"] = 4] = "MOWING";
|
|
18
|
+
RobotStatus[RobotStatus["WORKING"] = 5] = "WORKING";
|
|
19
|
+
RobotStatus[RobotStatus["MAPPING"] = 6] = "MAPPING";
|
|
20
|
+
RobotStatus[RobotStatus["ERROR"] = 7] = "ERROR";
|
|
21
|
+
RobotStatus[RobotStatus["UPGRADING"] = 8] = "UPGRADING";
|
|
22
|
+
RobotStatus[RobotStatus["DISCONNECTED"] = 9] = "DISCONNECTED";
|
|
23
|
+
RobotStatus[RobotStatus["UNKNOWN"] = -1] = "UNKNOWN";
|
|
24
|
+
RobotStatus[RobotStatus["TASK_DELAY"] = 10] = "TASK_DELAY";
|
|
25
|
+
})(RobotStatus || (RobotStatus = {}));
|
|
26
|
+
/**
|
|
27
|
+
* RTK状态枚举
|
|
28
|
+
*/
|
|
29
|
+
var RTK_STATE;
|
|
30
|
+
(function (RTK_STATE) {
|
|
31
|
+
RTK_STATE[RTK_STATE["LOW_RTK"] = 1] = "LOW_RTK";
|
|
32
|
+
RTK_STATE[RTK_STATE["MIDDLE_RTK"] = 2] = "MIDDLE_RTK";
|
|
33
|
+
RTK_STATE[RTK_STATE["HIGH_RTK"] = 3] = "HIGH_RTK";
|
|
34
|
+
RTK_STATE[RTK_STATE["NO_POSTURE"] = 10] = "NO_POSTURE";
|
|
35
|
+
RTK_STATE[RTK_STATE["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE";
|
|
36
|
+
RTK_STATE[RTK_STATE["OFF_LINE"] = 19] = "OFF_LINE";
|
|
37
|
+
})(RTK_STATE || (RTK_STATE = {}));
|
|
38
|
+
/**
|
|
39
|
+
* 实时数据类型枚举
|
|
40
|
+
*/
|
|
41
|
+
var REAL_TIME_DATA_TYPE;
|
|
42
|
+
(function (REAL_TIME_DATA_TYPE) {
|
|
43
|
+
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["LOCATION"] = 1] = "LOCATION";
|
|
44
|
+
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["PROCESS"] = 2] = "PROCESS";
|
|
45
|
+
})(REAL_TIME_DATA_TYPE || (REAL_TIME_DATA_TYPE = {}));
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 地图渲染相关常量配置
|
|
49
|
+
*/
|
|
50
|
+
/**
|
|
51
|
+
* 缩放因子 - 将米转换为像素
|
|
52
|
+
* 与Python代码中的SVG比例一致
|
|
53
|
+
*/
|
|
54
|
+
const SCALE_FACTOR = 50; // 50像素/米
|
|
55
|
+
/**
|
|
56
|
+
* 默认线宽设置
|
|
57
|
+
*/
|
|
58
|
+
const DEFAULT_LINE_WIDTHS = {
|
|
59
|
+
OBSTACLE: 2,
|
|
60
|
+
CHARGING_PILE: 2,
|
|
61
|
+
CHANNEL: 2,
|
|
62
|
+
PATH: 20,
|
|
63
|
+
VISION_OFF_AREA: 2,
|
|
64
|
+
TIME_LIMIT_OBSTACLE: 1,
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* 默认透明度设置
|
|
68
|
+
*/
|
|
69
|
+
const DEFAULT_OPACITIES = {
|
|
70
|
+
FULL: 1.0,
|
|
71
|
+
HIGH: 0.7,
|
|
72
|
+
MEDIUM: 0.6};
|
|
73
|
+
/**
|
|
74
|
+
* 默认半径设置
|
|
75
|
+
*/
|
|
76
|
+
const DEFAULT_RADII = {
|
|
77
|
+
CHARGING_PILE: 12};
|
|
78
|
+
/**
|
|
79
|
+
* 图层等级
|
|
80
|
+
*/
|
|
81
|
+
const LAYER_LEVELS = {
|
|
82
|
+
BOUNDARY: 2,
|
|
83
|
+
BOUNDARY_BORDER: 4};
|
|
84
|
+
/**
|
|
85
|
+
* 图层默认id
|
|
86
|
+
*/
|
|
87
|
+
const LAYER_DEFAULT_TYPE = {
|
|
88
|
+
CHANNEL: 'channel',
|
|
89
|
+
BOUNDARY: 'boundary',
|
|
90
|
+
PATH: 'path',
|
|
91
|
+
BOUNDARY_BORDER: 'boundary_border',
|
|
92
|
+
OBSTACLE: 'obstacle',
|
|
93
|
+
CHARGING_PILE: 'charging_pile',
|
|
94
|
+
POINT: 'point',
|
|
95
|
+
SVG: 'svg',
|
|
96
|
+
VISION_OFF_AREA: 'vision_off_area',
|
|
97
|
+
ANTENNA: 'antenna',
|
|
98
|
+
};
|
|
99
|
+
const ISOLATED_BOUNDARY_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
100
|
+
<g opacity="0.6">
|
|
101
|
+
<rect width="24" height="24" rx="12" fill="#1E1E1F" fill-opacity="0.5"/>
|
|
102
|
+
<path d="M8.20573 12.4961C6.739 11.1707 4.85775 11.2284 3.60938 11.1707C6.17744 13.0156 6.05584 15.7887 5.67404 16.9446H14.327C13.837 13.1673 15.5321 10.1289 16.4408 9.08187C15.0342 9.46118 13.5794 10.8303 13.0278 11.4674C12.8102 8.94572 13.992 5.97489 14.61 4.80469C12.5235 5.92214 11.0501 8.26056 10.4938 9.56261C9.22803 7.5947 6.83894 7.17806 5.883 6.9432C8.20573 10.2373 8.00039 11.1707 8.20573 12.4961Z" fill="white"/>
|
|
103
|
+
<mask id="path-3-outside-1_9822_43516" maskUnits="userSpaceOnUse" x="13.2344" y="7.20545" width="12.0208" height="12.0208" fill="black">
|
|
104
|
+
<rect fill="white" x="13.2344" y="7.20545" width="12.0208" height="12.0208"/>
|
|
105
|
+
<path d="M20.6852 11.1208C19.9042 10.3398 18.6378 10.3398 17.8568 11.1208L17.2733 11.7043C16.6707 12.3069 16.5358 13.1973 16.8631 13.9319L17.5916 13.2034C17.5657 12.9181 17.6619 12.6236 17.8803 12.4052L18.5674 11.7181C18.9579 11.3276 19.5911 11.3276 19.9816 11.7181L20.4056 12.1421C20.7959 12.5326 20.796 13.1658 20.4056 13.5563L19.7185 14.2434C19.5128 14.449 19.2393 14.5457 18.9699 14.5348L18.2235 15.2812C18.9538 15.596 19.8325 15.4565 20.429 14.86L21.0125 14.2765C21.7935 13.4955 21.7936 12.2291 21.0125 11.4481L20.6852 11.1208Z"/>
|
|
106
|
+
</mask>
|
|
107
|
+
<path d="M20.6852 11.1208C19.9042 10.3398 18.6378 10.3398 17.8568 11.1208L17.2733 11.7043C16.6707 12.3069 16.5358 13.1973 16.8631 13.9319L17.5916 13.2034C17.5657 12.9181 17.6619 12.6236 17.8803 12.4052L18.5674 11.7181C18.9579 11.3276 19.5911 11.3276 19.9816 11.7181L20.4056 12.1421C20.7959 12.5326 20.796 13.1658 20.4056 13.5563L19.7185 14.2434C19.5128 14.449 19.2393 14.5457 18.9699 14.5348L18.2235 15.2812C18.9538 15.596 19.8325 15.4565 20.429 14.86L21.0125 14.2765C21.7935 13.4955 21.7936 12.2291 21.0125 11.4481L20.6852 11.1208Z" fill="white"/>
|
|
108
|
+
<path d="M20.6852 11.1208L21.7458 10.0601L21.7459 10.0601L20.6852 11.1208ZM17.8568 11.1208L16.7961 10.0601L16.7962 10.0601L17.8568 11.1208ZM17.2733 11.7043L16.2126 10.6437L16.2126 10.6436L17.2733 11.7043ZM16.8631 13.9319L17.9238 14.9926L16.381 16.5354L15.493 14.5425L16.8631 13.9319ZM17.5916 13.2034L19.0855 13.0678L19.149 13.7674L18.6523 14.2641L17.5916 13.2034ZM20.4056 12.1421L21.4662 11.0814L21.4665 11.0817L20.4056 12.1421ZM18.9699 14.5348L17.9093 13.4741L18.3741 13.0093L19.0309 13.036L18.9699 14.5348ZM18.2235 15.2812L17.6298 16.6587L15.5997 15.7837L17.1628 14.2206L18.2235 15.2812ZM20.429 14.86L21.4897 15.9207L21.4897 15.9207L20.429 14.86ZM21.0125 14.2765L22.0732 15.3371L22.0732 15.3372L21.0125 14.2765ZM20.6852 11.1208L19.6246 12.1815C19.4294 11.9862 19.1127 11.9863 18.9174 12.1815L17.8568 11.1208L16.7962 10.0601C18.163 8.69337 20.379 8.6934 21.7458 10.0601L20.6852 11.1208ZM17.8568 11.1208L18.9175 12.1814L18.334 12.7649L17.2733 11.7043L16.2126 10.6436L16.7961 10.0601L17.8568 11.1208ZM17.2733 11.7043L18.334 12.7649C18.1877 12.9112 18.1488 13.1318 18.2333 13.3214L16.8631 13.9319L15.493 14.5425C14.9228 13.2629 15.1537 11.7026 16.2126 10.6437L17.2733 11.7043ZM16.8631 13.9319L15.8025 12.8713L16.531 12.1428L17.5916 13.2034L18.6523 14.2641L17.9238 14.9926L16.8631 13.9319ZM17.5916 13.2034L16.0978 13.339C16.0334 12.6302 16.2727 11.8914 16.8196 11.3445L17.8803 12.4052L18.9409 13.4658C19.051 13.3558 19.098 13.206 19.0855 13.0678L17.5916 13.2034ZM17.8803 12.4052L16.8196 11.3445L17.5067 10.6574L18.5674 11.7181L19.628 12.7788L18.9409 13.4658L17.8803 12.4052ZM18.5674 11.7181L17.5067 10.6574C18.483 9.68112 20.0659 9.68112 21.0422 10.6574L19.9816 11.7181L18.9209 12.7788C19.1162 12.974 19.4328 12.974 19.628 12.7788L18.5674 11.7181ZM19.9816 11.7181L21.0422 10.6574L21.4662 11.0814L20.4056 12.1421L19.3449 13.2027L18.9209 12.7788L19.9816 11.7181ZM20.4056 12.1421L21.4665 11.0817C22.4419 12.0577 22.4428 13.6404 21.4662 14.617L20.4056 13.5563L19.3449 12.4956C19.1493 12.6913 19.1498 13.0076 19.3446 13.2024L20.4056 12.1421ZM20.4056 13.5563L21.4662 14.617L20.7791 15.304L19.7185 14.2434L18.6578 13.1827L19.3449 12.4956L20.4056 13.5563ZM19.7185 14.2434L20.7791 15.304C20.2628 15.8204 19.5762 16.0607 18.909 16.0335L18.9699 14.5348L19.0309 13.036C18.9025 13.0308 18.7629 13.0777 18.6578 13.1827L19.7185 14.2434ZM18.9699 14.5348L20.0306 15.5954L19.2841 16.3419L18.2235 15.2812L17.1628 14.2206L17.9093 13.4741L18.9699 14.5348ZM18.2235 15.2812L18.8172 13.9037C19.0042 13.9843 19.2223 13.9455 19.3684 13.7993L20.429 14.86L21.4897 15.9207C20.4427 16.9676 18.9034 17.2077 17.6298 16.6587L18.2235 15.2812ZM20.429 14.86L19.3684 13.7994L19.9519 13.2159L21.0125 14.2765L22.0732 15.3372L21.4897 15.9207L20.429 14.86ZM21.0125 14.2765L19.9518 13.2159C20.1471 13.0206 20.1471 12.704 19.9519 12.5088L21.0125 11.4481L22.0732 10.3874C23.4401 11.7543 23.4399 13.9703 22.0732 15.3371L21.0125 14.2765ZM21.0125 11.4481L19.9519 12.5088L19.6246 12.1814L20.6852 11.1208L21.7459 10.0601L22.0732 10.3874L21.0125 11.4481Z" fill="#8E8E8F" mask="url(#path-3-outside-1_9822_43516)"/>
|
|
109
|
+
<mask id="path-5-outside-2_9822_43516" maskUnits="userSpaceOnUse" x="9.22265" y="10.388" width="12.7279" height="12.7279" fill="black">
|
|
110
|
+
<rect fill="white" x="9.22265" y="10.388" width="12.7279" height="12.7279"/>
|
|
111
|
+
<path d="M16.1708 14.5077C15.4353 14.1778 14.5422 14.3133 13.9383 14.9172L13.3548 15.5007C12.574 16.2818 12.5738 17.5481 13.3548 18.3291L13.6821 18.6564C14.4631 19.4374 15.7295 19.4373 16.5105 18.6564L17.094 18.0729C17.6895 17.4775 17.8299 16.6003 17.5173 15.8708L16.7743 16.6138C16.7828 16.8803 16.6863 17.1494 16.4829 17.3527L15.7952 18.0405C15.4046 18.4309 14.7714 18.431 14.3809 18.0405L13.957 17.6165C13.5667 17.226 13.5666 16.5927 13.957 16.2023L14.6447 15.5145C14.8654 15.2939 15.1639 15.1979 15.452 15.2266L16.1708 14.5077Z"/>
|
|
112
|
+
</mask>
|
|
113
|
+
<path d="M16.1708 14.5077C15.4353 14.1778 14.5422 14.3133 13.9383 14.9172L13.3548 15.5007C12.574 16.2818 12.5738 17.5481 13.3548 18.3291L13.6821 18.6564C14.4631 19.4374 15.7295 19.4373 16.5105 18.6564L17.094 18.0729C17.6895 17.4775 17.8299 16.6003 17.5173 15.8708L16.7743 16.6138C16.7828 16.8803 16.6863 17.1494 16.4829 17.3527L15.7952 18.0405C15.4046 18.4309 14.7714 18.431 14.3809 18.0405L13.957 17.6165C13.5667 17.226 13.5666 16.5927 13.957 16.2023L14.6447 15.5145C14.8654 15.2939 15.1639 15.1979 15.452 15.2266L16.1708 14.5077Z" fill="white"/>
|
|
114
|
+
<path d="M16.1708 14.5077L16.7847 13.1391L18.7701 14.0297L17.2315 15.5684L16.1708 14.5077ZM13.3548 15.5007L12.294 14.4402L12.2941 14.44L13.3548 15.5007ZM16.5105 18.6564L17.5712 19.7171L17.5711 19.7172L16.5105 18.6564ZM17.5173 15.8708L16.4567 14.8102L18.0236 13.2433L18.8962 15.2802L17.5173 15.8708ZM16.7743 16.6138L15.2751 16.6613L15.2545 16.0123L15.7137 15.5532L16.7743 16.6138ZM15.7952 18.0405L16.8558 19.1011L16.8556 19.1013L15.7952 18.0405ZM13.957 17.6165L12.8963 18.6772L12.8959 18.6767L13.957 17.6165ZM13.957 16.2023L12.8961 15.1418L12.8963 15.1416L13.957 16.2023ZM15.452 15.2266L16.5126 16.2872L16.0102 16.7896L15.3032 16.7192L15.452 15.2266ZM16.1708 14.5077L15.5569 15.8763C15.3688 15.792 15.1469 15.8299 14.999 15.9779L13.9383 14.9172L12.8776 13.8565C13.9375 12.7967 15.5018 12.5636 16.7847 13.1391L16.1708 14.5077ZM13.9383 14.9172L14.999 15.9779L14.4155 16.5614L13.3548 15.5007L12.2941 14.44L12.8776 13.8565L13.9383 14.9172ZM13.3548 15.5007L14.4156 16.5612C14.2202 16.7567 14.2204 17.0734 14.4155 17.2685L13.3548 18.3291L12.2941 19.3898C10.9272 18.0229 10.9277 15.8069 12.294 14.4402L13.3548 15.5007ZM13.3548 18.3291L14.4155 17.2685L14.7428 17.5958L13.6821 18.6564L12.6215 19.7171L12.2941 19.3898L13.3548 18.3291ZM13.6821 18.6564L14.7428 17.5958C14.9378 17.7908 15.2546 17.791 15.45 17.5956L16.5105 18.6564L17.5711 19.7172C16.2044 21.0836 13.9884 21.084 12.6215 19.7171L13.6821 18.6564ZM16.5105 18.6564L15.4499 17.5958L16.0334 17.0123L17.094 18.0729L18.1547 19.1336L17.5712 19.7171L16.5105 18.6564ZM17.094 18.0729L16.0334 17.0123C16.1795 16.8662 16.2185 16.6481 16.1385 16.4615L17.5173 15.8708L18.8962 15.2802C19.4413 16.5526 19.1996 18.0887 18.1547 19.1336L17.094 18.0729ZM17.5173 15.8708L18.578 16.9315L17.835 17.6745L16.7743 16.6138L15.7137 15.5532L16.4567 14.8102L17.5173 15.8708ZM16.7743 16.6138L18.2736 16.5664C18.2945 17.226 18.0544 17.9026 17.5436 18.4134L16.4829 17.3527L15.4223 16.2921C15.3182 16.3961 15.2711 16.5346 15.2751 16.6613L16.7743 16.6138ZM16.4829 17.3527L17.5436 18.4134L16.8558 19.1011L15.7952 18.0405L14.7345 16.9798L15.4223 16.2921L16.4829 17.3527ZM15.7952 18.0405L16.8556 19.1013C15.8795 20.0771 14.2967 20.0776 13.3203 19.1011L14.3809 18.0405L15.4416 16.9798C15.2461 16.7844 14.9297 16.7847 14.7347 16.9797L15.7952 18.0405ZM14.3809 18.0405L13.3203 19.1011L12.8963 18.6772L13.957 17.6165L15.0176 16.5558L15.4416 16.9798L14.3809 18.0405ZM13.957 17.6165L12.8959 18.6767C11.9207 17.7008 11.92 16.1182 12.8961 15.1418L13.957 16.2023L15.0178 17.2628C15.2133 17.0672 15.2128 16.7512 15.018 16.5563L13.957 17.6165ZM13.957 16.2023L12.8963 15.1416L13.5841 14.4539L14.6447 15.5145L15.7054 16.5752L15.0176 17.2629L13.957 16.2023ZM14.6447 15.5145L13.5841 14.4539C14.1364 13.9015 14.8848 13.6626 15.6007 13.734L15.452 15.2266L15.3032 16.7192C15.443 16.7331 15.5943 16.6862 15.7054 16.5752L14.6447 15.5145ZM15.452 15.2266L14.3913 14.1659L15.1101 13.4471L16.1708 14.5077L17.2315 15.5684L16.5126 16.2872L15.452 15.2266Z" fill="#8E8E8F" mask="url(#path-5-outside-2_9822_43516)"/>
|
|
115
|
+
<path d="M20.6852 11.1208C19.9042 10.3398 18.6378 10.3398 17.8568 11.1208L17.2733 11.7043C16.6707 12.3069 16.5358 13.1973 16.8631 13.9319L17.5916 13.2034C17.5657 12.9181 17.6619 12.6236 17.8803 12.4052L18.5674 11.7181C18.9579 11.3276 19.5911 11.3276 19.9816 11.7181L20.4056 12.1421C20.7959 12.5326 20.796 13.1658 20.4056 13.5563L19.7185 14.2434C19.5128 14.449 19.2393 14.5457 18.9699 14.5348L18.2235 15.2812C18.9538 15.596 19.8325 15.4565 20.429 14.86L21.0125 14.2765C21.7935 13.4955 21.7936 12.2291 21.0125 11.4481L20.6852 11.1208Z" fill="white"/>
|
|
116
|
+
<rect width="2.59942" height="2.97264" rx="1" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 21.1133 12.8486)" fill="#8E8E8F"/>
|
|
117
|
+
<rect width="1.91578" height="4.24403" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 19.6992 13.8066)" fill="#8E8E8F"/>
|
|
118
|
+
<rect width="2.59942" height="2.97264" rx="1" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 17.3125 16.6455)" fill="#8E8E8F"/>
|
|
119
|
+
</g>
|
|
120
|
+
</svg>`;
|
|
121
|
+
/**
|
|
122
|
+
* 遍历割草任务,下述四个字段可以在路径中唯一确定遍历的位置(当前区域、当前块、当前行、在当前行上的路程)
|
|
123
|
+
*/
|
|
124
|
+
const ACTION_BLOCK_COVER = 5;
|
|
125
|
+
/**
|
|
126
|
+
* 遍历割草块转移任务(在同一区域中的一个块转移到下一个块),下述四个字段可以在路径中唯一确定转移的位置(当前区域、前置块、当前转移路径线序号、在当前线上的路程)
|
|
127
|
+
*/
|
|
128
|
+
const ACTION_BLOCK_TRANSFER = 6;
|
|
129
|
+
/**
|
|
130
|
+
* 边界割草任务(割草任务内部的巡边任务)
|
|
131
|
+
*/
|
|
132
|
+
const ACTION_BOUNDARY_TASK = 8;
|
|
133
|
+
const SVG_MAP_VIEW_ID = 'fleet-maps-svg-map-view';
|
|
134
|
+
|
|
6
135
|
/**
|
|
7
136
|
* SVG基础MapView
|
|
8
137
|
* 使用真正的矢量SVG渲染替代Canvas位图渲染
|
|
@@ -16,7 +145,6 @@ class SvgMapView {
|
|
|
16
145
|
this.lineScale = 1; // 线条缩放系数
|
|
17
146
|
// 状态标志
|
|
18
147
|
this.destroyed = false;
|
|
19
|
-
this.showScale = false;
|
|
20
148
|
// 渲染系统 - 移除节流以确保用户操作的实时响应
|
|
21
149
|
// 拖动功能
|
|
22
150
|
this.isDragging = false;
|
|
@@ -59,6 +187,7 @@ class SvgMapView {
|
|
|
59
187
|
this.svg.setAttribute('shape-rendering', 'geometricPrecision');
|
|
60
188
|
this.svg.setAttribute('text-rendering', 'geometricPrecision');
|
|
61
189
|
this.svg.setAttribute('image-rendering', 'optimizeQuality');
|
|
190
|
+
this.svg.setAttribute('id', SVG_MAP_VIEW_ID);
|
|
62
191
|
}
|
|
63
192
|
/**
|
|
64
193
|
* 创建SVG组元素
|
|
@@ -81,7 +210,9 @@ class SvgMapView {
|
|
|
81
210
|
return;
|
|
82
211
|
this.layers.push(...layers);
|
|
83
212
|
this.layers.sort((a, b) => a.getLevel() - b.getLevel());
|
|
84
|
-
|
|
213
|
+
}
|
|
214
|
+
getLayer(type) {
|
|
215
|
+
return this.layers.find((layer) => layer.getType() === type) || null;
|
|
85
216
|
}
|
|
86
217
|
/**
|
|
87
218
|
* 添加图层
|
|
@@ -91,14 +222,12 @@ class SvgMapView {
|
|
|
91
222
|
return;
|
|
92
223
|
this.layers.push(layer);
|
|
93
224
|
this.layers.sort((a, b) => a.getLevel() - b.getLevel());
|
|
94
|
-
this.refresh();
|
|
95
225
|
}
|
|
96
226
|
/**
|
|
97
227
|
* 移除图层
|
|
98
228
|
*/
|
|
99
229
|
removeLayer(layer) {
|
|
100
230
|
const index = this.layers.indexOf(layer);
|
|
101
|
-
console.log('removeLayer----->', index);
|
|
102
231
|
if (index !== -1) {
|
|
103
232
|
this.layers.splice(index, 1);
|
|
104
233
|
this.refresh();
|
|
@@ -109,15 +238,18 @@ class SvgMapView {
|
|
|
109
238
|
* @param type 图层类型
|
|
110
239
|
*/
|
|
111
240
|
removeLayerByType(type) {
|
|
112
|
-
|
|
113
|
-
|
|
241
|
+
const layer = this.layers.find((layer) => layer.getType() === type);
|
|
242
|
+
if (layer) {
|
|
243
|
+
this.clearLayersGroup(layer);
|
|
244
|
+
this.layers = this.layers.filter((cLayer) => cLayer.getType() !== type);
|
|
245
|
+
}
|
|
114
246
|
}
|
|
115
247
|
// ==================== 变换系统 ====================
|
|
116
248
|
/**
|
|
117
249
|
* 设置自适应视图变换 - 让SVG刚好包裹住图形
|
|
118
250
|
*/
|
|
119
251
|
fitToView(bounds) {
|
|
120
|
-
const padding =
|
|
252
|
+
const padding = 20; // 添加一些边距以避免内容贴边
|
|
121
253
|
const boundWidth = bounds.maxX - bounds.minX;
|
|
122
254
|
const boundHeight = bounds.maxY - bounds.minY;
|
|
123
255
|
// 防止宽高为0的情况
|
|
@@ -140,8 +272,8 @@ class SvgMapView {
|
|
|
140
272
|
this.viewBox = {
|
|
141
273
|
x: bounds.minX - padding,
|
|
142
274
|
y: bounds.minY - padding,
|
|
143
|
-
width: boundWidth + padding,
|
|
144
|
-
height: boundHeight + padding,
|
|
275
|
+
width: boundWidth + padding * 2,
|
|
276
|
+
height: boundHeight + padding * 2,
|
|
145
277
|
};
|
|
146
278
|
// 根据宽高比选择合适的preserveAspectRatio设置
|
|
147
279
|
if (Math.abs(contentAspectRatio - containerAspectRatio) < 0.01) {
|
|
@@ -153,42 +285,6 @@ class SvgMapView {
|
|
|
153
285
|
this.svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
|
|
154
286
|
}
|
|
155
287
|
this.updateViewBox();
|
|
156
|
-
this.refresh();
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* 重置变换
|
|
160
|
-
*/
|
|
161
|
-
resetTransform() {
|
|
162
|
-
this.scale = 1;
|
|
163
|
-
// 重置viewBox到默认状态
|
|
164
|
-
const containerRect = this.container.getBoundingClientRect();
|
|
165
|
-
this.viewBox = {
|
|
166
|
-
x: 0,
|
|
167
|
-
y: 0,
|
|
168
|
-
width: containerRect.width,
|
|
169
|
-
height: containerRect.height,
|
|
170
|
-
};
|
|
171
|
-
this.updateViewBox();
|
|
172
|
-
this.refresh();
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* 设置缩放级别
|
|
176
|
-
*/
|
|
177
|
-
setZoom(zoomLevel) {
|
|
178
|
-
if (zoomLevel <= 0)
|
|
179
|
-
return;
|
|
180
|
-
const oldScale = this.scale;
|
|
181
|
-
this.scale = zoomLevel;
|
|
182
|
-
// 调整viewBox以实现缩放
|
|
183
|
-
const scaleFactor = oldScale / this.scale;
|
|
184
|
-
const centerX = this.viewBox.x + this.viewBox.width / 2;
|
|
185
|
-
const centerY = this.viewBox.y + this.viewBox.height / 2;
|
|
186
|
-
this.viewBox.width *= scaleFactor;
|
|
187
|
-
this.viewBox.height *= scaleFactor;
|
|
188
|
-
this.viewBox.x = centerX - this.viewBox.width / 2;
|
|
189
|
-
this.viewBox.y = centerY - this.viewBox.height / 2;
|
|
190
|
-
this.updateViewBox();
|
|
191
|
-
this.refresh();
|
|
192
288
|
}
|
|
193
289
|
/**
|
|
194
290
|
* 获取当前缩放级别
|
|
@@ -196,21 +292,21 @@ class SvgMapView {
|
|
|
196
292
|
getZoom() {
|
|
197
293
|
return this.scale;
|
|
198
294
|
}
|
|
199
|
-
/**
|
|
200
|
-
* 设置线条缩放系数
|
|
201
|
-
*/
|
|
202
|
-
setLineScale(lineScale) {
|
|
203
|
-
if (lineScale <= 0)
|
|
204
|
-
return;
|
|
205
|
-
this.lineScale = lineScale;
|
|
206
|
-
this.refresh();
|
|
207
|
-
}
|
|
208
295
|
/**
|
|
209
296
|
* 获取当前线条缩放系数
|
|
210
297
|
*/
|
|
211
298
|
getLineScale() {
|
|
212
299
|
return this.lineScale;
|
|
213
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* 绘制特定的图层
|
|
303
|
+
*/
|
|
304
|
+
renderLayer(type) {
|
|
305
|
+
const layer = this.layers.find((layer) => layer.getType() === type);
|
|
306
|
+
// 清空图层组
|
|
307
|
+
this.clearLayersGroup(layer);
|
|
308
|
+
this.onDrawLayers(type);
|
|
309
|
+
}
|
|
214
310
|
// ==================== 渲染系统 ====================
|
|
215
311
|
/**
|
|
216
312
|
* 主渲染方法
|
|
@@ -221,25 +317,112 @@ class SvgMapView {
|
|
|
221
317
|
// 绘制所有图层
|
|
222
318
|
this.onDrawLayers();
|
|
223
319
|
}
|
|
320
|
+
/**
|
|
321
|
+
* 获取图层id
|
|
322
|
+
*/
|
|
323
|
+
getLayerId(layer) {
|
|
324
|
+
return `layer-${layer.getType()}-${layer.getLevel()}`;
|
|
325
|
+
}
|
|
224
326
|
/**
|
|
225
327
|
* 清空图层组
|
|
226
328
|
*/
|
|
227
|
-
clearLayersGroup() {
|
|
228
|
-
|
|
229
|
-
this.
|
|
329
|
+
clearLayersGroup(layer) {
|
|
330
|
+
if (layer) {
|
|
331
|
+
const layerId = this.getLayerId(layer);
|
|
332
|
+
const layerGroup = this.layersGroup.querySelector(`#${layerId}`);
|
|
333
|
+
if (layerGroup) {
|
|
334
|
+
this.layersGroup.removeChild(layerGroup);
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
else {
|
|
338
|
+
while (this.layersGroup.firstChild) {
|
|
339
|
+
this.layersGroup.removeChild(this.layersGroup.firstChild);
|
|
340
|
+
}
|
|
230
341
|
}
|
|
231
342
|
}
|
|
232
343
|
/**
|
|
233
|
-
*
|
|
344
|
+
* 获取图层的下一个兄弟元素
|
|
345
|
+
* 根据图层的level来获取
|
|
234
346
|
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
347
|
+
getNextSibling(layer) {
|
|
348
|
+
const nextLayer = this.layers.find((cLayer) => cLayer.getLevel() > layer.getLevel());
|
|
349
|
+
const id = `layer-${nextLayer?.getType()}-${nextLayer?.getLevel()}`;
|
|
350
|
+
const nextSibling = this.layersGroup.querySelector(`#${id}`);
|
|
351
|
+
return nextSibling;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* 绘制图层,不传参数则默认绘制所有图层
|
|
355
|
+
*/
|
|
356
|
+
onDrawLayers(type) {
|
|
357
|
+
if (type) {
|
|
358
|
+
const layer = this.layers.find((layer) => layer.getType() === type);
|
|
359
|
+
if (layer) {
|
|
360
|
+
const layerGroup = this.createSVGGroup(`layer-${layer.getType()}-${layer.getLevel()}`);
|
|
239
361
|
layer.drawSVG(layerGroup, this.scale, this.lineScale);
|
|
240
|
-
this.
|
|
362
|
+
const nextSibling = this.getNextSibling(layer);
|
|
363
|
+
if (nextSibling) {
|
|
364
|
+
this.layersGroup.insertBefore(layerGroup, nextSibling);
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
this.layersGroup.appendChild(layerGroup);
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
for (const layer of this.layers) {
|
|
373
|
+
if (layer.isVisible()) {
|
|
374
|
+
const layerGroup = this.createSVGGroup(`layer-${layer.getType()}-${layer.getLevel()}`);
|
|
375
|
+
layer.drawSVG(layerGroup, this.scale, this.lineScale);
|
|
376
|
+
this.layersGroup.appendChild(layerGroup);
|
|
377
|
+
}
|
|
241
378
|
}
|
|
242
379
|
}
|
|
380
|
+
// if (type) {
|
|
381
|
+
// const layer = this.layers.find((layer) => layer.getType() === type);
|
|
382
|
+
// const layerId = this.getLayerId(layer);
|
|
383
|
+
// // 记录原始位置信息
|
|
384
|
+
// const layerGroup = this.layersGroup.querySelector(`#${layerId}`);
|
|
385
|
+
// let nextSibling: Node | null = null;
|
|
386
|
+
// if (layerGroup) {
|
|
387
|
+
// // 记录被删除元素的下一个兄弟元素,用于确定插入位置
|
|
388
|
+
// nextSibling = layerGroup.nextSibling;
|
|
389
|
+
// // 删除旧的图层组
|
|
390
|
+
// this.layersGroup.removeChild(layerGroup);
|
|
391
|
+
// // 从layerId解析出图层类型和层级
|
|
392
|
+
// // layerId格式: layer-${type}-${level}
|
|
393
|
+
// const layerIdParts = layerId.split('-');
|
|
394
|
+
// if (layerIdParts.length >= 3) {
|
|
395
|
+
// const layerType = layerIdParts.slice(1, -1).join('-'); // 处理类型名中可能包含连字符的情况
|
|
396
|
+
// const layerLevel = parseInt(layerIdParts[layerIdParts.length - 1]);
|
|
397
|
+
// // 查找对应的图层对象
|
|
398
|
+
// const targetLayer = this.layers.find(layer =>
|
|
399
|
+
// layer.getType() === layerType && layer.getLevel() === layerLevel
|
|
400
|
+
// );
|
|
401
|
+
// if (targetLayer && targetLayer.isVisible()) {
|
|
402
|
+
// // 创建新的图层组
|
|
403
|
+
// const newLayerGroup = this.createSVGGroup(layerId);
|
|
404
|
+
// // 重新绘制图层
|
|
405
|
+
// targetLayer.drawSVG(newLayerGroup, this.scale, this.lineScale);
|
|
406
|
+
// // 在原始位置插入新元素
|
|
407
|
+
// if (nextSibling) {
|
|
408
|
+
// this.layersGroup.insertBefore(newLayerGroup, nextSibling);
|
|
409
|
+
// } else {
|
|
410
|
+
// // 如果没有下一个兄弟元素,说明原来是最后一个,直接appendChild
|
|
411
|
+
// this.layersGroup.appendChild(newLayerGroup);
|
|
412
|
+
// }
|
|
413
|
+
// }
|
|
414
|
+
// }
|
|
415
|
+
// }
|
|
416
|
+
// } else {
|
|
417
|
+
// // 重绘所有图层
|
|
418
|
+
// for (const layer of this.layers) {
|
|
419
|
+
// if (layer.isVisible()) {
|
|
420
|
+
// const layerGroup = this.createSVGGroup(`layer-${layer.getType()}-${layer.getLevel()}`);
|
|
421
|
+
// layer.drawSVG(layerGroup, this.scale, this.lineScale);
|
|
422
|
+
// this.layersGroup.appendChild(layerGroup);
|
|
423
|
+
// }
|
|
424
|
+
// }
|
|
425
|
+
// }
|
|
243
426
|
}
|
|
244
427
|
/**
|
|
245
428
|
* 刷新渲染
|
|
@@ -249,12 +432,6 @@ class SvgMapView {
|
|
|
249
432
|
return;
|
|
250
433
|
this.render();
|
|
251
434
|
}
|
|
252
|
-
/**
|
|
253
|
-
* 重新初始化SVG(用于容器大小变化)
|
|
254
|
-
*/
|
|
255
|
-
reinitializeSVG() {
|
|
256
|
-
this.refresh();
|
|
257
|
-
}
|
|
258
435
|
// ==================== 拖拽功能 ====================
|
|
259
436
|
/**
|
|
260
437
|
* 设置拖拽事件处理器
|
|
@@ -379,22 +556,6 @@ class SvgMapView {
|
|
|
379
556
|
return null;
|
|
380
557
|
}
|
|
381
558
|
}
|
|
382
|
-
/**
|
|
383
|
-
* 自动适配viewBox到实际内容
|
|
384
|
-
*/
|
|
385
|
-
autoFitToContent() {
|
|
386
|
-
if (this.destroyed || this.layers.length === 0)
|
|
387
|
-
return;
|
|
388
|
-
const bounds = this.getLayersGroupBounds();
|
|
389
|
-
if (bounds) {
|
|
390
|
-
this.fitToView({
|
|
391
|
-
minX: bounds.x,
|
|
392
|
-
minY: bounds.y,
|
|
393
|
-
maxX: bounds.x + bounds.width,
|
|
394
|
-
maxY: bounds.y + bounds.height,
|
|
395
|
-
});
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
559
|
/**
|
|
399
560
|
* 获取ViewBox信息
|
|
400
561
|
*/
|
|
@@ -415,13 +576,6 @@ class SvgMapView {
|
|
|
415
576
|
* 诊断SVG尺寸信息
|
|
416
577
|
*/
|
|
417
578
|
diagnosticSizeInfo() { }
|
|
418
|
-
/**
|
|
419
|
-
* 设置是否显示比例尺
|
|
420
|
-
*/
|
|
421
|
-
setShowScale(show) {
|
|
422
|
-
this.showScale = show;
|
|
423
|
-
this.refresh();
|
|
424
|
-
}
|
|
425
579
|
/**
|
|
426
580
|
* 获取SVG元素
|
|
427
581
|
*/
|
|
@@ -601,164 +755,56 @@ const createStoreImpl = (createState) => {
|
|
|
601
755
|
const initialState = state = createState(setState, getState, api);
|
|
602
756
|
return api;
|
|
603
757
|
};
|
|
604
|
-
const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
605
|
-
|
|
606
|
-
const identity$1 = (arg) => arg;
|
|
607
|
-
function useStore(api, selector = identity$1) {
|
|
608
|
-
const slice = React.useSyncExternalStore(
|
|
609
|
-
api.subscribe,
|
|
610
|
-
() => selector(api.getState()),
|
|
611
|
-
() => selector(api.getInitialState())
|
|
612
|
-
);
|
|
613
|
-
React.useDebugValue(slice);
|
|
614
|
-
return slice;
|
|
615
|
-
}
|
|
616
|
-
const createImpl = (createState) => {
|
|
617
|
-
const api = createStore(createState);
|
|
618
|
-
const useBoundStore = (selector) => useStore(api, selector);
|
|
619
|
-
Object.assign(useBoundStore, api);
|
|
620
|
-
return useBoundStore;
|
|
621
|
-
};
|
|
622
|
-
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
623
|
-
|
|
624
|
-
const useSubBoundaryBorderStore = create((set, get) => ({
|
|
625
|
-
subBoundaryBorder: {},
|
|
626
|
-
//
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
})
|
|
635
|
-
//
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
...
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
/**
|
|
655
|
-
* 默认线宽设置
|
|
656
|
-
*/
|
|
657
|
-
const DEFAULT_LINE_WIDTHS = {
|
|
658
|
-
OBSTACLE: 2,
|
|
659
|
-
CHARGING_PILE: 2,
|
|
660
|
-
CHANNEL: 2,
|
|
661
|
-
PATH: 20,
|
|
662
|
-
VISION_OFF_AREA: 2,
|
|
663
|
-
TIME_LIMIT_OBSTACLE: 1,
|
|
664
|
-
};
|
|
665
|
-
/**
|
|
666
|
-
* 默认透明度设置
|
|
667
|
-
*/
|
|
668
|
-
const DEFAULT_OPACITIES = {
|
|
669
|
-
FULL: 1.0,
|
|
670
|
-
HIGH: 0.7,
|
|
671
|
-
LOW: 0.4};
|
|
672
|
-
/**
|
|
673
|
-
* 默认半径设置
|
|
674
|
-
*/
|
|
675
|
-
const DEFAULT_RADII = {
|
|
676
|
-
CHARGING_PILE: 12};
|
|
677
|
-
/**
|
|
678
|
-
* 图层等级
|
|
679
|
-
*/
|
|
680
|
-
const LAYER_LEVELS = {
|
|
681
|
-
BOUNDARY: 2,
|
|
682
|
-
BOUNDARY_BORDER: 4};
|
|
683
|
-
/**
|
|
684
|
-
* 图层默认id
|
|
685
|
-
*/
|
|
686
|
-
const LAYER_DEFAULT_TYPE = {
|
|
687
|
-
CHANNEL: 'channel',
|
|
688
|
-
BOUNDARY: 'boundary',
|
|
689
|
-
PATH: 'path',
|
|
690
|
-
BOUNDARY_BORDER: 'boundary_border',
|
|
691
|
-
OBSTACLE: 'obstacle',
|
|
692
|
-
CHARGING_PILE: 'charging_pile',
|
|
693
|
-
POINT: 'point',
|
|
694
|
-
SVG: 'svg',
|
|
695
|
-
VISION_OFF_AREA: 'vision_off_area',
|
|
696
|
-
ANTENNA: 'antenna',
|
|
697
|
-
};
|
|
698
|
-
var RobotStatus;
|
|
699
|
-
(function (RobotStatus) {
|
|
700
|
-
RobotStatus[RobotStatus["PARKED"] = 1] = "PARKED";
|
|
701
|
-
RobotStatus[RobotStatus["CHARGING"] = 2] = "CHARGING";
|
|
702
|
-
RobotStatus[RobotStatus["STANDBY"] = 3] = "STANDBY";
|
|
703
|
-
RobotStatus[RobotStatus["MOWING"] = 4] = "MOWING";
|
|
704
|
-
RobotStatus[RobotStatus["WORKING"] = 5] = "WORKING";
|
|
705
|
-
RobotStatus[RobotStatus["MAPPING"] = 6] = "MAPPING";
|
|
706
|
-
RobotStatus[RobotStatus["ERROR"] = 7] = "ERROR";
|
|
707
|
-
RobotStatus[RobotStatus["UPGRADING"] = 8] = "UPGRADING";
|
|
708
|
-
RobotStatus[RobotStatus["DISCONNECTED"] = 9] = "DISCONNECTED";
|
|
709
|
-
RobotStatus[RobotStatus["UNKNOWN"] = -1] = "UNKNOWN";
|
|
710
|
-
RobotStatus[RobotStatus["TASK_DELAY"] = 10] = "TASK_DELAY";
|
|
711
|
-
// WAITING = 'Waiting',
|
|
712
|
-
})(RobotStatus || (RobotStatus = {}));
|
|
713
|
-
// RTK状态
|
|
714
|
-
var RTK_STATE;
|
|
715
|
-
(function (RTK_STATE) {
|
|
716
|
-
RTK_STATE[RTK_STATE["LOW_RTK"] = 1] = "LOW_RTK";
|
|
717
|
-
RTK_STATE[RTK_STATE["MIDDLE_RTK"] = 2] = "MIDDLE_RTK";
|
|
718
|
-
RTK_STATE[RTK_STATE["HIGH_RTK"] = 3] = "HIGH_RTK";
|
|
719
|
-
RTK_STATE[RTK_STATE["NO_POSTURE"] = 10] = "NO_POSTURE";
|
|
720
|
-
RTK_STATE[RTK_STATE["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE";
|
|
721
|
-
RTK_STATE[RTK_STATE["OFF_LINE"] = 19] = "OFF_LINE";
|
|
722
|
-
})(RTK_STATE || (RTK_STATE = {}));
|
|
723
|
-
var REAL_TIME_DATA_TYPE;
|
|
724
|
-
(function (REAL_TIME_DATA_TYPE) {
|
|
725
|
-
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["LOCATION"] = 1] = "LOCATION";
|
|
726
|
-
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["PROCESS"] = 2] = "PROCESS";
|
|
727
|
-
})(REAL_TIME_DATA_TYPE || (REAL_TIME_DATA_TYPE = {}));
|
|
728
|
-
const ISOLATED_BOUNDARY_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
729
|
-
<g opacity="0.6">
|
|
730
|
-
<rect width="24" height="24" rx="12" fill="#1E1E1F" fill-opacity="0.5"/>
|
|
731
|
-
<path d="M8.20573 12.4961C6.739 11.1707 4.85775 11.2284 3.60938 11.1707C6.17744 13.0156 6.05584 15.7887 5.67404 16.9446H14.327C13.837 13.1673 15.5321 10.1289 16.4408 9.08187C15.0342 9.46118 13.5794 10.8303 13.0278 11.4674C12.8102 8.94572 13.992 5.97489 14.61 4.80469C12.5235 5.92214 11.0501 8.26056 10.4938 9.56261C9.22803 7.5947 6.83894 7.17806 5.883 6.9432C8.20573 10.2373 8.00039 11.1707 8.20573 12.4961Z" fill="white"/>
|
|
732
|
-
<mask id="path-3-outside-1_9822_43516" maskUnits="userSpaceOnUse" x="13.2344" y="7.20545" width="12.0208" height="12.0208" fill="black">
|
|
733
|
-
<rect fill="white" x="13.2344" y="7.20545" width="12.0208" height="12.0208"/>
|
|
734
|
-
<path d="M20.6852 11.1208C19.9042 10.3398 18.6378 10.3398 17.8568 11.1208L17.2733 11.7043C16.6707 12.3069 16.5358 13.1973 16.8631 13.9319L17.5916 13.2034C17.5657 12.9181 17.6619 12.6236 17.8803 12.4052L18.5674 11.7181C18.9579 11.3276 19.5911 11.3276 19.9816 11.7181L20.4056 12.1421C20.7959 12.5326 20.796 13.1658 20.4056 13.5563L19.7185 14.2434C19.5128 14.449 19.2393 14.5457 18.9699 14.5348L18.2235 15.2812C18.9538 15.596 19.8325 15.4565 20.429 14.86L21.0125 14.2765C21.7935 13.4955 21.7936 12.2291 21.0125 11.4481L20.6852 11.1208Z"/>
|
|
735
|
-
</mask>
|
|
736
|
-
<path d="M20.6852 11.1208C19.9042 10.3398 18.6378 10.3398 17.8568 11.1208L17.2733 11.7043C16.6707 12.3069 16.5358 13.1973 16.8631 13.9319L17.5916 13.2034C17.5657 12.9181 17.6619 12.6236 17.8803 12.4052L18.5674 11.7181C18.9579 11.3276 19.5911 11.3276 19.9816 11.7181L20.4056 12.1421C20.7959 12.5326 20.796 13.1658 20.4056 13.5563L19.7185 14.2434C19.5128 14.449 19.2393 14.5457 18.9699 14.5348L18.2235 15.2812C18.9538 15.596 19.8325 15.4565 20.429 14.86L21.0125 14.2765C21.7935 13.4955 21.7936 12.2291 21.0125 11.4481L20.6852 11.1208Z" fill="white"/>
|
|
737
|
-
<path d="M20.6852 11.1208L21.7458 10.0601L21.7459 10.0601L20.6852 11.1208ZM17.8568 11.1208L16.7961 10.0601L16.7962 10.0601L17.8568 11.1208ZM17.2733 11.7043L16.2126 10.6437L16.2126 10.6436L17.2733 11.7043ZM16.8631 13.9319L17.9238 14.9926L16.381 16.5354L15.493 14.5425L16.8631 13.9319ZM17.5916 13.2034L19.0855 13.0678L19.149 13.7674L18.6523 14.2641L17.5916 13.2034ZM20.4056 12.1421L21.4662 11.0814L21.4665 11.0817L20.4056 12.1421ZM18.9699 14.5348L17.9093 13.4741L18.3741 13.0093L19.0309 13.036L18.9699 14.5348ZM18.2235 15.2812L17.6298 16.6587L15.5997 15.7837L17.1628 14.2206L18.2235 15.2812ZM20.429 14.86L21.4897 15.9207L21.4897 15.9207L20.429 14.86ZM21.0125 14.2765L22.0732 15.3371L22.0732 15.3372L21.0125 14.2765ZM20.6852 11.1208L19.6246 12.1815C19.4294 11.9862 19.1127 11.9863 18.9174 12.1815L17.8568 11.1208L16.7962 10.0601C18.163 8.69337 20.379 8.6934 21.7458 10.0601L20.6852 11.1208ZM17.8568 11.1208L18.9175 12.1814L18.334 12.7649L17.2733 11.7043L16.2126 10.6436L16.7961 10.0601L17.8568 11.1208ZM17.2733 11.7043L18.334 12.7649C18.1877 12.9112 18.1488 13.1318 18.2333 13.3214L16.8631 13.9319L15.493 14.5425C14.9228 13.2629 15.1537 11.7026 16.2126 10.6437L17.2733 11.7043ZM16.8631 13.9319L15.8025 12.8713L16.531 12.1428L17.5916 13.2034L18.6523 14.2641L17.9238 14.9926L16.8631 13.9319ZM17.5916 13.2034L16.0978 13.339C16.0334 12.6302 16.2727 11.8914 16.8196 11.3445L17.8803 12.4052L18.9409 13.4658C19.051 13.3558 19.098 13.206 19.0855 13.0678L17.5916 13.2034ZM17.8803 12.4052L16.8196 11.3445L17.5067 10.6574L18.5674 11.7181L19.628 12.7788L18.9409 13.4658L17.8803 12.4052ZM18.5674 11.7181L17.5067 10.6574C18.483 9.68112 20.0659 9.68112 21.0422 10.6574L19.9816 11.7181L18.9209 12.7788C19.1162 12.974 19.4328 12.974 19.628 12.7788L18.5674 11.7181ZM19.9816 11.7181L21.0422 10.6574L21.4662 11.0814L20.4056 12.1421L19.3449 13.2027L18.9209 12.7788L19.9816 11.7181ZM20.4056 12.1421L21.4665 11.0817C22.4419 12.0577 22.4428 13.6404 21.4662 14.617L20.4056 13.5563L19.3449 12.4956C19.1493 12.6913 19.1498 13.0076 19.3446 13.2024L20.4056 12.1421ZM20.4056 13.5563L21.4662 14.617L20.7791 15.304L19.7185 14.2434L18.6578 13.1827L19.3449 12.4956L20.4056 13.5563ZM19.7185 14.2434L20.7791 15.304C20.2628 15.8204 19.5762 16.0607 18.909 16.0335L18.9699 14.5348L19.0309 13.036C18.9025 13.0308 18.7629 13.0777 18.6578 13.1827L19.7185 14.2434ZM18.9699 14.5348L20.0306 15.5954L19.2841 16.3419L18.2235 15.2812L17.1628 14.2206L17.9093 13.4741L18.9699 14.5348ZM18.2235 15.2812L18.8172 13.9037C19.0042 13.9843 19.2223 13.9455 19.3684 13.7993L20.429 14.86L21.4897 15.9207C20.4427 16.9676 18.9034 17.2077 17.6298 16.6587L18.2235 15.2812ZM20.429 14.86L19.3684 13.7994L19.9519 13.2159L21.0125 14.2765L22.0732 15.3372L21.4897 15.9207L20.429 14.86ZM21.0125 14.2765L19.9518 13.2159C20.1471 13.0206 20.1471 12.704 19.9519 12.5088L21.0125 11.4481L22.0732 10.3874C23.4401 11.7543 23.4399 13.9703 22.0732 15.3371L21.0125 14.2765ZM21.0125 11.4481L19.9519 12.5088L19.6246 12.1814L20.6852 11.1208L21.7459 10.0601L22.0732 10.3874L21.0125 11.4481Z" fill="#8E8E8F" mask="url(#path-3-outside-1_9822_43516)"/>
|
|
738
|
-
<mask id="path-5-outside-2_9822_43516" maskUnits="userSpaceOnUse" x="9.22265" y="10.388" width="12.7279" height="12.7279" fill="black">
|
|
739
|
-
<rect fill="white" x="9.22265" y="10.388" width="12.7279" height="12.7279"/>
|
|
740
|
-
<path d="M16.1708 14.5077C15.4353 14.1778 14.5422 14.3133 13.9383 14.9172L13.3548 15.5007C12.574 16.2818 12.5738 17.5481 13.3548 18.3291L13.6821 18.6564C14.4631 19.4374 15.7295 19.4373 16.5105 18.6564L17.094 18.0729C17.6895 17.4775 17.8299 16.6003 17.5173 15.8708L16.7743 16.6138C16.7828 16.8803 16.6863 17.1494 16.4829 17.3527L15.7952 18.0405C15.4046 18.4309 14.7714 18.431 14.3809 18.0405L13.957 17.6165C13.5667 17.226 13.5666 16.5927 13.957 16.2023L14.6447 15.5145C14.8654 15.2939 15.1639 15.1979 15.452 15.2266L16.1708 14.5077Z"/>
|
|
741
|
-
</mask>
|
|
742
|
-
<path d="M16.1708 14.5077C15.4353 14.1778 14.5422 14.3133 13.9383 14.9172L13.3548 15.5007C12.574 16.2818 12.5738 17.5481 13.3548 18.3291L13.6821 18.6564C14.4631 19.4374 15.7295 19.4373 16.5105 18.6564L17.094 18.0729C17.6895 17.4775 17.8299 16.6003 17.5173 15.8708L16.7743 16.6138C16.7828 16.8803 16.6863 17.1494 16.4829 17.3527L15.7952 18.0405C15.4046 18.4309 14.7714 18.431 14.3809 18.0405L13.957 17.6165C13.5667 17.226 13.5666 16.5927 13.957 16.2023L14.6447 15.5145C14.8654 15.2939 15.1639 15.1979 15.452 15.2266L16.1708 14.5077Z" fill="white"/>
|
|
743
|
-
<path d="M16.1708 14.5077L16.7847 13.1391L18.7701 14.0297L17.2315 15.5684L16.1708 14.5077ZM13.3548 15.5007L12.294 14.4402L12.2941 14.44L13.3548 15.5007ZM16.5105 18.6564L17.5712 19.7171L17.5711 19.7172L16.5105 18.6564ZM17.5173 15.8708L16.4567 14.8102L18.0236 13.2433L18.8962 15.2802L17.5173 15.8708ZM16.7743 16.6138L15.2751 16.6613L15.2545 16.0123L15.7137 15.5532L16.7743 16.6138ZM15.7952 18.0405L16.8558 19.1011L16.8556 19.1013L15.7952 18.0405ZM13.957 17.6165L12.8963 18.6772L12.8959 18.6767L13.957 17.6165ZM13.957 16.2023L12.8961 15.1418L12.8963 15.1416L13.957 16.2023ZM15.452 15.2266L16.5126 16.2872L16.0102 16.7896L15.3032 16.7192L15.452 15.2266ZM16.1708 14.5077L15.5569 15.8763C15.3688 15.792 15.1469 15.8299 14.999 15.9779L13.9383 14.9172L12.8776 13.8565C13.9375 12.7967 15.5018 12.5636 16.7847 13.1391L16.1708 14.5077ZM13.9383 14.9172L14.999 15.9779L14.4155 16.5614L13.3548 15.5007L12.2941 14.44L12.8776 13.8565L13.9383 14.9172ZM13.3548 15.5007L14.4156 16.5612C14.2202 16.7567 14.2204 17.0734 14.4155 17.2685L13.3548 18.3291L12.2941 19.3898C10.9272 18.0229 10.9277 15.8069 12.294 14.4402L13.3548 15.5007ZM13.3548 18.3291L14.4155 17.2685L14.7428 17.5958L13.6821 18.6564L12.6215 19.7171L12.2941 19.3898L13.3548 18.3291ZM13.6821 18.6564L14.7428 17.5958C14.9378 17.7908 15.2546 17.791 15.45 17.5956L16.5105 18.6564L17.5711 19.7172C16.2044 21.0836 13.9884 21.084 12.6215 19.7171L13.6821 18.6564ZM16.5105 18.6564L15.4499 17.5958L16.0334 17.0123L17.094 18.0729L18.1547 19.1336L17.5712 19.7171L16.5105 18.6564ZM17.094 18.0729L16.0334 17.0123C16.1795 16.8662 16.2185 16.6481 16.1385 16.4615L17.5173 15.8708L18.8962 15.2802C19.4413 16.5526 19.1996 18.0887 18.1547 19.1336L17.094 18.0729ZM17.5173 15.8708L18.578 16.9315L17.835 17.6745L16.7743 16.6138L15.7137 15.5532L16.4567 14.8102L17.5173 15.8708ZM16.7743 16.6138L18.2736 16.5664C18.2945 17.226 18.0544 17.9026 17.5436 18.4134L16.4829 17.3527L15.4223 16.2921C15.3182 16.3961 15.2711 16.5346 15.2751 16.6613L16.7743 16.6138ZM16.4829 17.3527L17.5436 18.4134L16.8558 19.1011L15.7952 18.0405L14.7345 16.9798L15.4223 16.2921L16.4829 17.3527ZM15.7952 18.0405L16.8556 19.1013C15.8795 20.0771 14.2967 20.0776 13.3203 19.1011L14.3809 18.0405L15.4416 16.9798C15.2461 16.7844 14.9297 16.7847 14.7347 16.9797L15.7952 18.0405ZM14.3809 18.0405L13.3203 19.1011L12.8963 18.6772L13.957 17.6165L15.0176 16.5558L15.4416 16.9798L14.3809 18.0405ZM13.957 17.6165L12.8959 18.6767C11.9207 17.7008 11.92 16.1182 12.8961 15.1418L13.957 16.2023L15.0178 17.2628C15.2133 17.0672 15.2128 16.7512 15.018 16.5563L13.957 17.6165ZM13.957 16.2023L12.8963 15.1416L13.5841 14.4539L14.6447 15.5145L15.7054 16.5752L15.0176 17.2629L13.957 16.2023ZM14.6447 15.5145L13.5841 14.4539C14.1364 13.9015 14.8848 13.6626 15.6007 13.734L15.452 15.2266L15.3032 16.7192C15.443 16.7331 15.5943 16.6862 15.7054 16.5752L14.6447 15.5145ZM15.452 15.2266L14.3913 14.1659L15.1101 13.4471L16.1708 14.5077L17.2315 15.5684L16.5126 16.2872L15.452 15.2266Z" fill="#8E8E8F" mask="url(#path-5-outside-2_9822_43516)"/>
|
|
744
|
-
<path d="M20.6852 11.1208C19.9042 10.3398 18.6378 10.3398 17.8568 11.1208L17.2733 11.7043C16.6707 12.3069 16.5358 13.1973 16.8631 13.9319L17.5916 13.2034C17.5657 12.9181 17.6619 12.6236 17.8803 12.4052L18.5674 11.7181C18.9579 11.3276 19.5911 11.3276 19.9816 11.7181L20.4056 12.1421C20.7959 12.5326 20.796 13.1658 20.4056 13.5563L19.7185 14.2434C19.5128 14.449 19.2393 14.5457 18.9699 14.5348L18.2235 15.2812C18.9538 15.596 19.8325 15.4565 20.429 14.86L21.0125 14.2765C21.7935 13.4955 21.7936 12.2291 21.0125 11.4481L20.6852 11.1208Z" fill="white"/>
|
|
745
|
-
<rect width="2.59942" height="2.97264" rx="1" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 21.1133 12.8486)" fill="#8E8E8F"/>
|
|
746
|
-
<rect width="1.91578" height="4.24403" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 19.6992 13.8066)" fill="#8E8E8F"/>
|
|
747
|
-
<rect width="2.59942" height="2.97264" rx="1" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 17.3125 16.6455)" fill="#8E8E8F"/>
|
|
748
|
-
</g>
|
|
749
|
-
</svg>`;
|
|
750
|
-
/**
|
|
751
|
-
* 遍历割草任务,下述四个字段可以在路径中唯一确定遍历的位置(当前区域、当前块、当前行、在当前行上的路程)
|
|
752
|
-
*/
|
|
753
|
-
const ACTION_BLOCK_COVER = 5;
|
|
754
|
-
/**
|
|
755
|
-
* 遍历割草块转移任务(在同一区域中的一个块转移到下一个块),下述四个字段可以在路径中唯一确定转移的位置(当前区域、前置块、当前转移路径线序号、在当前线上的路程)
|
|
756
|
-
*/
|
|
757
|
-
const ACTION_BLOCK_TRANSFER = 6;
|
|
758
|
-
/**
|
|
759
|
-
* 边界割草任务(割草任务内部的巡边任务)
|
|
760
|
-
*/
|
|
761
|
-
const ACTION_BOUNDARY_TASK = 8;
|
|
758
|
+
const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
|
|
759
|
+
|
|
760
|
+
const identity$1 = (arg) => arg;
|
|
761
|
+
function useStore(api, selector = identity$1) {
|
|
762
|
+
const slice = React.useSyncExternalStore(
|
|
763
|
+
api.subscribe,
|
|
764
|
+
() => selector(api.getState()),
|
|
765
|
+
() => selector(api.getInitialState())
|
|
766
|
+
);
|
|
767
|
+
React.useDebugValue(slice);
|
|
768
|
+
return slice;
|
|
769
|
+
}
|
|
770
|
+
const createImpl = (createState) => {
|
|
771
|
+
const api = createStore(createState);
|
|
772
|
+
const useBoundStore = (selector) => useStore(api, selector);
|
|
773
|
+
Object.assign(useBoundStore, api);
|
|
774
|
+
return useBoundStore;
|
|
775
|
+
};
|
|
776
|
+
const create = (createState) => createState ? createImpl(createState) : createImpl;
|
|
777
|
+
|
|
778
|
+
const useSubBoundaryBorderStore = create((set, get) => ({
|
|
779
|
+
subBoundaryBorder: {},
|
|
780
|
+
// 追加单个数据
|
|
781
|
+
addSubBoundaryBorder: (key, element) => set((state) => ({
|
|
782
|
+
subBoundaryBorder: {
|
|
783
|
+
...state.subBoundaryBorder,
|
|
784
|
+
[key]: element,
|
|
785
|
+
},
|
|
786
|
+
})),
|
|
787
|
+
// 清空所有数据
|
|
788
|
+
clearSubBoundaryBorder: () => set({ subBoundaryBorder: {} }),
|
|
789
|
+
// 障碍物
|
|
790
|
+
obstacles: {},
|
|
791
|
+
addObstacles: (key, element) => set((state) => ({
|
|
792
|
+
obstacles: {
|
|
793
|
+
...state.obstacles,
|
|
794
|
+
[key]: element,
|
|
795
|
+
},
|
|
796
|
+
})),
|
|
797
|
+
clearObstacles: () => set({ obstacles: {} }),
|
|
798
|
+
// svg数据
|
|
799
|
+
svgElements: {},
|
|
800
|
+
addSvgElements: (key, element) => set((state) => ({
|
|
801
|
+
svgElements: {
|
|
802
|
+
...state.svgElements,
|
|
803
|
+
[key]: element,
|
|
804
|
+
},
|
|
805
|
+
})),
|
|
806
|
+
clearSvgElements: () => set({ svgElements: {} }),
|
|
807
|
+
}));
|
|
762
808
|
|
|
763
809
|
/**
|
|
764
810
|
* 路径图层
|
|
@@ -810,51 +856,90 @@ class ChannelLayer extends BaseLayer {
|
|
|
810
856
|
}
|
|
811
857
|
// �� 修改:计算包含所有分区和通道的边界框
|
|
812
858
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
813
|
-
// 1.
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
859
|
+
// 1. 先计算所有分区的边界,如果能拿到边界的svg的大小,就使用这个如果拿不到,就根据分区去计算
|
|
860
|
+
const svg = document.getElementById(SVG_MAP_VIEW_ID);
|
|
861
|
+
if (svg && svg instanceof SVGSVGElement && svg.viewBox) {
|
|
862
|
+
const viewBox = svg.viewBox.baseVal;
|
|
863
|
+
minX = viewBox.x;
|
|
864
|
+
minY = viewBox.y;
|
|
865
|
+
maxX = viewBox.x + viewBox.width;
|
|
866
|
+
maxY = viewBox.y + viewBox.height;
|
|
867
|
+
}
|
|
868
|
+
else {
|
|
869
|
+
for (const partitionId in subBoundaryBorder) {
|
|
870
|
+
const boundaryData = subBoundaryBorder[partitionId];
|
|
871
|
+
if (boundaryData && boundaryData.coordinates && boundaryData.coordinates.length > 0) {
|
|
872
|
+
for (const coord of boundaryData.coordinates) {
|
|
873
|
+
minX = Math.min(minX, coord[0]);
|
|
874
|
+
minY = Math.min(minY, coord[1]);
|
|
875
|
+
maxX = Math.max(maxX, coord[0]);
|
|
876
|
+
maxY = Math.max(maxY, coord[1]);
|
|
877
|
+
}
|
|
822
878
|
}
|
|
823
879
|
}
|
|
824
880
|
}
|
|
825
881
|
// 2. 再计算所有通道的边界
|
|
826
882
|
for (const element of this.elements) {
|
|
827
|
-
const tunnelConnection = element.originalData?.connection;
|
|
828
|
-
if (tunnelConnection && Array.isArray(tunnelConnection)) {
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
883
|
+
// const tunnelConnection = element.originalData?.connection;
|
|
884
|
+
// if (tunnelConnection && Array.isArray(tunnelConnection)) {
|
|
885
|
+
// const clipPathId = `channel-exclude-${
|
|
886
|
+
// element.originalData?.id || Math.random().toString(36).substr(2, 9)
|
|
887
|
+
// }`;
|
|
888
|
+
// // 检查是否已存在该 clipPath
|
|
889
|
+
// const existingClipPath = defs.querySelector(`#${clipPathId}`);
|
|
890
|
+
// if (existingClipPath) continue;
|
|
891
|
+
// // 创建 clipPath
|
|
892
|
+
// const clipPath = document.createElementNS('http://www.w3.org/2000/svg', 'clipPath');
|
|
893
|
+
// clipPath.setAttribute('id', clipPathId);
|
|
894
|
+
// clipPath.setAttribute('clipPathUnits', 'userSpaceOnUse');
|
|
895
|
+
// // === 合成一个 path ===
|
|
896
|
+
// let d = `M ${minX} ${minY} L ${maxX} ${minY} L ${maxX} ${maxY} L ${minX} ${maxY} Z`;
|
|
897
|
+
// for (const partitionId of tunnelConnection) {
|
|
898
|
+
// const boundaryData = subBoundaryBorder[partitionId];
|
|
899
|
+
// if (boundaryData && boundaryData.coordinates.length >= 3) {
|
|
900
|
+
// d += ` M ${boundaryData.coordinates[0][0]} ${boundaryData.coordinates[0][1]}`;
|
|
901
|
+
// for (let i = 1; i < boundaryData.coordinates.length; i++) {
|
|
902
|
+
// d += ` L ${boundaryData.coordinates[i][0]} ${boundaryData.coordinates[i][1]}`;
|
|
903
|
+
// }
|
|
904
|
+
// d += ' Z';
|
|
905
|
+
// }
|
|
906
|
+
// }
|
|
907
|
+
// const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
908
|
+
// path.setAttribute('d', d);
|
|
909
|
+
// path.setAttribute('clip-rule', 'evenodd'); // 关键
|
|
910
|
+
// clipPath.appendChild(path);
|
|
911
|
+
// defs.appendChild(clipPath);
|
|
912
|
+
// clipPathIdsMap[element.originalData?.id.toString()] = clipPathId;
|
|
913
|
+
// } else {
|
|
914
|
+
const clipPathId = `channel-exclude-all-${element.originalData?.id || Math.random().toString(36).substr(2, 9)}`;
|
|
915
|
+
// 检查是否已存在该 clipPath
|
|
916
|
+
const existingClipPath = defs.querySelector(`#${clipPathId}`);
|
|
917
|
+
if (existingClipPath)
|
|
918
|
+
continue;
|
|
919
|
+
// 创建 clipPath
|
|
920
|
+
const clipPath = document.createElementNS('http://www.w3.org/2000/svg', 'clipPath');
|
|
921
|
+
clipPath.setAttribute('id', clipPathId);
|
|
922
|
+
clipPath.setAttribute('clipPathUnits', 'userSpaceOnUse');
|
|
923
|
+
// === 合成一个 path ===
|
|
924
|
+
let d = `M ${minX} ${minY} L ${maxX} ${minY} L ${maxX} ${maxY} L ${minX} ${maxY} Z`;
|
|
925
|
+
for (const partitionId in subBoundaryBorder) {
|
|
926
|
+
const boundaryData = subBoundaryBorder[partitionId];
|
|
927
|
+
if (boundaryData && boundaryData.coordinates.length >= 3) {
|
|
928
|
+
d += ` M ${boundaryData.coordinates[0][0]} ${boundaryData.coordinates[0][1]}`;
|
|
929
|
+
for (let i = 1; i < boundaryData.coordinates.length; i++) {
|
|
930
|
+
d += ` L ${boundaryData.coordinates[i][0]} ${boundaryData.coordinates[i][1]}`;
|
|
848
931
|
}
|
|
932
|
+
d += ' Z';
|
|
849
933
|
}
|
|
850
|
-
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
851
|
-
path.setAttribute('d', d);
|
|
852
|
-
path.setAttribute('clip-rule', 'evenodd'); // 关键
|
|
853
|
-
clipPath.appendChild(path);
|
|
854
|
-
defs.appendChild(clipPath);
|
|
855
|
-
clipPathIdsMap[element.originalData?.id.toString()] = clipPathId;
|
|
856
934
|
}
|
|
935
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
936
|
+
path.setAttribute('d', d);
|
|
937
|
+
path.setAttribute('clip-rule', 'evenodd'); // 关键
|
|
938
|
+
clipPath.appendChild(path);
|
|
939
|
+
defs.appendChild(clipPath);
|
|
940
|
+
clipPathIdsMap[element.originalData?.id.toString()] = clipPathId;
|
|
857
941
|
}
|
|
942
|
+
// }
|
|
858
943
|
return clipPathIdsMap;
|
|
859
944
|
}
|
|
860
945
|
/**
|
|
@@ -918,13 +1003,14 @@ class PathLayer extends BaseLayer {
|
|
|
918
1003
|
this.level = 3;
|
|
919
1004
|
this.scale = 1;
|
|
920
1005
|
this.lineScale = 1;
|
|
1006
|
+
this.boundaryPaths = {};
|
|
921
1007
|
this.type = LAYER_DEFAULT_TYPE.PATH;
|
|
922
1008
|
}
|
|
923
1009
|
/**
|
|
924
1010
|
* 创建所有分区并集的 clipPath
|
|
925
1011
|
*/
|
|
926
1012
|
createUnionClipPath(svgGroup) {
|
|
927
|
-
const { subBoundaryBorder } = useSubBoundaryBorderStore.getState();
|
|
1013
|
+
const { subBoundaryBorder, obstacles, svgElements } = useSubBoundaryBorderStore.getState();
|
|
928
1014
|
// 确保 defs 元素存在
|
|
929
1015
|
let defs = svgGroup.querySelector('defs');
|
|
930
1016
|
if (!defs) {
|
|
@@ -938,7 +1024,7 @@ class PathLayer extends BaseLayer {
|
|
|
938
1024
|
defs.removeChild(existing);
|
|
939
1025
|
// 合成所有分区的 path
|
|
940
1026
|
let d = '';
|
|
941
|
-
//
|
|
1027
|
+
// 1. 外圈(主边界,顺时针)
|
|
942
1028
|
Object.values(subBoundaryBorder).forEach((item) => {
|
|
943
1029
|
const bCoords = item.coordinates;
|
|
944
1030
|
if (bCoords.length >= 3) {
|
|
@@ -949,6 +1035,26 @@ class PathLayer extends BaseLayer {
|
|
|
949
1035
|
d += ' Z ';
|
|
950
1036
|
}
|
|
951
1037
|
});
|
|
1038
|
+
// 2. 内圈(禁区,逆时针)
|
|
1039
|
+
Object.values(obstacles).forEach((item) => {
|
|
1040
|
+
const bCoords = item.coordinates;
|
|
1041
|
+
if (bCoords.length >= 3) {
|
|
1042
|
+
d += `M ${bCoords[bCoords.length - 1][0]} ${bCoords[bCoords.length - 1][1]}`;
|
|
1043
|
+
for (let i = bCoords.length - 2; i >= 0; i--) {
|
|
1044
|
+
d += ` L ${bCoords[i][0]} ${bCoords[i][1]}`;
|
|
1045
|
+
}
|
|
1046
|
+
d += ' Z ';
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
// 3. svgElements(直接拼接path字符串,建议逆时针)
|
|
1050
|
+
if (Array.isArray(svgElements)) {
|
|
1051
|
+
svgElements.forEach((svgPath) => {
|
|
1052
|
+
const svgPathString = svgPath?.metadata?.svg;
|
|
1053
|
+
if (svgPathString && typeof svgPathString === 'string' && svgPathString.trim()) {
|
|
1054
|
+
d += svgPathString + ' ';
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
952
1058
|
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
953
1059
|
path.setAttribute('d', d);
|
|
954
1060
|
const clipPath = document.createElementNS('http://www.w3.org/2000/svg', 'clipPath');
|
|
@@ -973,17 +1079,21 @@ class PathLayer extends BaseLayer {
|
|
|
973
1079
|
// 2. 创建一个组,应用 clipPath
|
|
974
1080
|
const group = document.createElementNS('http://www.w3.org/2000/svg', 'g');
|
|
975
1081
|
group.setAttribute('clip-path', `url(#${clipPathId})`);
|
|
976
|
-
group.setAttribute('opacity', '0.
|
|
1082
|
+
group.setAttribute('opacity', '0.6'); // 统一透明度,防止叠加脏乱
|
|
977
1083
|
// 3. 渲染所有路径
|
|
978
1084
|
for (const element of this.elements) {
|
|
979
|
-
|
|
1085
|
+
const { id, elements } = element;
|
|
1086
|
+
this.boundaryPaths[id] = [];
|
|
1087
|
+
elements.forEach((element) => {
|
|
1088
|
+
this.renderPathToGroup(group, id, element);
|
|
1089
|
+
});
|
|
980
1090
|
}
|
|
981
1091
|
svgGroup.appendChild(group);
|
|
982
1092
|
}
|
|
983
1093
|
/**
|
|
984
1094
|
* 渲染单个路径到指定的组中
|
|
985
1095
|
*/
|
|
986
|
-
renderPathToGroup(group, element) {
|
|
1096
|
+
renderPathToGroup(group, id, element) {
|
|
987
1097
|
const { coordinates, style } = element;
|
|
988
1098
|
if (coordinates.length < 2)
|
|
989
1099
|
return;
|
|
@@ -999,7 +1109,7 @@ class PathLayer extends BaseLayer {
|
|
|
999
1109
|
// 直接给fill的颜色设置透明度会导致path重叠的部分颜色叠加,所以使用fill填充实色,通过fill-opacity设置透明度
|
|
1000
1110
|
path.setAttribute('fill', 'none');
|
|
1001
1111
|
// path.setAttribute('fill-opacity', '0.4');
|
|
1002
|
-
path.setAttribute('stroke', style.
|
|
1112
|
+
path.setAttribute('stroke', style.lineColor || '#000000');
|
|
1003
1113
|
path.setAttribute('mix-blend-mode', 'normal');
|
|
1004
1114
|
const lineWidth = Math.max(style.lineWidth || 1, 0.5);
|
|
1005
1115
|
path.setAttribute('stroke-width', lineWidth.toString());
|
|
@@ -1007,13 +1117,8 @@ class PathLayer extends BaseLayer {
|
|
|
1007
1117
|
path.setAttribute('stroke-linejoin', 'round');
|
|
1008
1118
|
// 注意:这里不设置 opacity,因为透明度由父组控制
|
|
1009
1119
|
// path.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
1010
|
-
if (style.lineDash && style.lineDash.length > 0) {
|
|
1011
|
-
path.setAttribute('stroke-dasharray', style.lineDash.join(','));
|
|
1012
|
-
}
|
|
1013
|
-
else if (style.strokeDasharray) {
|
|
1014
|
-
path.setAttribute('stroke-dasharray', style.strokeDasharray);
|
|
1015
|
-
}
|
|
1016
1120
|
path.classList.add('vector-path');
|
|
1121
|
+
this.boundaryPaths[id].push(path);
|
|
1017
1122
|
group.appendChild(path);
|
|
1018
1123
|
}
|
|
1019
1124
|
}
|
|
@@ -1122,7 +1227,7 @@ class ObstacleLayer extends BaseLayer {
|
|
|
1122
1227
|
}
|
|
1123
1228
|
}
|
|
1124
1229
|
|
|
1125
|
-
var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGYAAABqCAYAAABOHSQZAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAADRRSURBVHgB7X1pkF3HdV533+W9N9ubGWBmCHCwcEiBImBSBsF9EWBJlMmSIm/FilWJk3+y47J/+Icdu8oxQUflchanKhVX+YeTSiKp7ISU5FiSJZKiTFIiZZIyCqQgQBRIgdiIZQbALG/ect+93Z1zer93BuAQAiG6ig28ufdt9/Xtr893vnO6b19C3i/vl/fL++X98n55v7xf3utFSkkv8RoNnlP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5OTF820K0FQAAAAASUVORK5CYII=";
|
|
1126
1231
|
|
|
1127
1232
|
/**
|
|
1128
1233
|
* 充电桩图层
|
|
@@ -1312,7 +1417,7 @@ class SvgElementLayer extends BaseLayer {
|
|
|
1312
1417
|
// 在transformGroup上应用变换:平移到中心,旋转,缩放,然后居中SVG
|
|
1313
1418
|
const transform = [
|
|
1314
1419
|
`translate(${center[0]}, ${center[1]})`,
|
|
1315
|
-
`rotate(${(direction * 180) / Math.PI})`,
|
|
1420
|
+
`rotate(${-(direction * 180) / Math.PI})`,
|
|
1316
1421
|
`scale(${userScale})`,
|
|
1317
1422
|
`translate(${-originalWidth / 2}, ${-originalHeight / 2})`,
|
|
1318
1423
|
].join(' ');
|
|
@@ -1341,7 +1446,6 @@ class SvgElementLayer extends BaseLayer {
|
|
|
1341
1446
|
renderSvgPlaceholder(svgGroup, center, metadata, style) {
|
|
1342
1447
|
const size = (metadata?.scale || 1) * 20;
|
|
1343
1448
|
const rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
|
|
1344
|
-
console.log('style==', style);
|
|
1345
1449
|
rect.setAttribute('x', ((center[0] - size / 2) / 50).toString());
|
|
1346
1450
|
rect.setAttribute('y', ((center[1] - size / 2) / 50).toString());
|
|
1347
1451
|
rect.setAttribute('width', size.toString());
|
|
@@ -1411,9 +1515,10 @@ class VisionOffLayer extends BaseLayer {
|
|
|
1411
1515
|
*/
|
|
1412
1516
|
const BOUNDARY_STYLES = {
|
|
1413
1517
|
lineColor: '#ffffff',
|
|
1414
|
-
fillColor: 'rgba(239, 255, 237, 0.
|
|
1518
|
+
fillColor: 'rgba(239, 255, 237, 0.1)', // 更鲜艳的绿色半透明填充,增强可见性
|
|
1415
1519
|
lineWidth: 2,
|
|
1416
1520
|
opacity: DEFAULT_OPACITIES.FULL,
|
|
1521
|
+
mowingLineColor: 'rgba(99, 216, 174, 1)',
|
|
1417
1522
|
};
|
|
1418
1523
|
const VISION_OFF_AREA_STYLES = {
|
|
1419
1524
|
lineColor: 'rgba(108, 167, 255, 1)',
|
|
@@ -1442,10 +1547,11 @@ const DOODLE_STYLES = {
|
|
|
1442
1547
|
};
|
|
1443
1548
|
const PATH_EDGE_STYLES = {
|
|
1444
1549
|
lineWidth: DEFAULT_LINE_WIDTHS.PATH,
|
|
1445
|
-
opacity: DEFAULT_OPACITIES.
|
|
1446
|
-
edgeLineColor: 'rgba(
|
|
1550
|
+
opacity: DEFAULT_OPACITIES.MEDIUM,
|
|
1551
|
+
edgeLineColor: 'rgba(231, 238, 246)',
|
|
1447
1552
|
transLineColor: 'transparent',
|
|
1448
|
-
|
|
1553
|
+
mowedLineColor: 'rgba(231, 238, 246)',
|
|
1554
|
+
mowingLineColor: 'rgba(123, 200, 187)',
|
|
1449
1555
|
};
|
|
1450
1556
|
const CHANNEL_STYLES = {
|
|
1451
1557
|
lineColor: 'purple',
|
|
@@ -1529,11 +1635,11 @@ function createPathSegmentsByType(list) {
|
|
|
1529
1635
|
let currentSegmentType = null;
|
|
1530
1636
|
for (const currentPoint of list) {
|
|
1531
1637
|
const currentCoord = {
|
|
1532
|
-
x: currentPoint.postureX
|
|
1533
|
-
y:
|
|
1638
|
+
x: currentPoint.postureX,
|
|
1639
|
+
y: currentPoint.postureY
|
|
1534
1640
|
};
|
|
1535
1641
|
if (lastPoint !== null) {
|
|
1536
|
-
// 判断上一个点和当前点是否需要绘制 (
|
|
1642
|
+
// 判断上一个点和当前点是否需要绘制 (iso端逻辑)
|
|
1537
1643
|
const lastShouldDraw = lastPoint.pathType === '00' || lastPoint.pathType === '01' || lastPoint.knifeRotation === '01';
|
|
1538
1644
|
const currentShouldDraw = currentPoint.pathType === '00' || currentPoint.pathType === '01' || currentPoint.knifeRotation === '01';
|
|
1539
1645
|
let segmentType;
|
|
@@ -1553,8 +1659,8 @@ function createPathSegmentsByType(list) {
|
|
|
1553
1659
|
// 开始新段
|
|
1554
1660
|
currentSegment = [
|
|
1555
1661
|
{
|
|
1556
|
-
x: lastPoint.postureX
|
|
1557
|
-
y:
|
|
1662
|
+
x: lastPoint.postureX,
|
|
1663
|
+
y: lastPoint.postureY
|
|
1558
1664
|
},
|
|
1559
1665
|
currentCoord
|
|
1560
1666
|
];
|
|
@@ -1787,26 +1893,7 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1787
1893
|
}
|
|
1788
1894
|
// 第一步:收集所有TUNNEL数据的connection信息
|
|
1789
1895
|
const connectedBoundaryIds = new Set();
|
|
1790
|
-
//
|
|
1791
|
-
for (const subMap of mapData.sub_maps) {
|
|
1792
|
-
if (!subMap.elements)
|
|
1793
|
-
continue;
|
|
1794
|
-
// 找到该子地图中所有 type 为 TUNNEL 的元素
|
|
1795
|
-
const tunnelElements = subMap.elements.filter(element => element.type === 'TUNNEL');
|
|
1796
|
-
for (const tunnelElement of tunnelElements) {
|
|
1797
|
-
const connection = tunnelElement.connection;
|
|
1798
|
-
if (connection) {
|
|
1799
|
-
// connection可能是单个数字或数组
|
|
1800
|
-
if (Array.isArray(connection)) {
|
|
1801
|
-
connection.forEach(id => connectedBoundaryIds.add(id));
|
|
1802
|
-
}
|
|
1803
|
-
else if (typeof connection === 'number') {
|
|
1804
|
-
connectedBoundaryIds.add(connection);
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
}
|
|
1809
|
-
// 1.2 遍历mapData中的tunnels字段
|
|
1896
|
+
// 遍历mapData中的tunnels字段
|
|
1810
1897
|
if (mapData.tunnels && Array.isArray(mapData.tunnels)) {
|
|
1811
1898
|
for (const tunnel of mapData.tunnels) {
|
|
1812
1899
|
const connection = tunnel.connection;
|
|
@@ -1828,6 +1915,8 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1828
1915
|
continue;
|
|
1829
1916
|
// 每个sub_map的elements是边界坐标,没有sub_map只有一个boundary数据
|
|
1830
1917
|
const boundaryElement = subMap.elements.find(element => element.type === 'BOUNDARY');
|
|
1918
|
+
// 如果当前subMap存在充电桩且充电桩存在tunnel,说明当前subMap中的boundary是初始boundary,这个boundary不为孤立区域
|
|
1919
|
+
const hasTunnelToChargingPile = subMap.elements.some(element => element.type === 'CHARGING_PILE' && element.tunnel);
|
|
1831
1920
|
// 创建基础的 boundary 数据(来自 mapData)
|
|
1832
1921
|
const boundary = {
|
|
1833
1922
|
// 从 BOUNDARY 元素复制属性
|
|
@@ -1837,7 +1926,7 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1837
1926
|
points: convertPointsFormat(boundaryElement?.points) || [],
|
|
1838
1927
|
type: boundaryElement.type,
|
|
1839
1928
|
// 判断是否为孤立子区域
|
|
1840
|
-
isIsolated: !connectedBoundaryIds.has(boundaryElement.id)
|
|
1929
|
+
isIsolated: hasTunnelToChargingPile ? false : !connectedBoundaryIds.has(boundaryElement.id)
|
|
1841
1930
|
};
|
|
1842
1931
|
// 如果有 pathData,尝试匹配对应的分区数据
|
|
1843
1932
|
if (pathData) {
|
|
@@ -1858,180 +1947,13 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1858
1947
|
return boundaryData;
|
|
1859
1948
|
}
|
|
1860
1949
|
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
* 对应Java: public static int bytes2Int(byte[] data)
|
|
1869
|
-
*
|
|
1870
|
-
* @param data 源字节数组
|
|
1871
|
-
* @returns 返回int型数
|
|
1872
|
-
*/
|
|
1873
|
-
// public static bytes2Int(data: Uint8Array): number {
|
|
1874
|
-
// return FormatUtils.bytes2IntWithOffset(data, 0, false);
|
|
1875
|
-
// }
|
|
1876
|
-
/**
|
|
1877
|
-
* 从data数组的第position位置开始取4个字节组成int型数
|
|
1878
|
-
* 对应Java: public static int bytes2Int(byte[] data, int offset, boolean bigEndian)
|
|
1879
|
-
*
|
|
1880
|
-
* @param data 源字节数组
|
|
1881
|
-
* @param offset 要组成int型数据的起始位置
|
|
1882
|
-
* @param bigEndian 是否为大端
|
|
1883
|
-
* @returns 返回int型数
|
|
1884
|
-
*/
|
|
1885
|
-
static bytes2Int(data, offset, bigEndian) {
|
|
1886
|
-
return FormatUtils.bytes2IntWidthLength(data, offset, bigEndian, 4);
|
|
1887
|
-
}
|
|
1888
|
-
/**
|
|
1889
|
-
* 从data数组的第position位置开始取几个字节组成int型数
|
|
1890
|
-
* 对应Java: public static int bytes2Int(byte[] data, int offset, boolean bigEndian, int length)
|
|
1891
|
-
*
|
|
1892
|
-
* @param data 源字节数组
|
|
1893
|
-
* @param offset 要组成int型数据的起始位置
|
|
1894
|
-
* @param bigEndian 是否为大端
|
|
1895
|
-
* @param length 取的字节长度
|
|
1896
|
-
* @returns 返回int型数
|
|
1897
|
-
*/
|
|
1898
|
-
static bytes2IntWidthLength(data, offset, bigEndian, length) {
|
|
1899
|
-
if (!data || offset < 0 || offset > data.length) {
|
|
1900
|
-
return 0;
|
|
1901
|
-
}
|
|
1902
|
-
let result = 0;
|
|
1903
|
-
try {
|
|
1904
|
-
// 创建DataView来处理字节序
|
|
1905
|
-
const buffer = new ArrayBuffer(length);
|
|
1906
|
-
const view = new DataView(buffer);
|
|
1907
|
-
// 将指定长度的数据复制到buffer中
|
|
1908
|
-
const tempArray = new Uint8Array(buffer);
|
|
1909
|
-
for (let i = 0; i < length && offset + i < data.length; i++) {
|
|
1910
|
-
tempArray[i] = data[offset + i];
|
|
1911
|
-
}
|
|
1912
|
-
// 根据字节序读取数据(使用有符号整数,与Java保持一致)
|
|
1913
|
-
if (length === 1) {
|
|
1914
|
-
result = view.getInt8(0);
|
|
1915
|
-
}
|
|
1916
|
-
else if (length === 2) {
|
|
1917
|
-
result = view.getInt16(0, !bigEndian); // DataView的littleEndian参数与bigEndian相反
|
|
1918
|
-
}
|
|
1919
|
-
else if (length === 4) {
|
|
1920
|
-
result = view.getInt32(0, !bigEndian); // 改为 getInt32,返回有符号整数
|
|
1921
|
-
}
|
|
1922
|
-
else {
|
|
1923
|
-
// 对于其他长度,手动处理
|
|
1924
|
-
result = FormatUtils.manualBytes2Int(data, offset, bigEndian, length);
|
|
1925
|
-
}
|
|
1926
|
-
}
|
|
1927
|
-
catch (e) {
|
|
1928
|
-
// console.error(
|
|
1929
|
-
// `${FormatUtils.TAG}: bytes2Int: Exception : data = ${data}, offset = ${offset}`,
|
|
1930
|
-
// e
|
|
1931
|
-
// );
|
|
1932
|
-
// console.log(
|
|
1933
|
-
// `${FormatUtils.TAG}: bytes2Int: Exception = ${e instanceof Error ? e.message : e}`
|
|
1934
|
-
// );
|
|
1935
|
-
}
|
|
1936
|
-
return result;
|
|
1937
|
-
}
|
|
1938
|
-
/**
|
|
1939
|
-
* 手动处理字节到整数的转换(用于非标准长度)
|
|
1940
|
-
*
|
|
1941
|
-
* @param data 源字节数组
|
|
1942
|
-
* @param offset 起始位置
|
|
1943
|
-
* @param bigEndian 是否为大端
|
|
1944
|
-
* @param length 字节长度
|
|
1945
|
-
* @returns 转换后的整数
|
|
1946
|
-
*/
|
|
1947
|
-
static manualBytes2Int(data, offset, bigEndian, length) {
|
|
1948
|
-
let result = 0;
|
|
1949
|
-
if (bigEndian) {
|
|
1950
|
-
// 大端序:最高位字节在最低地址
|
|
1951
|
-
for (let i = 0; i < length && offset + i < data.length; i++) {
|
|
1952
|
-
result = (result << 8) | (data[offset + i] & 0xff);
|
|
1953
|
-
}
|
|
1954
|
-
}
|
|
1955
|
-
else {
|
|
1956
|
-
// 小端序:最低位字节在最低地址
|
|
1957
|
-
for (let i = length - 1; i >= 0; i--) {
|
|
1958
|
-
if (offset + i < data.length) {
|
|
1959
|
-
result = (result << 8) | (data[offset + i] & 0xff);
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
}
|
|
1963
|
-
return result;
|
|
1964
|
-
}
|
|
1965
|
-
/**
|
|
1966
|
-
* 将字节数组转换为十六进制字符串
|
|
1967
|
-
* 对应Java: public static String bytesToHex(byte[] bytes)
|
|
1968
|
-
*
|
|
1969
|
-
* @param bytes 字节数组
|
|
1970
|
-
* @returns 十六进制字符串
|
|
1971
|
-
*/
|
|
1972
|
-
static bytesToHex(bytes) {
|
|
1973
|
-
if (!bytes) {
|
|
1974
|
-
return 'null';
|
|
1975
|
-
}
|
|
1976
|
-
const hexArray = '0123456789ABCDEF'.split('');
|
|
1977
|
-
const hexChars = [];
|
|
1978
|
-
for (let j = 0; j < bytes.length; j++) {
|
|
1979
|
-
const v = bytes[j] & 0xff;
|
|
1980
|
-
hexChars.push(hexArray[v >>> 4]);
|
|
1981
|
-
hexChars.push(hexArray[v & 0x0f]);
|
|
1982
|
-
}
|
|
1983
|
-
return hexChars.join('');
|
|
1984
|
-
}
|
|
1985
|
-
/**
|
|
1986
|
-
* 将十六进制字符串转换为字节数组
|
|
1987
|
-
* 对应Java: public static byte[] hexStringToByteArray(String s)
|
|
1988
|
-
*
|
|
1989
|
-
* @param s 十六进制字符串
|
|
1990
|
-
* @returns 字节数组
|
|
1991
|
-
*/
|
|
1992
|
-
static hexStringToByteArray(s) {
|
|
1993
|
-
if (!s || s.length <= 0) {
|
|
1994
|
-
return null;
|
|
1995
|
-
}
|
|
1996
|
-
s = s.trim();
|
|
1997
|
-
const len = s.length;
|
|
1998
|
-
const data = new Uint8Array(len / 2);
|
|
1999
|
-
for (let i = 0; i < len - 1; i += 2) {
|
|
2000
|
-
try {
|
|
2001
|
-
const high = parseInt(s.charAt(i), 16);
|
|
2002
|
-
const low = parseInt(s.charAt(i + 1), 16);
|
|
2003
|
-
data[i / 2] = (high << 4) + low;
|
|
2004
|
-
}
|
|
2005
|
-
catch (e) {
|
|
2006
|
-
console.log('hexStringToByteArray: ' + e);
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
return data;
|
|
2010
|
-
}
|
|
2011
|
-
}
|
|
2012
|
-
FormatUtils.TAG = 'FormatUtils';
|
|
2013
|
-
// 使用示例
|
|
2014
|
-
// export function example() {
|
|
2015
|
-
// // 示例1:从字节数组开头读取4字节整数(小端序)
|
|
2016
|
-
// const data1 = new Uint8Array([0x12, 0x34, 0x56, 0x78]);
|
|
2017
|
-
// const result1 = FormatUtils.bytes2Int(data1); // 应该返回 0x78563412
|
|
2018
|
-
// // 示例2:从指定位置读取4字节整数(大端序)
|
|
2019
|
-
// const data2 = new Uint8Array([0x00, 0x00, 0x12, 0x34, 0x56, 0x78]);
|
|
2020
|
-
// const result2 = FormatUtils.bytes2Int(data2, 2, true); // 应该返回 0x12345678
|
|
2021
|
-
// // 示例3:读取2字节整数
|
|
2022
|
-
// const data3 = new Uint8Array([0x12, 0x34]);
|
|
2023
|
-
// const result3 = FormatUtils.bytes2Int(data3, 0, false, 2); // 应该返回 0x3412
|
|
2024
|
-
// console.log(`Result1: 0x${result1.toString(16)}`);
|
|
2025
|
-
// console.log(`Result2: 0x${result2.toString(16)}`);
|
|
2026
|
-
// console.log(`Result3: 0x${result3.toString(16)}`);
|
|
2027
|
-
// // 示例4:十六进制字符串转换
|
|
2028
|
-
// const hexString = "12345678";
|
|
2029
|
-
// const byteArray = FormatUtils.hexStringToByteArray(hexString);
|
|
2030
|
-
// const backToHex = FormatUtils.bytesToHex(byteArray);
|
|
2031
|
-
// console.log(`Original: ${hexString}`);
|
|
2032
|
-
// console.log(`To bytes: ${byteArray}`);
|
|
2033
|
-
// console.log(`Back to hex: ${backToHex}`);
|
|
2034
|
-
// }
|
|
1950
|
+
var RealTimeDataType;
|
|
1951
|
+
(function (RealTimeDataType) {
|
|
1952
|
+
RealTimeDataType[RealTimeDataType["LOCATION"] = 1] = "LOCATION";
|
|
1953
|
+
RealTimeDataType[RealTimeDataType["PROCESS"] = 2] = "PROCESS";
|
|
1954
|
+
RealTimeDataType[RealTimeDataType["PARTITION"] = 3] = "PARTITION";
|
|
1955
|
+
RealTimeDataType[RealTimeDataType["STATUS"] = 4] = "STATUS";
|
|
1956
|
+
})(RealTimeDataType || (RealTimeDataType = {}));
|
|
2035
1957
|
|
|
2036
1958
|
/**
|
|
2037
1959
|
* 射线法判断点是否在多边形内部
|
|
@@ -2127,50 +2049,6 @@ const getPartitionId = (partitionBoundary, postureX, postureY) => {
|
|
|
2127
2049
|
})?.id;
|
|
2128
2050
|
return partitionId;
|
|
2129
2051
|
};
|
|
2130
|
-
/**
|
|
2131
|
-
*
|
|
2132
|
-
* 支持分区割草后的解析,加入了分区数量、分区列表
|
|
2133
|
-
* 8 割草路径类型
|
|
2134
|
-
* 4 割草启动类型 0:自动 1:手动
|
|
2135
|
-
* 4 当前割草边界id
|
|
2136
|
-
* 4 当前边界割草百分比 比如9800----98%
|
|
2137
|
-
* @returns
|
|
2138
|
-
*/
|
|
2139
|
-
const parseMapWorkPosition = (mapWorkPosition) => {
|
|
2140
|
-
let isMowing = false;
|
|
2141
|
-
let mowStartType = null;
|
|
2142
|
-
let currentMowBoundaryId = null;
|
|
2143
|
-
let currentMowProgress = null;
|
|
2144
|
-
const bytes = new Uint8Array(mapWorkPosition.match(/.{1,2}/g)?.map((byte) => parseInt(byte, 16)) || []);
|
|
2145
|
-
if (mapWorkPosition.length >= 8) {
|
|
2146
|
-
// 以下两种状态认为是割草中
|
|
2147
|
-
// 1. action为8,且subAction为6
|
|
2148
|
-
// 2. action为5
|
|
2149
|
-
const action = FormatUtils.bytes2Int(bytes, 0, true);
|
|
2150
|
-
if (action === ACTION_BOUNDARY_TASK) {
|
|
2151
|
-
const subAction = FormatUtils.bytes2Int(bytes, 4, true);
|
|
2152
|
-
if (subAction === ACTION_BLOCK_TRANSFER) {
|
|
2153
|
-
// action=8且subAction=6:边界任务中的块转移
|
|
2154
|
-
isMowing = true;
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
else if (action === ACTION_BLOCK_COVER) {
|
|
2158
|
-
// action=5:块覆盖割草
|
|
2159
|
-
isMowing = true;
|
|
2160
|
-
}
|
|
2161
|
-
if (mapWorkPosition.length >= 16) {
|
|
2162
|
-
mowStartType = FormatUtils.bytes2Int(bytes, 8, true);
|
|
2163
|
-
currentMowBoundaryId = FormatUtils.bytes2Int(bytes, 12, true);
|
|
2164
|
-
currentMowProgress = FormatUtils.bytes2Int(bytes, 16, true);
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
return {
|
|
2168
|
-
isMowing,
|
|
2169
|
-
mowStartType,
|
|
2170
|
-
currentMowBoundaryId,
|
|
2171
|
-
currentMowProgress,
|
|
2172
|
-
};
|
|
2173
|
-
};
|
|
2174
2052
|
/**
|
|
2175
2053
|
* 处理实时数据的消息,这里的实时数据消息有两种,一种是实时轨迹,一种是割草进度,其中这两种下发的时间频次不一样
|
|
2176
2054
|
* 实时轨迹的路径需要依靠割草进度时候的割草状态判断,目前只能根据上一次获取到的割草进度的状态来处理,如果一开始没有割草的状态,则默认为不割草,后续会根据割草进度来更新
|
|
@@ -2178,7 +2056,7 @@ const parseMapWorkPosition = (mapWorkPosition) => {
|
|
|
2178
2056
|
* @param param0
|
|
2179
2057
|
* @returns
|
|
2180
2058
|
*/
|
|
2181
|
-
const
|
|
2059
|
+
const handleMultipleRealTimeData = ({ realTimeData, isMowing, pathData, partitionBoundary, }) => {
|
|
2182
2060
|
// 先将数据进行倒排,这样好插入数据
|
|
2183
2061
|
if (realTimeData.length > 0) {
|
|
2184
2062
|
realTimeData.reverse();
|
|
@@ -2194,7 +2072,6 @@ const handleRealTimeData = ({ realTimeData, isMowing, pathData, partitionBoundar
|
|
|
2194
2072
|
// 割草轨迹
|
|
2195
2073
|
const { postureX, postureY, vehicleState } = item;
|
|
2196
2074
|
const currentPartitionId = getPartitionId(partitionBoundary, Number(postureX), Number(postureY));
|
|
2197
|
-
console.log('currentPartitionId===', currentPartitionId);
|
|
2198
2075
|
if (currentPartitionId && newPathData?.[currentPartitionId]) {
|
|
2199
2076
|
const currentPathData = newPathData[currentPartitionId];
|
|
2200
2077
|
newPathData[currentPartitionId] = {
|
|
@@ -2206,7 +2083,7 @@ const handleRealTimeData = ({ realTimeData, isMowing, pathData, partitionBoundar
|
|
|
2206
2083
|
postureY: Number(postureY),
|
|
2207
2084
|
knifeRotation: mowingStatus && vehicleState === RobotStatus.MOWING ? '01' : '00', // "knifeRotation": "01",//刀盘是否转动 00-否 01-是
|
|
2208
2085
|
// knifeRotation: '01', // "knifeRotation": "01",//刀盘是否转动 00-否 01-是
|
|
2209
|
-
pathType: '
|
|
2086
|
+
pathType: '', //"pathType": "01",//路径类型 : 00-巡边 01-弓字型割草 02-地图测试 03-转移路径 04-避障路径 05-恢复/脱困路径
|
|
2210
2087
|
partitionId: currentPartitionId.toString(), // TODO:不知道为什么这里的id需要是字符串类型?
|
|
2211
2088
|
},
|
|
2212
2089
|
],
|
|
@@ -2215,21 +2092,20 @@ const handleRealTimeData = ({ realTimeData, isMowing, pathData, partitionBoundar
|
|
|
2215
2092
|
}
|
|
2216
2093
|
else if (item.type === REAL_TIME_DATA_TYPE.PROCESS) {
|
|
2217
2094
|
// 割草进度
|
|
2218
|
-
const {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
}
|
|
2095
|
+
const { action, subAction, currentMowBoundary, currentMowProgress } = item;
|
|
2096
|
+
// 设置状态
|
|
2097
|
+
if ((action === ACTION_BOUNDARY_TASK && subAction && subAction === ACTION_BLOCK_TRANSFER) ||
|
|
2098
|
+
action === ACTION_BLOCK_COVER) {
|
|
2099
|
+
mowingStatus = true;
|
|
2100
|
+
}
|
|
2101
|
+
else {
|
|
2102
|
+
mowingStatus = false;
|
|
2103
|
+
}
|
|
2104
|
+
const currentPartitionId = currentMowBoundary ? currentMowBoundary.toString() : null;
|
|
2105
|
+
if (currentMowProgress && currentPartitionId && newPathData?.[currentPartitionId]) {
|
|
2106
|
+
newPathData[currentPartitionId].partitionPercentage = currentMowProgress / 100;
|
|
2107
|
+
newPathData[currentPartitionId].finishedArea =
|
|
2108
|
+
(newPathData[currentPartitionId].area * currentMowProgress) / 10000;
|
|
2233
2109
|
}
|
|
2234
2110
|
}
|
|
2235
2111
|
});
|
|
@@ -2238,6 +2114,39 @@ const handleRealTimeData = ({ realTimeData, isMowing, pathData, partitionBoundar
|
|
|
2238
2114
|
isMowing: mowingStatus,
|
|
2239
2115
|
};
|
|
2240
2116
|
};
|
|
2117
|
+
/**
|
|
2118
|
+
* 根据实时数据,获取到割草状态
|
|
2119
|
+
* @param realTimeData 实时数据
|
|
2120
|
+
* @param isMowing 上一次的割草状态
|
|
2121
|
+
* @returns 新的割草状态
|
|
2122
|
+
*/
|
|
2123
|
+
const getProcessMowingDataFromRealTimeData = ({ realTimeData, isMowing, pathData, }) => {
|
|
2124
|
+
let newMowingStatus = isMowing;
|
|
2125
|
+
let newPathData = pathData || {};
|
|
2126
|
+
// 找到返回的第一个实时进度的点
|
|
2127
|
+
const firstProcessData = realTimeData.find((item) => item.type === RealTimeDataType.PROCESS);
|
|
2128
|
+
if (firstProcessData) {
|
|
2129
|
+
// console.log('firstProcessData==', firstProcessData);
|
|
2130
|
+
const { action, subAction, currentMowBoundary, currentMowProgress } = firstProcessData;
|
|
2131
|
+
// 设置状态
|
|
2132
|
+
if ((action === ACTION_BOUNDARY_TASK && subAction && subAction === ACTION_BLOCK_TRANSFER) ||
|
|
2133
|
+
action === ACTION_BLOCK_COVER) {
|
|
2134
|
+
newMowingStatus = true;
|
|
2135
|
+
}
|
|
2136
|
+
else {
|
|
2137
|
+
newMowingStatus = false;
|
|
2138
|
+
}
|
|
2139
|
+
if (currentMowBoundary && newPathData?.[currentMowBoundary]) {
|
|
2140
|
+
newPathData[currentMowBoundary].partitionPercentage = currentMowProgress / 100;
|
|
2141
|
+
newPathData[currentMowBoundary].finishedArea =
|
|
2142
|
+
(newPathData[currentMowBoundary].area * currentMowProgress) / 10000;
|
|
2143
|
+
}
|
|
2144
|
+
}
|
|
2145
|
+
return {
|
|
2146
|
+
isMowing: newMowingStatus,
|
|
2147
|
+
pathData: new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M3/u/iJT4yUkfPmHPyecxhsF9FNO4TrLOx5JvWqMjgNhYSbSDxGleZg4gTBqIolyjQWIXstyFCnwnqmzp1goDXDUIa4axXQ2tuYtHvjMKUN3UwxWALLHosCkAWuZswr61UdnvF4u1Yu48zDO0sbxY8xvwmFnw21w1bowHWlsQALgtdTnVkHb4YxKJKx+ZUJAKsvLimE9nvDgkNsVA0XKKlnIC6Tle64F64MOsODq4Kht/5BP3+O9hlf1gsSh58yiN58Y01s27bg7rrVo0GWKYGgWmyNJbQvsENhuGIqxcRNMRLU7rIgOjYVfDVM41LEJaFIPANnqaZQQMMv2Cw4JJW9+FCX1AoqBfbknA+X/L2uQHEIFRPC2seOjg4ROv1Jdpw5RO9iIVTrcY0o0cnKbuHum6F6K5GbJsJV32mom4H3uuuxU3T55XKZZHJdGM0tJhMWwDWsOFhUL+TWOz3EZ3H4irUiTZ2LFI75FsPTJnQza4KisUD8lUGzWLnLJXSiQOT4uKMid09DeSPP2ZmPLFsWVmMjp6EG25oQKPREKtWbeWbNgFHiZKtW+9r+frPQvwvfcQ/jYH5fi6T/KwmGSdpu/rnNFd9B/P9xCbxwgv9/OYXnA/kSHUmmvYAAAAASUVORK5CYII=";
|
|
2243
2152
|
|
|
@@ -2293,8 +2202,10 @@ function getNoPositionMowerImageByModal(mowerModal) {
|
|
|
2293
2202
|
}
|
|
2294
2203
|
return iNoPosition;
|
|
2295
2204
|
}
|
|
2296
|
-
function getMowerImage(positonConfig) {
|
|
2297
|
-
|
|
2205
|
+
function getMowerImage(positonConfig, modelType) {
|
|
2206
|
+
if (!positonConfig)
|
|
2207
|
+
return '';
|
|
2208
|
+
const model = modelType?.toLowerCase() || 'i';
|
|
2298
2209
|
const state = positonConfig.vehicleState;
|
|
2299
2210
|
const mowerImage = getMowerImageByModal(model);
|
|
2300
2211
|
const disabledImage = getDisabledMowerImageByModal(model);
|
|
@@ -2331,9 +2242,9 @@ function isInvalidPosition(positonConfig) {
|
|
|
2331
2242
|
}
|
|
2332
2243
|
function isOutOfRange(positonConfig) {
|
|
2333
2244
|
return (positonConfig.postureX != null &&
|
|
2334
|
-
Math.abs(positonConfig.postureX) > 1000
|
|
2245
|
+
Math.abs(positonConfig.postureX) > 1000 &&
|
|
2335
2246
|
positonConfig.postureY != null &&
|
|
2336
|
-
Math.abs(positonConfig.postureY) > 1000
|
|
2247
|
+
Math.abs(positonConfig.postureY) > 1000);
|
|
2337
2248
|
}
|
|
2338
2249
|
|
|
2339
2250
|
/** Detect free variable `global` from Node.js. */
|
|
@@ -4399,7 +4310,7 @@ function cloneBuffer(buffer, isDeep) {
|
|
|
4399
4310
|
}
|
|
4400
4311
|
|
|
4401
4312
|
/** Built-in value references. */
|
|
4402
|
-
var Uint8Array
|
|
4313
|
+
var Uint8Array = root.Uint8Array;
|
|
4403
4314
|
|
|
4404
4315
|
/**
|
|
4405
4316
|
* Creates a clone of `arrayBuffer`.
|
|
@@ -4410,7 +4321,7 @@ var Uint8Array$1 = root.Uint8Array;
|
|
|
4410
4321
|
*/
|
|
4411
4322
|
function cloneArrayBuffer(arrayBuffer) {
|
|
4412
4323
|
var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
|
4413
|
-
new Uint8Array
|
|
4324
|
+
new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
|
4414
4325
|
return result;
|
|
4415
4326
|
}
|
|
4416
4327
|
|
|
@@ -4761,6 +4672,36 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
4761
4672
|
*/
|
|
4762
4673
|
var round = createRound('round');
|
|
4763
4674
|
|
|
4675
|
+
/**
|
|
4676
|
+
* 工具模块类型定义
|
|
4677
|
+
*/
|
|
4678
|
+
/**
|
|
4679
|
+
* 路径段类型枚举
|
|
4680
|
+
*/
|
|
4681
|
+
var PathSegmentType;
|
|
4682
|
+
(function (PathSegmentType) {
|
|
4683
|
+
PathSegmentType["EDGE"] = "edge";
|
|
4684
|
+
PathSegmentType["MOWING"] = "mowing";
|
|
4685
|
+
PathSegmentType["TRANS"] = "trans";
|
|
4686
|
+
})(PathSegmentType || (PathSegmentType = {}));
|
|
4687
|
+
/**
|
|
4688
|
+
* 单位类型枚举
|
|
4689
|
+
*/
|
|
4690
|
+
var UnitsType;
|
|
4691
|
+
(function (UnitsType) {
|
|
4692
|
+
UnitsType["Metric"] = "Metric";
|
|
4693
|
+
UnitsType["Imperial"] = "Imperial";
|
|
4694
|
+
})(UnitsType || (UnitsType = {}));
|
|
4695
|
+
/**
|
|
4696
|
+
* 面积单位类型枚举
|
|
4697
|
+
*/
|
|
4698
|
+
var UnitsAreaType;
|
|
4699
|
+
(function (UnitsAreaType) {
|
|
4700
|
+
UnitsAreaType["SQUARE_METER"] = "m\u00B2";
|
|
4701
|
+
UnitsAreaType["SQUARE_FOOT"] = "ft\u00B2";
|
|
4702
|
+
UnitsAreaType["ACRE"] = "ac";
|
|
4703
|
+
})(UnitsAreaType || (UnitsAreaType = {}));
|
|
4704
|
+
|
|
4764
4705
|
/**
|
|
4765
4706
|
* 默认航向相对于canvas的偏移角度: 航向默认是东
|
|
4766
4707
|
*/
|
|
@@ -4788,10 +4729,6 @@ function radToDegree(radian) {
|
|
|
4788
4729
|
function distance(x1, y1, x2, y2) {
|
|
4789
4730
|
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
|
4790
4731
|
}
|
|
4791
|
-
// 计算前进方向和车头的夹角
|
|
4792
|
-
function calAngle(x1, y1, x2, y2) {
|
|
4793
|
-
return Math.atan2((y2 - y1), (x2 - x1));
|
|
4794
|
-
}
|
|
4795
4732
|
const mathRound = (value, decimals = 2) => {
|
|
4796
4733
|
return Number.isInteger(value) ? value : round(value, decimals);
|
|
4797
4734
|
};
|
|
@@ -4838,17 +4775,6 @@ function formatNumberWithMetricPrefix(value, round = true, decimals = 2) {
|
|
|
4838
4775
|
return `${mathFn(value / 1000000000, decimals)}B`;
|
|
4839
4776
|
}
|
|
4840
4777
|
}
|
|
4841
|
-
var UnitsType;
|
|
4842
|
-
(function (UnitsType) {
|
|
4843
|
-
UnitsType["Metric"] = "metric";
|
|
4844
|
-
UnitsType["Imperial"] = "imperial";
|
|
4845
|
-
})(UnitsType || (UnitsType = {}));
|
|
4846
|
-
var UnitsAreaType;
|
|
4847
|
-
(function (UnitsAreaType) {
|
|
4848
|
-
UnitsAreaType["SQUARE_METER"] = "m\u00B2";
|
|
4849
|
-
UnitsAreaType["SQUARE_FOOT"] = "ft\u00B2";
|
|
4850
|
-
UnitsAreaType["ACRE"] = "ac";
|
|
4851
|
-
})(UnitsAreaType || (UnitsAreaType = {}));
|
|
4852
4778
|
/**
|
|
4853
4779
|
* 转换割草面积的方法
|
|
4854
4780
|
* @param area 面积数值(单位:m²)
|
|
@@ -5037,6 +4963,19 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5037
4963
|
this.scale = 1;
|
|
5038
4964
|
this.level = LAYER_LEVELS.BOUNDARY_BORDER; // 中等层级
|
|
5039
4965
|
this.type = LAYER_DEFAULT_TYPE.BOUNDARY_BORDER;
|
|
4966
|
+
this.boudaryBorderPaths = {};
|
|
4967
|
+
this.mowingBoundarys = [];
|
|
4968
|
+
}
|
|
4969
|
+
/**
|
|
4970
|
+
* 设置当前割草任务的边界
|
|
4971
|
+
*/
|
|
4972
|
+
setMowingBoundarys(mowingBoundarys) {
|
|
4973
|
+
if (!mowingBoundarys) {
|
|
4974
|
+
this.mowingBoundarys = this.elements?.map(item => item?.originalData?.id);
|
|
4975
|
+
}
|
|
4976
|
+
else {
|
|
4977
|
+
this.mowingBoundarys = mowingBoundarys;
|
|
4978
|
+
}
|
|
5040
4979
|
}
|
|
5041
4980
|
/**
|
|
5042
4981
|
* SVG渲染方法
|
|
@@ -5057,7 +4996,8 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5057
4996
|
* 渲染边界边框
|
|
5058
4997
|
*/
|
|
5059
4998
|
renderBoundaryBorder(svgGroup, element) {
|
|
5060
|
-
const { coordinates, style } = element;
|
|
4999
|
+
const { coordinates, style, originalData } = element;
|
|
5000
|
+
const { id } = originalData || {};
|
|
5061
5001
|
if (coordinates.length < 2)
|
|
5062
5002
|
return;
|
|
5063
5003
|
// 1. 先遍历所有的coordinates,把所有点分为若干段的path
|
|
@@ -5068,20 +5008,21 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5068
5008
|
return;
|
|
5069
5009
|
if (segment.type === 2) {
|
|
5070
5010
|
// type=2: 直接添加到svgGroup中
|
|
5071
|
-
this.createDirectPath(svgGroup, segment.points, style);
|
|
5011
|
+
this.createDirectPath(svgGroup, segment.points, style, id);
|
|
5072
5012
|
}
|
|
5073
5013
|
else if (segment.type === 1) {
|
|
5074
5014
|
// type=1: 使用PathMeasure逻辑生成平行路径
|
|
5075
5015
|
// this.createDirectPath(svgGroup, segment.points, style);
|
|
5076
|
-
this.createParallelPathsWithMeasure(svgGroup, segment.points, style);
|
|
5016
|
+
this.createParallelPathsWithMeasure(svgGroup, segment.points, style, id);
|
|
5077
5017
|
}
|
|
5078
5018
|
});
|
|
5079
5019
|
}
|
|
5080
5020
|
/**
|
|
5081
5021
|
* 创建直接路径(type=2)
|
|
5082
5022
|
*/
|
|
5083
|
-
createDirectPath(svgGroup, points, style) {
|
|
5084
|
-
const
|
|
5023
|
+
createDirectPath(svgGroup, points, style, id) {
|
|
5024
|
+
const isMowing = this.mowingBoundarys.includes(Number(id));
|
|
5025
|
+
const strokeColor = isMowing ? style.mowingLineColor : style.lineColor;
|
|
5085
5026
|
const lineWidth = dp2px(style.lineWidth || 3);
|
|
5086
5027
|
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
5087
5028
|
// 构建路径数据
|
|
@@ -5104,13 +5045,18 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5104
5045
|
path.setAttribute('opacity', (style.opacity || 1).toString());
|
|
5105
5046
|
path.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
5106
5047
|
path.classList.add('vector-boundary-solid');
|
|
5048
|
+
if (!this.boudaryBorderPaths[id]) {
|
|
5049
|
+
this.boudaryBorderPaths[id] = [];
|
|
5050
|
+
}
|
|
5051
|
+
this.boudaryBorderPaths[id].push(path);
|
|
5107
5052
|
svgGroup.appendChild(path);
|
|
5108
5053
|
}
|
|
5109
5054
|
/**
|
|
5110
5055
|
* 使用PathMeasure逻辑创建平行路径(type=1)
|
|
5111
5056
|
*/
|
|
5112
|
-
createParallelPathsWithMeasure(svgGroup, points, style) {
|
|
5113
|
-
const
|
|
5057
|
+
createParallelPathsWithMeasure(svgGroup, points, style, id) {
|
|
5058
|
+
const isMowing = this.mowingBoundarys.includes(Number(id));
|
|
5059
|
+
const strokeColor = isMowing ? style.mowingLineColor : style.lineColor;
|
|
5114
5060
|
const lineWidth = dp2px(style.lineWidth || 3);
|
|
5115
5061
|
// 获取当前SVG的缩放级别,计算固定屏幕像素间距
|
|
5116
5062
|
const fixedScreenDistance = lineWidth; // 固定的屏幕像素距离
|
|
@@ -5133,6 +5079,10 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5133
5079
|
// 或者可以根据当前缩放级别动态计算dash array
|
|
5134
5080
|
path.style.strokeDasharray = `${lineWidth}px ${lineWidth * 2}px`;
|
|
5135
5081
|
path.classList.add(`vector-boundary-parallel-${index + 1}`);
|
|
5082
|
+
if (!this.boudaryBorderPaths[id]) {
|
|
5083
|
+
this.boudaryBorderPaths[id] = [];
|
|
5084
|
+
}
|
|
5085
|
+
this.boudaryBorderPaths[id].push(path);
|
|
5136
5086
|
svgGroup.appendChild(path);
|
|
5137
5087
|
});
|
|
5138
5088
|
}
|
|
@@ -5222,6 +5172,9 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5222
5172
|
}
|
|
5223
5173
|
return segments;
|
|
5224
5174
|
}
|
|
5175
|
+
resetPaths() {
|
|
5176
|
+
this.boudaryBorderPaths = {};
|
|
5177
|
+
}
|
|
5225
5178
|
}
|
|
5226
5179
|
|
|
5227
5180
|
var antennaOneOnline = "data:image/png;base64,iVBOR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usvU3TPmgQPOAdMgNjFJlczLPTXcgz7xI95dsyHBV428rSYp4imF84BA1qQ6QuN1wORmyp4pK2lCGYx7cieIsFv0pxUyHnft1jgOAcSPADluHlbBcFxFvQeZi0D3Bx6hK0GuhND5HWX9J8EFodpPUYMUnqLLjQ0iDZZ8QYTfsJC6ratqAPiAvbHCXZwWnSDqYmKYjnrIcYAZpB9KZLe2aGKUkQvxrT90ERzbEB2OBNPj5D0zFT7fi0yOw4MQkCymIqgRdcsJ/t90PtRIEpIdngfYCOWxwqGM0KwaP4P/LyfA2l5RlyAAAAAElFTkSuQmCC";
|
|
@@ -5434,7 +5387,7 @@ class DrawLayer extends BaseLayer {
|
|
|
5434
5387
|
this.pointLayer,
|
|
5435
5388
|
this.svgElementLayer,
|
|
5436
5389
|
this.visionOffLayer,
|
|
5437
|
-
];
|
|
5390
|
+
]?.filter((layer) => layer.getElements().length > 0);
|
|
5438
5391
|
}
|
|
5439
5392
|
getPathLayers() {
|
|
5440
5393
|
return this.pathLayer;
|
|
@@ -5449,6 +5402,14 @@ class BoundaryDataBuilder {
|
|
|
5449
5402
|
* 创建边界元素数据
|
|
5450
5403
|
*/
|
|
5451
5404
|
static create(type, coordinates, style) {
|
|
5405
|
+
const len = coordinates?.length || 0;
|
|
5406
|
+
const firstPoint = coordinates?.[0];
|
|
5407
|
+
const lastPoint = coordinates?.[len - 1];
|
|
5408
|
+
const isClosed = firstPoint?.[0] === lastPoint?.[0] && firstPoint?.[1] === lastPoint?.[1];
|
|
5409
|
+
// 如果地图没有闭合,则手动新增闭合点,避免border最后一部分没有闭合的情况
|
|
5410
|
+
if (!isClosed) {
|
|
5411
|
+
coordinates.push([firstPoint?.[0], firstPoint?.[1], lastPoint?.[2]]);
|
|
5412
|
+
}
|
|
5452
5413
|
return {
|
|
5453
5414
|
type,
|
|
5454
5415
|
coordinates,
|
|
@@ -5763,7 +5724,6 @@ class MapDataProcessor {
|
|
|
5763
5724
|
if (mapData.vision_off_areas && mapData.vision_off_areas.length > 0) {
|
|
5764
5725
|
allElements.push(...mapData.vision_off_areas);
|
|
5765
5726
|
}
|
|
5766
|
-
console.log('allElements', allElements);
|
|
5767
5727
|
// 按照元素类型分组并设置不同的层级
|
|
5768
5728
|
return this.createLayeredMapData(allElements);
|
|
5769
5729
|
}
|
|
@@ -5852,8 +5812,13 @@ class MapDataProcessor {
|
|
|
5852
5812
|
// 为ObstacleData创建兼容的MapElement接口
|
|
5853
5813
|
const mapElement = element;
|
|
5854
5814
|
const obstacleElement = ObstacleDataBuilder.fromMapElement(mapElement, this.mapConfig.obstacle);
|
|
5855
|
-
if (obstacleElement)
|
|
5815
|
+
if (obstacleElement) {
|
|
5856
5816
|
result.push(obstacleElement);
|
|
5817
|
+
const { addObstacles } = useSubBoundaryBorderStore.getState();
|
|
5818
|
+
addObstacles(`obstacle-${obstacleElement.originalData.id}`, {
|
|
5819
|
+
...obstacleElement,
|
|
5820
|
+
});
|
|
5821
|
+
}
|
|
5857
5822
|
}
|
|
5858
5823
|
catch (error) {
|
|
5859
5824
|
console.warn(`Error processing OBSTACLE element:`, element, error);
|
|
@@ -5914,9 +5879,13 @@ class MapDataProcessor {
|
|
|
5914
5879
|
element.direction !== undefined) {
|
|
5915
5880
|
const mapElement = element;
|
|
5916
5881
|
const svgElement = SvgElementDataBuilder.fromMapElement(mapElement, this.mapConfig.doodle);
|
|
5917
|
-
|
|
5918
|
-
if (svgElement)
|
|
5882
|
+
if (svgElement) {
|
|
5919
5883
|
result.push(svgElement);
|
|
5884
|
+
const { addSvgElements } = useSubBoundaryBorderStore.getState();
|
|
5885
|
+
addSvgElements(`time-limit-obstacle-${svgElement.originalData.id}`, {
|
|
5886
|
+
...svgElement,
|
|
5887
|
+
});
|
|
5888
|
+
}
|
|
5920
5889
|
}
|
|
5921
5890
|
// 如果有points数据,按传统方式绘制
|
|
5922
5891
|
else if ('points' in element &&
|
|
@@ -5925,8 +5894,13 @@ class MapDataProcessor {
|
|
|
5925
5894
|
element.points.length >= 3) {
|
|
5926
5895
|
const mapElement = element;
|
|
5927
5896
|
const polygonElement = ObstacleDataBuilder.createTimeLimitObstacle(mapElement, this.mapConfig.obstacle);
|
|
5928
|
-
if (polygonElement)
|
|
5897
|
+
if (polygonElement) {
|
|
5929
5898
|
result.push(polygonElement);
|
|
5899
|
+
const { addObstacles } = useSubBoundaryBorderStore.getState();
|
|
5900
|
+
addObstacles(`time-limit-obstacle-${polygonElement.originalData.id}`, {
|
|
5901
|
+
...polygonElement,
|
|
5902
|
+
});
|
|
5903
|
+
}
|
|
5930
5904
|
}
|
|
5931
5905
|
}
|
|
5932
5906
|
catch (error) {
|
|
@@ -5971,35 +5945,15 @@ class PathDataBuilder {
|
|
|
5971
5945
|
style,
|
|
5972
5946
|
};
|
|
5973
5947
|
}
|
|
5974
|
-
// /**
|
|
5975
|
-
// * 创建隧道元素数据
|
|
5976
|
-
// */
|
|
5977
|
-
// static createTunnel(element: MapElement): DrawElement | null {
|
|
5978
|
-
// const convertedPoints = convertPointsFormat(element.tunnel?.points || element.points);
|
|
5979
|
-
// if (!convertedPoints || convertedPoints.length < 2) return null;
|
|
5980
|
-
// return this.create(convertedPoints, DEFAULT_STYLES.PATH_EDGE);
|
|
5981
|
-
// }
|
|
5982
|
-
// /**
|
|
5983
|
-
// * 创建充电桩内部隧道路径(用于CHARGING_PILE元素中的tunnel.points)
|
|
5984
|
-
// */
|
|
5985
|
-
// static createChargingPileTunnelPath(element: MapElement): DrawElement | null {
|
|
5986
|
-
// if (!element.tunnel || !element.tunnel.points) return null;
|
|
5987
|
-
// const convertedTunnelPoints = convertPointsFormat(element.tunnel.points);
|
|
5988
|
-
// if (!convertedTunnelPoints || convertedTunnelPoints.length < 2) return null;
|
|
5989
|
-
// return this.create(convertedTunnelPoints, {
|
|
5990
|
-
// strokeColor: DEFAULT_STYLES.CHANNEL.strokeColor,
|
|
5991
|
-
// lineWidth: 2,
|
|
5992
|
-
// opacity: 1.0
|
|
5993
|
-
// });
|
|
5994
|
-
// }
|
|
5995
5948
|
/**
|
|
5996
5949
|
* 创建边缘路径
|
|
5997
5950
|
*/
|
|
5998
5951
|
static createEdgePath(points, config) {
|
|
5999
|
-
const
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
5952
|
+
const convertedPoints = convertPointsFormat(points);
|
|
5953
|
+
const drawElement = this.create(convertedPoints, {
|
|
5954
|
+
lineColor: config?.color,
|
|
5955
|
+
lineWidth: config?.lineWidth,
|
|
5956
|
+
opacity: config?.opacity,
|
|
6003
5957
|
});
|
|
6004
5958
|
drawElement.originalData = points;
|
|
6005
5959
|
return drawElement;
|
|
@@ -6008,10 +5962,11 @@ class PathDataBuilder {
|
|
|
6008
5962
|
* 创建割草路径
|
|
6009
5963
|
*/
|
|
6010
5964
|
static createMowingPath(points, config) {
|
|
6011
|
-
const
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
5965
|
+
const convertedPoints = convertPointsFormat(points);
|
|
5966
|
+
const drawElement = this.create(convertedPoints, {
|
|
5967
|
+
lineColor: config?.color,
|
|
5968
|
+
lineWidth: config?.lineWidth,
|
|
5969
|
+
opacity: config?.opacity,
|
|
6015
5970
|
});
|
|
6016
5971
|
drawElement.originalData = points;
|
|
6017
5972
|
return drawElement;
|
|
@@ -6020,11 +5975,11 @@ class PathDataBuilder {
|
|
|
6020
5975
|
* 创建传输路径
|
|
6021
5976
|
*/
|
|
6022
5977
|
static createTransPath(points, config) {
|
|
6023
|
-
const
|
|
6024
|
-
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
opacity: config?.opacity
|
|
5978
|
+
const convertedPoints = convertPointsFormat(points);
|
|
5979
|
+
const drawElement = this.create(convertedPoints, {
|
|
5980
|
+
lineColor: config?.color,
|
|
5981
|
+
lineWidth: config?.lineWidth,
|
|
5982
|
+
opacity: config?.opacity,
|
|
6028
5983
|
});
|
|
6029
5984
|
drawElement.originalData = points;
|
|
6030
5985
|
return drawElement;
|
|
@@ -6043,55 +5998,59 @@ class PathDataProcessor {
|
|
|
6043
5998
|
if (!pathData || typeof pathData !== 'object') {
|
|
6044
5999
|
return [];
|
|
6045
6000
|
}
|
|
6046
|
-
// 获取所有分区的路径数据
|
|
6047
|
-
const allPathItems = Object.values(pathData).reduce((acc, partitionData) => {
|
|
6048
|
-
if (partitionData && partitionData.points && partitionData.points.length > 0) {
|
|
6049
|
-
acc.push(...partitionData.points);
|
|
6050
|
-
}
|
|
6051
|
-
return acc;
|
|
6052
|
-
}, []);
|
|
6053
6001
|
// 合并配置
|
|
6054
6002
|
const config = mapConfig.path;
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
const
|
|
6063
|
-
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
|
|
6069
|
-
|
|
6070
|
-
|
|
6071
|
-
|
|
6072
|
-
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6079
|
-
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6083
|
-
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
|
|
6090
|
-
|
|
6091
|
-
|
|
6092
|
-
|
|
6093
|
-
|
|
6094
|
-
|
|
6003
|
+
const result = Object.keys(pathData).map((key) => {
|
|
6004
|
+
const id = Number(key);
|
|
6005
|
+
const points = pathData[key].points || [];
|
|
6006
|
+
// 使用Python相同的逻辑:按线段分组而不是按点分组
|
|
6007
|
+
const pathSegments = createPathSegmentsByType(points);
|
|
6008
|
+
const elements = [];
|
|
6009
|
+
// 处理边缘路径段
|
|
6010
|
+
for (const segment of pathSegments.edge) {
|
|
6011
|
+
// 转换 Point[] 为 number[][]
|
|
6012
|
+
const points = segment.points.map((point) => [point.x, point.y]);
|
|
6013
|
+
const element = PathDataBuilder.createEdgePath(points, {
|
|
6014
|
+
lineWidth: config.lineWidth,
|
|
6015
|
+
color: config.edgeLineColor,
|
|
6016
|
+
opacity: config.opacity,
|
|
6017
|
+
});
|
|
6018
|
+
element.originalData = points;
|
|
6019
|
+
element.pathType = PathSegmentType.EDGE;
|
|
6020
|
+
elements.push(element);
|
|
6021
|
+
}
|
|
6022
|
+
// 处理割草路径段
|
|
6023
|
+
for (const segment of pathSegments.mowing) {
|
|
6024
|
+
// 转换 Point[] 为 number[][]
|
|
6025
|
+
const points = segment.points.map((point) => [point.x, point.y]);
|
|
6026
|
+
const element = PathDataBuilder.createMowingPath(points, {
|
|
6027
|
+
lineWidth: config.lineWidth,
|
|
6028
|
+
color: config.mowedLineColor,
|
|
6029
|
+
opacity: config.opacity,
|
|
6030
|
+
});
|
|
6031
|
+
element.originalData = points;
|
|
6032
|
+
element.pathType = PathSegmentType.MOWING;
|
|
6033
|
+
elements.push(element);
|
|
6034
|
+
}
|
|
6035
|
+
// 处理传输路径段(只有在showTransPaths为true时才添加)
|
|
6036
|
+
for (const segment of pathSegments.trans) {
|
|
6037
|
+
// 转换 Point[] 为 number[][]
|
|
6038
|
+
const points = segment.points.map((point) => [point.x, point.y]);
|
|
6039
|
+
const element = PathDataBuilder.createTransPath(points, {
|
|
6040
|
+
lineWidth: config.lineWidth,
|
|
6041
|
+
color: config.transLineColor,
|
|
6042
|
+
opacity: config.opacity,
|
|
6043
|
+
});
|
|
6044
|
+
element.originalData = points;
|
|
6045
|
+
element.pathType = PathSegmentType.TRANS;
|
|
6046
|
+
elements.push(element);
|
|
6047
|
+
}
|
|
6048
|
+
return {
|
|
6049
|
+
id,
|
|
6050
|
+
elements,
|
|
6051
|
+
};
|
|
6052
|
+
});
|
|
6053
|
+
return result;
|
|
6095
6054
|
}
|
|
6096
6055
|
}
|
|
6097
6056
|
|
|
@@ -6100,15 +6059,19 @@ class PathDataProcessor {
|
|
|
6100
6059
|
* 专门处理边界标签的创建、定位和管理
|
|
6101
6060
|
*/
|
|
6102
6061
|
class BoundaryLabelsManager {
|
|
6103
|
-
constructor(svgView, boundaryData) {
|
|
6062
|
+
constructor(svgView, boundaryData, { unitType, language }) {
|
|
6104
6063
|
this.container = null;
|
|
6105
6064
|
this.overlayDiv = null;
|
|
6106
6065
|
this.globalClickHandler = null;
|
|
6107
6066
|
// 当前展开的边界id
|
|
6108
6067
|
this.currentExpandedBoundaryId = null;
|
|
6068
|
+
// 旋转角度
|
|
6069
|
+
this.rotation = 0;
|
|
6109
6070
|
this.svgView = svgView;
|
|
6110
6071
|
this.boundaryData = boundaryData;
|
|
6111
6072
|
this.initializeContainer();
|
|
6073
|
+
this.unitType = unitType;
|
|
6074
|
+
this.language = language;
|
|
6112
6075
|
}
|
|
6113
6076
|
/**
|
|
6114
6077
|
* 初始化容器
|
|
@@ -6182,17 +6145,17 @@ class BoundaryLabelsManager {
|
|
|
6182
6145
|
labelDiv.style.fontWeight = 'bold';
|
|
6183
6146
|
labelDiv.style.whiteSpace = 'nowrap';
|
|
6184
6147
|
labelDiv.style.maxWidth = '220px';
|
|
6185
|
-
labelDiv.style.transform =
|
|
6148
|
+
labelDiv.style.transform = `translate(-50%, -50%) rotate(${-this.rotation}deg)`;
|
|
6186
6149
|
labelDiv.style.pointerEvents = 'auto';
|
|
6187
6150
|
labelDiv.style.boxShadow = '0 2px 8px rgba(0,0,0,0.4)';
|
|
6188
6151
|
labelDiv.style.cursor = 'pointer';
|
|
6189
|
-
labelDiv.style.transition = 'background-color 0.2s ease
|
|
6152
|
+
labelDiv.style.transition = 'background-color 0.2s ease';
|
|
6190
6153
|
labelDiv.style.userSelect = 'none';
|
|
6191
6154
|
labelDiv.style.zIndex = BoundaryLabelsManager.Z_INDEX.DEFAULT.toString();
|
|
6192
6155
|
// 计算进度
|
|
6193
|
-
const progress = boundary.finishedArea && boundary.area
|
|
6194
|
-
`${Math.round((boundary.finishedArea / boundary.area) * 100)}%`
|
|
6195
|
-
'0%';
|
|
6156
|
+
const progress = boundary.finishedArea && boundary.area
|
|
6157
|
+
? `${Math.round((boundary.finishedArea / boundary.area) * 100)}%`
|
|
6158
|
+
: '0%';
|
|
6196
6159
|
// 基础内容(始终显示)
|
|
6197
6160
|
const baseContent = document.createElement('div');
|
|
6198
6161
|
baseContent.className = 'boundary-label-base';
|
|
@@ -6204,12 +6167,14 @@ class BoundaryLabelsManager {
|
|
|
6204
6167
|
extendedContent.style.marginTop = '6px';
|
|
6205
6168
|
extendedContent.style.fontSize = '11px';
|
|
6206
6169
|
extendedContent.style.opacity = '0.9';
|
|
6207
|
-
extendedContent.style.display =
|
|
6170
|
+
extendedContent.style.display =
|
|
6171
|
+
this.currentExpandedBoundaryId === boundary.id ? 'block' : 'none';
|
|
6208
6172
|
extendedContent.style.borderTop = '1px solid rgba(255,255,255,0.2)';
|
|
6209
6173
|
extendedContent.style.paddingTop = '6px';
|
|
6174
|
+
console.log('this.unitType->', this.unitType);
|
|
6210
6175
|
// 面积信息
|
|
6211
|
-
const totalArea = convertAreaByUnits(boundary.area || 0,
|
|
6212
|
-
const finishedArea = convertAreaByUnits(boundary.finishedArea || 0,
|
|
6176
|
+
const totalArea = convertAreaByUnits(boundary.area || 0, this.unitType);
|
|
6177
|
+
const finishedArea = convertAreaByUnits(boundary.finishedArea || 0, this.unitType);
|
|
6213
6178
|
const coverageText = `Coverage: ${finishedArea.value}/${totalArea.value}`;
|
|
6214
6179
|
// 日期信息
|
|
6215
6180
|
const dateText = formatBoundaryDateText(boundary.endTime || 0);
|
|
@@ -6275,7 +6240,6 @@ class BoundaryLabelsManager {
|
|
|
6275
6240
|
this.collapseOtherLabels(boundaryId);
|
|
6276
6241
|
// 展开当前标签
|
|
6277
6242
|
extendedContent.style.display = 'block';
|
|
6278
|
-
labelDiv.style.whiteSpace = 'normal';
|
|
6279
6243
|
this.currentExpandedBoundaryId = boundaryId;
|
|
6280
6244
|
}
|
|
6281
6245
|
/**
|
|
@@ -6285,7 +6249,7 @@ class BoundaryLabelsManager {
|
|
|
6285
6249
|
if (!this.container)
|
|
6286
6250
|
return;
|
|
6287
6251
|
const allLabels = this.container.querySelectorAll('.boundary-label');
|
|
6288
|
-
allLabels.forEach(label => {
|
|
6252
|
+
allLabels.forEach((label) => {
|
|
6289
6253
|
const labelBoundaryId = label.getAttribute('data-boundary-id');
|
|
6290
6254
|
if (labelBoundaryId && labelBoundaryId !== boundaryId.toString()) {
|
|
6291
6255
|
const extendedContent = label.querySelector('.boundary-label-extended');
|
|
@@ -6388,7 +6352,7 @@ class BoundaryLabelsManager {
|
|
|
6388
6352
|
if (points.length < 3)
|
|
6389
6353
|
return null;
|
|
6390
6354
|
// 过滤有效点
|
|
6391
|
-
const validPoints = points.filter(point => point.length >= 2);
|
|
6355
|
+
const validPoints = points.filter((point) => point.length >= 2);
|
|
6392
6356
|
if (validPoints.length < 3)
|
|
6393
6357
|
return null;
|
|
6394
6358
|
// 确保多边形是封闭的(如果不是,自动闭合)
|
|
@@ -6437,7 +6401,7 @@ class BoundaryLabelsManager {
|
|
|
6437
6401
|
});
|
|
6438
6402
|
return {
|
|
6439
6403
|
x: sumX / points.length,
|
|
6440
|
-
y: sumY / points.length
|
|
6404
|
+
y: sumY / points.length,
|
|
6441
6405
|
};
|
|
6442
6406
|
}
|
|
6443
6407
|
/**
|
|
@@ -6511,12 +6475,6 @@ class BoundaryLabelsManager {
|
|
|
6511
6475
|
this.container.style.display = visible ? 'block' : 'none';
|
|
6512
6476
|
}
|
|
6513
6477
|
}
|
|
6514
|
-
/**
|
|
6515
|
-
* 获取边界数据
|
|
6516
|
-
*/
|
|
6517
|
-
getBoundaryData() {
|
|
6518
|
-
return this.boundaryData;
|
|
6519
|
-
}
|
|
6520
6478
|
/**
|
|
6521
6479
|
* 根据ID获取特定边界的标签元素
|
|
6522
6480
|
*/
|
|
@@ -6533,7 +6491,7 @@ class BoundaryLabelsManager {
|
|
|
6533
6491
|
return;
|
|
6534
6492
|
const allLabels = this.container.querySelectorAll('.boundary-label');
|
|
6535
6493
|
this.currentExpandedBoundaryId = null;
|
|
6536
|
-
allLabels.forEach(label => {
|
|
6494
|
+
allLabels.forEach((label) => {
|
|
6537
6495
|
const extendedContent = label.querySelector('.boundary-label-extended');
|
|
6538
6496
|
if (extendedContent) {
|
|
6539
6497
|
extendedContent.style.display = 'none';
|
|
@@ -6548,7 +6506,7 @@ class BoundaryLabelsManager {
|
|
|
6548
6506
|
if (!this.container)
|
|
6549
6507
|
return;
|
|
6550
6508
|
const allLabels = this.container.querySelectorAll('.boundary-label');
|
|
6551
|
-
allLabels.forEach(label => {
|
|
6509
|
+
allLabels.forEach((label) => {
|
|
6552
6510
|
const labelElement = label;
|
|
6553
6511
|
if (interactive) {
|
|
6554
6512
|
labelElement.style.pointerEvents = 'auto';
|
|
@@ -6567,34 +6525,26 @@ class BoundaryLabelsManager {
|
|
|
6567
6525
|
});
|
|
6568
6526
|
}
|
|
6569
6527
|
/**
|
|
6570
|
-
*
|
|
6571
|
-
|
|
6572
|
-
resetZIndex() {
|
|
6573
|
-
this.resetLabelZIndex();
|
|
6574
|
-
}
|
|
6575
|
-
/**
|
|
6576
|
-
* 获取层级常量(静态方法)
|
|
6577
|
-
*/
|
|
6578
|
-
static getZIndexConstants() {
|
|
6579
|
-
return BoundaryLabelsManager.Z_INDEX;
|
|
6580
|
-
}
|
|
6581
|
-
/**
|
|
6582
|
-
* 调试方法:检查当前所有边界标签的层级
|
|
6528
|
+
* 设置标签旋转角度,使其与地图旋转相反,保持水平状态
|
|
6529
|
+
* @param rotation 地图的旋转角度(度)
|
|
6583
6530
|
*/
|
|
6584
|
-
|
|
6531
|
+
setRotation(rotation) {
|
|
6585
6532
|
if (!this.container)
|
|
6586
6533
|
return;
|
|
6587
|
-
|
|
6588
|
-
|
|
6534
|
+
this.rotation = rotation;
|
|
6535
|
+
const labels = this.container.querySelectorAll('.boundary-label');
|
|
6536
|
+
labels.forEach((label) => {
|
|
6589
6537
|
const labelElement = label;
|
|
6590
|
-
|
|
6538
|
+
// 应用与地图旋转相反的旋转,保持标签水平
|
|
6539
|
+
const counterRotation = -rotation;
|
|
6540
|
+
labelElement.style.transform = `translate(-50%, -50%) rotate(${counterRotation}deg)`;
|
|
6591
6541
|
});
|
|
6592
6542
|
}
|
|
6593
6543
|
}
|
|
6594
6544
|
// 简化的层级定义
|
|
6595
6545
|
BoundaryLabelsManager.Z_INDEX = {
|
|
6596
6546
|
DEFAULT: 900, // 默认层级
|
|
6597
|
-
ACTIVE: 9999 // 点击激活时的高层级
|
|
6547
|
+
ACTIVE: 9999, // 点击激活时的高层级
|
|
6598
6548
|
};
|
|
6599
6549
|
|
|
6600
6550
|
/**
|
|
@@ -6607,6 +6557,10 @@ class ChargingPileManager {
|
|
|
6607
6557
|
this.container = null;
|
|
6608
6558
|
this.overlayDiv = null;
|
|
6609
6559
|
this.pileElements = new Map();
|
|
6560
|
+
// 原始旋转角度
|
|
6561
|
+
this.originalRotation = 0;
|
|
6562
|
+
// 旋转角度
|
|
6563
|
+
this.rotation = 0;
|
|
6610
6564
|
this.svgView = svgView;
|
|
6611
6565
|
this.initializeContainer();
|
|
6612
6566
|
}
|
|
@@ -6661,7 +6615,9 @@ class ChargingPileManager {
|
|
|
6661
6615
|
// 将弧度转换为角度
|
|
6662
6616
|
const angle = (direction * 180) / Math.PI;
|
|
6663
6617
|
const rotationDegree = 270 - angle; // 坐标系转换
|
|
6664
|
-
|
|
6618
|
+
this.originalRotation = rotationDegree;
|
|
6619
|
+
const actualRotation = rotationDegree - this.rotation;
|
|
6620
|
+
pileDiv.style.transform = `translate(-50%, -50%) rotate(${actualRotation}deg)`;
|
|
6665
6621
|
// 添加动画
|
|
6666
6622
|
// this.addChargingPileAnimation(pileDiv, imgElement, rotationDegree);
|
|
6667
6623
|
// 生成唯一ID
|
|
@@ -6710,30 +6666,15 @@ class ChargingPileManager {
|
|
|
6710
6666
|
updatePositions() {
|
|
6711
6667
|
if (!this.overlayDiv || !this.container)
|
|
6712
6668
|
return;
|
|
6713
|
-
|
|
6714
|
-
const divWidth = divRect.width;
|
|
6715
|
-
const divHeight = divRect.height;
|
|
6716
|
-
// 获取SVG的viewBox
|
|
6717
|
-
const svg = this.svgView.getSVG();
|
|
6718
|
-
if (!svg)
|
|
6719
|
-
return;
|
|
6720
|
-
const viewBox = svg.viewBox.baseVal;
|
|
6721
|
-
const viewBoxData = {
|
|
6722
|
-
x: viewBox.x,
|
|
6723
|
-
y: viewBox.y,
|
|
6724
|
-
width: viewBox.width,
|
|
6725
|
-
height: viewBox.height,
|
|
6726
|
-
};
|
|
6727
|
-
this.updatePositionsWithPrecomputedData(divWidth, divHeight, viewBoxData);
|
|
6669
|
+
this.updatePositionsWithPrecomputedData();
|
|
6728
6670
|
}
|
|
6729
6671
|
/**
|
|
6730
6672
|
* 使用预计算数据更新位置
|
|
6731
6673
|
*/
|
|
6732
|
-
updatePositionsWithPrecomputedData(
|
|
6674
|
+
updatePositionsWithPrecomputedData() {
|
|
6733
6675
|
this.chargingPileElements.forEach((element, _index) => {
|
|
6734
6676
|
const center = element.coordinates[0];
|
|
6735
|
-
const pixelPosition = this.convertMapCoordinateToPixelWithPrecomputedData(center[0], center[1]
|
|
6736
|
-
console.log('updatePositionsWithPrecomputedData----->', element, pixelPosition, divWidth, divHeight, viewBox);
|
|
6677
|
+
const pixelPosition = this.convertMapCoordinateToPixelWithPrecomputedData(center[0], center[1]);
|
|
6737
6678
|
if (pixelPosition) {
|
|
6738
6679
|
const pileId = `pile_${center[0]}_${center[1]}`;
|
|
6739
6680
|
const pileElement = this.pileElements.get(pileId);
|
|
@@ -6747,7 +6688,15 @@ class ChargingPileManager {
|
|
|
6747
6688
|
/**
|
|
6748
6689
|
* 使用预计算数据进行坐标转换
|
|
6749
6690
|
*/
|
|
6750
|
-
convertMapCoordinateToPixelWithPrecomputedData(mapX, mapY
|
|
6691
|
+
convertMapCoordinateToPixelWithPrecomputedData(mapX, mapY) {
|
|
6692
|
+
// 获取叠加层div的CSS尺寸
|
|
6693
|
+
const divWidth = parseFloat(this.overlayDiv.style.width) || this.overlayDiv.offsetWidth;
|
|
6694
|
+
const divHeight = parseFloat(this.overlayDiv.style.height) || this.overlayDiv.offsetHeight;
|
|
6695
|
+
// 获取SVG的viewBox
|
|
6696
|
+
const svg = this.svgView.getSVG();
|
|
6697
|
+
if (!svg)
|
|
6698
|
+
return { x: 0, y: 0 };
|
|
6699
|
+
const viewBox = svg.viewBox.baseVal;
|
|
6751
6700
|
// 计算地图坐标在viewBox中的相对位置
|
|
6752
6701
|
const relativeX = (mapX - viewBox.x) / viewBox.width;
|
|
6753
6702
|
const relativeY = (mapY - viewBox.y) / viewBox.height;
|
|
@@ -6762,29 +6711,9 @@ class ChargingPileManager {
|
|
|
6762
6711
|
clear() {
|
|
6763
6712
|
this.chargingPileElements = [];
|
|
6764
6713
|
this.pileElements.clear();
|
|
6765
|
-
if (this.container) {
|
|
6766
|
-
this.container.innerHTML = '';
|
|
6767
|
-
}
|
|
6768
|
-
}
|
|
6769
|
-
/**
|
|
6770
|
-
* 设置可见性
|
|
6771
|
-
*/
|
|
6772
|
-
setVisible(visible) {
|
|
6773
|
-
if (this.container) {
|
|
6774
|
-
this.container.style.display = visible ? 'block' : 'none';
|
|
6775
|
-
}
|
|
6776
|
-
}
|
|
6777
|
-
/**
|
|
6778
|
-
* 获取充电桩数量
|
|
6779
|
-
*/
|
|
6780
|
-
getElementCount() {
|
|
6781
|
-
return this.chargingPileElements.length;
|
|
6782
|
-
}
|
|
6783
|
-
/**
|
|
6784
|
-
* 充电桩不需要动态层级调整(为了接口统一而保留)
|
|
6785
|
-
*/
|
|
6786
|
-
resetZIndex() {
|
|
6787
|
-
// 充电桩层级始终保持固定,无需重置
|
|
6714
|
+
if (this.container) {
|
|
6715
|
+
this.container.innerHTML = '';
|
|
6716
|
+
}
|
|
6788
6717
|
}
|
|
6789
6718
|
/**
|
|
6790
6719
|
* 销毁管理器
|
|
@@ -6797,10 +6726,21 @@ class ChargingPileManager {
|
|
|
6797
6726
|
this.container = null;
|
|
6798
6727
|
this.overlayDiv = null;
|
|
6799
6728
|
}
|
|
6729
|
+
/**
|
|
6730
|
+
* 设置充电桩旋转角度
|
|
6731
|
+
*/
|
|
6732
|
+
setRotation(rotation) {
|
|
6733
|
+
this.rotation = rotation;
|
|
6734
|
+
const allContainers = this.container.querySelectorAll('.charging-pile');
|
|
6735
|
+
allContainers.forEach((container) => {
|
|
6736
|
+
const pileElement = container;
|
|
6737
|
+
pileElement.style.transform = `translate(-50%, -50%) rotate(${this.originalRotation - this.rotation}deg)`;
|
|
6738
|
+
});
|
|
6739
|
+
}
|
|
6800
6740
|
}
|
|
6801
6741
|
// 简化的层级定义 - 充电桩只需要一个固定层级
|
|
6802
6742
|
ChargingPileManager.Z_INDEX = {
|
|
6803
|
-
CHARGING_PILE:
|
|
6743
|
+
CHARGING_PILE: 750, // 充电桩图标固定层级
|
|
6804
6744
|
};
|
|
6805
6745
|
|
|
6806
6746
|
/**
|
|
@@ -6818,6 +6758,8 @@ class AntennaManager {
|
|
|
6818
6758
|
this.globalClickHandler = null;
|
|
6819
6759
|
this.antennaTooltipFlag = false;
|
|
6820
6760
|
this.singleAntennaTooltipFlag = false;
|
|
6761
|
+
// 旋转角度
|
|
6762
|
+
this.rotation = 0;
|
|
6821
6763
|
this.svgView = svgView;
|
|
6822
6764
|
this.initializeContainer();
|
|
6823
6765
|
this.setupGlobalClickHandler();
|
|
@@ -6890,7 +6832,7 @@ class AntennaManager {
|
|
|
6890
6832
|
const antennaContainer = document.createElement('div');
|
|
6891
6833
|
antennaContainer.className = 'antenna-container-item';
|
|
6892
6834
|
antennaContainer.style.position = 'absolute';
|
|
6893
|
-
antennaContainer.style.transform =
|
|
6835
|
+
antennaContainer.style.transform = `translate(-50%, -50%) rotate(${-this.rotation}deg)`;
|
|
6894
6836
|
antennaContainer.style.pointerEvents = 'auto';
|
|
6895
6837
|
antennaContainer.style.zIndex = AntennaManager.Z_INDEX.DEFAULT.toString();
|
|
6896
6838
|
antennaContainer.setAttribute('data-antenna-id', antennaData.type.toString());
|
|
@@ -6931,8 +6873,6 @@ class AntennaManager {
|
|
|
6931
6873
|
this.singleAntennaTooltipFlag = true;
|
|
6932
6874
|
}
|
|
6933
6875
|
this.expandTooltip(antennaContainer);
|
|
6934
|
-
// 调试:检查层级变化
|
|
6935
|
-
this.debugCheckZIndex();
|
|
6936
6876
|
});
|
|
6937
6877
|
// 添加悬停效果
|
|
6938
6878
|
antennaDiv.addEventListener('mouseenter', () => {
|
|
@@ -7182,39 +7122,6 @@ class AntennaManager {
|
|
|
7182
7122
|
this.container.innerHTML = '';
|
|
7183
7123
|
}
|
|
7184
7124
|
}
|
|
7185
|
-
/**
|
|
7186
|
-
* 设置可见性
|
|
7187
|
-
*/
|
|
7188
|
-
setVisible(visible) {
|
|
7189
|
-
if (this.container) {
|
|
7190
|
-
this.container.style.display = visible ? 'block' : 'none';
|
|
7191
|
-
}
|
|
7192
|
-
}
|
|
7193
|
-
/**
|
|
7194
|
-
* 获取天线数量
|
|
7195
|
-
*/
|
|
7196
|
-
getElementCount() {
|
|
7197
|
-
return this.antennaElements.length;
|
|
7198
|
-
}
|
|
7199
|
-
/**
|
|
7200
|
-
* 重置天线层级(公共方法)
|
|
7201
|
-
*/
|
|
7202
|
-
resetZIndex() {
|
|
7203
|
-
this.resetAntennaZIndex();
|
|
7204
|
-
}
|
|
7205
|
-
/**
|
|
7206
|
-
* 获取层级常量(静态方法)
|
|
7207
|
-
*/
|
|
7208
|
-
static getZIndexConstants() {
|
|
7209
|
-
return AntennaManager.Z_INDEX;
|
|
7210
|
-
}
|
|
7211
|
-
/**
|
|
7212
|
-
* 调试方法:检查当前所有天线的层级
|
|
7213
|
-
*/
|
|
7214
|
-
debugCheckZIndex() {
|
|
7215
|
-
if (!this.container)
|
|
7216
|
-
return;
|
|
7217
|
-
}
|
|
7218
7125
|
/**
|
|
7219
7126
|
* 销毁管理器
|
|
7220
7127
|
*/
|
|
@@ -7231,10 +7138,21 @@ class AntennaManager {
|
|
|
7231
7138
|
this.container = null;
|
|
7232
7139
|
this.overlayDiv = null;
|
|
7233
7140
|
}
|
|
7141
|
+
/**
|
|
7142
|
+
* 设置天线旋转角度
|
|
7143
|
+
*/
|
|
7144
|
+
setRotation(rotation) {
|
|
7145
|
+
this.rotation = rotation;
|
|
7146
|
+
const allContainers = this.container.querySelectorAll('.antenna-container-item');
|
|
7147
|
+
allContainers.forEach((container) => {
|
|
7148
|
+
const antennaContainer = container;
|
|
7149
|
+
antennaContainer.style.transform = `translate(-50%, -50%) rotate(${-this.rotation}deg)`;
|
|
7150
|
+
});
|
|
7151
|
+
}
|
|
7234
7152
|
}
|
|
7235
7153
|
// 简化的层级定义
|
|
7236
7154
|
AntennaManager.Z_INDEX = {
|
|
7237
|
-
DEFAULT:
|
|
7155
|
+
DEFAULT: 800, // 默认层级
|
|
7238
7156
|
ACTIVE: 9999, // 点击激活时的高层级
|
|
7239
7157
|
};
|
|
7240
7158
|
|
|
@@ -7285,8 +7203,8 @@ const EDIT_BEHAVIOR = {
|
|
|
7285
7203
|
SUCCESS_MESSAGE_DURATION_MS: 3000,
|
|
7286
7204
|
};
|
|
7287
7205
|
|
|
7288
|
-
class
|
|
7289
|
-
constructor(svgView,
|
|
7206
|
+
class MowerPositionManager {
|
|
7207
|
+
constructor(svgView, mowerPositionConfig, modelType, overlayDiv, onAnimationComplete, onMowingPositionChange) {
|
|
7290
7208
|
this.container = null;
|
|
7291
7209
|
this.overlayDiv = null;
|
|
7292
7210
|
this.mowerElement = null;
|
|
@@ -7303,9 +7221,11 @@ class MowerPostionManager {
|
|
|
7303
7221
|
this.deltaPosition = null;
|
|
7304
7222
|
this.onlyUpdateTheta = false;
|
|
7305
7223
|
this.svgView = svgView;
|
|
7306
|
-
this.
|
|
7224
|
+
this.mowerPositionConfig = mowerPositionConfig;
|
|
7225
|
+
this.modelType = modelType;
|
|
7307
7226
|
this.overlayDiv = overlayDiv;
|
|
7308
7227
|
this.onAnimationComplete = onAnimationComplete;
|
|
7228
|
+
this.onMowingPositionChange = onMowingPositionChange;
|
|
7309
7229
|
this.initializeContainer();
|
|
7310
7230
|
}
|
|
7311
7231
|
get animationFlag() {
|
|
@@ -7351,12 +7271,13 @@ class MowerPostionManager {
|
|
|
7351
7271
|
imgElement.style.height = '100%';
|
|
7352
7272
|
imgElement.style.objectFit = 'contain';
|
|
7353
7273
|
// 获取图片源
|
|
7354
|
-
const imageSrc = getMowerImage(this.
|
|
7274
|
+
const imageSrc = getMowerImage(this.mowerPositionConfig);
|
|
7355
7275
|
if (imageSrc) {
|
|
7356
7276
|
imgElement.src = imageSrc;
|
|
7357
7277
|
}
|
|
7358
7278
|
this.mowerElement.appendChild(imgElement);
|
|
7359
7279
|
this.container.appendChild(this.mowerElement);
|
|
7280
|
+
this.updatePosition(this.mowerPositionConfig);
|
|
7360
7281
|
}
|
|
7361
7282
|
/**
|
|
7362
7283
|
* 设置叠加层div引用(用于坐标转换)
|
|
@@ -7373,51 +7294,62 @@ class MowerPostionManager {
|
|
|
7373
7294
|
/**
|
|
7374
7295
|
* 根据最后一次有效的位置更新数据
|
|
7375
7296
|
*/
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7297
|
+
updatePositionByLastPosition(chargingPilesPositionConfig) {
|
|
7298
|
+
if (!chargingPilesPositionConfig)
|
|
7299
|
+
return;
|
|
7300
|
+
this.mowerPositionConfig = chargingPilesPositionConfig;
|
|
7301
|
+
const positonOutOfRange = isOutOfRange(chargingPilesPositionConfig);
|
|
7302
|
+
const positionInValid = isInvalidPosition(chargingPilesPositionConfig);
|
|
7303
|
+
let postureX = 0;
|
|
7304
|
+
let postureY = 0;
|
|
7305
|
+
let postureTheta = 0;
|
|
7379
7306
|
const lastPosition = this.lastPosition;
|
|
7380
|
-
if (
|
|
7381
|
-
|
|
7307
|
+
if (positonOutOfRange || positionInValid) {
|
|
7308
|
+
postureX = lastPosition?.x || 0;
|
|
7309
|
+
postureY = lastPosition?.y || 0;
|
|
7310
|
+
postureTheta = lastPosition?.rotation || 0;
|
|
7382
7311
|
}
|
|
7383
7312
|
else {
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
postureY: lastPosition.y,
|
|
7388
|
-
postureTheta: lastPosition.rotation,
|
|
7389
|
-
}, 0);
|
|
7313
|
+
postureX = chargingPilesPositionConfig.postureX || 0;
|
|
7314
|
+
postureY = chargingPilesPositionConfig.postureY || 0;
|
|
7315
|
+
postureTheta = chargingPilesPositionConfig.postureTheta || 0;
|
|
7390
7316
|
}
|
|
7317
|
+
// 检查是否需要更新图片
|
|
7318
|
+
this.updateMowerImage(chargingPilesPositionConfig);
|
|
7319
|
+
// 立即更新位置
|
|
7320
|
+
this.setElementPosition(postureX, postureY, postureTheta);
|
|
7391
7321
|
}
|
|
7392
7322
|
/**
|
|
7393
7323
|
* 更新割草机位置
|
|
7394
7324
|
*/
|
|
7395
|
-
updatePosition(
|
|
7396
|
-
console.log('updatePosition----->', positonConfig);
|
|
7325
|
+
updatePosition(positionConfig, animationTime = 0) {
|
|
7397
7326
|
// 检查是否需要更新图片
|
|
7398
|
-
this.updateMowerImage(
|
|
7327
|
+
this.updateMowerImage(positionConfig);
|
|
7328
|
+
// 更新配置
|
|
7329
|
+
this.mowerPositionConfig = positionConfig;
|
|
7330
|
+
const postureX = positionConfig?.postureX || this.lastPosition?.x || 0;
|
|
7331
|
+
const postureY = positionConfig?.postureY || this.lastPosition?.y || 0;
|
|
7332
|
+
const postureTheta = positionConfig?.postureTheta || this.lastPosition?.rotation || 0;
|
|
7399
7333
|
// 停止当前动画(如果有)
|
|
7400
7334
|
this.stopAnimation();
|
|
7401
7335
|
// 第一个点
|
|
7402
7336
|
if (!this.currentPosition) {
|
|
7403
7337
|
this.currentPosition = {
|
|
7404
|
-
x:
|
|
7405
|
-
y:
|
|
7406
|
-
rotation:
|
|
7338
|
+
x: postureX,
|
|
7339
|
+
y: postureY,
|
|
7340
|
+
rotation: postureTheta,
|
|
7407
7341
|
};
|
|
7408
7342
|
this.setElementPosition(this.currentPosition.x, this.currentPosition.y, this.currentPosition.rotation);
|
|
7409
7343
|
return;
|
|
7410
7344
|
}
|
|
7411
7345
|
// 根据动画时长决定更新方式
|
|
7412
7346
|
if (animationTime > 0) {
|
|
7413
|
-
this.startAnimationToPosition(
|
|
7347
|
+
this.startAnimationToPosition(positionConfig, animationTime);
|
|
7414
7348
|
}
|
|
7415
7349
|
else {
|
|
7416
7350
|
// 立即更新位置
|
|
7417
|
-
this.setElementPosition(
|
|
7351
|
+
this.setElementPosition(positionConfig.postureX, positionConfig.postureY, positionConfig.postureTheta);
|
|
7418
7352
|
}
|
|
7419
|
-
// 更新配置
|
|
7420
|
-
this.mowerPositonConfig = positonConfig;
|
|
7421
7353
|
}
|
|
7422
7354
|
/**
|
|
7423
7355
|
* 更新割草机图片
|
|
@@ -7428,9 +7360,14 @@ class MowerPostionManager {
|
|
|
7428
7360
|
const imgElement = this.mowerElement.querySelector('img');
|
|
7429
7361
|
if (!imgElement)
|
|
7430
7362
|
return;
|
|
7431
|
-
const imageSrc = getMowerImage(positonConfig);
|
|
7363
|
+
const imageSrc = getMowerImage(positonConfig, this.modelType);
|
|
7432
7364
|
if (imageSrc) {
|
|
7433
7365
|
imgElement.src = imageSrc;
|
|
7366
|
+
imgElement.style.display = 'block';
|
|
7367
|
+
}
|
|
7368
|
+
else {
|
|
7369
|
+
imgElement.style.display = 'none';
|
|
7370
|
+
return;
|
|
7434
7371
|
}
|
|
7435
7372
|
}
|
|
7436
7373
|
/**
|
|
@@ -7440,7 +7377,9 @@ class MowerPostionManager {
|
|
|
7440
7377
|
const { x: pointX, y: pointY } = convertCoordinate(x, y);
|
|
7441
7378
|
const targetPixelPosition = this.convertMapCoordinateToOverlayPixel(pointX, pointY);
|
|
7442
7379
|
const targetRotation = radToDegree(theta);
|
|
7380
|
+
this.currentPosition = { x: x, y: y, rotation: theta };
|
|
7443
7381
|
this.lastPosition = { x, y, rotation: theta };
|
|
7382
|
+
// console.log('setElementPosition', x, y, theta, targetRotation, positonOutOfRange, positionValid, targetPixelPosition);
|
|
7444
7383
|
if (!this.mowerElement)
|
|
7445
7384
|
return;
|
|
7446
7385
|
this.mowerElement.style.left = `${targetPixelPosition?.x}px`;
|
|
@@ -7466,29 +7405,48 @@ class MowerPostionManager {
|
|
|
7466
7405
|
startAnimationToPosition(positionConfig, duration) {
|
|
7467
7406
|
if (!this.mowerElement || !this.currentPosition)
|
|
7468
7407
|
return;
|
|
7469
|
-
console.log('before startAnimationToPosition----->', this.startPosition, this.currentPosition, this.targetPosition, positionConfig);
|
|
7470
|
-
this.startPosition = { ...this.currentPosition, rotation: radNormalize(this.currentPosition.rotation) };
|
|
7471
7408
|
this.targetPosition = {
|
|
7472
7409
|
x: positionConfig.postureX,
|
|
7473
7410
|
y: positionConfig.postureY,
|
|
7474
7411
|
rotation: positionConfig.postureTheta,
|
|
7475
7412
|
};
|
|
7413
|
+
const isTargetPositionInvalid = isInvalidPosition({
|
|
7414
|
+
postureX: this.targetPosition.x,
|
|
7415
|
+
postureY: this.targetPosition.y,
|
|
7416
|
+
postureTheta: this.targetPosition.rotation,
|
|
7417
|
+
});
|
|
7418
|
+
const isTargetPositionOutOfRange = isOutOfRange({
|
|
7419
|
+
postureX: this.targetPosition.x,
|
|
7420
|
+
postureY: this.targetPosition.y,
|
|
7421
|
+
postureTheta: this.targetPosition.rotation,
|
|
7422
|
+
});
|
|
7423
|
+
// 如果目标坐标点不合理,则舍弃不使用
|
|
7424
|
+
if (isTargetPositionInvalid || isTargetPositionOutOfRange) {
|
|
7425
|
+
return;
|
|
7426
|
+
}
|
|
7427
|
+
this.startPosition = {
|
|
7428
|
+
...this.currentPosition,
|
|
7429
|
+
rotation: radNormalize(this.currentPosition.rotation),
|
|
7430
|
+
};
|
|
7476
7431
|
this.animationDuration = duration;
|
|
7477
7432
|
this.startTime = window.performance.now();
|
|
7478
7433
|
this.isAnimating = true;
|
|
7479
7434
|
this.onlyUpdateTheta =
|
|
7480
7435
|
distance(this.currentPosition.x, this.currentPosition.y, positionConfig.postureX, positionConfig.postureY) < 0.2;
|
|
7481
7436
|
// 为了实现倒车时,割草机图标旋转方向正确,需要计算当前位置和目标位置的夹角
|
|
7482
|
-
const calTheta = calAngle(
|
|
7437
|
+
// const calTheta = calAngle(
|
|
7438
|
+
// this.startPosition.x,
|
|
7439
|
+
// this.startPosition.y,
|
|
7440
|
+
// this.targetPosition.x,
|
|
7441
|
+
// this.targetPosition.y
|
|
7442
|
+
// );
|
|
7483
7443
|
const startTheta = this.startPosition.rotation;
|
|
7484
|
-
const targetTheta = this.
|
|
7485
|
-
console.log('begain startAnimationToPosition----->', this.startPosition, this.targetPosition, this.onlyUpdateTheta);
|
|
7444
|
+
const targetTheta = this.targetPosition.rotation;
|
|
7486
7445
|
this.deltaPosition = {
|
|
7487
7446
|
x: this.onlyUpdateTheta ? 0 : this.targetPosition.x - this.startPosition.x,
|
|
7488
7447
|
y: this.onlyUpdateTheta ? 0 : this.targetPosition.y - this.startPosition.y,
|
|
7489
|
-
rotation: radNormalize(targetTheta - startTheta)
|
|
7448
|
+
rotation: radNormalize(targetTheta - startTheta),
|
|
7490
7449
|
};
|
|
7491
|
-
console.log('deltaPosition----->', targetTheta, startTheta, calTheta, this.deltaPosition);
|
|
7492
7450
|
// 开始动画循环
|
|
7493
7451
|
this.animateStep();
|
|
7494
7452
|
}
|
|
@@ -7499,7 +7457,7 @@ class MowerPostionManager {
|
|
|
7499
7457
|
* 动画步骤
|
|
7500
7458
|
*/
|
|
7501
7459
|
animateStep() {
|
|
7502
|
-
if (!this.isAnimating || !this.
|
|
7460
|
+
if (!this.isAnimating || !this.targetPosition || !this.startPosition)
|
|
7503
7461
|
return;
|
|
7504
7462
|
const currentTime = window.performance.now();
|
|
7505
7463
|
const elapsed = currentTime - this.startTime;
|
|
@@ -7510,20 +7468,24 @@ class MowerPostionManager {
|
|
|
7510
7468
|
const currentX = this.startPosition.x + this.deltaPosition.x * easedProgress;
|
|
7511
7469
|
const currentY = this.startPosition.y + this.deltaPosition.y * easedProgress;
|
|
7512
7470
|
const currentRotation = this.startPosition.rotation + this.deltaPosition.rotation * easedProgress;
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7471
|
+
// 假设在这里进行更新路径数据
|
|
7472
|
+
if (this.onMowingPositionChange) {
|
|
7473
|
+
this.onMowingPositionChange({
|
|
7474
|
+
x: currentX,
|
|
7475
|
+
y: currentY,
|
|
7476
|
+
vehicleState: this.mowerPositionConfig?.vehicleState,
|
|
7477
|
+
});
|
|
7478
|
+
}
|
|
7479
|
+
// console.log('animateStep-->', this.startPosition, this.deltaPosition, this.targetPosition, easedProgress)
|
|
7480
|
+
this.setElementPosition(currentX, currentY, currentRotation);
|
|
7516
7481
|
// 继续动画或结束
|
|
7517
7482
|
if (progress < 1) {
|
|
7518
7483
|
// 设置当前位置
|
|
7519
|
-
this.setElementPosition(currentX, currentY, currentRotation);
|
|
7520
7484
|
this.animationId = window.requestAnimationFrame(() => this.animateStep());
|
|
7521
7485
|
}
|
|
7522
7486
|
else {
|
|
7523
|
-
this.setElementPosition(currentX, currentY, currentRotation);
|
|
7524
7487
|
// 动画完成
|
|
7525
7488
|
this.stopAnimation();
|
|
7526
|
-
console.log('end animateStep----->', this.lastPosition, this.currentPosition, this.targetPosition);
|
|
7527
7489
|
// 通知动画完成
|
|
7528
7490
|
if (this.onAnimationComplete) {
|
|
7529
7491
|
this.onAnimationComplete();
|
|
@@ -7568,12 +7530,6 @@ class MowerPostionManager {
|
|
|
7568
7530
|
this.container.style.display = visible ? 'block' : 'none';
|
|
7569
7531
|
}
|
|
7570
7532
|
}
|
|
7571
|
-
/**
|
|
7572
|
-
* 检查是否正在动画中
|
|
7573
|
-
*/
|
|
7574
|
-
getIsAnimating() {
|
|
7575
|
-
return this.isAnimating;
|
|
7576
|
-
}
|
|
7577
7533
|
/**
|
|
7578
7534
|
* 销毁管理器
|
|
7579
7535
|
*/
|
|
@@ -7589,13 +7545,85 @@ class MowerPostionManager {
|
|
|
7589
7545
|
}
|
|
7590
7546
|
}
|
|
7591
7547
|
|
|
7548
|
+
// 记录割草状态,状态变更的时候,变量不触发重新渲染
|
|
7549
|
+
const useProcessMowingState = create((set) => ({
|
|
7550
|
+
processStateIsMowing: false,
|
|
7551
|
+
updateProcessStateIsMowing: (isMowing) => set({ processStateIsMowing: isMowing }),
|
|
7552
|
+
resetProcessStateIsMowing: () => set({ processStateIsMowing: false }),
|
|
7553
|
+
}));
|
|
7554
|
+
|
|
7555
|
+
/**
|
|
7556
|
+
* 高级节流函数
|
|
7557
|
+
* @param func 要节流的函数
|
|
7558
|
+
* @param delay 延迟时间(毫秒)
|
|
7559
|
+
* @param options 配置选项
|
|
7560
|
+
* @returns 节流后的函数
|
|
7561
|
+
*/
|
|
7562
|
+
function throttleAdvanced(func, delay, options = { leading: true, trailing: true }) {
|
|
7563
|
+
let lastExecTime = 0;
|
|
7564
|
+
let timeoutId = null;
|
|
7565
|
+
let lastArgs = null;
|
|
7566
|
+
return function throttled(...args) {
|
|
7567
|
+
const currentTime = Date.now();
|
|
7568
|
+
lastArgs = args;
|
|
7569
|
+
// 如果距离上次执行的时间小于延迟时间
|
|
7570
|
+
if (currentTime - lastExecTime < delay) {
|
|
7571
|
+
// 清除之前的定时器
|
|
7572
|
+
if (timeoutId) {
|
|
7573
|
+
clearTimeout(timeoutId);
|
|
7574
|
+
}
|
|
7575
|
+
// 设置新的定时器
|
|
7576
|
+
timeoutId = setTimeout(() => {
|
|
7577
|
+
if (options.trailing && lastArgs) {
|
|
7578
|
+
lastExecTime = Date.now();
|
|
7579
|
+
func.apply(this, lastArgs);
|
|
7580
|
+
lastArgs = null;
|
|
7581
|
+
}
|
|
7582
|
+
timeoutId = null;
|
|
7583
|
+
}, delay - (currentTime - lastExecTime));
|
|
7584
|
+
}
|
|
7585
|
+
else {
|
|
7586
|
+
// 如果距离上次执行的时间已经超过延迟时间
|
|
7587
|
+
if (options.leading) {
|
|
7588
|
+
lastExecTime = currentTime;
|
|
7589
|
+
func.apply(this, args);
|
|
7590
|
+
}
|
|
7591
|
+
}
|
|
7592
|
+
};
|
|
7593
|
+
}
|
|
7594
|
+
/**
|
|
7595
|
+
* 检测当前设备是否为移动设备
|
|
7596
|
+
* @returns {boolean} 如果是移动设备返回true,否则返回false
|
|
7597
|
+
*/
|
|
7598
|
+
function isMobileDevice() {
|
|
7599
|
+
// 确保在浏览器环境中运行
|
|
7600
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
|
7601
|
+
return false;
|
|
7602
|
+
}
|
|
7603
|
+
// 检查用户代理字符串
|
|
7604
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
7605
|
+
const mobileKeywords = [
|
|
7606
|
+
'android', 'webos', 'iphone', 'ipad', 'ipod',
|
|
7607
|
+
'blackberry', 'windows phone', 'mobile'
|
|
7608
|
+
];
|
|
7609
|
+
const isMobileUserAgent = mobileKeywords.some(keyword => userAgent.includes(keyword));
|
|
7610
|
+
// 检查触摸屏支持
|
|
7611
|
+
const hasTouchScreen = 'ontouchstart' in window ||
|
|
7612
|
+
(navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
|
|
7613
|
+
// 检查屏幕尺寸(移动设备通常屏幕较小)
|
|
7614
|
+
const isSmallScreen = window.innerWidth <= 768;
|
|
7615
|
+
// 综合判断:用户代理包含移动设备关键词,或者有触摸屏且屏幕较小
|
|
7616
|
+
return isMobileUserAgent || (hasTouchScreen && isSmallScreen);
|
|
7617
|
+
}
|
|
7618
|
+
|
|
7592
7619
|
// Google Maps 叠加层类 - 带编辑功能
|
|
7593
7620
|
class MowerMapOverlay {
|
|
7594
|
-
constructor(bounds, mapData,
|
|
7621
|
+
constructor(bounds, mapData, partitionBoundary, mowerPositionConfig, modelType, pathData, isEditMode = false, unitType = UnitsType.Imperial, language = 'en', mapConfig = {}, antennaConfig = {}, mowPartitionData = null, defaultTransform, onMapLoad, onPathLoad, dragCallbacks) {
|
|
7595
7622
|
this.div = null;
|
|
7596
7623
|
this.svgMapView = null;
|
|
7597
7624
|
this.offscreenContainer = null;
|
|
7598
7625
|
this.overlayView = null;
|
|
7626
|
+
this.defaultTransform = { x: 0, y: 0, rotation: 0 };
|
|
7599
7627
|
// boundary数据
|
|
7600
7628
|
this.boundaryData = [];
|
|
7601
7629
|
// 边界标签管理器
|
|
@@ -7605,7 +7633,7 @@ class MowerMapOverlay {
|
|
|
7605
7633
|
// 天线管理器
|
|
7606
7634
|
this.antennaManager = null;
|
|
7607
7635
|
// 割草机位置管理器
|
|
7608
|
-
this.
|
|
7636
|
+
this.mowerPositionManager = null;
|
|
7609
7637
|
// 当前动画时长
|
|
7610
7638
|
this.currentAnimationTime = 0;
|
|
7611
7639
|
// 是否正在用户动画中(区分用户主动触发的动画和地图重绘)
|
|
@@ -7628,16 +7656,38 @@ class MowerMapOverlay {
|
|
|
7628
7656
|
// 初始状态记录(用于计算相对于初始状态的偏移)
|
|
7629
7657
|
this.initialOffset = { x: 0, y: 0 };
|
|
7630
7658
|
this.initialRotation = 0;
|
|
7659
|
+
this.mowPartitionData = null;
|
|
7660
|
+
this.updatePathDataByMowingPositionThrottled = throttleAdvanced(this.updatePathDataByMowingPosition, 300, {
|
|
7661
|
+
leading: true,
|
|
7662
|
+
trailing: false,
|
|
7663
|
+
});
|
|
7631
7664
|
this.bounds = bounds;
|
|
7632
7665
|
this.mapData = mapData;
|
|
7666
|
+
this.partitionBoundary = partitionBoundary;
|
|
7633
7667
|
this.pathData = pathData;
|
|
7634
7668
|
this.isEditMode = isEditMode;
|
|
7669
|
+
this.unitType = unitType;
|
|
7670
|
+
this.language = language;
|
|
7635
7671
|
this.mapConfig = mapConfig;
|
|
7636
7672
|
this.antennaConfig = antennaConfig;
|
|
7637
7673
|
this.onMapLoad = onMapLoad;
|
|
7638
7674
|
this.onPathLoad = onPathLoad;
|
|
7639
7675
|
this.dragCallbacks = dragCallbacks;
|
|
7640
|
-
this.
|
|
7676
|
+
this.mowerPositionConfig = mowerPositionConfig;
|
|
7677
|
+
this.mowPartitionData = mowPartitionData;
|
|
7678
|
+
this.modelType = modelType;
|
|
7679
|
+
// 设置默认的transform
|
|
7680
|
+
if (defaultTransform) {
|
|
7681
|
+
this.defaultTransform = {
|
|
7682
|
+
x: defaultTransform.x ?? 0,
|
|
7683
|
+
y: defaultTransform.y ?? 0,
|
|
7684
|
+
rotation: defaultTransform.rotation ?? 0,
|
|
7685
|
+
};
|
|
7686
|
+
// defaultTransform的x对应经度偏移量,y对应纬度偏移量
|
|
7687
|
+
this.latLngOffset.lng = this.defaultTransform.x;
|
|
7688
|
+
this.latLngOffset.lat = this.defaultTransform.y;
|
|
7689
|
+
this.currentRotation = this.defaultTransform.rotation;
|
|
7690
|
+
}
|
|
7641
7691
|
// 创建 OverlayView 实例
|
|
7642
7692
|
if (window.google && window.google.maps) {
|
|
7643
7693
|
this.overlayView = new window.google.maps.OverlayView();
|
|
@@ -7652,26 +7702,28 @@ class MowerMapOverlay {
|
|
|
7652
7702
|
this.overlayView.handleSave = this.handleSave.bind(this);
|
|
7653
7703
|
this.overlayView.setCustomIcons = this.setCustomIcons.bind(this);
|
|
7654
7704
|
this.overlayView.getCurrentDragState = this.getCurrentDragState.bind(this);
|
|
7705
|
+
this.overlayView.setTransform = this.setTransform.bind(this);
|
|
7706
|
+
this.overlayView.resetToDefaultTransform = this.resetToDefaultTransform.bind(this);
|
|
7655
7707
|
}
|
|
7656
7708
|
this.boundaryData = generateBoundaryData(mapData, pathData);
|
|
7657
7709
|
}
|
|
7658
|
-
updatePosition(
|
|
7659
|
-
console.log('updatePosition==', positonConfig, animationTime);
|
|
7710
|
+
updatePosition(positionConfig, animationTime = 2200) {
|
|
7660
7711
|
// 保存当前动画时长
|
|
7661
7712
|
this.currentAnimationTime = animationTime;
|
|
7662
7713
|
// 标记是否为用户动画(大于0表示用户主动触发的动画)
|
|
7663
7714
|
this.isUserAnimation = animationTime > 0;
|
|
7664
7715
|
// 更新割草机位置配置
|
|
7665
|
-
this.
|
|
7716
|
+
this.mowerPositionConfig = positionConfig;
|
|
7666
7717
|
// 更新割草机位置管理器
|
|
7667
|
-
if (this.
|
|
7668
|
-
this.
|
|
7718
|
+
if (this.mowerPositionManager) {
|
|
7719
|
+
this.mowerPositionManager.updatePosition(positionConfig, animationTime);
|
|
7669
7720
|
}
|
|
7670
7721
|
}
|
|
7671
|
-
|
|
7722
|
+
updatePositionByLastPosition(chargingPilesPositionConfig) {
|
|
7723
|
+
this.mowerPositionConfig = chargingPilesPositionConfig;
|
|
7672
7724
|
// 更新配置
|
|
7673
|
-
if (this.
|
|
7674
|
-
this.
|
|
7725
|
+
if (this.mowerPositionManager) {
|
|
7726
|
+
this.mowerPositionManager.updatePositionByLastPosition(chargingPilesPositionConfig);
|
|
7675
7727
|
}
|
|
7676
7728
|
}
|
|
7677
7729
|
setMap(map) {
|
|
@@ -7688,7 +7740,25 @@ class MowerMapOverlay {
|
|
|
7688
7740
|
getPanes() {
|
|
7689
7741
|
return this.overlayView ? this.overlayView.getPanes() : null;
|
|
7690
7742
|
}
|
|
7743
|
+
resetBorderLayerHighlight() {
|
|
7744
|
+
this.mowPartitionData = null;
|
|
7745
|
+
const boundaryBorderLayer = this.svgMapView?.getLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7746
|
+
if (!boundaryBorderLayer)
|
|
7747
|
+
return;
|
|
7748
|
+
boundaryBorderLayer.setMowingBoundarys([]);
|
|
7749
|
+
this.svgMapView?.renderLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7750
|
+
}
|
|
7751
|
+
setBorderLayerHighlight(mowPartitionData) {
|
|
7752
|
+
this.mowPartitionData = mowPartitionData;
|
|
7753
|
+
const boundaryBorderLayer = this.svgMapView?.getLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7754
|
+
const partitionIds = mowPartitionData?.partitionIds || [];
|
|
7755
|
+
if (!boundaryBorderLayer)
|
|
7756
|
+
return;
|
|
7757
|
+
boundaryBorderLayer.setMowingBoundarys(partitionIds);
|
|
7758
|
+
this.svgMapView?.renderLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7759
|
+
}
|
|
7691
7760
|
onAdd() {
|
|
7761
|
+
console.log('onAdd');
|
|
7692
7762
|
// 创建包含SVG的div
|
|
7693
7763
|
this.div = document.createElement('div');
|
|
7694
7764
|
this.div.style.borderStyle = 'none';
|
|
@@ -7710,6 +7780,7 @@ class MowerMapOverlay {
|
|
|
7710
7780
|
this.createBoundaryLabelsManager();
|
|
7711
7781
|
// 创建割草机位置管理器
|
|
7712
7782
|
this.createMowerPositionManager();
|
|
7783
|
+
this.setManagerRotation(this.defaultTransform.rotation);
|
|
7713
7784
|
// 如果处于编辑模式,创建编辑界面
|
|
7714
7785
|
if (this.isEditMode) {
|
|
7715
7786
|
this.createEditInterface();
|
|
@@ -7748,23 +7819,17 @@ class MowerMapOverlay {
|
|
|
7748
7819
|
const map = this.getMap();
|
|
7749
7820
|
if (!map || !this.svgMapView)
|
|
7750
7821
|
return;
|
|
7751
|
-
|
|
7752
|
-
// const center = map.getCenter();
|
|
7753
|
-
// 基础公式:像素/米 = 156543.03392 * cos(latitude) / (2 ^ zoom)
|
|
7754
|
-
// const metersPerPixel =
|
|
7755
|
-
// (156543.03392 * Math.cos((center.lat() * Math.PI) / 180)) / Math.pow(2, currentZoom);
|
|
7756
|
-
// 缩放比例 = 1 / 米/像素
|
|
7757
|
-
// const scale = (1 / metersPerPixel) * 50;
|
|
7758
|
-
// 应用缩放到SVG
|
|
7759
|
-
// this.svgMapView.setZoom(scale);
|
|
7822
|
+
this.draw();
|
|
7760
7823
|
}
|
|
7761
7824
|
// 创建边界标签管理器
|
|
7762
7825
|
createBoundaryLabelsManager() {
|
|
7763
7826
|
if (!this.div || !this.svgMapView)
|
|
7764
7827
|
return;
|
|
7765
|
-
console.log('this.boundaryData----->', this.boundaryData);
|
|
7766
7828
|
// 创建边界标签管理器
|
|
7767
|
-
this.boundaryLabelsManager = new BoundaryLabelsManager(this.svgMapView, this.boundaryData
|
|
7829
|
+
this.boundaryLabelsManager = new BoundaryLabelsManager(this.svgMapView, this.boundaryData, {
|
|
7830
|
+
unitType: this.unitType,
|
|
7831
|
+
language: this.language,
|
|
7832
|
+
});
|
|
7768
7833
|
// 设置叠加层div引用
|
|
7769
7834
|
this.boundaryLabelsManager.setOverlayDiv(this.div);
|
|
7770
7835
|
// 添加所有边界标签
|
|
@@ -7808,11 +7873,11 @@ class MowerMapOverlay {
|
|
|
7808
7873
|
if (!this.div || !this.svgMapView)
|
|
7809
7874
|
return;
|
|
7810
7875
|
// 创建割草机位置管理器,传入动画完成回调
|
|
7811
|
-
this.
|
|
7876
|
+
this.mowerPositionManager = new MowerPositionManager(this.svgMapView, this.mowerPositionConfig, this.modelType, this.div, () => { }, this.updatePathDataByMowingPositionThrottled.bind(this));
|
|
7812
7877
|
// 设置叠加层div引用
|
|
7813
|
-
this.
|
|
7878
|
+
this.mowerPositionManager.setOverlayDiv(this.div);
|
|
7814
7879
|
// 获取容器并添加到主div
|
|
7815
|
-
const container = this.
|
|
7880
|
+
const container = this.mowerPositionManager.getElement();
|
|
7816
7881
|
if (container) {
|
|
7817
7882
|
this.div.appendChild(container);
|
|
7818
7883
|
}
|
|
@@ -7839,23 +7904,9 @@ class MowerMapOverlay {
|
|
|
7839
7904
|
this.boundaryLabelsManager.updatePositionsWithPrecomputedData(width, height, viewBoxInfo);
|
|
7840
7905
|
}
|
|
7841
7906
|
// 更新管理器位置
|
|
7842
|
-
updateManagerPositions(
|
|
7907
|
+
updateManagerPositions(_width, _height) {
|
|
7843
7908
|
if (!this.div)
|
|
7844
7909
|
return;
|
|
7845
|
-
// 获取SVG元素和其viewBox
|
|
7846
|
-
const svgElement = this.div.querySelector('svg');
|
|
7847
|
-
if (!svgElement)
|
|
7848
|
-
return;
|
|
7849
|
-
const viewBox = svgElement.viewBox.baseVal;
|
|
7850
|
-
if (!viewBox)
|
|
7851
|
-
return;
|
|
7852
|
-
// 构造viewBox信息对象
|
|
7853
|
-
({
|
|
7854
|
-
x: viewBox.x,
|
|
7855
|
-
y: viewBox.y,
|
|
7856
|
-
width: viewBox.width,
|
|
7857
|
-
height: viewBox.height,
|
|
7858
|
-
});
|
|
7859
7910
|
// 更新充电桩位置
|
|
7860
7911
|
if (this.chargingPileManager) {
|
|
7861
7912
|
this.chargingPileManager.updatePositions();
|
|
@@ -7904,7 +7955,7 @@ class MowerMapOverlay {
|
|
|
7904
7955
|
this.rotateHandle.style.pointerEvents = 'auto';
|
|
7905
7956
|
this.rotateHandle.innerHTML = DEFAULT_ROTATE_ICON;
|
|
7906
7957
|
this.editContainer.appendChild(this.rotateHandle);
|
|
7907
|
-
//
|
|
7958
|
+
// 创建拖拽手柄(左下角)- 仅在移动设备上显示
|
|
7908
7959
|
this.dragHandle = document.createElement('div');
|
|
7909
7960
|
this.dragHandle.style.position = 'absolute';
|
|
7910
7961
|
this.dragHandle.style.bottom = '-20px';
|
|
@@ -7915,6 +7966,10 @@ class MowerMapOverlay {
|
|
|
7915
7966
|
this.dragHandle.style.zIndex = EDIT_STYLES.Z_INDEX.HANDLE;
|
|
7916
7967
|
this.dragHandle.style.pointerEvents = 'auto';
|
|
7917
7968
|
this.dragHandle.innerHTML = DEFAULT_DRAG_ICON;
|
|
7969
|
+
// 在PC设备上隐藏拖拽手柄
|
|
7970
|
+
if (!isMobileDevice()) {
|
|
7971
|
+
this.dragHandle.style.display = 'none';
|
|
7972
|
+
}
|
|
7918
7973
|
this.editContainer.appendChild(this.dragHandle);
|
|
7919
7974
|
// 将编辑容器添加到主div
|
|
7920
7975
|
this.div.appendChild(this.editContainer);
|
|
@@ -7930,9 +7985,10 @@ class MowerMapOverlay {
|
|
|
7930
7985
|
}
|
|
7931
7986
|
// 获取当前拖拽状态
|
|
7932
7987
|
getCurrentDragState() {
|
|
7988
|
+
// 返回基于地图中心点的经纬度偏移量
|
|
7933
7989
|
return {
|
|
7934
|
-
|
|
7935
|
-
|
|
7990
|
+
x: this.latLngOffset.lng + this.tempPixelOffset.x - this.initialOffset.x,
|
|
7991
|
+
y: this.latLngOffset.lat + this.tempPixelOffset.y - this.initialOffset.y,
|
|
7936
7992
|
rotation: this.currentRotation - this.initialRotation,
|
|
7937
7993
|
isDragging: this.isDragging,
|
|
7938
7994
|
isRotating: this.isRotating,
|
|
@@ -7955,7 +8011,6 @@ class MowerMapOverlay {
|
|
|
7955
8011
|
this.boundaryLabelsManager.collapseAllLabels();
|
|
7956
8012
|
}
|
|
7957
8013
|
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
7958
|
-
console.log('开始旋转操作');
|
|
7959
8014
|
});
|
|
7960
8015
|
// 旋转手柄的触摸事件
|
|
7961
8016
|
this.rotateHandle.addEventListener('touchstart', (e) => {
|
|
@@ -7971,39 +8026,41 @@ class MowerMapOverlay {
|
|
|
7971
8026
|
this.boundaryLabelsManager.collapseAllLabels();
|
|
7972
8027
|
}
|
|
7973
8028
|
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
7974
|
-
console.log('开始旋转操作(触摸)');
|
|
7975
|
-
}, { passive: false });
|
|
7976
|
-
// 拖拽手柄的鼠标事件
|
|
7977
|
-
this.dragHandle.addEventListener('mousedown', (e) => {
|
|
7978
|
-
e.preventDefault();
|
|
7979
|
-
e.stopPropagation();
|
|
7980
|
-
e.stopImmediatePropagation();
|
|
7981
|
-
this.isDragging = true;
|
|
7982
|
-
this.startPos = { x: e.clientX, y: e.clientY };
|
|
7983
|
-
this.dragHandle.style.cursor = 'grabbing';
|
|
7984
|
-
// 开始编辑时关闭所有展开的边界标签
|
|
7985
|
-
if (this.boundaryLabelsManager) {
|
|
7986
|
-
this.boundaryLabelsManager.collapseAllLabels();
|
|
7987
|
-
}
|
|
7988
|
-
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
7989
|
-
console.log('开始拖动操作(通过手柄)');
|
|
7990
|
-
});
|
|
7991
|
-
// 拖拽手柄的触摸事件
|
|
7992
|
-
this.dragHandle.addEventListener('touchstart', (e) => {
|
|
7993
|
-
e.preventDefault();
|
|
7994
|
-
e.stopPropagation();
|
|
7995
|
-
e.stopImmediatePropagation();
|
|
7996
|
-
this.isDragging = true;
|
|
7997
|
-
const touch = e.touches[0];
|
|
7998
|
-
this.startPos = { x: touch.clientX, y: touch.clientY };
|
|
7999
|
-
this.dragHandle.style.cursor = 'grabbing';
|
|
8000
|
-
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8001
|
-
console.log('开始拖动操作(通过手柄,触摸)');
|
|
8002
8029
|
}, { passive: false });
|
|
8030
|
+
// 拖拽手柄的鼠标事件 - 仅在移动设备上启用
|
|
8031
|
+
if (isMobileDevice()) {
|
|
8032
|
+
this.dragHandle.addEventListener('mousedown', (e) => {
|
|
8033
|
+
e.preventDefault();
|
|
8034
|
+
e.stopPropagation();
|
|
8035
|
+
e.stopImmediatePropagation();
|
|
8036
|
+
this.isDragging = true;
|
|
8037
|
+
this.startPos = { x: e.clientX, y: e.clientY };
|
|
8038
|
+
this.dragHandle.style.cursor = 'grabbing';
|
|
8039
|
+
// 开始编辑时关闭所有展开的边界标签
|
|
8040
|
+
if (this.boundaryLabelsManager) {
|
|
8041
|
+
this.boundaryLabelsManager.collapseAllLabels();
|
|
8042
|
+
}
|
|
8043
|
+
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8044
|
+
});
|
|
8045
|
+
// 拖拽手柄的触摸事件
|
|
8046
|
+
this.dragHandle.addEventListener('touchstart', (e) => {
|
|
8047
|
+
e.preventDefault();
|
|
8048
|
+
e.stopPropagation();
|
|
8049
|
+
e.stopImmediatePropagation();
|
|
8050
|
+
this.isDragging = true;
|
|
8051
|
+
const touch = e.touches[0];
|
|
8052
|
+
this.startPos = { x: touch.clientX, y: touch.clientY };
|
|
8053
|
+
this.dragHandle.style.cursor = 'grabbing';
|
|
8054
|
+
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8055
|
+
}, { passive: false });
|
|
8056
|
+
}
|
|
8003
8057
|
// 编辑容器的鼠标事件(整个区域拖拽)
|
|
8004
8058
|
this.editContainer.addEventListener('mousedown', (e) => {
|
|
8005
|
-
|
|
8006
|
-
|
|
8059
|
+
// 在移动设备上,检查是否点击了拖拽手柄或旋转手柄
|
|
8060
|
+
// 在PC设备上,只检查旋转手柄(拖拽手柄已隐藏)
|
|
8061
|
+
const isDragHandleClick = isMobileDevice() && e.target === this.dragHandle;
|
|
8062
|
+
const isRotateHandleClick = e.target === this.rotateHandle;
|
|
8063
|
+
if (isDragHandleClick || isRotateHandleClick) {
|
|
8007
8064
|
return;
|
|
8008
8065
|
}
|
|
8009
8066
|
e.preventDefault();
|
|
@@ -8020,8 +8077,11 @@ class MowerMapOverlay {
|
|
|
8020
8077
|
});
|
|
8021
8078
|
// 编辑容器的触摸事件(整个区域拖拽)
|
|
8022
8079
|
this.editContainer.addEventListener('touchstart', (e) => {
|
|
8023
|
-
|
|
8024
|
-
|
|
8080
|
+
// 在移动设备上,检查是否点击了拖拽手柄或旋转手柄
|
|
8081
|
+
// 在PC设备上,只检查旋转手柄(拖拽手柄已隐藏)
|
|
8082
|
+
const isDragHandleClick = isMobileDevice() && e.target === this.dragHandle;
|
|
8083
|
+
const isRotateHandleClick = e.target === this.rotateHandle;
|
|
8084
|
+
if (isDragHandleClick || isRotateHandleClick) {
|
|
8025
8085
|
return;
|
|
8026
8086
|
}
|
|
8027
8087
|
e.preventDefault();
|
|
@@ -8081,7 +8141,6 @@ class MowerMapOverlay {
|
|
|
8081
8141
|
e.preventDefault();
|
|
8082
8142
|
e.stopPropagation();
|
|
8083
8143
|
e.stopImmediatePropagation();
|
|
8084
|
-
console.log('结束编辑操作');
|
|
8085
8144
|
}
|
|
8086
8145
|
// 如果是拖拽结束,将像素偏移量转换为地理坐标偏移量
|
|
8087
8146
|
if (this.isDragging) {
|
|
@@ -8103,7 +8162,6 @@ class MowerMapOverlay {
|
|
|
8103
8162
|
e.preventDefault();
|
|
8104
8163
|
e.stopPropagation();
|
|
8105
8164
|
e.stopImmediatePropagation();
|
|
8106
|
-
console.log('结束编辑操作(触摸)');
|
|
8107
8165
|
}
|
|
8108
8166
|
// 如果是拖拽结束,将像素偏移量转换为地理坐标偏移量
|
|
8109
8167
|
if (this.isDragging) {
|
|
@@ -8209,11 +8267,12 @@ class MowerMapOverlay {
|
|
|
8209
8267
|
// 确保旋转角度在0-360度范围内
|
|
8210
8268
|
this.currentRotation = ((this.currentRotation % 360) + 360) % 360;
|
|
8211
8269
|
// 应用旋转变换到DOM元素,同时保持位移
|
|
8270
|
+
// 更新边界标签的旋转角度,使其保持水平状态
|
|
8271
|
+
this.setManagerRotation(this.currentRotation);
|
|
8212
8272
|
const transform = `translate(${this.tempPixelOffset.x}px, ${this.tempPixelOffset.y}px) rotate(${this.currentRotation}deg)`;
|
|
8213
8273
|
this.div.style.transform = transform;
|
|
8214
8274
|
// 更新鼠标起始位置为当前位置,为下次计算做准备
|
|
8215
8275
|
this.startPos = { x: mouseCurrentX, y: mouseCurrentY };
|
|
8216
|
-
console.log('旋转角度:', this.currentRotation, '角度增量:', angleDifferenceDegrees);
|
|
8217
8276
|
}
|
|
8218
8277
|
// 将像素偏移量转换为地理坐标偏移量
|
|
8219
8278
|
convertPixelOffsetToLatLng() {
|
|
@@ -8243,17 +8302,8 @@ class MowerMapOverlay {
|
|
|
8243
8302
|
// 累积更新地理坐标偏移量(不是直接赋值!)
|
|
8244
8303
|
this.latLngOffset.lat += latOffset;
|
|
8245
8304
|
this.latLngOffset.lng += lngOffset;
|
|
8246
|
-
console.log('精确转换偏移量:', {
|
|
8247
|
-
pixelOffset: this.tempPixelOffset,
|
|
8248
|
-
centerLatLng: { lat: centerLatLng.lat(), lng: centerLatLng.lng() },
|
|
8249
|
-
offsetLatLng: { lat: offsetLatLng.lat(), lng: offsetLatLng.lng() },
|
|
8250
|
-
latOffset,
|
|
8251
|
-
lngOffset,
|
|
8252
|
-
newLatLngOffset: this.latLngOffset,
|
|
8253
|
-
});
|
|
8254
8305
|
// 重置临时像素偏移量
|
|
8255
8306
|
this.tempPixelOffset = { x: 0, y: 0 };
|
|
8256
|
-
// 重新绘制以应用新的地理坐标偏移量
|
|
8257
8307
|
this.draw();
|
|
8258
8308
|
}
|
|
8259
8309
|
// 获取编辑数据
|
|
@@ -8289,8 +8339,6 @@ class MowerMapOverlay {
|
|
|
8289
8339
|
editData: editData,
|
|
8290
8340
|
timestamp: new Date().toISOString(),
|
|
8291
8341
|
};
|
|
8292
|
-
// 在这里可以添加保存逻辑,比如发送到服务器
|
|
8293
|
-
console.log('保存编辑数据:', saveData);
|
|
8294
8342
|
// 显示保存成功提示
|
|
8295
8343
|
this.showSaveSuccess();
|
|
8296
8344
|
return saveData;
|
|
@@ -8356,6 +8404,63 @@ class MowerMapOverlay {
|
|
|
8356
8404
|
this.div.style.pointerEvents = 'none';
|
|
8357
8405
|
}
|
|
8358
8406
|
}
|
|
8407
|
+
/**
|
|
8408
|
+
* 设置旋转角度
|
|
8409
|
+
*/
|
|
8410
|
+
setManagerRotation(rotation) {
|
|
8411
|
+
if (this.boundaryLabelsManager) {
|
|
8412
|
+
this.boundaryLabelsManager.setRotation(rotation);
|
|
8413
|
+
}
|
|
8414
|
+
if (this.antennaManager) {
|
|
8415
|
+
this.antennaManager.setRotation(rotation);
|
|
8416
|
+
}
|
|
8417
|
+
if (this.chargingPileManager) {
|
|
8418
|
+
this.chargingPileManager.setRotation(rotation);
|
|
8419
|
+
}
|
|
8420
|
+
}
|
|
8421
|
+
// 设置transform
|
|
8422
|
+
setTransform(transform) {
|
|
8423
|
+
if (typeof transform.x === 'number')
|
|
8424
|
+
this.tempPixelOffset.x = transform.x;
|
|
8425
|
+
if (typeof transform.y === 'number')
|
|
8426
|
+
this.tempPixelOffset.y = transform.y;
|
|
8427
|
+
if (typeof transform.rotation === 'number')
|
|
8428
|
+
this.currentRotation = transform.rotation;
|
|
8429
|
+
this.defaultTransform = {
|
|
8430
|
+
x: transform.x,
|
|
8431
|
+
y: transform.y,
|
|
8432
|
+
rotation: transform.rotation,
|
|
8433
|
+
};
|
|
8434
|
+
// defaultTransform的x对应经度偏移量,y对应纬度偏移量
|
|
8435
|
+
this.latLngOffset.lng = this.defaultTransform.x;
|
|
8436
|
+
this.latLngOffset.lat = this.defaultTransform.y;
|
|
8437
|
+
this.setManagerRotation(this.currentRotation);
|
|
8438
|
+
this.draw();
|
|
8439
|
+
}
|
|
8440
|
+
// 重置到默认的transform
|
|
8441
|
+
resetToDefaultTransform() {
|
|
8442
|
+
// 重置所有偏移和旋转相关的状态,x对应经度偏移,y对应纬度偏移
|
|
8443
|
+
this.latLngOffset.lng = this.defaultTransform.x;
|
|
8444
|
+
this.latLngOffset.lat = this.defaultTransform.y;
|
|
8445
|
+
this.tempPixelOffset = { x: 0, y: 0 };
|
|
8446
|
+
this.currentRotation = this.defaultTransform.rotation;
|
|
8447
|
+
this.initialOffset = { x: 0, y: 0 };
|
|
8448
|
+
this.initialRotation = 0;
|
|
8449
|
+
// 重新绘制
|
|
8450
|
+
// 重置边界标签的旋转角度
|
|
8451
|
+
if (this.boundaryLabelsManager) {
|
|
8452
|
+
this.boundaryLabelsManager.setRotation(this.defaultTransform.rotation);
|
|
8453
|
+
}
|
|
8454
|
+
if (this.antennaManager) {
|
|
8455
|
+
this.antennaManager.setRotation(this.defaultTransform.rotation);
|
|
8456
|
+
}
|
|
8457
|
+
if (this.chargingPileManager) {
|
|
8458
|
+
this.chargingPileManager.setRotation(this.defaultTransform.rotation);
|
|
8459
|
+
}
|
|
8460
|
+
this.draw();
|
|
8461
|
+
// 触发拖拽回调,通知外部状态更新
|
|
8462
|
+
this.dragCallbacks?.onDragEnd?.(this.getCurrentDragState());
|
|
8463
|
+
}
|
|
8359
8464
|
initializeSvgMapView() {
|
|
8360
8465
|
if (!this.offscreenContainer)
|
|
8361
8466
|
return;
|
|
@@ -8366,8 +8471,10 @@ class MowerMapOverlay {
|
|
|
8366
8471
|
this.loadMapData();
|
|
8367
8472
|
// 加载路径数据
|
|
8368
8473
|
if (this.pathData && this.svgMapView) {
|
|
8369
|
-
this.loadPathData(this.pathData);
|
|
8474
|
+
this.loadPathData(this.pathData, this.mowPartitionData);
|
|
8370
8475
|
}
|
|
8476
|
+
// 刷新绘制图层
|
|
8477
|
+
this.svgMapView.refresh();
|
|
8371
8478
|
// 获取生成的SVG并添加到叠加层div中
|
|
8372
8479
|
const svgElement = this.svgMapView.getSVG();
|
|
8373
8480
|
if (svgElement) {
|
|
@@ -8390,9 +8497,6 @@ class MowerMapOverlay {
|
|
|
8390
8497
|
// 使用现有的MapDataProcessor处理地图数据
|
|
8391
8498
|
const elements = MapDataProcessor.processMapData(this.mapData, this.mapConfig);
|
|
8392
8499
|
// 分离充电桩和天线元素,其他元素添加到SVG图层
|
|
8393
|
-
// const svgElements = elements.filter(element =>
|
|
8394
|
-
// element.type !== 'charging_pile' && element.type !== 'antenna'
|
|
8395
|
-
// );
|
|
8396
8500
|
const svgElements = elements.filter((element) => element.type !== 'charging_pile' && element.type !== 'antenna');
|
|
8397
8501
|
const chargingPileElements = elements.filter((element) => element.type === 'charging_pile');
|
|
8398
8502
|
// 处理SVG图层元素
|
|
@@ -8401,14 +8505,16 @@ class MowerMapOverlay {
|
|
|
8401
8505
|
// 处理天线数据
|
|
8402
8506
|
let antennaElements = [];
|
|
8403
8507
|
if (this.antennaConfig.length > 0) {
|
|
8404
|
-
antennaElements = AntennaDataBuilder.fromAntennaData(this.antennaConfig);
|
|
8508
|
+
antennaElements = AntennaDataBuilder.fromAntennaData(this.antennaConfig, this.mapConfig);
|
|
8405
8509
|
}
|
|
8406
8510
|
// 添加图层到SvgMapView
|
|
8407
8511
|
const layers = drawLayer.getLayers();
|
|
8408
8512
|
this.svgMapView.clear();
|
|
8409
|
-
|
|
8410
|
-
|
|
8411
|
-
|
|
8513
|
+
this.svgMapView.addLayers(layers);
|
|
8514
|
+
const boundaryBorderLayer = this.svgMapView.getLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
8515
|
+
if (boundaryBorderLayer) {
|
|
8516
|
+
boundaryBorderLayer.setMowingBoundarys(this.mowPartitionData?.partitionIds || []);
|
|
8517
|
+
}
|
|
8412
8518
|
this.createChargingPileManager();
|
|
8413
8519
|
// 使用管理器处理充电桩和天线
|
|
8414
8520
|
if (this.chargingPileManager && chargingPileElements.length > 0) {
|
|
@@ -8434,40 +8540,95 @@ class MowerMapOverlay {
|
|
|
8434
8540
|
console.error('加载地图数据时出错:', error);
|
|
8435
8541
|
}
|
|
8436
8542
|
}
|
|
8437
|
-
loadPathData(pathData) {
|
|
8543
|
+
loadPathData(pathData, mowPartitionData) {
|
|
8438
8544
|
try {
|
|
8439
8545
|
// 使用现有的PathDataProcessor处理路径数据
|
|
8440
8546
|
const pathElements = PathDataProcessor.processPathData(pathData, this.mapConfig);
|
|
8547
|
+
const newPathElements = pathElements.map((pathElement) => {
|
|
8548
|
+
const { id, elements } = pathElement;
|
|
8549
|
+
const isMowBoundary = mowPartitionData && mowPartitionData?.partitionIds?.includes(id);
|
|
8550
|
+
if (isMowBoundary) {
|
|
8551
|
+
return {
|
|
8552
|
+
id: id,
|
|
8553
|
+
elements: elements.map((element) => {
|
|
8554
|
+
const isTransPath = element.pathType === PathSegmentType.TRANS;
|
|
8555
|
+
if (isTransPath) {
|
|
8556
|
+
return element;
|
|
8557
|
+
}
|
|
8558
|
+
return {
|
|
8559
|
+
...element,
|
|
8560
|
+
style: {
|
|
8561
|
+
...element.style,
|
|
8562
|
+
lineColor: DEFAULT_STYLES.path.mowingLineColor,
|
|
8563
|
+
},
|
|
8564
|
+
};
|
|
8565
|
+
}),
|
|
8566
|
+
};
|
|
8567
|
+
}
|
|
8568
|
+
else {
|
|
8569
|
+
return pathElement;
|
|
8570
|
+
}
|
|
8571
|
+
});
|
|
8441
8572
|
const pathLayer = new PathLayer();
|
|
8442
|
-
pathLayer.addElements(
|
|
8573
|
+
pathLayer.addElements(newPathElements);
|
|
8443
8574
|
// 添加图层到SvgMapView
|
|
8444
8575
|
this.svgMapView.removeLayerByType(LAYER_DEFAULT_TYPE.PATH);
|
|
8445
8576
|
this.svgMapView.addLayer(pathLayer);
|
|
8446
|
-
|
|
8577
|
+
this.svgMapView.renderLayer(LAYER_DEFAULT_TYPE.PATH);
|
|
8447
8578
|
// 调用回调
|
|
8448
|
-
const elementCount =
|
|
8579
|
+
const elementCount = newPathElements.length;
|
|
8449
8580
|
this.onPathLoad?.(elementCount);
|
|
8450
8581
|
}
|
|
8451
8582
|
catch (error) {
|
|
8452
8583
|
console.error('加载路径数据时出错:', error);
|
|
8453
8584
|
}
|
|
8454
8585
|
}
|
|
8586
|
+
/**
|
|
8587
|
+
* 根据割草机位置,更新路径数据
|
|
8588
|
+
* @param position 割草机位置
|
|
8589
|
+
*/
|
|
8590
|
+
updatePathDataByMowingPosition(position) {
|
|
8591
|
+
// 找到当前position所在的分区id,将该点更新到pathData中
|
|
8592
|
+
const currentPartitionId = getPartitionId(this.partitionBoundary, position.x, position.y);
|
|
8593
|
+
const processStateIsMowing = useProcessMowingState.getState().processStateIsMowing;
|
|
8594
|
+
if (currentPartitionId && this.pathData?.[currentPartitionId]) {
|
|
8595
|
+
const currentPathData = this.pathData[currentPartitionId];
|
|
8596
|
+
this.pathData[currentPartitionId] = {
|
|
8597
|
+
...currentPathData,
|
|
8598
|
+
points: [
|
|
8599
|
+
...(currentPathData?.points || []),
|
|
8600
|
+
{
|
|
8601
|
+
postureX: Number(position.x),
|
|
8602
|
+
postureY: Number(position.y),
|
|
8603
|
+
knifeRotation: processStateIsMowing && position.vehicleState === RobotStatus.MOWING ? '01' : '00', // "knifeRotation": "01",//刀盘是否转动 00-否 01-是
|
|
8604
|
+
pathType: '', //这里由于从实时路径是获取不到pathType的,所以这里暂时不传。让路径是否绘制取决于knifeRotation
|
|
8605
|
+
partitionId: currentPartitionId.toString(),
|
|
8606
|
+
},
|
|
8607
|
+
],
|
|
8608
|
+
};
|
|
8609
|
+
this.updatePathData(this.pathData, this.mowPartitionData);
|
|
8610
|
+
}
|
|
8611
|
+
}
|
|
8612
|
+
updateMowPartitionData(mowPartitionData) {
|
|
8613
|
+
this.mowPartitionData = mowPartitionData;
|
|
8614
|
+
}
|
|
8455
8615
|
/** 更新历史路径数据 */
|
|
8456
|
-
updatePathData(pathData) {
|
|
8616
|
+
updatePathData(pathData, mowPartitionData) {
|
|
8457
8617
|
if (!this.svgMapView || !pathData)
|
|
8458
8618
|
return;
|
|
8459
8619
|
// 找到pathLayer,将其删除,然后重新添加
|
|
8460
|
-
this.loadPathData(pathData);
|
|
8620
|
+
this.loadPathData(pathData, mowPartitionData);
|
|
8461
8621
|
}
|
|
8622
|
+
/** 更新边界标签信息 */
|
|
8462
8623
|
updateBoundaryLabelInfo(pathJson) {
|
|
8463
8624
|
if (!pathJson)
|
|
8464
8625
|
return;
|
|
8465
8626
|
const boundaryData = generateBoundaryData(this.mapData, pathJson);
|
|
8466
|
-
console.log('boundaryData==', boundaryData);
|
|
8627
|
+
// console.log('boundaryData==', boundaryData);
|
|
8467
8628
|
this.boundaryLabelsManager?.updateBoundaryData(boundaryData);
|
|
8468
8629
|
}
|
|
8469
8630
|
draw() {
|
|
8470
|
-
console.log('
|
|
8631
|
+
console.log('ondraw');
|
|
8471
8632
|
// 防御性检查:如果this.div为null,说明onAdd还没被调用,直接返回
|
|
8472
8633
|
if (!this.div) {
|
|
8473
8634
|
return;
|
|
@@ -8525,13 +8686,17 @@ class MowerMapOverlay {
|
|
|
8525
8686
|
this.div.style.transform = transform;
|
|
8526
8687
|
}
|
|
8527
8688
|
else {
|
|
8528
|
-
//
|
|
8529
|
-
|
|
8530
|
-
|
|
8689
|
+
// 非拖拽时:应用当前偏移和旋转(包括默认值)
|
|
8690
|
+
const transforms = [];
|
|
8691
|
+
// 应用像素偏移
|
|
8692
|
+
if (this.tempPixelOffset.x !== 0 || this.tempPixelOffset.y !== 0) {
|
|
8693
|
+
transforms.push(`translate(${this.tempPixelOffset.x}px, ${this.tempPixelOffset.y}px)`);
|
|
8531
8694
|
}
|
|
8532
|
-
|
|
8533
|
-
|
|
8695
|
+
// 应用旋转
|
|
8696
|
+
if (this.currentRotation !== 0) {
|
|
8697
|
+
transforms.push(`rotate(${this.currentRotation}deg)`);
|
|
8534
8698
|
}
|
|
8699
|
+
this.div.style.transform = transforms.join(' ');
|
|
8535
8700
|
}
|
|
8536
8701
|
// 更新SVG视图框以适应新的尺寸
|
|
8537
8702
|
if (this.svgMapView) {
|
|
@@ -8551,11 +8716,11 @@ class MowerMapOverlay {
|
|
|
8551
8716
|
this.updateManagerPositions(width, height);
|
|
8552
8717
|
// 重绘的时候可能在动画中,这时候需要强制更新一次数据,不然会出现抖动的效果
|
|
8553
8718
|
// 非动画的情况下,根据最新的数据实时同步就可以了
|
|
8554
|
-
if (!this.
|
|
8555
|
-
this.
|
|
8719
|
+
if (!this.mowerPositionManager?.animationFlag) {
|
|
8720
|
+
this.mowerPositionManager?.updatePositionByLastPosition(this.mowerPositionConfig);
|
|
8556
8721
|
}
|
|
8557
8722
|
else {
|
|
8558
|
-
this.
|
|
8723
|
+
this.mowerPositionManager?.forceUpdatePosition();
|
|
8559
8724
|
}
|
|
8560
8725
|
if (this.antennaManager) {
|
|
8561
8726
|
this.antennaManager.updateAntennaPosition();
|
|
@@ -8591,9 +8756,9 @@ class MowerMapOverlay {
|
|
|
8591
8756
|
this.antennaManager = null;
|
|
8592
8757
|
}
|
|
8593
8758
|
// 清理割草机位置管理器
|
|
8594
|
-
if (this.
|
|
8595
|
-
this.
|
|
8596
|
-
this.
|
|
8759
|
+
if (this.mowerPositionManager) {
|
|
8760
|
+
this.mowerPositionManager.destroy();
|
|
8761
|
+
this.mowerPositionManager = null;
|
|
8597
8762
|
}
|
|
8598
8763
|
// 清理编辑界面
|
|
8599
8764
|
this.removeEditInterface();
|
|
@@ -8610,12 +8775,45 @@ class MowerMapOverlay {
|
|
|
8610
8775
|
}
|
|
8611
8776
|
// 显示/隐藏割草机位置
|
|
8612
8777
|
setMowerPositionVisible(visible) {
|
|
8613
|
-
if (this.
|
|
8614
|
-
this.
|
|
8615
|
-
}
|
|
8778
|
+
if (this.mowerPositionManager) {
|
|
8779
|
+
this.mowerPositionManager.setVisible(visible);
|
|
8780
|
+
}
|
|
8781
|
+
}
|
|
8782
|
+
// 获取SvgMapView实例(用于debug)
|
|
8783
|
+
getSvgMapView() {
|
|
8784
|
+
return this.svgMapView;
|
|
8785
|
+
}
|
|
8786
|
+
}
|
|
8787
|
+
|
|
8788
|
+
// 获取车辆状态的中文文案
|
|
8789
|
+
const getVehicleStateText = (vehicleState) => {
|
|
8790
|
+
switch (vehicleState) {
|
|
8791
|
+
case RobotStatus.PARKED:
|
|
8792
|
+
return 'PARKED';
|
|
8793
|
+
case RobotStatus.CHARGING:
|
|
8794
|
+
return 'CHARGING';
|
|
8795
|
+
case RobotStatus.STANDBY:
|
|
8796
|
+
return 'STANDBY';
|
|
8797
|
+
case RobotStatus.MOWING:
|
|
8798
|
+
return 'MOWING';
|
|
8799
|
+
case RobotStatus.WORKING:
|
|
8800
|
+
return 'WORKING';
|
|
8801
|
+
case RobotStatus.MAPPING:
|
|
8802
|
+
return 'MAPPING';
|
|
8803
|
+
case RobotStatus.ERROR:
|
|
8804
|
+
return 'ERROR';
|
|
8805
|
+
case RobotStatus.UPGRADING:
|
|
8806
|
+
return 'UPGRADING';
|
|
8807
|
+
case RobotStatus.DISCONNECTED:
|
|
8808
|
+
return 'DISCONNECTED';
|
|
8809
|
+
case RobotStatus.TASK_DELAY:
|
|
8810
|
+
return 'TASK_DELAY';
|
|
8811
|
+
case RobotStatus.UNKNOWN:
|
|
8812
|
+
return '未知';
|
|
8813
|
+
default:
|
|
8814
|
+
return `未知状态(${vehicleState})`;
|
|
8616
8815
|
}
|
|
8617
|
-
}
|
|
8618
|
-
|
|
8816
|
+
};
|
|
8619
8817
|
// 验证GPS坐标是否有效
|
|
8620
8818
|
const isValidGpsCoordinate = (coordinate) => {
|
|
8621
8819
|
if (!coordinate || coordinate.length < 2)
|
|
@@ -8629,47 +8827,89 @@ const isValidGpsCoordinate = (coordinate) => {
|
|
|
8629
8827
|
!(Math.abs(lng) < 0.001 && Math.abs(lat) < 0.001) // 排除接近(0,0)的坐标
|
|
8630
8828
|
);
|
|
8631
8829
|
};
|
|
8830
|
+
// 旋转坐标点
|
|
8831
|
+
const rotateCoordinate = (point, center, angleRadians) => {
|
|
8832
|
+
const [x, y] = point;
|
|
8833
|
+
const [cx, cy] = center;
|
|
8834
|
+
// 将点移动到原点
|
|
8835
|
+
const dx = x - cx;
|
|
8836
|
+
const dy = y - cy;
|
|
8837
|
+
// 应用旋转矩阵
|
|
8838
|
+
const cos = Math.cos(angleRadians);
|
|
8839
|
+
const sin = Math.sin(angleRadians);
|
|
8840
|
+
const rotatedX = dx * cos - dy * sin;
|
|
8841
|
+
const rotatedY = dx * sin + dy * cos;
|
|
8842
|
+
// 移回原位置
|
|
8843
|
+
return [rotatedX + cx, rotatedY + cy];
|
|
8844
|
+
};
|
|
8632
8845
|
// 获取有效的GPS边界
|
|
8633
|
-
const getValidGpsBounds = (mapData) => {
|
|
8846
|
+
const getValidGpsBounds = (mapData, rotation = 0) => {
|
|
8847
|
+
let bounds;
|
|
8634
8848
|
// 首先尝试使用地图数据中的GPS坐标
|
|
8635
8849
|
if (isValidGpsCoordinate(mapData.sw_gps) && isValidGpsCoordinate(mapData.ne_gps)) {
|
|
8636
|
-
|
|
8850
|
+
bounds = {
|
|
8637
8851
|
sw: mapData.sw_gps,
|
|
8638
8852
|
ne: mapData.ne_gps,
|
|
8639
8853
|
};
|
|
8640
8854
|
}
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8855
|
+
else {
|
|
8856
|
+
// 如果GPS坐标无效,尝试从地图几何数据估算
|
|
8857
|
+
const { sw, ne } = estimateGpsFromMapBounds(mapData);
|
|
8858
|
+
if (sw && ne) {
|
|
8859
|
+
console.warn('GPS坐标无效,使用地图几何数据估算边界:', sw, ne);
|
|
8860
|
+
bounds = {
|
|
8861
|
+
sw: [sw[0], sw[1]],
|
|
8862
|
+
ne: [ne[0], ne[1]],
|
|
8863
|
+
};
|
|
8864
|
+
}
|
|
8865
|
+
else {
|
|
8866
|
+
// 最后的fallback:使用默认坐标
|
|
8867
|
+
console.warn('无法获取有效的GPS边界,使用默认坐标');
|
|
8868
|
+
bounds = {
|
|
8869
|
+
sw: [-9.1562, -37.7503],
|
|
8870
|
+
ne: [31.247, 5.797],
|
|
8871
|
+
};
|
|
8872
|
+
}
|
|
8873
|
+
}
|
|
8874
|
+
// 如果有旋转角度,计算旋转后的边界
|
|
8875
|
+
if (rotation !== 0) {
|
|
8876
|
+
const angleRadians = (rotation * Math.PI) / 180; // 转换为弧度
|
|
8877
|
+
// 计算边界中心点
|
|
8878
|
+
const centerLng = (bounds.sw[0] + bounds.ne[0]) / 2;
|
|
8879
|
+
const centerLat = (bounds.sw[1] + bounds.ne[1]) / 2;
|
|
8880
|
+
const center = [centerLng, centerLat];
|
|
8881
|
+
// 旋转四个角点
|
|
8882
|
+
const sw = rotateCoordinate(bounds.sw, center, angleRadians);
|
|
8883
|
+
const ne = rotateCoordinate(bounds.ne, center, angleRadians);
|
|
8884
|
+
const se = rotateCoordinate([bounds.ne[0], bounds.sw[1]], center, angleRadians);
|
|
8885
|
+
const nw = rotateCoordinate([bounds.sw[0], bounds.ne[1]], center, angleRadians);
|
|
8886
|
+
// 计算旋转后的边界框(包含所有旋转后的点)
|
|
8887
|
+
const lngs = [sw[0], ne[0], se[0], nw[0]];
|
|
8888
|
+
const lats = [sw[1], ne[1], se[1], nw[1]];
|
|
8889
|
+
bounds = {
|
|
8890
|
+
sw: [Math.min(...lngs), Math.min(...lats)],
|
|
8891
|
+
ne: [Math.max(...lngs), Math.max(...lats)],
|
|
8649
8892
|
};
|
|
8650
8893
|
}
|
|
8651
|
-
|
|
8652
|
-
console.warn('无法获取有效的GPS边界,使用默认坐标');
|
|
8653
|
-
return {
|
|
8654
|
-
sw: [-9.1562, -37.7503],
|
|
8655
|
-
ne: [31.247, 5.797],
|
|
8656
|
-
};
|
|
8894
|
+
return bounds;
|
|
8657
8895
|
};
|
|
8658
8896
|
// 默认配置
|
|
8659
8897
|
const defaultMapConfig = DEFAULT_STYLES;
|
|
8660
8898
|
// 地图渲染器组件
|
|
8661
|
-
const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJson, pathJson, realTimeData,
|
|
8662
|
-
const svgMapViewRef = React.useRef(null);
|
|
8899
|
+
const MowerMapRenderer = React.forwardRef(({ unitType = UnitsType.Imperial, language = 'en', mapConfig, modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance, isEditMode = false, dragCallbacks, defaultTransform, debug = false, }, ref) => {
|
|
8663
8900
|
const [elementCount, setElementCount] = React.useState(0);
|
|
8664
8901
|
const [pathCount, setPathCount] = React.useState(0);
|
|
8665
|
-
const [zoom, setZoom] = React.useState(1);
|
|
8666
8902
|
const [currentError, setCurrentError] = React.useState(null);
|
|
8667
8903
|
const overlayRef = React.useRef(null);
|
|
8668
8904
|
// const mapRef = useMap();
|
|
8669
8905
|
const [isGoogleMapsReady, setIsGoogleMapsReady] = React.useState(false);
|
|
8670
8906
|
const [hasInitializedBounds, setHasInitializedBounds] = React.useState(false);
|
|
8671
|
-
const { clearSubBoundaryBorder } = useSubBoundaryBorderStore();
|
|
8907
|
+
const { clearSubBoundaryBorder, clearObstacles } = useSubBoundaryBorderStore();
|
|
8672
8908
|
const currentProcessMowingStatusRef = React.useRef(false);
|
|
8909
|
+
const { updateProcessStateIsMowing, processStateIsMowing } = useProcessMowingState();
|
|
8910
|
+
const [mowPartitionData, setMowPartitionData] = React.useState(null);
|
|
8911
|
+
// Debug相关状态
|
|
8912
|
+
const [debugInfo, setDebugInfo] = React.useState({});
|
|
8673
8913
|
// 处理地图分区边界
|
|
8674
8914
|
const partitionBoundary = React.useMemo(() => {
|
|
8675
8915
|
const allBoundaryElements = [];
|
|
@@ -8692,22 +8932,67 @@ const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJs
|
|
|
8692
8932
|
}, [mapConfig]);
|
|
8693
8933
|
const mergedAntennaConfig = React.useMemo(() => antennaConfig, [antennaConfig]);
|
|
8694
8934
|
const mowerPositionData = React.useMemo(() => {
|
|
8935
|
+
// realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
|
|
8936
|
+
if (!realTimeData || realTimeData.length === 0)
|
|
8937
|
+
return {
|
|
8938
|
+
postureX: 0,
|
|
8939
|
+
postureY: 0,
|
|
8940
|
+
postureTheta: 0,
|
|
8941
|
+
vehicleState: RobotStatus.DISCONNECTED,
|
|
8942
|
+
};
|
|
8943
|
+
let currentPositionData;
|
|
8944
|
+
if (realTimeData.length === 1 && realTimeData[0].type === RealTimeDataType.LOCATION) {
|
|
8945
|
+
currentPositionData = realTimeData[0];
|
|
8946
|
+
}
|
|
8947
|
+
else {
|
|
8948
|
+
currentPositionData = realTimeData?.find((item) => item.type === RealTimeDataType.LOCATION);
|
|
8949
|
+
}
|
|
8950
|
+
if (!currentPositionData)
|
|
8951
|
+
return undefined;
|
|
8695
8952
|
return {
|
|
8696
8953
|
postureTheta: currentPositionData?.postureTheta
|
|
8697
8954
|
? Number(currentPositionData.postureTheta)
|
|
8698
8955
|
: 0,
|
|
8699
8956
|
postureX: currentPositionData?.postureX ? Number(currentPositionData.postureX) : 0,
|
|
8700
8957
|
postureY: currentPositionData?.postureY ? Number(currentPositionData.postureY) : 0,
|
|
8701
|
-
|
|
8702
|
-
|
|
8958
|
+
lastPostureTheta: currentPositionData?.lastPostureTheta
|
|
8959
|
+
? Number(currentPositionData.lastPostureTheta)
|
|
8960
|
+
: 0,
|
|
8961
|
+
lastPostureX: currentPositionData?.lastPostureX
|
|
8962
|
+
? Number(currentPositionData.lastPostureX)
|
|
8963
|
+
: 0,
|
|
8964
|
+
lastPostureY: currentPositionData?.lastPostureY
|
|
8965
|
+
? Number(currentPositionData.lastPostureY)
|
|
8966
|
+
: 0,
|
|
8967
|
+
vehicleState: currentPositionData?.vehicleState || RobotStatus.DISCONNECTED,
|
|
8703
8968
|
};
|
|
8704
|
-
}, [
|
|
8705
|
-
console.log('mowerPositionData==', currentPositionData, mowerPositionData);
|
|
8969
|
+
}, [realTimeData, modelType]);
|
|
8706
8970
|
// 处理错误
|
|
8707
8971
|
const handleError = (error) => {
|
|
8708
8972
|
setCurrentError(error);
|
|
8709
8973
|
onError?.(error);
|
|
8710
8974
|
};
|
|
8975
|
+
const fitBounds = React.useCallback(() => {
|
|
8976
|
+
if (!mapJson || !mapRef)
|
|
8977
|
+
return null;
|
|
8978
|
+
// 计算边界
|
|
8979
|
+
const bounds = calculateMapBounds(mapJson);
|
|
8980
|
+
if (!bounds) {
|
|
8981
|
+
handleError('无法计算地图边界');
|
|
8982
|
+
return;
|
|
8983
|
+
}
|
|
8984
|
+
// 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
|
|
8985
|
+
const validBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
8986
|
+
// 地图数据中的坐标格式是 [longitude, latitude]
|
|
8987
|
+
const swLat = validBounds.sw[1] + defaultTransform.y;
|
|
8988
|
+
const swLng = validBounds.sw[0] + defaultTransform.x;
|
|
8989
|
+
const neLat = validBounds.ne[1] + defaultTransform.y;
|
|
8990
|
+
const neLng = validBounds.ne[0] + defaultTransform.x;
|
|
8991
|
+
const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
|
|
8992
|
+
new window.google.maps.LatLng(neLat, neLng) // 东北角
|
|
8993
|
+
);
|
|
8994
|
+
mapRef.fitBounds(googleBounds);
|
|
8995
|
+
}, [mapJson, mapRef, defaultTransform]);
|
|
8711
8996
|
// 初始化Google Maps叠加层
|
|
8712
8997
|
const initializeGoogleMapsOverlay = async () => {
|
|
8713
8998
|
if (!mapJson)
|
|
@@ -8731,7 +9016,8 @@ const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJs
|
|
|
8731
9016
|
return;
|
|
8732
9017
|
}
|
|
8733
9018
|
// 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
|
|
8734
|
-
|
|
9019
|
+
// 这里需要使用0度,需要原始的坐标点去计算元素的实际位置,只有在fitbounds的时候才需要使用旋转后的坐标点
|
|
9020
|
+
const validBounds = getValidGpsBounds(mapJson, 0);
|
|
8735
9021
|
// 地图数据中的坐标格式是 [longitude, latitude]
|
|
8736
9022
|
const swLat = validBounds.sw[1];
|
|
8737
9023
|
const swLng = validBounds.sw[0];
|
|
@@ -8740,17 +9026,13 @@ const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJs
|
|
|
8740
9026
|
const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
|
|
8741
9027
|
new window.google.maps.LatLng(neLat, neLng) // 东北角
|
|
8742
9028
|
);
|
|
8743
|
-
console.log('使用有效GPS坐标创建边界:', {
|
|
8744
|
-
sw: { lat: swLat, lng: swLng },
|
|
8745
|
-
ne: { lat: neLat, lng: neLng },
|
|
8746
|
-
});
|
|
8747
9029
|
// 如果已经存在叠加层,先移除它
|
|
8748
9030
|
if (overlayRef.current) {
|
|
8749
9031
|
overlayRef.current.setMap(null);
|
|
8750
9032
|
overlayRef.current = null;
|
|
8751
9033
|
}
|
|
8752
9034
|
// 创建叠加层
|
|
8753
|
-
const overlay = new MowerMapOverlay(googleBounds, mapJson, mowerPositionData, pathJson || {}, isEditMode, mergedMapConfig, mergedAntennaConfig, (count) => {
|
|
9035
|
+
const overlay = new MowerMapOverlay(googleBounds, mapJson, partitionBoundary, mowerPositionData, modelType, pathJson || {}, isEditMode, unitType, language, mergedMapConfig, mergedAntennaConfig, null, defaultTransform, (count) => {
|
|
8754
9036
|
setElementCount(count);
|
|
8755
9037
|
onMapLoad?.(count);
|
|
8756
9038
|
}, (count) => {
|
|
@@ -8771,39 +9053,32 @@ const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJs
|
|
|
8771
9053
|
handleError(`初始化Google Maps叠加层失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
8772
9054
|
}
|
|
8773
9055
|
};
|
|
8774
|
-
const
|
|
8775
|
-
|
|
8776
|
-
const
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
overlayRef.current.updatePathData(newRealTimeData.pathData);
|
|
8788
|
-
}
|
|
8789
|
-
overlayRef.current.updateBoundaryLabelInfo(newRealTimeData.pathData);
|
|
8790
|
-
};
|
|
9056
|
+
const resetInCharginPie = React.useCallback(() => {
|
|
9057
|
+
const elements = MapDataProcessor.processMapData(mapJson, mergedMapConfig);
|
|
9058
|
+
const chargingPiles = elements.find((element) => element.type === 'charging_pile');
|
|
9059
|
+
if (!overlayRef.current)
|
|
9060
|
+
return;
|
|
9061
|
+
// 如果在充电桩上,则直接更新位置到充电桩的位置
|
|
9062
|
+
overlayRef.current.updatePosition({
|
|
9063
|
+
...mowerPositionData,
|
|
9064
|
+
postureX: chargingPiles?.originalData.position[0],
|
|
9065
|
+
postureY: chargingPiles?.originalData.position[1],
|
|
9066
|
+
postureTheta: chargingPiles?.originalData.direction - Math.PI || 0,
|
|
9067
|
+
}, 0);
|
|
9068
|
+
}, [mapJson, mowerPositionData]);
|
|
8791
9069
|
// 初始化效果
|
|
8792
9070
|
React.useEffect(() => {
|
|
8793
9071
|
initializeGoogleMapsOverlay();
|
|
8794
|
-
console.log('init mow map');
|
|
8795
9072
|
// 清理函数
|
|
8796
9073
|
return () => {
|
|
8797
9074
|
clearSubBoundaryBorder();
|
|
9075
|
+
clearObstacles();
|
|
9076
|
+
updateProcessStateIsMowing(false);
|
|
8798
9077
|
currentProcessMowingStatusRef.current = false;
|
|
8799
9078
|
if (overlayRef.current) {
|
|
8800
9079
|
overlayRef.current.setMap(null);
|
|
8801
9080
|
overlayRef.current = null;
|
|
8802
9081
|
}
|
|
8803
|
-
if (svgMapViewRef.current) {
|
|
8804
|
-
svgMapViewRef.current.destroy();
|
|
8805
|
-
svgMapViewRef.current = null;
|
|
8806
|
-
}
|
|
8807
9082
|
};
|
|
8808
9083
|
}, [mapJson, pathJson, mergedMapConfig, mergedAntennaConfig]);
|
|
8809
9084
|
// 监听编辑模式变化
|
|
@@ -8823,13 +9098,13 @@ const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJs
|
|
|
8823
9098
|
return;
|
|
8824
9099
|
const elements = MapDataProcessor.processMapData(mapJson, mergedMapConfig);
|
|
8825
9100
|
const chargingPiles = elements.find((element) => element.type === 'charging_pile');
|
|
8826
|
-
console.log('chargingPiles==', chargingPiles, currentPositionData);
|
|
8827
9101
|
if (!mowerPositionData || !overlayRef.current)
|
|
8828
9102
|
return;
|
|
8829
9103
|
const inChargingPiles = [RobotStatus.CHARGING, RobotStatus.PARKED];
|
|
8830
9104
|
const isOffLine = mowerPositionData.vehicleState === RobotStatus.DISCONNECTED;
|
|
8831
9105
|
const isInChargingPile = inChargingPiles.includes(mowerPositionData.vehicleState);
|
|
8832
|
-
//
|
|
9106
|
+
// 如果在充电桩上,则直接更新位置到充电桩的位置
|
|
9107
|
+
console.log('usefeect mowerPositionData----->', mowerPositionData, isInChargingPile);
|
|
8833
9108
|
if (isInChargingPile) {
|
|
8834
9109
|
overlayRef.current.updatePosition({
|
|
8835
9110
|
...mowerPositionData,
|
|
@@ -8839,68 +9114,244 @@ const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJs
|
|
|
8839
9114
|
}, 0);
|
|
8840
9115
|
}
|
|
8841
9116
|
else {
|
|
9117
|
+
// 如果车辆是disabled状态或者超出边界(默认超过1000m),则更新位置到上一次的位置
|
|
8842
9118
|
const positonOutOfRange = isOutOfRange(mowerPositionData);
|
|
8843
9119
|
const positionValid = isInvalidPosition(mowerPositionData);
|
|
8844
|
-
const
|
|
9120
|
+
const isStandby = mowerPositionData.vehicleState === RobotStatus.STANDBY;
|
|
8845
9121
|
if (positonOutOfRange || positionValid || isOffLine) {
|
|
8846
|
-
|
|
8847
|
-
|
|
8848
|
-
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
9122
|
+
// 初始信息是通过后端接口获取的,此时当前位置数据不可用的时候,可以取上一次的位置数据
|
|
9123
|
+
// mowerPositionData 中可能会包含上一次的位置数据,
|
|
9124
|
+
const lastPostureX = mowerPositionData.lastPostureX;
|
|
9125
|
+
const lastPostureY = mowerPositionData.lastPostureY;
|
|
9126
|
+
const lastPostureTheta = mowerPositionData.lastPostureTheta;
|
|
9127
|
+
if (lastPostureX && lastPostureY && lastPostureTheta) {
|
|
9128
|
+
overlayRef.current.updatePositionByLastPosition(mowerPositionData);
|
|
9129
|
+
}
|
|
9130
|
+
else {
|
|
9131
|
+
overlayRef.current.updatePositionByLastPosition({
|
|
9132
|
+
...mowerPositionData,
|
|
9133
|
+
postureX: chargingPiles?.originalData.position[0],
|
|
9134
|
+
postureY: chargingPiles?.originalData.position[1],
|
|
9135
|
+
postureTheta: chargingPiles?.originalData.direction - Math.PI || 0,
|
|
9136
|
+
});
|
|
9137
|
+
}
|
|
8852
9138
|
}
|
|
8853
9139
|
else {
|
|
8854
|
-
overlayRef.current.updatePosition(mowerPositionData,
|
|
9140
|
+
overlayRef.current.updatePosition(mowerPositionData, isStandby ? 0 : 2000);
|
|
8855
9141
|
}
|
|
8856
9142
|
}
|
|
8857
|
-
}, [
|
|
9143
|
+
}, [mowerPositionData]);
|
|
9144
|
+
// 更新debug信息
|
|
9145
|
+
React.useEffect(() => {
|
|
9146
|
+
if (!debug)
|
|
9147
|
+
return;
|
|
9148
|
+
const updateDebugInfo = () => {
|
|
9149
|
+
const newDebugInfo = {};
|
|
9150
|
+
// 获取地图GPS边界
|
|
9151
|
+
if (mapJson) {
|
|
9152
|
+
newDebugInfo.mapBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
9153
|
+
}
|
|
9154
|
+
// 获取SVG viewBox信息
|
|
9155
|
+
if (overlayRef.current) {
|
|
9156
|
+
const overlay = overlayRef.current;
|
|
9157
|
+
const svgMapView = overlay.getSvgMapView?.();
|
|
9158
|
+
if (svgMapView) {
|
|
9159
|
+
const viewBoxInfo = svgMapView.getViewBoxInfo();
|
|
9160
|
+
// 计算实际的米单位数据(除以缩放比例)
|
|
9161
|
+
const SCALE_FACTOR = 50; // 根据项目中的缩放因子
|
|
9162
|
+
newDebugInfo.viewBox = {
|
|
9163
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9164
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9165
|
+
width: viewBoxInfo.width / SCALE_FACTOR,
|
|
9166
|
+
height: viewBoxInfo.height / SCALE_FACTOR,
|
|
9167
|
+
scale: SCALE_FACTOR,
|
|
9168
|
+
// 计算左下角和右上角坐标
|
|
9169
|
+
sw: {
|
|
9170
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9171
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9172
|
+
},
|
|
9173
|
+
ne: {
|
|
9174
|
+
x: (viewBoxInfo.x + viewBoxInfo.width) / SCALE_FACTOR,
|
|
9175
|
+
y: (viewBoxInfo.y + viewBoxInfo.height) / SCALE_FACTOR,
|
|
9176
|
+
},
|
|
9177
|
+
};
|
|
9178
|
+
}
|
|
9179
|
+
}
|
|
9180
|
+
// 获取当前割草机位置
|
|
9181
|
+
if (mowerPositionData) {
|
|
9182
|
+
newDebugInfo.mowerPosition = {
|
|
9183
|
+
x: mowerPositionData.postureX || 0,
|
|
9184
|
+
y: mowerPositionData.postureY || 0,
|
|
9185
|
+
theta: mowerPositionData.postureTheta || 0,
|
|
9186
|
+
lastX: mowerPositionData.lastPostureX || 0,
|
|
9187
|
+
lastY: mowerPositionData.lastPostureY || 0,
|
|
9188
|
+
lastTheta: mowerPositionData.lastPostureTheta || 0,
|
|
9189
|
+
vehicleState: mowerPositionData.vehicleState || RobotStatus.UNKNOWN,
|
|
9190
|
+
vehicleStateText: getVehicleStateText(mowerPositionData.vehicleState || RobotStatus.UNKNOWN),
|
|
9191
|
+
};
|
|
9192
|
+
}
|
|
9193
|
+
// 获取当前割草地块数据
|
|
9194
|
+
newDebugInfo.partitionData = mowPartitionData;
|
|
9195
|
+
setDebugInfo(newDebugInfo);
|
|
9196
|
+
};
|
|
9197
|
+
updateDebugInfo();
|
|
9198
|
+
}, [debug, mapJson, mowerPositionData, mowPartitionData, defaultTransform]);
|
|
9199
|
+
// 当关键数据变化时立即更新debug信息
|
|
9200
|
+
React.useEffect(() => {
|
|
9201
|
+
if (!debug)
|
|
9202
|
+
return;
|
|
9203
|
+
const updateDebugInfo = () => {
|
|
9204
|
+
const newDebugInfo = {};
|
|
9205
|
+
// 获取地图GPS边界
|
|
9206
|
+
if (mapJson) {
|
|
9207
|
+
newDebugInfo.mapBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
9208
|
+
}
|
|
9209
|
+
// 获取SVG viewBox信息
|
|
9210
|
+
if (overlayRef.current) {
|
|
9211
|
+
const overlay = overlayRef.current;
|
|
9212
|
+
const svgMapView = overlay.getSvgMapView?.();
|
|
9213
|
+
if (svgMapView) {
|
|
9214
|
+
const viewBoxInfo = svgMapView.getViewBoxInfo();
|
|
9215
|
+
// 计算实际的米单位数据(除以缩放比例)
|
|
9216
|
+
const SCALE_FACTOR = 50; // 根据项目中的缩放因子
|
|
9217
|
+
newDebugInfo.viewBox = {
|
|
9218
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9219
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9220
|
+
width: viewBoxInfo.width / SCALE_FACTOR,
|
|
9221
|
+
height: viewBoxInfo.height / SCALE_FACTOR,
|
|
9222
|
+
scale: SCALE_FACTOR,
|
|
9223
|
+
// 计算左下角和右上角坐标
|
|
9224
|
+
sw: {
|
|
9225
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9226
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9227
|
+
},
|
|
9228
|
+
ne: {
|
|
9229
|
+
x: (viewBoxInfo.x + viewBoxInfo.width) / SCALE_FACTOR,
|
|
9230
|
+
y: (viewBoxInfo.y + viewBoxInfo.height) / SCALE_FACTOR,
|
|
9231
|
+
},
|
|
9232
|
+
};
|
|
9233
|
+
}
|
|
9234
|
+
}
|
|
9235
|
+
// 获取当前割草机位置
|
|
9236
|
+
if (mowerPositionData) {
|
|
9237
|
+
newDebugInfo.mowerPosition = {
|
|
9238
|
+
x: mowerPositionData.postureX || 0,
|
|
9239
|
+
y: mowerPositionData.postureY || 0,
|
|
9240
|
+
theta: mowerPositionData.postureTheta || 0,
|
|
9241
|
+
lastX: mowerPositionData.lastPostureX || 0,
|
|
9242
|
+
lastY: mowerPositionData.lastPostureY || 0,
|
|
9243
|
+
lastTheta: mowerPositionData.lastPostureTheta || 0,
|
|
9244
|
+
vehicleState: mowerPositionData.vehicleState || RobotStatus.UNKNOWN,
|
|
9245
|
+
vehicleStateText: getVehicleStateText(mowerPositionData.vehicleState || RobotStatus.UNKNOWN),
|
|
9246
|
+
};
|
|
9247
|
+
}
|
|
9248
|
+
// 获取当前割草地块数据
|
|
9249
|
+
newDebugInfo.partitionData = mowPartitionData;
|
|
9250
|
+
setDebugInfo(newDebugInfo);
|
|
9251
|
+
};
|
|
9252
|
+
updateDebugInfo();
|
|
9253
|
+
}, [debug, mowerPositionData, mowPartitionData]);
|
|
8858
9254
|
React.useEffect(() => {
|
|
9255
|
+
if (!realTimeData || realTimeData.length === 0 || !Array.isArray(realTimeData)) {
|
|
9256
|
+
return;
|
|
9257
|
+
}
|
|
9258
|
+
console.log('usefeect realTimeData----->', realTimeData, mapJson, pathJson, overlayRef.current);
|
|
9259
|
+
let curMowPartitionData = mowPartitionData;
|
|
9260
|
+
// realtime中包含当前割草任务的数据,根据数据进行path路径和边界的高亮操作,
|
|
9261
|
+
const mowingPartition = realTimeData.find((item) => item.type === RealTimeDataType.PARTITION);
|
|
9262
|
+
if (mowingPartition) {
|
|
9263
|
+
setMowPartitionData(mowingPartition);
|
|
9264
|
+
curMowPartitionData = mowingPartition;
|
|
9265
|
+
}
|
|
9266
|
+
const positionData = realTimeData?.find(item => item?.type === RealTimeDataType.LOCATION);
|
|
9267
|
+
const statusData = realTimeData?.find(item => item?.type === RealTimeDataType.STATUS);
|
|
9268
|
+
if (statusData || positionData) {
|
|
9269
|
+
const currentStatus = statusData?.vehicleState || positionData?.vehicleState;
|
|
9270
|
+
// 车辆回桩不会回传最后的park的位置,所以根据实时数据的状态数据判断车辆回到桩上
|
|
9271
|
+
if ([RobotStatus.CHARGING, RobotStatus.PARKED].includes(currentStatus || RobotStatus.UNKNOWN)) {
|
|
9272
|
+
resetInCharginPie();
|
|
9273
|
+
}
|
|
9274
|
+
else if (currentStatus === RobotStatus.WORKING) {
|
|
9275
|
+
// 兜底收不到割草地块的实时数据,使用状态来兜底
|
|
9276
|
+
overlayRef.current.resetBorderLayerHighlight();
|
|
9277
|
+
setMowPartitionData(null);
|
|
9278
|
+
curMowPartitionData = null;
|
|
9279
|
+
}
|
|
9280
|
+
else if (currentStatus === RobotStatus.MOWING && (curMowPartitionData && !curMowPartitionData?.partitionIds)) {
|
|
9281
|
+
// 如果当前是割草状态,但是地块数据初始化过且不存在则认为是全局割草,则把所有地块都高亮
|
|
9282
|
+
const allPartitionIds = mapJson?.sub_maps?.map(item => item?.id);
|
|
9283
|
+
setMowPartitionData({
|
|
9284
|
+
partitionIds: allPartitionIds
|
|
9285
|
+
});
|
|
9286
|
+
curMowPartitionData = {
|
|
9287
|
+
partitionIds: allPartitionIds
|
|
9288
|
+
};
|
|
9289
|
+
}
|
|
9290
|
+
}
|
|
8859
9291
|
if (!mapJson ||
|
|
8860
9292
|
!pathJson ||
|
|
8861
|
-
!
|
|
8862
|
-
realTimeData.length === 0 ||
|
|
8863
|
-
!Array.isArray(realTimeData))
|
|
9293
|
+
!overlayRef.current)
|
|
8864
9294
|
return;
|
|
8865
9295
|
// 根据后端推送的实时数据,进行不同处理
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
|
|
8869
|
-
|
|
8870
|
-
|
|
8871
|
-
React.useImperativeHandle(ref, () => ({
|
|
8872
|
-
setZoom: (newZoom) => {
|
|
8873
|
-
setZoom(newZoom);
|
|
8874
|
-
if (svgMapViewRef.current) {
|
|
8875
|
-
svgMapViewRef.current.setZoom(newZoom);
|
|
9296
|
+
if (curMowPartitionData) {
|
|
9297
|
+
const isMowing = curMowPartitionData?.partitionIds && curMowPartitionData.partitionIds.length > 0;
|
|
9298
|
+
overlayRef.current.updateMowPartitionData(curMowPartitionData);
|
|
9299
|
+
if (!isMowing) {
|
|
9300
|
+
overlayRef.current.resetBorderLayerHighlight();
|
|
8876
9301
|
}
|
|
8877
|
-
|
|
8878
|
-
|
|
8879
|
-
getZoom: () => zoom,
|
|
8880
|
-
resetView: () => {
|
|
8881
|
-
if (svgMapViewRef.current) {
|
|
8882
|
-
svgMapViewRef.current.resetTransform();
|
|
9302
|
+
else {
|
|
9303
|
+
overlayRef.current.setBorderLayerHighlight(curMowPartitionData);
|
|
8883
9304
|
}
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
9305
|
+
}
|
|
9306
|
+
// 如果一次性推送的是多条数据,则把多条数据处理后存入pathData,然后更新路径数据和边界标签信息
|
|
9307
|
+
// 如果一次只推送一条数据,则只解析里面的进度数据,然后更新边界标签信息,剩下的实时轨迹数据由车辆运动产生时存入pathData
|
|
9308
|
+
if (realTimeData.length > 1) {
|
|
9309
|
+
const { pathData, isMowing } = handleMultipleRealTimeData({
|
|
9310
|
+
realTimeData,
|
|
9311
|
+
isMowing: processStateIsMowing,
|
|
9312
|
+
pathData: pathJson,
|
|
9313
|
+
partitionBoundary,
|
|
9314
|
+
});
|
|
9315
|
+
updateProcessStateIsMowing(isMowing);
|
|
9316
|
+
if (pathData) {
|
|
9317
|
+
overlayRef.current.updatePathData(pathData, curMowPartitionData);
|
|
9318
|
+
overlayRef.current.updateBoundaryLabelInfo(pathData);
|
|
8890
9319
|
}
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
9320
|
+
}
|
|
9321
|
+
else {
|
|
9322
|
+
const { isMowing, pathData } = getProcessMowingDataFromRealTimeData({
|
|
9323
|
+
realTimeData,
|
|
9324
|
+
isMowing: processStateIsMowing,
|
|
9325
|
+
pathData: pathJson,
|
|
9326
|
+
});
|
|
9327
|
+
updateProcessStateIsMowing(isMowing);
|
|
9328
|
+
overlayRef.current.updatePathData(pathData, curMowPartitionData);
|
|
9329
|
+
// 更新进度数据
|
|
9330
|
+
if (pathData) {
|
|
9331
|
+
overlayRef.current.updateBoundaryLabelInfo(pathData);
|
|
8903
9332
|
}
|
|
9333
|
+
}
|
|
9334
|
+
}, [realTimeData, mapJson, pathJson]);
|
|
9335
|
+
React.useEffect(() => {
|
|
9336
|
+
if (!overlayRef.current || !defaultTransform)
|
|
9337
|
+
return;
|
|
9338
|
+
console.log('defaultTransform----->', defaultTransform, overlayRef.current, mapJson);
|
|
9339
|
+
overlayRef.current?.setTransform(defaultTransform);
|
|
9340
|
+
const validBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
9341
|
+
// 地图数据中的坐标格式是 [longitude, latitude]
|
|
9342
|
+
const swLat = validBounds.sw[1] + defaultTransform.y;
|
|
9343
|
+
const swLng = validBounds.sw[0] + defaultTransform.x;
|
|
9344
|
+
const neLat = validBounds.ne[1] + defaultTransform.y;
|
|
9345
|
+
const neLng = validBounds.ne[0] + defaultTransform.x;
|
|
9346
|
+
const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
|
|
9347
|
+
new window.google.maps.LatLng(neLat, neLng) // 东北角
|
|
9348
|
+
);
|
|
9349
|
+
mapRef.fitBounds(googleBounds);
|
|
9350
|
+
}, [defaultTransform]);
|
|
9351
|
+
// 提供ref方法
|
|
9352
|
+
React.useImperativeHandle(ref, () => ({
|
|
9353
|
+
fitToView: () => {
|
|
9354
|
+
fitBounds();
|
|
8904
9355
|
},
|
|
8905
9356
|
getOverlay: () => {
|
|
8906
9357
|
return overlayRef.current;
|
|
@@ -8929,13 +9380,35 @@ const MowerMapRenderer = React.forwardRef(({ mapConfig, modelType, mapRef, mapJs
|
|
|
8929
9380
|
getElementCount: () => elementCount,
|
|
8930
9381
|
getPathCount: () => pathCount,
|
|
8931
9382
|
isGoogleMapsReady: () => isGoogleMapsReady,
|
|
9383
|
+
setTransform: (t) => overlayRef.current?.setTransform(t),
|
|
9384
|
+
resetToDefaultTransform: () => overlayRef.current?.resetToDefaultTransform(),
|
|
8932
9385
|
}));
|
|
9386
|
+
// Debug信息组件
|
|
9387
|
+
const DebugInfo = () => {
|
|
9388
|
+
if (!debug)
|
|
9389
|
+
return null;
|
|
9390
|
+
return (jsxRuntime.jsxs("div", { style: {
|
|
9391
|
+
position: 'fixed',
|
|
9392
|
+
bottom: '10px',
|
|
9393
|
+
left: '10px',
|
|
9394
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
9395
|
+
color: 'white',
|
|
9396
|
+
padding: '10px',
|
|
9397
|
+
borderRadius: '5px',
|
|
9398
|
+
fontSize: '12px',
|
|
9399
|
+
fontFamily: 'monospace',
|
|
9400
|
+
zIndex: 10000,
|
|
9401
|
+
maxWidth: '300px',
|
|
9402
|
+
lineHeight: '1.4',
|
|
9403
|
+
}, children: [jsxRuntime.jsx("div", { style: { fontWeight: 'bold', marginBottom: '8px' }, children: "\uD83D\uDC1B Debug Info" }), debugInfo.mapBounds && (jsxRuntime.jsxs("div", { style: { marginBottom: '6px' }, children: [jsxRuntime.jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDCCD Map GPS Bounds:" }), jsxRuntime.jsxs("div", { children: ["SW: [", debugInfo.mapBounds.sw[0].toFixed(6), ", ", debugInfo.mapBounds.sw[1].toFixed(6), "]"] }), jsxRuntime.jsxs("div", { children: ["NE: [", debugInfo.mapBounds.ne[0].toFixed(6), ", ", debugInfo.mapBounds.ne[1].toFixed(6), "]"] })] })), debugInfo.viewBox && (jsxRuntime.jsxs("div", { style: { marginBottom: '6px' }, children: [jsxRuntime.jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDCD0 SVG ViewBox (meters):" }), jsxRuntime.jsxs("div", { children: ["SW: [", debugInfo.viewBox.sw.x.toFixed(2), ", ", debugInfo.viewBox.sw.y.toFixed(2), "]"] }), jsxRuntime.jsxs("div", { children: ["NE: [", debugInfo.viewBox.ne.x.toFixed(2), ", ", debugInfo.viewBox.ne.y.toFixed(2), "]"] }), jsxRuntime.jsxs("div", { children: ["Size: ", debugInfo.viewBox.width.toFixed(2), "m \u00D7 ", debugInfo.viewBox.height.toFixed(2), "m"] }), jsxRuntime.jsxs("div", { children: ["Scale: 1:", debugInfo.viewBox.scale] })] })), debugInfo.mowerPosition && (jsxRuntime.jsxs("div", { style: { marginBottom: '6px' }, children: [jsxRuntime.jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDE9C Mower Position:" }), jsxRuntime.jsxs("div", { children: ["Current: X=", debugInfo.mowerPosition.x.toFixed(2), ", Y=", debugInfo.mowerPosition.y.toFixed(2)] }), jsxRuntime.jsxs("div", { children: ["Theta: ", ((debugInfo.mowerPosition.theta * 180) / Math.PI).toFixed(1), "\u00B0"] }), jsxRuntime.jsxs("div", { children: ["Last: X=", debugInfo.mowerPosition.lastX.toFixed(2), ", Y=", debugInfo.mowerPosition.lastY.toFixed(2)] }), jsxRuntime.jsxs("div", { children: ["Last Theta: ", ((debugInfo.mowerPosition.lastTheta * 180) / Math.PI).toFixed(1), "\u00B0"] }), jsxRuntime.jsxs("div", { children: ["Status: ", debugInfo.mowerPosition.vehicleStateText, " (", debugInfo.mowerPosition.vehicleState, ")"] })] })), debugInfo.partitionData && (jsxRuntime.jsxs("div", { style: { marginBottom: '6px' }, children: [jsxRuntime.jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDD32 Mow Partition Data:" }), jsxRuntime.jsxs("div", { children: ["Type: ", debugInfo.partitionData.type || 'N/A'] }), debugInfo.partitionData.partitionIds &&
|
|
9404
|
+
debugInfo.partitionData.partitionIds.length > 0 ? (jsxRuntime.jsxs("div", { children: ["Active IDs: [", debugInfo.partitionData.partitionIds.join(', '), "]"] })) : (jsxRuntime.jsx("div", { children: "No active partitions" })), debugInfo.partitionData.time && (jsxRuntime.jsxs("div", { children: ["Updated: ", new Date(debugInfo.partitionData.time).toLocaleTimeString()] }))] })), !debugInfo.partitionData && (jsxRuntime.jsxs("div", { style: { marginBottom: '6px' }, children: [jsxRuntime.jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDD32 Mow Partition Data:" }), jsxRuntime.jsx("div", { style: { color: '#888' }, children: "No partition data available" })] }))] }));
|
|
9405
|
+
};
|
|
8933
9406
|
// 错误显示
|
|
8934
9407
|
if (currentError) {
|
|
8935
|
-
return (jsxRuntime.
|
|
9408
|
+
return (jsxRuntime.jsxs("div", { className: className, style: style, children: [jsxRuntime.jsxs("div", { style: { color: 'red', padding: '10px' }, children: ["\u9519\u8BEF: ", currentError] }), jsxRuntime.jsx(DebugInfo, {})] }));
|
|
8936
9409
|
}
|
|
8937
|
-
// 使用goole maps
|
|
8938
|
-
return null;
|
|
9410
|
+
// 使用goole maps自定义叠加层,返回debug信息(如果启用)
|
|
9411
|
+
return debug ? jsxRuntime.jsx(DebugInfo, {}) : null;
|
|
8939
9412
|
});
|
|
8940
9413
|
MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
8941
9414
|
|