@fleet-frontend/mower-maps 0.0.9-beta.1 → 0.0.9-beta.11
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 +3 -25
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/styles.d.ts +2 -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 +950 -638
- package/dist/index.js +949 -637
- package/dist/processor/MapDataProcessor.d.ts +1 -1
- package/dist/processor/MapDataProcessor.d.ts.map +1 -1
- package/dist/processor/PathDataProcessor.d.ts +2 -21
- 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 +1 -1
- 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 +2 -24
- package/dist/render/AntennaManager.d.ts.map +1 -1
- package/dist/render/BoundaryLabelsManager.d.ts +8 -22
- package/dist/render/BoundaryLabelsManager.d.ts.map +1 -1
- package/dist/render/ChargingPileManager.d.ts +3 -18
- package/dist/render/ChargingPileManager.d.ts.map +1 -1
- package/dist/render/MowerMapOverlay.d.ts +9 -3
- package/dist/render/MowerMapOverlay.d.ts.map +1 -1
- package/dist/render/MowerMapRenderer.d.ts.map +1 -1
- package/dist/render/MowerPositionManager.d.ts +3 -6
- package/dist/render/MowerPositionManager.d.ts.map +1 -1
- package/dist/render/SvgMapView.d.ts +0 -25
- package/dist/render/SvgMapView.d.ts.map +1 -1
- package/dist/render/layers/BoundaryBorderLayer.d.ts +6 -1
- 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 +10 -2
- 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 -38
- package/dist/render/layers/types.d.ts.map +1 -1
- package/dist/store/processMowingState.d.ts +1 -5
- package/dist/store/processMowingState.d.ts.map +1 -1
- 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 +11 -1
- package/dist/types/realTime.d.ts.map +1 -1
- package/dist/types/renderer.d.ts +8 -4
- 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 +11 -5
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/coordinates.d.ts +1 -7
- package/dist/utils/coordinates.d.ts.map +1 -1
- package/dist/utils/handleRealTime.d.ts +2 -7
- 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 -23
- package/dist/utils/pathSegments.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,136 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import React, { forwardRef, useState, useRef, useMemo, useCallback, useEffect, useImperativeHandle } from 'react';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* 常量和枚举类型定义
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* 机器人状态枚举
|
|
9
|
+
*/
|
|
10
|
+
var RobotStatus;
|
|
11
|
+
(function (RobotStatus) {
|
|
12
|
+
RobotStatus[RobotStatus["PARKED"] = 1] = "PARKED";
|
|
13
|
+
RobotStatus[RobotStatus["CHARGING"] = 2] = "CHARGING";
|
|
14
|
+
RobotStatus[RobotStatus["STANDBY"] = 3] = "STANDBY";
|
|
15
|
+
RobotStatus[RobotStatus["MOWING"] = 4] = "MOWING";
|
|
16
|
+
RobotStatus[RobotStatus["WORKING"] = 5] = "WORKING";
|
|
17
|
+
RobotStatus[RobotStatus["MAPPING"] = 6] = "MAPPING";
|
|
18
|
+
RobotStatus[RobotStatus["ERROR"] = 7] = "ERROR";
|
|
19
|
+
RobotStatus[RobotStatus["UPGRADING"] = 8] = "UPGRADING";
|
|
20
|
+
RobotStatus[RobotStatus["DISCONNECTED"] = 9] = "DISCONNECTED";
|
|
21
|
+
RobotStatus[RobotStatus["UNKNOWN"] = -1] = "UNKNOWN";
|
|
22
|
+
RobotStatus[RobotStatus["TASK_DELAY"] = 10] = "TASK_DELAY";
|
|
23
|
+
})(RobotStatus || (RobotStatus = {}));
|
|
24
|
+
/**
|
|
25
|
+
* RTK状态枚举
|
|
26
|
+
*/
|
|
27
|
+
var RTK_STATE;
|
|
28
|
+
(function (RTK_STATE) {
|
|
29
|
+
RTK_STATE[RTK_STATE["LOW_RTK"] = 1] = "LOW_RTK";
|
|
30
|
+
RTK_STATE[RTK_STATE["MIDDLE_RTK"] = 2] = "MIDDLE_RTK";
|
|
31
|
+
RTK_STATE[RTK_STATE["HIGH_RTK"] = 3] = "HIGH_RTK";
|
|
32
|
+
RTK_STATE[RTK_STATE["NO_POSTURE"] = 10] = "NO_POSTURE";
|
|
33
|
+
RTK_STATE[RTK_STATE["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE";
|
|
34
|
+
RTK_STATE[RTK_STATE["OFF_LINE"] = 19] = "OFF_LINE";
|
|
35
|
+
})(RTK_STATE || (RTK_STATE = {}));
|
|
36
|
+
/**
|
|
37
|
+
* 实时数据类型枚举
|
|
38
|
+
*/
|
|
39
|
+
var REAL_TIME_DATA_TYPE;
|
|
40
|
+
(function (REAL_TIME_DATA_TYPE) {
|
|
41
|
+
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["LOCATION"] = 1] = "LOCATION";
|
|
42
|
+
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["PROCESS"] = 2] = "PROCESS";
|
|
43
|
+
})(REAL_TIME_DATA_TYPE || (REAL_TIME_DATA_TYPE = {}));
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* 地图渲染相关常量配置
|
|
47
|
+
*/
|
|
48
|
+
/**
|
|
49
|
+
* 缩放因子 - 将米转换为像素
|
|
50
|
+
* 与Python代码中的SVG比例一致
|
|
51
|
+
*/
|
|
52
|
+
const SCALE_FACTOR = 50; // 50像素/米
|
|
53
|
+
/**
|
|
54
|
+
* 默认线宽设置
|
|
55
|
+
*/
|
|
56
|
+
const DEFAULT_LINE_WIDTHS = {
|
|
57
|
+
OBSTACLE: 2,
|
|
58
|
+
CHARGING_PILE: 2,
|
|
59
|
+
CHANNEL: 2,
|
|
60
|
+
PATH: 20,
|
|
61
|
+
VISION_OFF_AREA: 2,
|
|
62
|
+
TIME_LIMIT_OBSTACLE: 1,
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* 默认透明度设置
|
|
66
|
+
*/
|
|
67
|
+
const DEFAULT_OPACITIES = {
|
|
68
|
+
FULL: 1.0,
|
|
69
|
+
HIGH: 0.7,
|
|
70
|
+
MEDIUM: 0.6,
|
|
71
|
+
DOODLE: 0.8};
|
|
72
|
+
/**
|
|
73
|
+
* 默认半径设置
|
|
74
|
+
*/
|
|
75
|
+
const DEFAULT_RADII = {
|
|
76
|
+
CHARGING_PILE: 12};
|
|
77
|
+
/**
|
|
78
|
+
* 图层等级
|
|
79
|
+
*/
|
|
80
|
+
const LAYER_LEVELS = {
|
|
81
|
+
BOUNDARY: 2,
|
|
82
|
+
BOUNDARY_BORDER: 4};
|
|
83
|
+
/**
|
|
84
|
+
* 图层默认id
|
|
85
|
+
*/
|
|
86
|
+
const LAYER_DEFAULT_TYPE = {
|
|
87
|
+
CHANNEL: 'channel',
|
|
88
|
+
BOUNDARY: 'boundary',
|
|
89
|
+
PATH: 'path',
|
|
90
|
+
BOUNDARY_BORDER: 'boundary_border',
|
|
91
|
+
OBSTACLE: 'obstacle',
|
|
92
|
+
CHARGING_PILE: 'charging_pile',
|
|
93
|
+
POINT: 'point',
|
|
94
|
+
SVG: 'svg',
|
|
95
|
+
VISION_OFF_AREA: 'vision_off_area',
|
|
96
|
+
ANTENNA: 'antenna',
|
|
97
|
+
};
|
|
98
|
+
const ISOLATED_BOUNDARY_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
99
|
+
<g opacity="0.6">
|
|
100
|
+
<rect width="24" height="24" rx="12" fill="#1E1E1F" fill-opacity="0.5"/>
|
|
101
|
+
<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"/>
|
|
102
|
+
<mask id="path-3-outside-1_9822_43516" maskUnits="userSpaceOnUse" x="13.2344" y="7.20545" width="12.0208" height="12.0208" fill="black">
|
|
103
|
+
<rect fill="white" x="13.2344" y="7.20545" width="12.0208" height="12.0208"/>
|
|
104
|
+
<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"/>
|
|
105
|
+
</mask>
|
|
106
|
+
<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"/>
|
|
107
|
+
<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)"/>
|
|
108
|
+
<mask id="path-5-outside-2_9822_43516" maskUnits="userSpaceOnUse" x="9.22265" y="10.388" width="12.7279" height="12.7279" fill="black">
|
|
109
|
+
<rect fill="white" x="9.22265" y="10.388" width="12.7279" height="12.7279"/>
|
|
110
|
+
<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"/>
|
|
111
|
+
</mask>
|
|
112
|
+
<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"/>
|
|
113
|
+
<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)"/>
|
|
114
|
+
<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"/>
|
|
115
|
+
<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"/>
|
|
116
|
+
<rect width="1.91578" height="4.24403" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 19.6992 13.8066)" fill="#8E8E8F"/>
|
|
117
|
+
<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"/>
|
|
118
|
+
</g>
|
|
119
|
+
</svg>`;
|
|
120
|
+
/**
|
|
121
|
+
* 遍历割草任务,下述四个字段可以在路径中唯一确定遍历的位置(当前区域、当前块、当前行、在当前行上的路程)
|
|
122
|
+
*/
|
|
123
|
+
const ACTION_BLOCK_COVER = 5;
|
|
124
|
+
/**
|
|
125
|
+
* 遍历割草块转移任务(在同一区域中的一个块转移到下一个块),下述四个字段可以在路径中唯一确定转移的位置(当前区域、前置块、当前转移路径线序号、在当前线上的路程)
|
|
126
|
+
*/
|
|
127
|
+
const ACTION_BLOCK_TRANSFER = 6;
|
|
128
|
+
/**
|
|
129
|
+
* 边界割草任务(割草任务内部的巡边任务)
|
|
130
|
+
*/
|
|
131
|
+
const ACTION_BOUNDARY_TASK = 8;
|
|
132
|
+
const SVG_MAP_VIEW_ID = 'fleet-maps-svg-map-view';
|
|
133
|
+
|
|
4
134
|
/**
|
|
5
135
|
* SVG基础MapView
|
|
6
136
|
* 使用真正的矢量SVG渲染替代Canvas位图渲染
|
|
@@ -14,7 +144,6 @@ class SvgMapView {
|
|
|
14
144
|
this.lineScale = 1; // 线条缩放系数
|
|
15
145
|
// 状态标志
|
|
16
146
|
this.destroyed = false;
|
|
17
|
-
this.showScale = false;
|
|
18
147
|
// 渲染系统 - 移除节流以确保用户操作的实时响应
|
|
19
148
|
// 拖动功能
|
|
20
149
|
this.isDragging = false;
|
|
@@ -57,6 +186,7 @@ class SvgMapView {
|
|
|
57
186
|
this.svg.setAttribute('shape-rendering', 'geometricPrecision');
|
|
58
187
|
this.svg.setAttribute('text-rendering', 'geometricPrecision');
|
|
59
188
|
this.svg.setAttribute('image-rendering', 'optimizeQuality');
|
|
189
|
+
this.svg.setAttribute('id', SVG_MAP_VIEW_ID);
|
|
60
190
|
}
|
|
61
191
|
/**
|
|
62
192
|
* 创建SVG组元素
|
|
@@ -81,7 +211,6 @@ class SvgMapView {
|
|
|
81
211
|
this.layers.sort((a, b) => a.getLevel() - b.getLevel());
|
|
82
212
|
}
|
|
83
213
|
getLayer(type) {
|
|
84
|
-
console.log('getLayer----->', this.layers, type);
|
|
85
214
|
return this.layers.find((layer) => layer.getType() === type) || null;
|
|
86
215
|
}
|
|
87
216
|
/**
|
|
@@ -119,7 +248,7 @@ class SvgMapView {
|
|
|
119
248
|
* 设置自适应视图变换 - 让SVG刚好包裹住图形
|
|
120
249
|
*/
|
|
121
250
|
fitToView(bounds) {
|
|
122
|
-
const padding =
|
|
251
|
+
const padding = 20; // 添加一些边距以避免内容贴边
|
|
123
252
|
const boundWidth = bounds.maxX - bounds.minX;
|
|
124
253
|
const boundHeight = bounds.maxY - bounds.minY;
|
|
125
254
|
// 防止宽高为0的情况
|
|
@@ -142,8 +271,8 @@ class SvgMapView {
|
|
|
142
271
|
this.viewBox = {
|
|
143
272
|
x: bounds.minX - padding,
|
|
144
273
|
y: bounds.minY - padding,
|
|
145
|
-
width: boundWidth + padding,
|
|
146
|
-
height: boundHeight + padding,
|
|
274
|
+
width: boundWidth + padding * 2,
|
|
275
|
+
height: boundHeight + padding * 2,
|
|
147
276
|
};
|
|
148
277
|
// 根据宽高比选择合适的preserveAspectRatio设置
|
|
149
278
|
if (Math.abs(contentAspectRatio - containerAspectRatio) < 0.01) {
|
|
@@ -155,42 +284,6 @@ class SvgMapView {
|
|
|
155
284
|
this.svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
|
|
156
285
|
}
|
|
157
286
|
this.updateViewBox();
|
|
158
|
-
this.refresh();
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* 重置变换
|
|
162
|
-
*/
|
|
163
|
-
resetTransform() {
|
|
164
|
-
this.scale = 1;
|
|
165
|
-
// 重置viewBox到默认状态
|
|
166
|
-
const containerRect = this.container.getBoundingClientRect();
|
|
167
|
-
this.viewBox = {
|
|
168
|
-
x: 0,
|
|
169
|
-
y: 0,
|
|
170
|
-
width: containerRect.width,
|
|
171
|
-
height: containerRect.height,
|
|
172
|
-
};
|
|
173
|
-
this.updateViewBox();
|
|
174
|
-
this.refresh();
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* 设置缩放级别
|
|
178
|
-
*/
|
|
179
|
-
setZoom(zoomLevel) {
|
|
180
|
-
if (zoomLevel <= 0)
|
|
181
|
-
return;
|
|
182
|
-
const oldScale = this.scale;
|
|
183
|
-
this.scale = zoomLevel;
|
|
184
|
-
// 调整viewBox以实现缩放
|
|
185
|
-
const scaleFactor = oldScale / this.scale;
|
|
186
|
-
const centerX = this.viewBox.x + this.viewBox.width / 2;
|
|
187
|
-
const centerY = this.viewBox.y + this.viewBox.height / 2;
|
|
188
|
-
this.viewBox.width *= scaleFactor;
|
|
189
|
-
this.viewBox.height *= scaleFactor;
|
|
190
|
-
this.viewBox.x = centerX - this.viewBox.width / 2;
|
|
191
|
-
this.viewBox.y = centerY - this.viewBox.height / 2;
|
|
192
|
-
this.updateViewBox();
|
|
193
|
-
this.refresh();
|
|
194
287
|
}
|
|
195
288
|
/**
|
|
196
289
|
* 获取当前缩放级别
|
|
@@ -198,15 +291,6 @@ class SvgMapView {
|
|
|
198
291
|
getZoom() {
|
|
199
292
|
return this.scale;
|
|
200
293
|
}
|
|
201
|
-
/**
|
|
202
|
-
* 设置线条缩放系数
|
|
203
|
-
*/
|
|
204
|
-
setLineScale(lineScale) {
|
|
205
|
-
if (lineScale <= 0)
|
|
206
|
-
return;
|
|
207
|
-
this.lineScale = lineScale;
|
|
208
|
-
this.refresh();
|
|
209
|
-
}
|
|
210
294
|
/**
|
|
211
295
|
* 获取当前线条缩放系数
|
|
212
296
|
*/
|
|
@@ -310,7 +394,7 @@ class SvgMapView {
|
|
|
310
394
|
// const layerType = layerIdParts.slice(1, -1).join('-'); // 处理类型名中可能包含连字符的情况
|
|
311
395
|
// const layerLevel = parseInt(layerIdParts[layerIdParts.length - 1]);
|
|
312
396
|
// // 查找对应的图层对象
|
|
313
|
-
// const targetLayer = this.layers.find(layer =>
|
|
397
|
+
// const targetLayer = this.layers.find(layer =>
|
|
314
398
|
// layer.getType() === layerType && layer.getLevel() === layerLevel
|
|
315
399
|
// );
|
|
316
400
|
// if (targetLayer && targetLayer.isVisible()) {
|
|
@@ -347,12 +431,6 @@ class SvgMapView {
|
|
|
347
431
|
return;
|
|
348
432
|
this.render();
|
|
349
433
|
}
|
|
350
|
-
/**
|
|
351
|
-
* 重新初始化SVG(用于容器大小变化)
|
|
352
|
-
*/
|
|
353
|
-
reinitializeSVG() {
|
|
354
|
-
this.refresh();
|
|
355
|
-
}
|
|
356
434
|
// ==================== 拖拽功能 ====================
|
|
357
435
|
/**
|
|
358
436
|
* 设置拖拽事件处理器
|
|
@@ -477,22 +555,6 @@ class SvgMapView {
|
|
|
477
555
|
return null;
|
|
478
556
|
}
|
|
479
557
|
}
|
|
480
|
-
/**
|
|
481
|
-
* 自动适配viewBox到实际内容
|
|
482
|
-
*/
|
|
483
|
-
autoFitToContent() {
|
|
484
|
-
if (this.destroyed || this.layers.length === 0)
|
|
485
|
-
return;
|
|
486
|
-
const bounds = this.getLayersGroupBounds();
|
|
487
|
-
if (bounds) {
|
|
488
|
-
this.fitToView({
|
|
489
|
-
minX: bounds.x,
|
|
490
|
-
minY: bounds.y,
|
|
491
|
-
maxX: bounds.x + bounds.width,
|
|
492
|
-
maxY: bounds.y + bounds.height,
|
|
493
|
-
});
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
558
|
/**
|
|
497
559
|
* 获取ViewBox信息
|
|
498
560
|
*/
|
|
@@ -513,13 +575,6 @@ class SvgMapView {
|
|
|
513
575
|
* 诊断SVG尺寸信息
|
|
514
576
|
*/
|
|
515
577
|
diagnosticSizeInfo() { }
|
|
516
|
-
/**
|
|
517
|
-
* 设置是否显示比例尺
|
|
518
|
-
*/
|
|
519
|
-
setShowScale(show) {
|
|
520
|
-
this.showScale = show;
|
|
521
|
-
this.refresh();
|
|
522
|
-
}
|
|
523
578
|
/**
|
|
524
579
|
* 获取SVG元素
|
|
525
580
|
*/
|
|
@@ -721,8 +776,6 @@ const create = (createState) => createState ? createImpl(createState) : createIm
|
|
|
721
776
|
|
|
722
777
|
const useSubBoundaryBorderStore = create((set, get) => ({
|
|
723
778
|
subBoundaryBorder: {},
|
|
724
|
-
// 覆盖所有数据
|
|
725
|
-
setSubBoundaryBorder: (subBoundaryBorder) => set({ subBoundaryBorder }),
|
|
726
779
|
// 追加单个数据
|
|
727
780
|
addSubBoundaryBorder: (key, element) => set((state) => ({
|
|
728
781
|
subBoundaryBorder: {
|
|
@@ -730,134 +783,28 @@ const useSubBoundaryBorderStore = create((set, get) => ({
|
|
|
730
783
|
[key]: element,
|
|
731
784
|
},
|
|
732
785
|
})),
|
|
733
|
-
// 追加多个数据
|
|
734
|
-
addMultipleSubBoundaryBorders: (borders) => set((state) => ({
|
|
735
|
-
subBoundaryBorder: {
|
|
736
|
-
...state.subBoundaryBorder,
|
|
737
|
-
...borders,
|
|
738
|
-
},
|
|
739
|
-
})),
|
|
740
786
|
// 清空所有数据
|
|
741
787
|
clearSubBoundaryBorder: () => set({ subBoundaryBorder: {} }),
|
|
788
|
+
// 障碍物
|
|
789
|
+
obstacles: {},
|
|
790
|
+
addObstacles: (key, element) => set((state) => ({
|
|
791
|
+
obstacles: {
|
|
792
|
+
...state.obstacles,
|
|
793
|
+
[key]: element,
|
|
794
|
+
},
|
|
795
|
+
})),
|
|
796
|
+
clearObstacles: () => set({ obstacles: {} }),
|
|
797
|
+
// svg数据
|
|
798
|
+
svgElements: {},
|
|
799
|
+
addSvgElements: (key, element) => set((state) => ({
|
|
800
|
+
svgElements: {
|
|
801
|
+
...state.svgElements,
|
|
802
|
+
[key]: element,
|
|
803
|
+
},
|
|
804
|
+
})),
|
|
805
|
+
clearSvgElements: () => set({ svgElements: {} }),
|
|
742
806
|
}));
|
|
743
807
|
|
|
744
|
-
/**
|
|
745
|
-
* 地图渲染相关常量配置
|
|
746
|
-
*/
|
|
747
|
-
/**
|
|
748
|
-
* 缩放因子 - 将米转换为像素
|
|
749
|
-
* 与Python代码中的SVG比例一致
|
|
750
|
-
*/
|
|
751
|
-
const SCALE_FACTOR = 50; // 50像素/米
|
|
752
|
-
/**
|
|
753
|
-
* 默认线宽设置
|
|
754
|
-
*/
|
|
755
|
-
const DEFAULT_LINE_WIDTHS = {
|
|
756
|
-
OBSTACLE: 2,
|
|
757
|
-
CHARGING_PILE: 2,
|
|
758
|
-
CHANNEL: 2,
|
|
759
|
-
PATH: 20,
|
|
760
|
-
VISION_OFF_AREA: 2,
|
|
761
|
-
TIME_LIMIT_OBSTACLE: 1,
|
|
762
|
-
};
|
|
763
|
-
/**
|
|
764
|
-
* 默认透明度设置
|
|
765
|
-
*/
|
|
766
|
-
const DEFAULT_OPACITIES = {
|
|
767
|
-
FULL: 1.0,
|
|
768
|
-
HIGH: 0.7,
|
|
769
|
-
LOW: 0.4};
|
|
770
|
-
/**
|
|
771
|
-
* 默认半径设置
|
|
772
|
-
*/
|
|
773
|
-
const DEFAULT_RADII = {
|
|
774
|
-
CHARGING_PILE: 12};
|
|
775
|
-
/**
|
|
776
|
-
* 图层等级
|
|
777
|
-
*/
|
|
778
|
-
const LAYER_LEVELS = {
|
|
779
|
-
BOUNDARY: 2,
|
|
780
|
-
BOUNDARY_BORDER: 4};
|
|
781
|
-
/**
|
|
782
|
-
* 图层默认id
|
|
783
|
-
*/
|
|
784
|
-
const LAYER_DEFAULT_TYPE = {
|
|
785
|
-
CHANNEL: 'channel',
|
|
786
|
-
BOUNDARY: 'boundary',
|
|
787
|
-
PATH: 'path',
|
|
788
|
-
BOUNDARY_BORDER: 'boundary_border',
|
|
789
|
-
OBSTACLE: 'obstacle',
|
|
790
|
-
CHARGING_PILE: 'charging_pile',
|
|
791
|
-
POINT: 'point',
|
|
792
|
-
SVG: 'svg',
|
|
793
|
-
VISION_OFF_AREA: 'vision_off_area',
|
|
794
|
-
ANTENNA: 'antenna',
|
|
795
|
-
};
|
|
796
|
-
var RobotStatus;
|
|
797
|
-
(function (RobotStatus) {
|
|
798
|
-
RobotStatus[RobotStatus["PARKED"] = 1] = "PARKED";
|
|
799
|
-
RobotStatus[RobotStatus["CHARGING"] = 2] = "CHARGING";
|
|
800
|
-
RobotStatus[RobotStatus["STANDBY"] = 3] = "STANDBY";
|
|
801
|
-
RobotStatus[RobotStatus["MOWING"] = 4] = "MOWING";
|
|
802
|
-
RobotStatus[RobotStatus["WORKING"] = 5] = "WORKING";
|
|
803
|
-
RobotStatus[RobotStatus["MAPPING"] = 6] = "MAPPING";
|
|
804
|
-
RobotStatus[RobotStatus["ERROR"] = 7] = "ERROR";
|
|
805
|
-
RobotStatus[RobotStatus["UPGRADING"] = 8] = "UPGRADING";
|
|
806
|
-
RobotStatus[RobotStatus["DISCONNECTED"] = 9] = "DISCONNECTED";
|
|
807
|
-
RobotStatus[RobotStatus["UNKNOWN"] = -1] = "UNKNOWN";
|
|
808
|
-
RobotStatus[RobotStatus["TASK_DELAY"] = 10] = "TASK_DELAY";
|
|
809
|
-
// WAITING = 'Waiting',
|
|
810
|
-
})(RobotStatus || (RobotStatus = {}));
|
|
811
|
-
// RTK状态
|
|
812
|
-
var RTK_STATE;
|
|
813
|
-
(function (RTK_STATE) {
|
|
814
|
-
RTK_STATE[RTK_STATE["LOW_RTK"] = 1] = "LOW_RTK";
|
|
815
|
-
RTK_STATE[RTK_STATE["MIDDLE_RTK"] = 2] = "MIDDLE_RTK";
|
|
816
|
-
RTK_STATE[RTK_STATE["HIGH_RTK"] = 3] = "HIGH_RTK";
|
|
817
|
-
RTK_STATE[RTK_STATE["NO_POSTURE"] = 10] = "NO_POSTURE";
|
|
818
|
-
RTK_STATE[RTK_STATE["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE";
|
|
819
|
-
RTK_STATE[RTK_STATE["OFF_LINE"] = 19] = "OFF_LINE";
|
|
820
|
-
})(RTK_STATE || (RTK_STATE = {}));
|
|
821
|
-
var REAL_TIME_DATA_TYPE;
|
|
822
|
-
(function (REAL_TIME_DATA_TYPE) {
|
|
823
|
-
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["LOCATION"] = 1] = "LOCATION";
|
|
824
|
-
REAL_TIME_DATA_TYPE[REAL_TIME_DATA_TYPE["PROCESS"] = 2] = "PROCESS";
|
|
825
|
-
})(REAL_TIME_DATA_TYPE || (REAL_TIME_DATA_TYPE = {}));
|
|
826
|
-
const ISOLATED_BOUNDARY_SVG = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
827
|
-
<g opacity="0.6">
|
|
828
|
-
<rect width="24" height="24" rx="12" fill="#1E1E1F" fill-opacity="0.5"/>
|
|
829
|
-
<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"/>
|
|
830
|
-
<mask id="path-3-outside-1_9822_43516" maskUnits="userSpaceOnUse" x="13.2344" y="7.20545" width="12.0208" height="12.0208" fill="black">
|
|
831
|
-
<rect fill="white" x="13.2344" y="7.20545" width="12.0208" height="12.0208"/>
|
|
832
|
-
<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"/>
|
|
833
|
-
</mask>
|
|
834
|
-
<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"/>
|
|
835
|
-
<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)"/>
|
|
836
|
-
<mask id="path-5-outside-2_9822_43516" maskUnits="userSpaceOnUse" x="9.22265" y="10.388" width="12.7279" height="12.7279" fill="black">
|
|
837
|
-
<rect fill="white" x="9.22265" y="10.388" width="12.7279" height="12.7279"/>
|
|
838
|
-
<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"/>
|
|
839
|
-
</mask>
|
|
840
|
-
<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"/>
|
|
841
|
-
<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)"/>
|
|
842
|
-
<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"/>
|
|
843
|
-
<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"/>
|
|
844
|
-
<rect width="1.91578" height="4.24403" transform="matrix(-0.707107 -0.707107 -0.707107 0.707107 19.6992 13.8066)" fill="#8E8E8F"/>
|
|
845
|
-
<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"/>
|
|
846
|
-
</g>
|
|
847
|
-
</svg>`;
|
|
848
|
-
/**
|
|
849
|
-
* 遍历割草任务,下述四个字段可以在路径中唯一确定遍历的位置(当前区域、当前块、当前行、在当前行上的路程)
|
|
850
|
-
*/
|
|
851
|
-
const ACTION_BLOCK_COVER = 5;
|
|
852
|
-
/**
|
|
853
|
-
* 遍历割草块转移任务(在同一区域中的一个块转移到下一个块),下述四个字段可以在路径中唯一确定转移的位置(当前区域、前置块、当前转移路径线序号、在当前线上的路程)
|
|
854
|
-
*/
|
|
855
|
-
const ACTION_BLOCK_TRANSFER = 6;
|
|
856
|
-
/**
|
|
857
|
-
* 边界割草任务(割草任务内部的巡边任务)
|
|
858
|
-
*/
|
|
859
|
-
const ACTION_BOUNDARY_TASK = 8;
|
|
860
|
-
|
|
861
808
|
/**
|
|
862
809
|
* 路径图层
|
|
863
810
|
* 专门处理路径元素的渲染
|
|
@@ -908,51 +855,90 @@ class ChannelLayer extends BaseLayer {
|
|
|
908
855
|
}
|
|
909
856
|
// �� 修改:计算包含所有分区和通道的边界框
|
|
910
857
|
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
911
|
-
// 1.
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
858
|
+
// 1. 先计算所有分区的边界,如果能拿到边界的svg的大小,就使用这个如果拿不到,就根据分区去计算
|
|
859
|
+
const svg = document.getElementById(SVG_MAP_VIEW_ID);
|
|
860
|
+
if (svg && svg instanceof SVGSVGElement && svg.viewBox) {
|
|
861
|
+
const viewBox = svg.viewBox.baseVal;
|
|
862
|
+
minX = viewBox.x;
|
|
863
|
+
minY = viewBox.y;
|
|
864
|
+
maxX = viewBox.x + viewBox.width;
|
|
865
|
+
maxY = viewBox.y + viewBox.height;
|
|
866
|
+
}
|
|
867
|
+
else {
|
|
868
|
+
for (const partitionId in subBoundaryBorder) {
|
|
869
|
+
const boundaryData = subBoundaryBorder[partitionId];
|
|
870
|
+
if (boundaryData && boundaryData.coordinates && boundaryData.coordinates.length > 0) {
|
|
871
|
+
for (const coord of boundaryData.coordinates) {
|
|
872
|
+
minX = Math.min(minX, coord[0]);
|
|
873
|
+
minY = Math.min(minY, coord[1]);
|
|
874
|
+
maxX = Math.max(maxX, coord[0]);
|
|
875
|
+
maxY = Math.max(maxY, coord[1]);
|
|
876
|
+
}
|
|
920
877
|
}
|
|
921
878
|
}
|
|
922
879
|
}
|
|
923
880
|
// 2. 再计算所有通道的边界
|
|
924
881
|
for (const element of this.elements) {
|
|
925
|
-
const tunnelConnection = element.originalData?.connection;
|
|
926
|
-
if (tunnelConnection && Array.isArray(tunnelConnection)) {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
882
|
+
// const tunnelConnection = element.originalData?.connection;
|
|
883
|
+
// if (tunnelConnection && Array.isArray(tunnelConnection)) {
|
|
884
|
+
// const clipPathId = `channel-exclude-${
|
|
885
|
+
// element.originalData?.id || Math.random().toString(36).substr(2, 9)
|
|
886
|
+
// }`;
|
|
887
|
+
// // 检查是否已存在该 clipPath
|
|
888
|
+
// const existingClipPath = defs.querySelector(`#${clipPathId}`);
|
|
889
|
+
// if (existingClipPath) continue;
|
|
890
|
+
// // 创建 clipPath
|
|
891
|
+
// const clipPath = document.createElementNS('http://www.w3.org/2000/svg', 'clipPath');
|
|
892
|
+
// clipPath.setAttribute('id', clipPathId);
|
|
893
|
+
// clipPath.setAttribute('clipPathUnits', 'userSpaceOnUse');
|
|
894
|
+
// // === 合成一个 path ===
|
|
895
|
+
// let d = `M ${minX} ${minY} L ${maxX} ${minY} L ${maxX} ${maxY} L ${minX} ${maxY} Z`;
|
|
896
|
+
// for (const partitionId of tunnelConnection) {
|
|
897
|
+
// const boundaryData = subBoundaryBorder[partitionId];
|
|
898
|
+
// if (boundaryData && boundaryData.coordinates.length >= 3) {
|
|
899
|
+
// d += ` M ${boundaryData.coordinates[0][0]} ${boundaryData.coordinates[0][1]}`;
|
|
900
|
+
// for (let i = 1; i < boundaryData.coordinates.length; i++) {
|
|
901
|
+
// d += ` L ${boundaryData.coordinates[i][0]} ${boundaryData.coordinates[i][1]}`;
|
|
902
|
+
// }
|
|
903
|
+
// d += ' Z';
|
|
904
|
+
// }
|
|
905
|
+
// }
|
|
906
|
+
// const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
907
|
+
// path.setAttribute('d', d);
|
|
908
|
+
// path.setAttribute('clip-rule', 'evenodd'); // 关键
|
|
909
|
+
// clipPath.appendChild(path);
|
|
910
|
+
// defs.appendChild(clipPath);
|
|
911
|
+
// clipPathIdsMap[element.originalData?.id.toString()] = clipPathId;
|
|
912
|
+
// } else {
|
|
913
|
+
const clipPathId = `channel-exclude-all-${element.originalData?.id || Math.random().toString(36).substr(2, 9)}`;
|
|
914
|
+
// 检查是否已存在该 clipPath
|
|
915
|
+
const existingClipPath = defs.querySelector(`#${clipPathId}`);
|
|
916
|
+
if (existingClipPath)
|
|
917
|
+
continue;
|
|
918
|
+
// 创建 clipPath
|
|
919
|
+
const clipPath = document.createElementNS('http://www.w3.org/2000/svg', 'clipPath');
|
|
920
|
+
clipPath.setAttribute('id', clipPathId);
|
|
921
|
+
clipPath.setAttribute('clipPathUnits', 'userSpaceOnUse');
|
|
922
|
+
// === 合成一个 path ===
|
|
923
|
+
let d = `M ${minX} ${minY} L ${maxX} ${minY} L ${maxX} ${maxY} L ${minX} ${maxY} Z`;
|
|
924
|
+
for (const partitionId in subBoundaryBorder) {
|
|
925
|
+
const boundaryData = subBoundaryBorder[partitionId];
|
|
926
|
+
if (boundaryData && boundaryData.coordinates.length >= 3) {
|
|
927
|
+
d += ` M ${boundaryData.coordinates[0][0]} ${boundaryData.coordinates[0][1]}`;
|
|
928
|
+
for (let i = 1; i < boundaryData.coordinates.length; i++) {
|
|
929
|
+
d += ` L ${boundaryData.coordinates[i][0]} ${boundaryData.coordinates[i][1]}`;
|
|
946
930
|
}
|
|
931
|
+
d += ' Z';
|
|
947
932
|
}
|
|
948
|
-
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
949
|
-
path.setAttribute('d', d);
|
|
950
|
-
path.setAttribute('clip-rule', 'evenodd'); // 关键
|
|
951
|
-
clipPath.appendChild(path);
|
|
952
|
-
defs.appendChild(clipPath);
|
|
953
|
-
clipPathIdsMap[element.originalData?.id.toString()] = clipPathId;
|
|
954
933
|
}
|
|
934
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
935
|
+
path.setAttribute('d', d);
|
|
936
|
+
path.setAttribute('clip-rule', 'evenodd'); // 关键
|
|
937
|
+
clipPath.appendChild(path);
|
|
938
|
+
defs.appendChild(clipPath);
|
|
939
|
+
clipPathIdsMap[element.originalData?.id.toString()] = clipPathId;
|
|
955
940
|
}
|
|
941
|
+
// }
|
|
956
942
|
return clipPathIdsMap;
|
|
957
943
|
}
|
|
958
944
|
/**
|
|
@@ -1023,7 +1009,7 @@ class PathLayer extends BaseLayer {
|
|
|
1023
1009
|
* 创建所有分区并集的 clipPath
|
|
1024
1010
|
*/
|
|
1025
1011
|
createUnionClipPath(svgGroup) {
|
|
1026
|
-
const { subBoundaryBorder } = useSubBoundaryBorderStore.getState();
|
|
1012
|
+
const { subBoundaryBorder, obstacles, svgElements } = useSubBoundaryBorderStore.getState();
|
|
1027
1013
|
// 确保 defs 元素存在
|
|
1028
1014
|
let defs = svgGroup.querySelector('defs');
|
|
1029
1015
|
if (!defs) {
|
|
@@ -1037,7 +1023,7 @@ class PathLayer extends BaseLayer {
|
|
|
1037
1023
|
defs.removeChild(existing);
|
|
1038
1024
|
// 合成所有分区的 path
|
|
1039
1025
|
let d = '';
|
|
1040
|
-
//
|
|
1026
|
+
// 1. 外圈(主边界,顺时针)
|
|
1041
1027
|
Object.values(subBoundaryBorder).forEach((item) => {
|
|
1042
1028
|
const bCoords = item.coordinates;
|
|
1043
1029
|
if (bCoords.length >= 3) {
|
|
@@ -1048,6 +1034,48 @@ class PathLayer extends BaseLayer {
|
|
|
1048
1034
|
d += ' Z ';
|
|
1049
1035
|
}
|
|
1050
1036
|
});
|
|
1037
|
+
// 2. 内圈(禁区,逆时针)
|
|
1038
|
+
Object.values(obstacles).forEach((item) => {
|
|
1039
|
+
const bCoords = item.coordinates;
|
|
1040
|
+
if (bCoords.length >= 3) {
|
|
1041
|
+
d += `M ${bCoords[bCoords.length - 1][0]} ${bCoords[bCoords.length - 1][1]}`;
|
|
1042
|
+
for (let i = bCoords.length - 2; i >= 0; i--) {
|
|
1043
|
+
d += ` L ${bCoords[i][0]} ${bCoords[i][1]}`;
|
|
1044
|
+
}
|
|
1045
|
+
d += ' Z ';
|
|
1046
|
+
}
|
|
1047
|
+
});
|
|
1048
|
+
// 3. svgElements(解析 SVG 字符串并提取 path 数据)
|
|
1049
|
+
Object.values(svgElements).forEach((svgPath) => {
|
|
1050
|
+
const svgPathString = svgPath?.metadata?.svg;
|
|
1051
|
+
if (svgPathString && typeof svgPathString === 'string' && svgPathString.trim()) {
|
|
1052
|
+
// 处理转义字符
|
|
1053
|
+
const processedSvgString = svgPathString.replace(/\\n/g, '\n').replace(/\\"/g, '"');
|
|
1054
|
+
// 解析 SVG 字符串
|
|
1055
|
+
const parser = new DOMParser();
|
|
1056
|
+
const svgDoc = parser.parseFromString(processedSvgString, 'image/svg+xml');
|
|
1057
|
+
const svgElement = svgDoc.documentElement;
|
|
1058
|
+
if (svgElement.tagName === 'svg') {
|
|
1059
|
+
// 查找 path 元素
|
|
1060
|
+
const pathElement = svgElement.querySelector('path');
|
|
1061
|
+
if (pathElement) {
|
|
1062
|
+
const pathData = pathElement.getAttribute('d');
|
|
1063
|
+
if (pathData) {
|
|
1064
|
+
// 获取 SVG 元素的变换参数
|
|
1065
|
+
const centerCoords = svgPath.coordinates?.[0] || [0, 0];
|
|
1066
|
+
const center = [centerCoords[0], centerCoords[1]];
|
|
1067
|
+
const userScale = svgPath.metadata.scale || 1;
|
|
1068
|
+
const direction = svgPath.metadata?.direction || 0;
|
|
1069
|
+
const originalWidth = parseFloat(svgElement.getAttribute('width') || '76');
|
|
1070
|
+
const originalHeight = parseFloat(svgElement.getAttribute('height') || '68');
|
|
1071
|
+
// 应用变换到路径数据
|
|
1072
|
+
const transformedPathData = this.transformSvgPath(pathData, center, userScale, direction, originalWidth, originalHeight);
|
|
1073
|
+
d += transformedPathData + ' ';
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
});
|
|
1051
1079
|
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1052
1080
|
path.setAttribute('d', d);
|
|
1053
1081
|
const clipPath = document.createElementNS('http://www.w3.org/2000/svg', 'clipPath');
|
|
@@ -1072,47 +1100,132 @@ class PathLayer extends BaseLayer {
|
|
|
1072
1100
|
// 2. 创建一个组,应用 clipPath
|
|
1073
1101
|
const group = document.createElementNS('http://www.w3.org/2000/svg', 'g');
|
|
1074
1102
|
group.setAttribute('clip-path', `url(#${clipPathId})`);
|
|
1075
|
-
group.setAttribute('opacity', '0.
|
|
1076
|
-
// 3.
|
|
1103
|
+
group.setAttribute('opacity', '0.5'); // 统一透明度,防止叠加脏乱
|
|
1104
|
+
// 3. 优化渲染:按样式分组并合并路径
|
|
1105
|
+
this.renderOptimizedPaths(group);
|
|
1106
|
+
svgGroup.appendChild(group);
|
|
1107
|
+
}
|
|
1108
|
+
/**
|
|
1109
|
+
* 优化渲染:按样式分组并合并路径,减少 DOM 节点数量
|
|
1110
|
+
*/
|
|
1111
|
+
renderOptimizedPaths(group) {
|
|
1112
|
+
// 按样式分组存储路径数据
|
|
1113
|
+
const styleGroups = new Map();
|
|
1114
|
+
// 收集所有路径数据并按样式分组
|
|
1077
1115
|
for (const element of this.elements) {
|
|
1078
|
-
|
|
1116
|
+
// 类型断言:PathLayer 中的 elements 实际上是 PathElements 结构
|
|
1117
|
+
const pathElement = element;
|
|
1118
|
+
const { id, elements } = pathElement;
|
|
1079
1119
|
this.boundaryPaths[id] = [];
|
|
1120
|
+
elements.forEach((pathElement) => {
|
|
1121
|
+
const { coordinates, style } = pathElement;
|
|
1122
|
+
if (coordinates.length < 2)
|
|
1123
|
+
return;
|
|
1124
|
+
// 生成样式键(用于分组)
|
|
1125
|
+
const styleKey = this.generateStyleKey(style);
|
|
1126
|
+
// 构建路径数据
|
|
1127
|
+
let pathData = `M ${coordinates[0][0]} ${coordinates[0][1]}`;
|
|
1128
|
+
for (let i = 1; i < coordinates.length; i++) {
|
|
1129
|
+
pathData += ` L ${coordinates[i][0]} ${coordinates[i][1]}`;
|
|
1130
|
+
}
|
|
1131
|
+
// 按样式分组存储
|
|
1132
|
+
if (!styleGroups.has(styleKey)) {
|
|
1133
|
+
styleGroups.set(styleKey, { pathData: [], elements: [] });
|
|
1134
|
+
}
|
|
1135
|
+
styleGroups.get(styleKey).pathData.push(pathData);
|
|
1136
|
+
styleGroups.get(styleKey).elements.push(pathElement);
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
// 为每种样式创建一个合并的 path 元素
|
|
1140
|
+
styleGroups.forEach((groupData) => {
|
|
1141
|
+
const { pathData, elements } = groupData;
|
|
1142
|
+
if (pathData.length === 0)
|
|
1143
|
+
return;
|
|
1144
|
+
// 使用第一个元素的样式作为该组的样式
|
|
1145
|
+
const firstElement = elements[0];
|
|
1146
|
+
const style = firstElement.style;
|
|
1147
|
+
// 创建合并的 path 元素
|
|
1148
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1149
|
+
// 合并所有路径数据
|
|
1150
|
+
const mergedPathData = pathData.join(' ');
|
|
1151
|
+
path.setAttribute('d', mergedPathData);
|
|
1152
|
+
// 设置样式属性
|
|
1153
|
+
path.setAttribute('fill', 'none');
|
|
1154
|
+
path.setAttribute('stroke', style.lineColor || '#000000');
|
|
1155
|
+
path.setAttribute('mix-blend-mode', 'normal');
|
|
1156
|
+
const lineWidth = Math.max(style.lineWidth || 1, 0.5);
|
|
1157
|
+
path.setAttribute('stroke-width', lineWidth.toString());
|
|
1158
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
1159
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
1160
|
+
path.classList.add('vector-path');
|
|
1161
|
+
// 将合并的 path 添加到组中
|
|
1162
|
+
group.appendChild(path);
|
|
1163
|
+
// 保存引用到 boundaryPaths 中(保持兼容性)
|
|
1080
1164
|
elements.forEach((element) => {
|
|
1081
|
-
|
|
1165
|
+
const { id } = element;
|
|
1166
|
+
if (!this.boundaryPaths[id]) {
|
|
1167
|
+
this.boundaryPaths[id] = [];
|
|
1168
|
+
}
|
|
1169
|
+
this.boundaryPaths[id].push(path);
|
|
1082
1170
|
});
|
|
1171
|
+
});
|
|
1172
|
+
}
|
|
1173
|
+
/**
|
|
1174
|
+
* 变换 SVG 路径数据
|
|
1175
|
+
*/
|
|
1176
|
+
transformSvgPath(pathData, center, scale, direction, originalWidth, originalHeight) {
|
|
1177
|
+
// 解析路径数据并应用变换
|
|
1178
|
+
const commands = pathData.match(/[MmLlHhVvCcSsQqTtAaZz][^MmLlHhVvCcSsQqTtAaZz]*/g) || [];
|
|
1179
|
+
let transformedCommands = [];
|
|
1180
|
+
for (const command of commands) {
|
|
1181
|
+
const type = command[0];
|
|
1182
|
+
const params = command
|
|
1183
|
+
.slice(1)
|
|
1184
|
+
.trim()
|
|
1185
|
+
.split(/[\s,]+/)
|
|
1186
|
+
.filter(Boolean)
|
|
1187
|
+
.map(Number);
|
|
1188
|
+
if (type === 'Z' || type === 'z') {
|
|
1189
|
+
// 闭合路径,不需要变换
|
|
1190
|
+
transformedCommands.push(command);
|
|
1191
|
+
continue;
|
|
1192
|
+
}
|
|
1193
|
+
// 处理坐标参数
|
|
1194
|
+
let transformedParams = [];
|
|
1195
|
+
for (let i = 0; i < params.length; i += 2) {
|
|
1196
|
+
if (i + 1 < params.length) {
|
|
1197
|
+
let x = params[i];
|
|
1198
|
+
let y = params[i + 1];
|
|
1199
|
+
// 应用变换:先平移到中心,然后缩放、旋转,最后平移到目标位置
|
|
1200
|
+
// 1. 平移到原点(相对于原始尺寸的中心)
|
|
1201
|
+
x -= originalWidth / 2;
|
|
1202
|
+
y -= originalHeight / 2;
|
|
1203
|
+
// 2. 应用缩放
|
|
1204
|
+
x *= scale;
|
|
1205
|
+
y *= scale;
|
|
1206
|
+
// 3. 应用旋转
|
|
1207
|
+
const cos = Math.cos(-direction);
|
|
1208
|
+
const sin = Math.sin(-direction);
|
|
1209
|
+
const newX = x * cos - y * sin;
|
|
1210
|
+
const newY = x * sin + y * cos;
|
|
1211
|
+
// 4. 平移到目标位置
|
|
1212
|
+
x = newX + center[0];
|
|
1213
|
+
y = newY + center[1];
|
|
1214
|
+
transformedParams.push(x, y);
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
// 重建命令
|
|
1218
|
+
if (transformedParams.length > 0) {
|
|
1219
|
+
transformedCommands.push(type + transformedParams.join(' '));
|
|
1220
|
+
}
|
|
1083
1221
|
}
|
|
1084
|
-
|
|
1222
|
+
return transformedCommands.join(' ');
|
|
1085
1223
|
}
|
|
1086
1224
|
/**
|
|
1087
|
-
*
|
|
1225
|
+
* 生成样式键,用于路径分组
|
|
1088
1226
|
*/
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
if (coordinates.length < 2)
|
|
1092
|
-
return;
|
|
1093
|
-
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
1094
|
-
// 构建路径数据
|
|
1095
|
-
let pathData = `M ${coordinates[0][0]} ${coordinates[0][1]}`;
|
|
1096
|
-
for (let i = 1; i < coordinates.length; i++) {
|
|
1097
|
-
pathData += ` L ${coordinates[i][0]} ${coordinates[i][1]}`;
|
|
1098
|
-
}
|
|
1099
|
-
path.style.mixBlendMode = 'normal';
|
|
1100
|
-
// 设置路径属性
|
|
1101
|
-
path.setAttribute('d', pathData);
|
|
1102
|
-
// 直接给fill的颜色设置透明度会导致path重叠的部分颜色叠加,所以使用fill填充实色,通过fill-opacity设置透明度
|
|
1103
|
-
path.setAttribute('fill', 'none');
|
|
1104
|
-
// path.setAttribute('fill-opacity', '0.4');
|
|
1105
|
-
path.setAttribute('stroke', style.lineColor || '#000000');
|
|
1106
|
-
path.setAttribute('mix-blend-mode', 'normal');
|
|
1107
|
-
const lineWidth = Math.max(style.lineWidth || 1, 0.5);
|
|
1108
|
-
path.setAttribute('stroke-width', lineWidth.toString());
|
|
1109
|
-
path.setAttribute('stroke-linecap', 'round');
|
|
1110
|
-
path.setAttribute('stroke-linejoin', 'round');
|
|
1111
|
-
// 注意:这里不设置 opacity,因为透明度由父组控制
|
|
1112
|
-
// path.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
1113
|
-
path.classList.add('vector-path');
|
|
1114
|
-
this.boundaryPaths[id].push(path);
|
|
1115
|
-
group.appendChild(path);
|
|
1227
|
+
generateStyleKey(style) {
|
|
1228
|
+
return `${style.lineColor || '#000000'}-${style.lineWidth || 1}-${style.opacity || 1}`;
|
|
1116
1229
|
}
|
|
1117
1230
|
}
|
|
1118
1231
|
|
|
@@ -1220,7 +1333,7 @@ class ObstacleLayer extends BaseLayer {
|
|
|
1220
1333
|
}
|
|
1221
1334
|
}
|
|
1222
1335
|
|
|
1223
|
-
var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGYAAABqCAYAAABOHSQZAAAACXBIWXMAACxLAAAsSwGlPZap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L6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
|
|
1224
1337
|
|
|
1225
1338
|
/**
|
|
1226
1339
|
* 充电桩图层
|
|
@@ -1410,7 +1523,7 @@ class SvgElementLayer extends BaseLayer {
|
|
|
1410
1523
|
// 在transformGroup上应用变换:平移到中心,旋转,缩放,然后居中SVG
|
|
1411
1524
|
const transform = [
|
|
1412
1525
|
`translate(${center[0]}, ${center[1]})`,
|
|
1413
|
-
`rotate(${(direction * 180) / Math.PI})`,
|
|
1526
|
+
`rotate(${-(direction * 180) / Math.PI})`,
|
|
1414
1527
|
`scale(${userScale})`,
|
|
1415
1528
|
`translate(${-originalWidth / 2}, ${-originalHeight / 2})`,
|
|
1416
1529
|
].join(' ');
|
|
@@ -1508,7 +1621,7 @@ class VisionOffLayer extends BaseLayer {
|
|
|
1508
1621
|
*/
|
|
1509
1622
|
const BOUNDARY_STYLES = {
|
|
1510
1623
|
lineColor: '#ffffff',
|
|
1511
|
-
fillColor: 'rgba(239, 255, 237, 0.
|
|
1624
|
+
fillColor: 'rgba(239, 255, 237, 0.1)', // 更鲜艳的绿色半透明填充,增强可见性
|
|
1512
1625
|
lineWidth: 2,
|
|
1513
1626
|
opacity: DEFAULT_OPACITIES.FULL,
|
|
1514
1627
|
mowingLineColor: 'rgba(99, 216, 174, 1)',
|
|
@@ -1536,14 +1649,14 @@ const DOODLE_STYLES = {
|
|
|
1536
1649
|
lineColor: '#ff5722',
|
|
1537
1650
|
fillColor: '#ff9800', // 粉色半透明填充
|
|
1538
1651
|
lineWidth: DEFAULT_LINE_WIDTHS.TIME_LIMIT_OBSTACLE,
|
|
1539
|
-
opacity: DEFAULT_OPACITIES.
|
|
1652
|
+
opacity: DEFAULT_OPACITIES.DOODLE,
|
|
1540
1653
|
};
|
|
1541
1654
|
const PATH_EDGE_STYLES = {
|
|
1542
1655
|
lineWidth: DEFAULT_LINE_WIDTHS.PATH,
|
|
1543
|
-
opacity: DEFAULT_OPACITIES.
|
|
1544
|
-
edgeLineColor: 'rgba(
|
|
1656
|
+
opacity: DEFAULT_OPACITIES.MEDIUM,
|
|
1657
|
+
edgeLineColor: 'rgba(231, 238, 246)',
|
|
1545
1658
|
transLineColor: 'transparent',
|
|
1546
|
-
mowedLineColor: 'rgba(
|
|
1659
|
+
mowedLineColor: 'rgba(231, 238, 246)',
|
|
1547
1660
|
mowingLineColor: 'rgba(123, 200, 187)',
|
|
1548
1661
|
};
|
|
1549
1662
|
const CHANNEL_STYLES = {
|
|
@@ -1612,15 +1725,6 @@ function convertCoordinate(x, y) {
|
|
|
1612
1725
|
};
|
|
1613
1726
|
}
|
|
1614
1727
|
|
|
1615
|
-
/**
|
|
1616
|
-
* 路径段类型
|
|
1617
|
-
*/
|
|
1618
|
-
var PathSegmentType;
|
|
1619
|
-
(function (PathSegmentType) {
|
|
1620
|
-
PathSegmentType["EDGE"] = "edge";
|
|
1621
|
-
PathSegmentType["MOWING"] = "mowing";
|
|
1622
|
-
PathSegmentType["TRANS"] = "trans";
|
|
1623
|
-
})(PathSegmentType || (PathSegmentType = {}));
|
|
1624
1728
|
/**
|
|
1625
1729
|
* 按Python逻辑创建路径段:根据连续的两点之间的关系确定线段类型
|
|
1626
1730
|
*/
|
|
@@ -1895,26 +1999,7 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1895
1999
|
}
|
|
1896
2000
|
// 第一步:收集所有TUNNEL数据的connection信息
|
|
1897
2001
|
const connectedBoundaryIds = new Set();
|
|
1898
|
-
//
|
|
1899
|
-
for (const subMap of mapData.sub_maps) {
|
|
1900
|
-
if (!subMap.elements)
|
|
1901
|
-
continue;
|
|
1902
|
-
// 找到该子地图中所有 type 为 TUNNEL 的元素
|
|
1903
|
-
const tunnelElements = subMap.elements.filter(element => element.type === 'TUNNEL');
|
|
1904
|
-
for (const tunnelElement of tunnelElements) {
|
|
1905
|
-
const connection = tunnelElement.connection;
|
|
1906
|
-
if (connection) {
|
|
1907
|
-
// connection可能是单个数字或数组
|
|
1908
|
-
if (Array.isArray(connection)) {
|
|
1909
|
-
connection.forEach(id => connectedBoundaryIds.add(id));
|
|
1910
|
-
}
|
|
1911
|
-
else if (typeof connection === 'number') {
|
|
1912
|
-
connectedBoundaryIds.add(connection);
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
}
|
|
1916
|
-
}
|
|
1917
|
-
// 1.2 遍历mapData中的tunnels字段
|
|
2002
|
+
// 遍历mapData中的tunnels字段
|
|
1918
2003
|
if (mapData.tunnels && Array.isArray(mapData.tunnels)) {
|
|
1919
2004
|
for (const tunnel of mapData.tunnels) {
|
|
1920
2005
|
const connection = tunnel.connection;
|
|
@@ -1936,6 +2021,8 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1936
2021
|
continue;
|
|
1937
2022
|
// 每个sub_map的elements是边界坐标,没有sub_map只有一个boundary数据
|
|
1938
2023
|
const boundaryElement = subMap.elements.find(element => element.type === 'BOUNDARY');
|
|
2024
|
+
// 如果当前subMap存在充电桩且充电桩存在tunnel,说明当前subMap中的boundary是初始boundary,这个boundary不为孤立区域
|
|
2025
|
+
const hasTunnelToChargingPile = subMap.elements.some(element => element.type === 'CHARGING_PILE' && element.tunnel);
|
|
1939
2026
|
// 创建基础的 boundary 数据(来自 mapData)
|
|
1940
2027
|
const boundary = {
|
|
1941
2028
|
// 从 BOUNDARY 元素复制属性
|
|
@@ -1945,7 +2032,7 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1945
2032
|
points: convertPointsFormat(boundaryElement?.points) || [],
|
|
1946
2033
|
type: boundaryElement.type,
|
|
1947
2034
|
// 判断是否为孤立子区域
|
|
1948
|
-
isIsolated: !connectedBoundaryIds.has(boundaryElement.id)
|
|
2035
|
+
isIsolated: hasTunnelToChargingPile ? false : !connectedBoundaryIds.has(boundaryElement.id)
|
|
1949
2036
|
};
|
|
1950
2037
|
// 如果有 pathData,尝试匹配对应的分区数据
|
|
1951
2038
|
if (pathData) {
|
|
@@ -1966,6 +2053,14 @@ function generateBoundaryData(mapData, pathData) {
|
|
|
1966
2053
|
return boundaryData;
|
|
1967
2054
|
}
|
|
1968
2055
|
|
|
2056
|
+
var RealTimeDataType;
|
|
2057
|
+
(function (RealTimeDataType) {
|
|
2058
|
+
RealTimeDataType[RealTimeDataType["LOCATION"] = 1] = "LOCATION";
|
|
2059
|
+
RealTimeDataType[RealTimeDataType["PROCESS"] = 2] = "PROCESS";
|
|
2060
|
+
RealTimeDataType[RealTimeDataType["PARTITION"] = 3] = "PARTITION";
|
|
2061
|
+
RealTimeDataType[RealTimeDataType["STATUS"] = 4] = "STATUS";
|
|
2062
|
+
})(RealTimeDataType || (RealTimeDataType = {}));
|
|
2063
|
+
|
|
1969
2064
|
/**
|
|
1970
2065
|
* 射线法判断点是否在多边形内部
|
|
1971
2066
|
* @param x 点的x坐标
|
|
@@ -2083,7 +2178,6 @@ const handleMultipleRealTimeData = ({ realTimeData, isMowing, pathData, partitio
|
|
|
2083
2178
|
// 割草轨迹
|
|
2084
2179
|
const { postureX, postureY, vehicleState } = item;
|
|
2085
2180
|
const currentPartitionId = getPartitionId(partitionBoundary, Number(postureX), Number(postureY));
|
|
2086
|
-
console.log('currentPartitionId===', currentPartitionId);
|
|
2087
2181
|
if (currentPartitionId && newPathData?.[currentPartitionId]) {
|
|
2088
2182
|
const currentPathData = newPathData[currentPartitionId];
|
|
2089
2183
|
newPathData[currentPartitionId] = {
|
|
@@ -2136,7 +2230,7 @@ const getProcessMowingDataFromRealTimeData = ({ realTimeData, isMowing, pathData
|
|
|
2136
2230
|
let newMowingStatus = isMowing;
|
|
2137
2231
|
let newPathData = pathData || {};
|
|
2138
2232
|
// 找到返回的第一个实时进度的点
|
|
2139
|
-
const firstProcessData = realTimeData.find((item) => item.type ===
|
|
2233
|
+
const firstProcessData = realTimeData.find((item) => item.type === RealTimeDataType.PROCESS);
|
|
2140
2234
|
if (firstProcessData) {
|
|
2141
2235
|
// console.log('firstProcessData==', firstProcessData);
|
|
2142
2236
|
const { action, subAction, currentMowBoundary, currentMowProgress } = firstProcessData;
|
|
@@ -2214,10 +2308,10 @@ function getNoPositionMowerImageByModal(mowerModal) {
|
|
|
2214
2308
|
}
|
|
2215
2309
|
return iNoPosition;
|
|
2216
2310
|
}
|
|
2217
|
-
function getMowerImage(positonConfig) {
|
|
2311
|
+
function getMowerImage(positonConfig, modelType) {
|
|
2218
2312
|
if (!positonConfig)
|
|
2219
2313
|
return '';
|
|
2220
|
-
const model =
|
|
2314
|
+
const model = modelType?.toLowerCase() || 'i';
|
|
2221
2315
|
const state = positonConfig.vehicleState;
|
|
2222
2316
|
const mowerImage = getMowerImageByModal(model);
|
|
2223
2317
|
const disabledImage = getDisabledMowerImageByModal(model);
|
|
@@ -4682,7 +4776,37 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
4682
4776
|
* _.round(4060, -2);
|
|
4683
4777
|
* // => 4100
|
|
4684
4778
|
*/
|
|
4685
|
-
var round = createRound('round');
|
|
4779
|
+
var round = createRound('round');
|
|
4780
|
+
|
|
4781
|
+
/**
|
|
4782
|
+
* 工具模块类型定义
|
|
4783
|
+
*/
|
|
4784
|
+
/**
|
|
4785
|
+
* 路径段类型枚举
|
|
4786
|
+
*/
|
|
4787
|
+
var PathSegmentType;
|
|
4788
|
+
(function (PathSegmentType) {
|
|
4789
|
+
PathSegmentType["EDGE"] = "edge";
|
|
4790
|
+
PathSegmentType["MOWING"] = "mowing";
|
|
4791
|
+
PathSegmentType["TRANS"] = "trans";
|
|
4792
|
+
})(PathSegmentType || (PathSegmentType = {}));
|
|
4793
|
+
/**
|
|
4794
|
+
* 单位类型枚举
|
|
4795
|
+
*/
|
|
4796
|
+
var UnitsType;
|
|
4797
|
+
(function (UnitsType) {
|
|
4798
|
+
UnitsType["Metric"] = "Metric";
|
|
4799
|
+
UnitsType["Imperial"] = "Imperial";
|
|
4800
|
+
})(UnitsType || (UnitsType = {}));
|
|
4801
|
+
/**
|
|
4802
|
+
* 面积单位类型枚举
|
|
4803
|
+
*/
|
|
4804
|
+
var UnitsAreaType;
|
|
4805
|
+
(function (UnitsAreaType) {
|
|
4806
|
+
UnitsAreaType["SQUARE_METER"] = "m\u00B2";
|
|
4807
|
+
UnitsAreaType["SQUARE_FOOT"] = "ft\u00B2";
|
|
4808
|
+
UnitsAreaType["ACRE"] = "ac";
|
|
4809
|
+
})(UnitsAreaType || (UnitsAreaType = {}));
|
|
4686
4810
|
|
|
4687
4811
|
/**
|
|
4688
4812
|
* 默认航向相对于canvas的偏移角度: 航向默认是东
|
|
@@ -4757,17 +4881,6 @@ function formatNumberWithMetricPrefix(value, round = true, decimals = 2) {
|
|
|
4757
4881
|
return `${mathFn(value / 1000000000, decimals)}B`;
|
|
4758
4882
|
}
|
|
4759
4883
|
}
|
|
4760
|
-
var UnitsType;
|
|
4761
|
-
(function (UnitsType) {
|
|
4762
|
-
UnitsType["Metric"] = "metric";
|
|
4763
|
-
UnitsType["Imperial"] = "imperial";
|
|
4764
|
-
})(UnitsType || (UnitsType = {}));
|
|
4765
|
-
var UnitsAreaType;
|
|
4766
|
-
(function (UnitsAreaType) {
|
|
4767
|
-
UnitsAreaType["SQUARE_METER"] = "m\u00B2";
|
|
4768
|
-
UnitsAreaType["SQUARE_FOOT"] = "ft\u00B2";
|
|
4769
|
-
UnitsAreaType["ACRE"] = "ac";
|
|
4770
|
-
})(UnitsAreaType || (UnitsAreaType = {}));
|
|
4771
4884
|
/**
|
|
4772
4885
|
* 转换割草面积的方法
|
|
4773
4886
|
* @param area 面积数值(单位:m²)
|
|
@@ -4957,6 +5070,18 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
4957
5070
|
this.level = LAYER_LEVELS.BOUNDARY_BORDER; // 中等层级
|
|
4958
5071
|
this.type = LAYER_DEFAULT_TYPE.BOUNDARY_BORDER;
|
|
4959
5072
|
this.boudaryBorderPaths = {};
|
|
5073
|
+
this.mowingBoundarys = [];
|
|
5074
|
+
}
|
|
5075
|
+
/**
|
|
5076
|
+
* 设置当前割草任务的边界
|
|
5077
|
+
*/
|
|
5078
|
+
setMowingBoundarys(mowingBoundarys) {
|
|
5079
|
+
if (!mowingBoundarys) {
|
|
5080
|
+
this.mowingBoundarys = this.elements?.map(item => item?.originalData?.id);
|
|
5081
|
+
}
|
|
5082
|
+
else {
|
|
5083
|
+
this.mowingBoundarys = mowingBoundarys;
|
|
5084
|
+
}
|
|
4960
5085
|
}
|
|
4961
5086
|
/**
|
|
4962
5087
|
* SVG渲染方法
|
|
@@ -5002,7 +5127,8 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5002
5127
|
* 创建直接路径(type=2)
|
|
5003
5128
|
*/
|
|
5004
5129
|
createDirectPath(svgGroup, points, style, id) {
|
|
5005
|
-
const
|
|
5130
|
+
const isMowing = this.mowingBoundarys.includes(Number(id));
|
|
5131
|
+
const strokeColor = isMowing ? style.mowingLineColor : style.lineColor;
|
|
5006
5132
|
const lineWidth = dp2px(style.lineWidth || 3);
|
|
5007
5133
|
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
5008
5134
|
// 构建路径数据
|
|
@@ -5035,7 +5161,8 @@ class BoundaryBorderLayer extends BaseLayer {
|
|
|
5035
5161
|
* 使用PathMeasure逻辑创建平行路径(type=1)
|
|
5036
5162
|
*/
|
|
5037
5163
|
createParallelPathsWithMeasure(svgGroup, points, style, id) {
|
|
5038
|
-
const
|
|
5164
|
+
const isMowing = this.mowingBoundarys.includes(Number(id));
|
|
5165
|
+
const strokeColor = isMowing ? style.mowingLineColor : style.lineColor;
|
|
5039
5166
|
const lineWidth = dp2px(style.lineWidth || 3);
|
|
5040
5167
|
// 获取当前SVG的缩放级别,计算固定屏幕像素间距
|
|
5041
5168
|
const fixedScreenDistance = lineWidth; // 固定的屏幕像素距离
|
|
@@ -5381,6 +5508,14 @@ class BoundaryDataBuilder {
|
|
|
5381
5508
|
* 创建边界元素数据
|
|
5382
5509
|
*/
|
|
5383
5510
|
static create(type, coordinates, style) {
|
|
5511
|
+
const len = coordinates?.length || 0;
|
|
5512
|
+
const firstPoint = coordinates?.[0];
|
|
5513
|
+
const lastPoint = coordinates?.[len - 1];
|
|
5514
|
+
const isClosed = firstPoint?.[0] === lastPoint?.[0] && firstPoint?.[1] === lastPoint?.[1];
|
|
5515
|
+
// 如果地图没有闭合,则手动新增闭合点,避免border最后一部分没有闭合的情况
|
|
5516
|
+
if (!isClosed) {
|
|
5517
|
+
coordinates.push([firstPoint?.[0], firstPoint?.[1], lastPoint?.[2]]);
|
|
5518
|
+
}
|
|
5384
5519
|
return {
|
|
5385
5520
|
type,
|
|
5386
5521
|
coordinates,
|
|
@@ -5783,8 +5918,13 @@ class MapDataProcessor {
|
|
|
5783
5918
|
// 为ObstacleData创建兼容的MapElement接口
|
|
5784
5919
|
const mapElement = element;
|
|
5785
5920
|
const obstacleElement = ObstacleDataBuilder.fromMapElement(mapElement, this.mapConfig.obstacle);
|
|
5786
|
-
if (obstacleElement)
|
|
5921
|
+
if (obstacleElement) {
|
|
5787
5922
|
result.push(obstacleElement);
|
|
5923
|
+
const { addObstacles } = useSubBoundaryBorderStore.getState();
|
|
5924
|
+
addObstacles(`obstacle-${obstacleElement.originalData.id}`, {
|
|
5925
|
+
...obstacleElement,
|
|
5926
|
+
});
|
|
5927
|
+
}
|
|
5788
5928
|
}
|
|
5789
5929
|
catch (error) {
|
|
5790
5930
|
console.warn(`Error processing OBSTACLE element:`, element, error);
|
|
@@ -5845,8 +5985,13 @@ class MapDataProcessor {
|
|
|
5845
5985
|
element.direction !== undefined) {
|
|
5846
5986
|
const mapElement = element;
|
|
5847
5987
|
const svgElement = SvgElementDataBuilder.fromMapElement(mapElement, this.mapConfig.doodle);
|
|
5848
|
-
if (svgElement)
|
|
5988
|
+
if (svgElement) {
|
|
5849
5989
|
result.push(svgElement);
|
|
5990
|
+
const { addSvgElements } = useSubBoundaryBorderStore.getState();
|
|
5991
|
+
addSvgElements(`time-limit-obstacle-${svgElement.originalData.id}`, {
|
|
5992
|
+
...svgElement,
|
|
5993
|
+
});
|
|
5994
|
+
}
|
|
5850
5995
|
}
|
|
5851
5996
|
// 如果有points数据,按传统方式绘制
|
|
5852
5997
|
else if ('points' in element &&
|
|
@@ -5855,8 +6000,13 @@ class MapDataProcessor {
|
|
|
5855
6000
|
element.points.length >= 3) {
|
|
5856
6001
|
const mapElement = element;
|
|
5857
6002
|
const polygonElement = ObstacleDataBuilder.createTimeLimitObstacle(mapElement, this.mapConfig.obstacle);
|
|
5858
|
-
if (polygonElement)
|
|
6003
|
+
if (polygonElement) {
|
|
5859
6004
|
result.push(polygonElement);
|
|
6005
|
+
const { addObstacles } = useSubBoundaryBorderStore.getState();
|
|
6006
|
+
addObstacles(`time-limit-obstacle-${polygonElement.originalData.id}`, {
|
|
6007
|
+
...polygonElement,
|
|
6008
|
+
});
|
|
6009
|
+
}
|
|
5860
6010
|
}
|
|
5861
6011
|
}
|
|
5862
6012
|
catch (error) {
|
|
@@ -6006,7 +6156,6 @@ class PathDataProcessor {
|
|
|
6006
6156
|
elements,
|
|
6007
6157
|
};
|
|
6008
6158
|
});
|
|
6009
|
-
console.log('result->', result);
|
|
6010
6159
|
return result;
|
|
6011
6160
|
}
|
|
6012
6161
|
}
|
|
@@ -6016,7 +6165,7 @@ class PathDataProcessor {
|
|
|
6016
6165
|
* 专门处理边界标签的创建、定位和管理
|
|
6017
6166
|
*/
|
|
6018
6167
|
class BoundaryLabelsManager {
|
|
6019
|
-
constructor(svgView, boundaryData) {
|
|
6168
|
+
constructor(svgView, boundaryData, { unitType, language }) {
|
|
6020
6169
|
this.container = null;
|
|
6021
6170
|
this.overlayDiv = null;
|
|
6022
6171
|
this.globalClickHandler = null;
|
|
@@ -6027,6 +6176,8 @@ class BoundaryLabelsManager {
|
|
|
6027
6176
|
this.svgView = svgView;
|
|
6028
6177
|
this.boundaryData = boundaryData;
|
|
6029
6178
|
this.initializeContainer();
|
|
6179
|
+
this.unitType = unitType;
|
|
6180
|
+
this.language = language;
|
|
6030
6181
|
}
|
|
6031
6182
|
/**
|
|
6032
6183
|
* 初始化容器
|
|
@@ -6126,9 +6277,10 @@ class BoundaryLabelsManager {
|
|
|
6126
6277
|
this.currentExpandedBoundaryId === boundary.id ? 'block' : 'none';
|
|
6127
6278
|
extendedContent.style.borderTop = '1px solid rgba(255,255,255,0.2)';
|
|
6128
6279
|
extendedContent.style.paddingTop = '6px';
|
|
6280
|
+
console.log('this.unitType->', this.unitType);
|
|
6129
6281
|
// 面积信息
|
|
6130
|
-
const totalArea = convertAreaByUnits(boundary.area || 0,
|
|
6131
|
-
const finishedArea = convertAreaByUnits(boundary.finishedArea || 0,
|
|
6282
|
+
const totalArea = convertAreaByUnits(boundary.area || 0, this.unitType);
|
|
6283
|
+
const finishedArea = convertAreaByUnits(boundary.finishedArea || 0, this.unitType);
|
|
6132
6284
|
const coverageText = `Coverage: ${finishedArea.value}/${totalArea.value}`;
|
|
6133
6285
|
// 日期信息
|
|
6134
6286
|
const dateText = formatBoundaryDateText(boundary.endTime || 0);
|
|
@@ -6194,7 +6346,6 @@ class BoundaryLabelsManager {
|
|
|
6194
6346
|
this.collapseOtherLabels(boundaryId);
|
|
6195
6347
|
// 展开当前标签
|
|
6196
6348
|
extendedContent.style.display = 'block';
|
|
6197
|
-
labelDiv.style.whiteSpace = 'normal';
|
|
6198
6349
|
this.currentExpandedBoundaryId = boundaryId;
|
|
6199
6350
|
}
|
|
6200
6351
|
/**
|
|
@@ -6237,7 +6388,6 @@ class BoundaryLabelsManager {
|
|
|
6237
6388
|
* @param viewBox SVG的viewBox信息
|
|
6238
6389
|
*/
|
|
6239
6390
|
updatePositionsWithPrecomputedData(divWidth, divHeight, viewBox) {
|
|
6240
|
-
console.log('updatePositionsWithPrecomputedData----->', this.rotation);
|
|
6241
6391
|
if (!this.container || !this.svgView)
|
|
6242
6392
|
return;
|
|
6243
6393
|
const dw = parseFloat(this.svgView.getSVG().getAttribute('width')) || divWidth;
|
|
@@ -6431,12 +6581,6 @@ class BoundaryLabelsManager {
|
|
|
6431
6581
|
this.container.style.display = visible ? 'block' : 'none';
|
|
6432
6582
|
}
|
|
6433
6583
|
}
|
|
6434
|
-
/**
|
|
6435
|
-
* 获取边界数据
|
|
6436
|
-
*/
|
|
6437
|
-
getBoundaryData() {
|
|
6438
|
-
return this.boundaryData;
|
|
6439
|
-
}
|
|
6440
6584
|
/**
|
|
6441
6585
|
* 根据ID获取特定边界的标签元素
|
|
6442
6586
|
*/
|
|
@@ -6486,18 +6630,6 @@ class BoundaryLabelsManager {
|
|
|
6486
6630
|
}
|
|
6487
6631
|
});
|
|
6488
6632
|
}
|
|
6489
|
-
/**
|
|
6490
|
-
* 重置标签层级(公共方法)
|
|
6491
|
-
*/
|
|
6492
|
-
resetZIndex() {
|
|
6493
|
-
this.resetLabelZIndex();
|
|
6494
|
-
}
|
|
6495
|
-
/**
|
|
6496
|
-
* 获取层级常量(静态方法)
|
|
6497
|
-
*/
|
|
6498
|
-
static getZIndexConstants() {
|
|
6499
|
-
return BoundaryLabelsManager.Z_INDEX;
|
|
6500
|
-
}
|
|
6501
6633
|
/**
|
|
6502
6634
|
* 设置标签旋转角度,使其与地图旋转相反,保持水平状态
|
|
6503
6635
|
* @param rotation 地图的旋转角度(度)
|
|
@@ -6514,19 +6646,6 @@ class BoundaryLabelsManager {
|
|
|
6514
6646
|
labelElement.style.transform = `translate(-50%, -50%) rotate(${counterRotation}deg)`;
|
|
6515
6647
|
});
|
|
6516
6648
|
}
|
|
6517
|
-
/**
|
|
6518
|
-
* 重置标签旋转角度
|
|
6519
|
-
*/
|
|
6520
|
-
resetLabelsRotation() {
|
|
6521
|
-
if (!this.container)
|
|
6522
|
-
return;
|
|
6523
|
-
const labels = this.container.querySelectorAll('.boundary-label');
|
|
6524
|
-
labels.forEach((label) => {
|
|
6525
|
-
const labelElement = label;
|
|
6526
|
-
// 重置为默认的居中变换
|
|
6527
|
-
labelElement.style.transform = 'translate(-50%, -50%)';
|
|
6528
|
-
});
|
|
6529
|
-
}
|
|
6530
6649
|
}
|
|
6531
6650
|
// 简化的层级定义
|
|
6532
6651
|
BoundaryLabelsManager.Z_INDEX = {
|
|
@@ -6702,26 +6821,6 @@ class ChargingPileManager {
|
|
|
6702
6821
|
this.container.innerHTML = '';
|
|
6703
6822
|
}
|
|
6704
6823
|
}
|
|
6705
|
-
/**
|
|
6706
|
-
* 设置可见性
|
|
6707
|
-
*/
|
|
6708
|
-
setVisible(visible) {
|
|
6709
|
-
if (this.container) {
|
|
6710
|
-
this.container.style.display = visible ? 'block' : 'none';
|
|
6711
|
-
}
|
|
6712
|
-
}
|
|
6713
|
-
/**
|
|
6714
|
-
* 获取充电桩数量
|
|
6715
|
-
*/
|
|
6716
|
-
getElementCount() {
|
|
6717
|
-
return this.chargingPileElements.length;
|
|
6718
|
-
}
|
|
6719
|
-
/**
|
|
6720
|
-
* 充电桩不需要动态层级调整(为了接口统一而保留)
|
|
6721
|
-
*/
|
|
6722
|
-
resetZIndex() {
|
|
6723
|
-
// 充电桩层级始终保持固定,无需重置
|
|
6724
|
-
}
|
|
6725
6824
|
/**
|
|
6726
6825
|
* 销毁管理器
|
|
6727
6826
|
*/
|
|
@@ -6744,21 +6843,10 @@ class ChargingPileManager {
|
|
|
6744
6843
|
pileElement.style.transform = `translate(-50%, -50%) rotate(${this.originalRotation - this.rotation}deg)`;
|
|
6745
6844
|
});
|
|
6746
6845
|
}
|
|
6747
|
-
/**
|
|
6748
|
-
* 重置充电桩旋转角度
|
|
6749
|
-
*/
|
|
6750
|
-
resetRotation() {
|
|
6751
|
-
this.rotation = 0;
|
|
6752
|
-
const allContainers = this.container.querySelectorAll('.charging-pile');
|
|
6753
|
-
allContainers.forEach((container) => {
|
|
6754
|
-
const pileElement = container;
|
|
6755
|
-
pileElement.style.transform = `translate(-50%, -50%) rotate(${this.originalRotation - this.rotation}deg)`;
|
|
6756
|
-
});
|
|
6757
|
-
}
|
|
6758
6846
|
}
|
|
6759
6847
|
// 简化的层级定义 - 充电桩只需要一个固定层级
|
|
6760
6848
|
ChargingPileManager.Z_INDEX = {
|
|
6761
|
-
CHARGING_PILE:
|
|
6849
|
+
CHARGING_PILE: 750, // 充电桩图标固定层级
|
|
6762
6850
|
};
|
|
6763
6851
|
|
|
6764
6852
|
/**
|
|
@@ -7140,32 +7228,6 @@ class AntennaManager {
|
|
|
7140
7228
|
this.container.innerHTML = '';
|
|
7141
7229
|
}
|
|
7142
7230
|
}
|
|
7143
|
-
/**
|
|
7144
|
-
* 设置可见性
|
|
7145
|
-
*/
|
|
7146
|
-
setVisible(visible) {
|
|
7147
|
-
if (this.container) {
|
|
7148
|
-
this.container.style.display = visible ? 'block' : 'none';
|
|
7149
|
-
}
|
|
7150
|
-
}
|
|
7151
|
-
/**
|
|
7152
|
-
* 获取天线数量
|
|
7153
|
-
*/
|
|
7154
|
-
getElementCount() {
|
|
7155
|
-
return this.antennaElements.length;
|
|
7156
|
-
}
|
|
7157
|
-
/**
|
|
7158
|
-
* 重置天线层级(公共方法)
|
|
7159
|
-
*/
|
|
7160
|
-
resetZIndex() {
|
|
7161
|
-
this.resetAntennaZIndex();
|
|
7162
|
-
}
|
|
7163
|
-
/**
|
|
7164
|
-
* 获取层级常量(静态方法)
|
|
7165
|
-
*/
|
|
7166
|
-
static getZIndexConstants() {
|
|
7167
|
-
return AntennaManager.Z_INDEX;
|
|
7168
|
-
}
|
|
7169
7231
|
/**
|
|
7170
7232
|
* 销毁管理器
|
|
7171
7233
|
*/
|
|
@@ -7193,21 +7255,10 @@ class AntennaManager {
|
|
|
7193
7255
|
antennaContainer.style.transform = `translate(-50%, -50%) rotate(${-this.rotation}deg)`;
|
|
7194
7256
|
});
|
|
7195
7257
|
}
|
|
7196
|
-
/**
|
|
7197
|
-
* 重置天线旋转角度
|
|
7198
|
-
*/
|
|
7199
|
-
resetRotation() {
|
|
7200
|
-
this.rotation = 0;
|
|
7201
|
-
const allContainers = this.container.querySelectorAll('.antenna-container-item');
|
|
7202
|
-
allContainers.forEach((container) => {
|
|
7203
|
-
const antennaContainer = container;
|
|
7204
|
-
antennaContainer.style.transform = `translate(-50%, -50%) rotate(${-this.rotation}deg)`;
|
|
7205
|
-
});
|
|
7206
|
-
}
|
|
7207
7258
|
}
|
|
7208
7259
|
// 简化的层级定义
|
|
7209
7260
|
AntennaManager.Z_INDEX = {
|
|
7210
|
-
DEFAULT:
|
|
7261
|
+
DEFAULT: 800, // 默认层级
|
|
7211
7262
|
ACTIVE: 9999, // 点击激活时的高层级
|
|
7212
7263
|
};
|
|
7213
7264
|
|
|
@@ -7259,7 +7310,7 @@ const EDIT_BEHAVIOR = {
|
|
|
7259
7310
|
};
|
|
7260
7311
|
|
|
7261
7312
|
class MowerPositionManager {
|
|
7262
|
-
constructor(svgView, mowerPositionConfig, overlayDiv, onAnimationComplete, onMowingPositionChange) {
|
|
7313
|
+
constructor(svgView, mowerPositionConfig, modelType, overlayDiv, onAnimationComplete, onMowingPositionChange) {
|
|
7263
7314
|
this.container = null;
|
|
7264
7315
|
this.overlayDiv = null;
|
|
7265
7316
|
this.mowerElement = null;
|
|
@@ -7277,6 +7328,7 @@ class MowerPositionManager {
|
|
|
7277
7328
|
this.onlyUpdateTheta = false;
|
|
7278
7329
|
this.svgView = svgView;
|
|
7279
7330
|
this.mowerPositionConfig = mowerPositionConfig;
|
|
7331
|
+
this.modelType = modelType;
|
|
7280
7332
|
this.overlayDiv = overlayDiv;
|
|
7281
7333
|
this.onAnimationComplete = onAnimationComplete;
|
|
7282
7334
|
this.onMowingPositionChange = onMowingPositionChange;
|
|
@@ -7331,6 +7383,7 @@ class MowerPositionManager {
|
|
|
7331
7383
|
}
|
|
7332
7384
|
this.mowerElement.appendChild(imgElement);
|
|
7333
7385
|
this.container.appendChild(this.mowerElement);
|
|
7386
|
+
this.updatePosition(this.mowerPositionConfig);
|
|
7334
7387
|
}
|
|
7335
7388
|
/**
|
|
7336
7389
|
* 设置叠加层div引用(用于坐标转换)
|
|
@@ -7351,11 +7404,22 @@ class MowerPositionManager {
|
|
|
7351
7404
|
if (!chargingPilesPositionConfig)
|
|
7352
7405
|
return;
|
|
7353
7406
|
this.mowerPositionConfig = chargingPilesPositionConfig;
|
|
7354
|
-
|
|
7407
|
+
const positonOutOfRange = isOutOfRange(chargingPilesPositionConfig);
|
|
7408
|
+
const positionInValid = isInvalidPosition(chargingPilesPositionConfig);
|
|
7409
|
+
let postureX = 0;
|
|
7410
|
+
let postureY = 0;
|
|
7411
|
+
let postureTheta = 0;
|
|
7355
7412
|
const lastPosition = this.lastPosition;
|
|
7356
|
-
|
|
7357
|
-
|
|
7358
|
-
|
|
7413
|
+
if (positonOutOfRange || positionInValid) {
|
|
7414
|
+
postureX = lastPosition?.x || 0;
|
|
7415
|
+
postureY = lastPosition?.y || 0;
|
|
7416
|
+
postureTheta = lastPosition?.rotation || 0;
|
|
7417
|
+
}
|
|
7418
|
+
else {
|
|
7419
|
+
postureX = chargingPilesPositionConfig.postureX || 0;
|
|
7420
|
+
postureY = chargingPilesPositionConfig.postureY || 0;
|
|
7421
|
+
postureTheta = chargingPilesPositionConfig.postureTheta || 0;
|
|
7422
|
+
}
|
|
7359
7423
|
// 检查是否需要更新图片
|
|
7360
7424
|
this.updateMowerImage(chargingPilesPositionConfig);
|
|
7361
7425
|
// 立即更新位置
|
|
@@ -7365,12 +7429,13 @@ class MowerPositionManager {
|
|
|
7365
7429
|
* 更新割草机位置
|
|
7366
7430
|
*/
|
|
7367
7431
|
updatePosition(positionConfig, animationTime = 0) {
|
|
7368
|
-
console.log('manager updatePosition----->', positionConfig);
|
|
7369
7432
|
// 检查是否需要更新图片
|
|
7370
7433
|
this.updateMowerImage(positionConfig);
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
const
|
|
7434
|
+
// 更新配置
|
|
7435
|
+
this.mowerPositionConfig = positionConfig;
|
|
7436
|
+
const postureX = positionConfig?.postureX || this.lastPosition?.x || 0;
|
|
7437
|
+
const postureY = positionConfig?.postureY || this.lastPosition?.y || 0;
|
|
7438
|
+
const postureTheta = positionConfig?.postureTheta || this.lastPosition?.rotation || 0;
|
|
7374
7439
|
// 停止当前动画(如果有)
|
|
7375
7440
|
this.stopAnimation();
|
|
7376
7441
|
// 第一个点
|
|
@@ -7391,8 +7456,6 @@ class MowerPositionManager {
|
|
|
7391
7456
|
// 立即更新位置
|
|
7392
7457
|
this.setElementPosition(positionConfig.postureX, positionConfig.postureY, positionConfig.postureTheta);
|
|
7393
7458
|
}
|
|
7394
|
-
// 更新配置
|
|
7395
|
-
this.mowerPositionConfig = positionConfig;
|
|
7396
7459
|
}
|
|
7397
7460
|
/**
|
|
7398
7461
|
* 更新割草机图片
|
|
@@ -7403,9 +7466,14 @@ class MowerPositionManager {
|
|
|
7403
7466
|
const imgElement = this.mowerElement.querySelector('img');
|
|
7404
7467
|
if (!imgElement)
|
|
7405
7468
|
return;
|
|
7406
|
-
const imageSrc = getMowerImage(positonConfig);
|
|
7469
|
+
const imageSrc = getMowerImage(positonConfig, this.modelType);
|
|
7407
7470
|
if (imageSrc) {
|
|
7408
7471
|
imgElement.src = imageSrc;
|
|
7472
|
+
imgElement.style.display = 'block';
|
|
7473
|
+
}
|
|
7474
|
+
else {
|
|
7475
|
+
imgElement.style.display = 'none';
|
|
7476
|
+
return;
|
|
7409
7477
|
}
|
|
7410
7478
|
}
|
|
7411
7479
|
/**
|
|
@@ -7415,17 +7483,9 @@ class MowerPositionManager {
|
|
|
7415
7483
|
const { x: pointX, y: pointY } = convertCoordinate(x, y);
|
|
7416
7484
|
const targetPixelPosition = this.convertMapCoordinateToOverlayPixel(pointX, pointY);
|
|
7417
7485
|
const targetRotation = radToDegree(theta);
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
const positionValid = isInvalidPosition({
|
|
7422
|
-
postureX: x,
|
|
7423
|
-
postureY: y,
|
|
7424
|
-
postureTheta: theta,
|
|
7425
|
-
});
|
|
7426
|
-
if (!positonOutOfRange && !positionValid) {
|
|
7427
|
-
this.lastPosition = { x, y, rotation: theta };
|
|
7428
|
-
}
|
|
7486
|
+
this.currentPosition = { x: x, y: y, rotation: theta };
|
|
7487
|
+
this.lastPosition = { x, y, rotation: theta };
|
|
7488
|
+
// console.log('setElementPosition', x, y, theta, targetRotation, positonOutOfRange, positionValid, targetPixelPosition);
|
|
7429
7489
|
if (!this.mowerElement)
|
|
7430
7490
|
return;
|
|
7431
7491
|
this.mowerElement.style.left = `${targetPixelPosition?.x}px`;
|
|
@@ -7451,15 +7511,29 @@ class MowerPositionManager {
|
|
|
7451
7511
|
startAnimationToPosition(positionConfig, duration) {
|
|
7452
7512
|
if (!this.mowerElement || !this.currentPosition)
|
|
7453
7513
|
return;
|
|
7454
|
-
this.startPosition = {
|
|
7455
|
-
...this.currentPosition,
|
|
7456
|
-
rotation: radNormalize(this.currentPosition.rotation),
|
|
7457
|
-
};
|
|
7458
7514
|
this.targetPosition = {
|
|
7459
7515
|
x: positionConfig.postureX,
|
|
7460
7516
|
y: positionConfig.postureY,
|
|
7461
7517
|
rotation: positionConfig.postureTheta,
|
|
7462
7518
|
};
|
|
7519
|
+
const isTargetPositionInvalid = isInvalidPosition({
|
|
7520
|
+
postureX: this.targetPosition.x,
|
|
7521
|
+
postureY: this.targetPosition.y,
|
|
7522
|
+
postureTheta: this.targetPosition.rotation,
|
|
7523
|
+
});
|
|
7524
|
+
const isTargetPositionOutOfRange = isOutOfRange({
|
|
7525
|
+
postureX: this.targetPosition.x,
|
|
7526
|
+
postureY: this.targetPosition.y,
|
|
7527
|
+
postureTheta: this.targetPosition.rotation,
|
|
7528
|
+
});
|
|
7529
|
+
// 如果目标坐标点不合理,则舍弃不使用
|
|
7530
|
+
if (isTargetPositionInvalid || isTargetPositionOutOfRange) {
|
|
7531
|
+
return;
|
|
7532
|
+
}
|
|
7533
|
+
this.startPosition = {
|
|
7534
|
+
...this.currentPosition,
|
|
7535
|
+
rotation: radNormalize(this.currentPosition.rotation),
|
|
7536
|
+
};
|
|
7463
7537
|
this.animationDuration = duration;
|
|
7464
7538
|
this.startTime = window.performance.now();
|
|
7465
7539
|
this.isAnimating = true;
|
|
@@ -7489,7 +7563,7 @@ class MowerPositionManager {
|
|
|
7489
7563
|
* 动画步骤
|
|
7490
7564
|
*/
|
|
7491
7565
|
animateStep() {
|
|
7492
|
-
if (!this.isAnimating || !this.
|
|
7566
|
+
if (!this.isAnimating || !this.targetPosition || !this.startPosition)
|
|
7493
7567
|
return;
|
|
7494
7568
|
const currentTime = window.performance.now();
|
|
7495
7569
|
const elapsed = currentTime - this.startTime;
|
|
@@ -7500,25 +7574,22 @@ class MowerPositionManager {
|
|
|
7500
7574
|
const currentX = this.startPosition.x + this.deltaPosition.x * easedProgress;
|
|
7501
7575
|
const currentY = this.startPosition.y + this.deltaPosition.y * easedProgress;
|
|
7502
7576
|
const currentRotation = this.startPosition.rotation + this.deltaPosition.rotation * easedProgress;
|
|
7503
|
-
this.currentPosition = { x: currentX, y: currentY, rotation: currentRotation };
|
|
7504
7577
|
// 假设在这里进行更新路径数据
|
|
7505
7578
|
if (this.onMowingPositionChange) {
|
|
7506
7579
|
this.onMowingPositionChange({
|
|
7507
7580
|
x: currentX,
|
|
7508
7581
|
y: currentY,
|
|
7509
|
-
vehicleState: this.mowerPositionConfig
|
|
7582
|
+
vehicleState: this.mowerPositionConfig?.vehicleState,
|
|
7510
7583
|
});
|
|
7511
7584
|
}
|
|
7512
|
-
// console.log('animateStep
|
|
7513
|
-
|
|
7585
|
+
// console.log('animateStep-->', this.startPosition, this.deltaPosition, this.targetPosition, easedProgress)
|
|
7586
|
+
this.setElementPosition(currentX, currentY, currentRotation);
|
|
7514
7587
|
// 继续动画或结束
|
|
7515
7588
|
if (progress < 1) {
|
|
7516
7589
|
// 设置当前位置
|
|
7517
|
-
this.setElementPosition(currentX, currentY, currentRotation);
|
|
7518
7590
|
this.animationId = window.requestAnimationFrame(() => this.animateStep());
|
|
7519
7591
|
}
|
|
7520
7592
|
else {
|
|
7521
|
-
this.setElementPosition(currentX, currentY, currentRotation);
|
|
7522
7593
|
// 动画完成
|
|
7523
7594
|
this.stopAnimation();
|
|
7524
7595
|
// 通知动画完成
|
|
@@ -7565,12 +7636,6 @@ class MowerPositionManager {
|
|
|
7565
7636
|
this.container.style.display = visible ? 'block' : 'none';
|
|
7566
7637
|
}
|
|
7567
7638
|
}
|
|
7568
|
-
/**
|
|
7569
|
-
* 检查是否正在动画中
|
|
7570
|
-
*/
|
|
7571
|
-
getIsAnimating() {
|
|
7572
|
-
return this.isAnimating;
|
|
7573
|
-
}
|
|
7574
7639
|
/**
|
|
7575
7640
|
* 销毁管理器
|
|
7576
7641
|
*/
|
|
@@ -7632,10 +7697,34 @@ function throttleAdvanced(func, delay, options = { leading: true, trailing: true
|
|
|
7632
7697
|
}
|
|
7633
7698
|
};
|
|
7634
7699
|
}
|
|
7700
|
+
/**
|
|
7701
|
+
* 检测当前设备是否为移动设备
|
|
7702
|
+
* @returns {boolean} 如果是移动设备返回true,否则返回false
|
|
7703
|
+
*/
|
|
7704
|
+
function isMobileDevice() {
|
|
7705
|
+
// 确保在浏览器环境中运行
|
|
7706
|
+
if (typeof window === 'undefined' || typeof navigator === 'undefined') {
|
|
7707
|
+
return false;
|
|
7708
|
+
}
|
|
7709
|
+
// 检查用户代理字符串
|
|
7710
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
7711
|
+
const mobileKeywords = [
|
|
7712
|
+
'android', 'webos', 'iphone', 'ipad', 'ipod',
|
|
7713
|
+
'blackberry', 'windows phone', 'mobile'
|
|
7714
|
+
];
|
|
7715
|
+
const isMobileUserAgent = mobileKeywords.some(keyword => userAgent.includes(keyword));
|
|
7716
|
+
// 检查触摸屏支持
|
|
7717
|
+
const hasTouchScreen = 'ontouchstart' in window ||
|
|
7718
|
+
(navigator.maxTouchPoints && navigator.maxTouchPoints > 0);
|
|
7719
|
+
// 检查屏幕尺寸(移动设备通常屏幕较小)
|
|
7720
|
+
const isSmallScreen = window.innerWidth <= 768;
|
|
7721
|
+
// 综合判断:用户代理包含移动设备关键词,或者有触摸屏且屏幕较小
|
|
7722
|
+
return isMobileUserAgent || (hasTouchScreen && isSmallScreen);
|
|
7723
|
+
}
|
|
7635
7724
|
|
|
7636
7725
|
// Google Maps 叠加层类 - 带编辑功能
|
|
7637
7726
|
class MowerMapOverlay {
|
|
7638
|
-
constructor(bounds, mapData, partitionBoundary, mowerPositionConfig, pathData, isEditMode = false, mapConfig = {}, antennaConfig = {}, mowPartitionData = null, defaultTransform, onMapLoad, onPathLoad, dragCallbacks) {
|
|
7727
|
+
constructor(bounds, mapData, partitionBoundary, mowerPositionConfig, modelType, pathData, isEditMode = false, unitType = UnitsType.Imperial, language = 'en', mapConfig = {}, antennaConfig = {}, mowPartitionData = null, defaultTransform, onMapLoad, onPathLoad, dragCallbacks) {
|
|
7639
7728
|
this.div = null;
|
|
7640
7729
|
this.svgMapView = null;
|
|
7641
7730
|
this.offscreenContainer = null;
|
|
@@ -7683,6 +7772,8 @@ class MowerMapOverlay {
|
|
|
7683
7772
|
this.partitionBoundary = partitionBoundary;
|
|
7684
7773
|
this.pathData = pathData;
|
|
7685
7774
|
this.isEditMode = isEditMode;
|
|
7775
|
+
this.unitType = unitType;
|
|
7776
|
+
this.language = language;
|
|
7686
7777
|
this.mapConfig = mapConfig;
|
|
7687
7778
|
this.antennaConfig = antennaConfig;
|
|
7688
7779
|
this.onMapLoad = onMapLoad;
|
|
@@ -7690,6 +7781,7 @@ class MowerMapOverlay {
|
|
|
7690
7781
|
this.dragCallbacks = dragCallbacks;
|
|
7691
7782
|
this.mowerPositionConfig = mowerPositionConfig;
|
|
7692
7783
|
this.mowPartitionData = mowPartitionData;
|
|
7784
|
+
this.modelType = modelType;
|
|
7693
7785
|
// 设置默认的transform
|
|
7694
7786
|
if (defaultTransform) {
|
|
7695
7787
|
this.defaultTransform = {
|
|
@@ -7722,7 +7814,6 @@ class MowerMapOverlay {
|
|
|
7722
7814
|
this.boundaryData = generateBoundaryData(mapData, pathData);
|
|
7723
7815
|
}
|
|
7724
7816
|
updatePosition(positionConfig, animationTime = 2200) {
|
|
7725
|
-
console.log('updatePosition==', positionConfig, animationTime);
|
|
7726
7817
|
// 保存当前动画时长
|
|
7727
7818
|
this.currentAnimationTime = animationTime;
|
|
7728
7819
|
// 标记是否为用户动画(大于0表示用户主动触发的动画)
|
|
@@ -7735,7 +7826,7 @@ class MowerMapOverlay {
|
|
|
7735
7826
|
}
|
|
7736
7827
|
}
|
|
7737
7828
|
updatePositionByLastPosition(chargingPilesPositionConfig) {
|
|
7738
|
-
|
|
7829
|
+
this.mowerPositionConfig = chargingPilesPositionConfig;
|
|
7739
7830
|
// 更新配置
|
|
7740
7831
|
if (this.mowerPositionManager) {
|
|
7741
7832
|
this.mowerPositionManager.updatePositionByLastPosition(chargingPilesPositionConfig);
|
|
@@ -7756,32 +7847,24 @@ class MowerMapOverlay {
|
|
|
7756
7847
|
return this.overlayView ? this.overlayView.getPanes() : null;
|
|
7757
7848
|
}
|
|
7758
7849
|
resetBorderLayerHighlight() {
|
|
7850
|
+
this.mowPartitionData = null;
|
|
7759
7851
|
const boundaryBorderLayer = this.svgMapView?.getLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
path.setAttribute('stroke', BOUNDARY_STYLES.lineColor);
|
|
7765
|
-
});
|
|
7766
|
-
}
|
|
7767
|
-
});
|
|
7852
|
+
if (!boundaryBorderLayer)
|
|
7853
|
+
return;
|
|
7854
|
+
boundaryBorderLayer.setMowingBoundarys([]);
|
|
7855
|
+
this.svgMapView?.renderLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7768
7856
|
}
|
|
7769
7857
|
setBorderLayerHighlight(mowPartitionData) {
|
|
7770
7858
|
this.mowPartitionData = mowPartitionData;
|
|
7771
7859
|
const boundaryBorderLayer = this.svgMapView?.getLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7772
7860
|
const partitionIds = mowPartitionData?.partitionIds || [];
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
if (boundaryBorderPaths) {
|
|
7778
|
-
boundaryBorderPaths.forEach((path) => {
|
|
7779
|
-
path.setAttribute('stroke', BOUNDARY_STYLES.mowingLineColor);
|
|
7780
|
-
});
|
|
7781
|
-
}
|
|
7782
|
-
}
|
|
7861
|
+
if (!boundaryBorderLayer)
|
|
7862
|
+
return;
|
|
7863
|
+
boundaryBorderLayer.setMowingBoundarys(partitionIds);
|
|
7864
|
+
this.svgMapView?.renderLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
7783
7865
|
}
|
|
7784
7866
|
onAdd() {
|
|
7867
|
+
console.log('onAdd');
|
|
7785
7868
|
// 创建包含SVG的div
|
|
7786
7869
|
this.div = document.createElement('div');
|
|
7787
7870
|
this.div.style.borderStyle = 'none';
|
|
@@ -7803,6 +7886,7 @@ class MowerMapOverlay {
|
|
|
7803
7886
|
this.createBoundaryLabelsManager();
|
|
7804
7887
|
// 创建割草机位置管理器
|
|
7805
7888
|
this.createMowerPositionManager();
|
|
7889
|
+
this.setManagerRotation(this.defaultTransform.rotation);
|
|
7806
7890
|
// 如果处于编辑模式,创建编辑界面
|
|
7807
7891
|
if (this.isEditMode) {
|
|
7808
7892
|
this.createEditInterface();
|
|
@@ -7841,16 +7925,6 @@ class MowerMapOverlay {
|
|
|
7841
7925
|
const map = this.getMap();
|
|
7842
7926
|
if (!map || !this.svgMapView)
|
|
7843
7927
|
return;
|
|
7844
|
-
// const currentZoom = map.getZoom();
|
|
7845
|
-
// const center = map.getCenter();
|
|
7846
|
-
// 基础公式:像素/米 = 156543.03392 * cos(latitude) / (2 ^ zoom)
|
|
7847
|
-
// const metersPerPixel =
|
|
7848
|
-
// (156543.03392 * Math.cos((center.lat() * Math.PI) / 180)) / Math.pow(2, currentZoom);
|
|
7849
|
-
// 缩放比例 = 1 / 米/像素
|
|
7850
|
-
// const scale = (1 / metersPerPixel) * 50;
|
|
7851
|
-
// 应用缩放到SVG
|
|
7852
|
-
// this.svgMapView.setZoom(scale);
|
|
7853
|
-
// 当缩放变化时,重新绘制以确保位置正确
|
|
7854
7928
|
this.draw();
|
|
7855
7929
|
}
|
|
7856
7930
|
// 创建边界标签管理器
|
|
@@ -7858,7 +7932,10 @@ class MowerMapOverlay {
|
|
|
7858
7932
|
if (!this.div || !this.svgMapView)
|
|
7859
7933
|
return;
|
|
7860
7934
|
// 创建边界标签管理器
|
|
7861
|
-
this.boundaryLabelsManager = new BoundaryLabelsManager(this.svgMapView, this.boundaryData
|
|
7935
|
+
this.boundaryLabelsManager = new BoundaryLabelsManager(this.svgMapView, this.boundaryData, {
|
|
7936
|
+
unitType: this.unitType,
|
|
7937
|
+
language: this.language,
|
|
7938
|
+
});
|
|
7862
7939
|
// 设置叠加层div引用
|
|
7863
7940
|
this.boundaryLabelsManager.setOverlayDiv(this.div);
|
|
7864
7941
|
// 添加所有边界标签
|
|
@@ -7902,9 +7979,7 @@ class MowerMapOverlay {
|
|
|
7902
7979
|
if (!this.div || !this.svgMapView)
|
|
7903
7980
|
return;
|
|
7904
7981
|
// 创建割草机位置管理器,传入动画完成回调
|
|
7905
|
-
this.mowerPositionManager = new MowerPositionManager(this.svgMapView, this.mowerPositionConfig, this.div, () => {
|
|
7906
|
-
console.log('动画完成');
|
|
7907
|
-
}, this.updatePathDataByMowingPositionThrottled.bind(this));
|
|
7982
|
+
this.mowerPositionManager = new MowerPositionManager(this.svgMapView, this.mowerPositionConfig, this.modelType, this.div, () => { }, this.updatePathDataByMowingPositionThrottled.bind(this));
|
|
7908
7983
|
// 设置叠加层div引用
|
|
7909
7984
|
this.mowerPositionManager.setOverlayDiv(this.div);
|
|
7910
7985
|
// 获取容器并添加到主div
|
|
@@ -7935,7 +8010,7 @@ class MowerMapOverlay {
|
|
|
7935
8010
|
this.boundaryLabelsManager.updatePositionsWithPrecomputedData(width, height, viewBoxInfo);
|
|
7936
8011
|
}
|
|
7937
8012
|
// 更新管理器位置
|
|
7938
|
-
updateManagerPositions(
|
|
8013
|
+
updateManagerPositions(_width, _height) {
|
|
7939
8014
|
if (!this.div)
|
|
7940
8015
|
return;
|
|
7941
8016
|
// 更新充电桩位置
|
|
@@ -7986,7 +8061,7 @@ class MowerMapOverlay {
|
|
|
7986
8061
|
this.rotateHandle.style.pointerEvents = 'auto';
|
|
7987
8062
|
this.rotateHandle.innerHTML = DEFAULT_ROTATE_ICON;
|
|
7988
8063
|
this.editContainer.appendChild(this.rotateHandle);
|
|
7989
|
-
//
|
|
8064
|
+
// 创建拖拽手柄(左下角)- 仅在移动设备上显示
|
|
7990
8065
|
this.dragHandle = document.createElement('div');
|
|
7991
8066
|
this.dragHandle.style.position = 'absolute';
|
|
7992
8067
|
this.dragHandle.style.bottom = '-20px';
|
|
@@ -7997,6 +8072,10 @@ class MowerMapOverlay {
|
|
|
7997
8072
|
this.dragHandle.style.zIndex = EDIT_STYLES.Z_INDEX.HANDLE;
|
|
7998
8073
|
this.dragHandle.style.pointerEvents = 'auto';
|
|
7999
8074
|
this.dragHandle.innerHTML = DEFAULT_DRAG_ICON;
|
|
8075
|
+
// 在PC设备上隐藏拖拽手柄
|
|
8076
|
+
if (!isMobileDevice()) {
|
|
8077
|
+
this.dragHandle.style.display = 'none';
|
|
8078
|
+
}
|
|
8000
8079
|
this.editContainer.appendChild(this.dragHandle);
|
|
8001
8080
|
// 将编辑容器添加到主div
|
|
8002
8081
|
this.div.appendChild(this.editContainer);
|
|
@@ -8038,7 +8117,6 @@ class MowerMapOverlay {
|
|
|
8038
8117
|
this.boundaryLabelsManager.collapseAllLabels();
|
|
8039
8118
|
}
|
|
8040
8119
|
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8041
|
-
console.log('开始旋转操作');
|
|
8042
8120
|
});
|
|
8043
8121
|
// 旋转手柄的触摸事件
|
|
8044
8122
|
this.rotateHandle.addEventListener('touchstart', (e) => {
|
|
@@ -8054,39 +8132,41 @@ class MowerMapOverlay {
|
|
|
8054
8132
|
this.boundaryLabelsManager.collapseAllLabels();
|
|
8055
8133
|
}
|
|
8056
8134
|
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8057
|
-
console.log('开始旋转操作(触摸)');
|
|
8058
|
-
}, { passive: false });
|
|
8059
|
-
// 拖拽手柄的鼠标事件
|
|
8060
|
-
this.dragHandle.addEventListener('mousedown', (e) => {
|
|
8061
|
-
e.preventDefault();
|
|
8062
|
-
e.stopPropagation();
|
|
8063
|
-
e.stopImmediatePropagation();
|
|
8064
|
-
this.isDragging = true;
|
|
8065
|
-
this.startPos = { x: e.clientX, y: e.clientY };
|
|
8066
|
-
this.dragHandle.style.cursor = 'grabbing';
|
|
8067
|
-
// 开始编辑时关闭所有展开的边界标签
|
|
8068
|
-
if (this.boundaryLabelsManager) {
|
|
8069
|
-
this.boundaryLabelsManager.collapseAllLabels();
|
|
8070
|
-
}
|
|
8071
|
-
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8072
|
-
console.log('开始拖动操作(通过手柄)');
|
|
8073
|
-
});
|
|
8074
|
-
// 拖拽手柄的触摸事件
|
|
8075
|
-
this.dragHandle.addEventListener('touchstart', (e) => {
|
|
8076
|
-
e.preventDefault();
|
|
8077
|
-
e.stopPropagation();
|
|
8078
|
-
e.stopImmediatePropagation();
|
|
8079
|
-
this.isDragging = true;
|
|
8080
|
-
const touch = e.touches[0];
|
|
8081
|
-
this.startPos = { x: touch.clientX, y: touch.clientY };
|
|
8082
|
-
this.dragHandle.style.cursor = 'grabbing';
|
|
8083
|
-
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8084
|
-
console.log('开始拖动操作(通过手柄,触摸)');
|
|
8085
8135
|
}, { passive: false });
|
|
8136
|
+
// 拖拽手柄的鼠标事件 - 仅在移动设备上启用
|
|
8137
|
+
if (isMobileDevice()) {
|
|
8138
|
+
this.dragHandle.addEventListener('mousedown', (e) => {
|
|
8139
|
+
e.preventDefault();
|
|
8140
|
+
e.stopPropagation();
|
|
8141
|
+
e.stopImmediatePropagation();
|
|
8142
|
+
this.isDragging = true;
|
|
8143
|
+
this.startPos = { x: e.clientX, y: e.clientY };
|
|
8144
|
+
this.dragHandle.style.cursor = 'grabbing';
|
|
8145
|
+
// 开始编辑时关闭所有展开的边界标签
|
|
8146
|
+
if (this.boundaryLabelsManager) {
|
|
8147
|
+
this.boundaryLabelsManager.collapseAllLabels();
|
|
8148
|
+
}
|
|
8149
|
+
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8150
|
+
});
|
|
8151
|
+
// 拖拽手柄的触摸事件
|
|
8152
|
+
this.dragHandle.addEventListener('touchstart', (e) => {
|
|
8153
|
+
e.preventDefault();
|
|
8154
|
+
e.stopPropagation();
|
|
8155
|
+
e.stopImmediatePropagation();
|
|
8156
|
+
this.isDragging = true;
|
|
8157
|
+
const touch = e.touches[0];
|
|
8158
|
+
this.startPos = { x: touch.clientX, y: touch.clientY };
|
|
8159
|
+
this.dragHandle.style.cursor = 'grabbing';
|
|
8160
|
+
this.dragCallbacks?.onDragStart?.(this.getCurrentDragState());
|
|
8161
|
+
}, { passive: false });
|
|
8162
|
+
}
|
|
8086
8163
|
// 编辑容器的鼠标事件(整个区域拖拽)
|
|
8087
8164
|
this.editContainer.addEventListener('mousedown', (e) => {
|
|
8088
|
-
|
|
8089
|
-
|
|
8165
|
+
// 在移动设备上,检查是否点击了拖拽手柄或旋转手柄
|
|
8166
|
+
// 在PC设备上,只检查旋转手柄(拖拽手柄已隐藏)
|
|
8167
|
+
const isDragHandleClick = isMobileDevice() && e.target === this.dragHandle;
|
|
8168
|
+
const isRotateHandleClick = e.target === this.rotateHandle;
|
|
8169
|
+
if (isDragHandleClick || isRotateHandleClick) {
|
|
8090
8170
|
return;
|
|
8091
8171
|
}
|
|
8092
8172
|
e.preventDefault();
|
|
@@ -8103,8 +8183,11 @@ class MowerMapOverlay {
|
|
|
8103
8183
|
});
|
|
8104
8184
|
// 编辑容器的触摸事件(整个区域拖拽)
|
|
8105
8185
|
this.editContainer.addEventListener('touchstart', (e) => {
|
|
8106
|
-
|
|
8107
|
-
|
|
8186
|
+
// 在移动设备上,检查是否点击了拖拽手柄或旋转手柄
|
|
8187
|
+
// 在PC设备上,只检查旋转手柄(拖拽手柄已隐藏)
|
|
8188
|
+
const isDragHandleClick = isMobileDevice() && e.target === this.dragHandle;
|
|
8189
|
+
const isRotateHandleClick = e.target === this.rotateHandle;
|
|
8190
|
+
if (isDragHandleClick || isRotateHandleClick) {
|
|
8108
8191
|
return;
|
|
8109
8192
|
}
|
|
8110
8193
|
e.preventDefault();
|
|
@@ -8164,7 +8247,6 @@ class MowerMapOverlay {
|
|
|
8164
8247
|
e.preventDefault();
|
|
8165
8248
|
e.stopPropagation();
|
|
8166
8249
|
e.stopImmediatePropagation();
|
|
8167
|
-
console.log('结束编辑操作');
|
|
8168
8250
|
}
|
|
8169
8251
|
// 如果是拖拽结束,将像素偏移量转换为地理坐标偏移量
|
|
8170
8252
|
if (this.isDragging) {
|
|
@@ -8186,7 +8268,6 @@ class MowerMapOverlay {
|
|
|
8186
8268
|
e.preventDefault();
|
|
8187
8269
|
e.stopPropagation();
|
|
8188
8270
|
e.stopImmediatePropagation();
|
|
8189
|
-
console.log('结束编辑操作(触摸)');
|
|
8190
8271
|
}
|
|
8191
8272
|
// 如果是拖拽结束,将像素偏移量转换为地理坐标偏移量
|
|
8192
8273
|
if (this.isDragging) {
|
|
@@ -8298,7 +8379,6 @@ class MowerMapOverlay {
|
|
|
8298
8379
|
this.div.style.transform = transform;
|
|
8299
8380
|
// 更新鼠标起始位置为当前位置,为下次计算做准备
|
|
8300
8381
|
this.startPos = { x: mouseCurrentX, y: mouseCurrentY };
|
|
8301
|
-
console.log('旋转角度:', this.currentRotation, '角度增量:', angleDifferenceDegrees);
|
|
8302
8382
|
}
|
|
8303
8383
|
// 将像素偏移量转换为地理坐标偏移量
|
|
8304
8384
|
convertPixelOffsetToLatLng() {
|
|
@@ -8328,14 +8408,6 @@ class MowerMapOverlay {
|
|
|
8328
8408
|
// 累积更新地理坐标偏移量(不是直接赋值!)
|
|
8329
8409
|
this.latLngOffset.lat += latOffset;
|
|
8330
8410
|
this.latLngOffset.lng += lngOffset;
|
|
8331
|
-
console.log('精确转换偏移量:', {
|
|
8332
|
-
pixelOffset: this.tempPixelOffset,
|
|
8333
|
-
centerLatLng: { lat: centerLatLng.lat(), lng: centerLatLng.lng() },
|
|
8334
|
-
offsetLatLng: { lat: offsetLatLng.lat(), lng: offsetLatLng.lng() },
|
|
8335
|
-
latOffset,
|
|
8336
|
-
lngOffset,
|
|
8337
|
-
newLatLngOffset: this.latLngOffset,
|
|
8338
|
-
});
|
|
8339
8411
|
// 重置临时像素偏移量
|
|
8340
8412
|
this.tempPixelOffset = { x: 0, y: 0 };
|
|
8341
8413
|
this.draw();
|
|
@@ -8373,8 +8445,6 @@ class MowerMapOverlay {
|
|
|
8373
8445
|
editData: editData,
|
|
8374
8446
|
timestamp: new Date().toISOString(),
|
|
8375
8447
|
};
|
|
8376
|
-
// 在这里可以添加保存逻辑,比如发送到服务器
|
|
8377
|
-
console.log('保存编辑数据:', saveData);
|
|
8378
8448
|
// 显示保存成功提示
|
|
8379
8449
|
this.showSaveSuccess();
|
|
8380
8450
|
return saveData;
|
|
@@ -8467,6 +8537,9 @@ class MowerMapOverlay {
|
|
|
8467
8537
|
y: transform.y,
|
|
8468
8538
|
rotation: transform.rotation,
|
|
8469
8539
|
};
|
|
8540
|
+
// defaultTransform的x对应经度偏移量,y对应纬度偏移量
|
|
8541
|
+
this.latLngOffset.lng = this.defaultTransform.x;
|
|
8542
|
+
this.latLngOffset.lat = this.defaultTransform.y;
|
|
8470
8543
|
this.setManagerRotation(this.currentRotation);
|
|
8471
8544
|
this.draw();
|
|
8472
8545
|
}
|
|
@@ -8500,12 +8573,10 @@ class MowerMapOverlay {
|
|
|
8500
8573
|
try {
|
|
8501
8574
|
// 创建SvgMapView实例
|
|
8502
8575
|
this.svgMapView = new SvgMapView(this.offscreenContainer, 800, 600);
|
|
8503
|
-
window.svgMapView = this.svgMapView;
|
|
8504
8576
|
// 加载地图数据
|
|
8505
8577
|
this.loadMapData();
|
|
8506
8578
|
// 加载路径数据
|
|
8507
8579
|
if (this.pathData && this.svgMapView) {
|
|
8508
|
-
console.log('initializeSvgMapView->', this.pathData, this.mowPartitionData);
|
|
8509
8580
|
this.loadPathData(this.pathData, this.mowPartitionData);
|
|
8510
8581
|
}
|
|
8511
8582
|
// 刷新绘制图层
|
|
@@ -8532,9 +8603,6 @@ class MowerMapOverlay {
|
|
|
8532
8603
|
// 使用现有的MapDataProcessor处理地图数据
|
|
8533
8604
|
const elements = MapDataProcessor.processMapData(this.mapData, this.mapConfig);
|
|
8534
8605
|
// 分离充电桩和天线元素,其他元素添加到SVG图层
|
|
8535
|
-
// const svgElements = elements.filter(element =>
|
|
8536
|
-
// element.type !== 'charging_pile' && element.type !== 'antenna'
|
|
8537
|
-
// );
|
|
8538
8606
|
const svgElements = elements.filter((element) => element.type !== 'charging_pile' && element.type !== 'antenna');
|
|
8539
8607
|
const chargingPileElements = elements.filter((element) => element.type === 'charging_pile');
|
|
8540
8608
|
// 处理SVG图层元素
|
|
@@ -8549,6 +8617,10 @@ class MowerMapOverlay {
|
|
|
8549
8617
|
const layers = drawLayer.getLayers();
|
|
8550
8618
|
this.svgMapView.clear();
|
|
8551
8619
|
this.svgMapView.addLayers(layers);
|
|
8620
|
+
const boundaryBorderLayer = this.svgMapView.getLayer(LAYER_DEFAULT_TYPE.BOUNDARY_BORDER);
|
|
8621
|
+
if (boundaryBorderLayer) {
|
|
8622
|
+
boundaryBorderLayer.setMowingBoundarys(this.mowPartitionData?.partitionIds || []);
|
|
8623
|
+
}
|
|
8552
8624
|
this.createChargingPileManager();
|
|
8553
8625
|
// 使用管理器处理充电桩和天线
|
|
8554
8626
|
if (this.chargingPileManager && chargingPileElements.length > 0) {
|
|
@@ -8578,7 +8650,6 @@ class MowerMapOverlay {
|
|
|
8578
8650
|
try {
|
|
8579
8651
|
// 使用现有的PathDataProcessor处理路径数据
|
|
8580
8652
|
const pathElements = PathDataProcessor.processPathData(pathData, this.mapConfig);
|
|
8581
|
-
console.log('pathdaata->', pathElements, mowPartitionData);
|
|
8582
8653
|
const newPathElements = pathElements.map((pathElement) => {
|
|
8583
8654
|
const { id, elements } = pathElement;
|
|
8584
8655
|
const isMowBoundary = mowPartitionData && mowPartitionData?.partitionIds?.includes(id);
|
|
@@ -8626,7 +8697,6 @@ class MowerMapOverlay {
|
|
|
8626
8697
|
// 找到当前position所在的分区id,将该点更新到pathData中
|
|
8627
8698
|
const currentPartitionId = getPartitionId(this.partitionBoundary, position.x, position.y);
|
|
8628
8699
|
const processStateIsMowing = useProcessMowingState.getState().processStateIsMowing;
|
|
8629
|
-
// console.log('processStateIsMowing==', processStateIsMowing);
|
|
8630
8700
|
if (currentPartitionId && this.pathData?.[currentPartitionId]) {
|
|
8631
8701
|
const currentPathData = this.pathData[currentPartitionId];
|
|
8632
8702
|
this.pathData[currentPartitionId] = {
|
|
@@ -8815,15 +8885,41 @@ class MowerMapOverlay {
|
|
|
8815
8885
|
this.mowerPositionManager.setVisible(visible);
|
|
8816
8886
|
}
|
|
8817
8887
|
}
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8888
|
+
// 获取SvgMapView实例(用于debug)
|
|
8889
|
+
getSvgMapView() {
|
|
8890
|
+
return this.svgMapView;
|
|
8891
|
+
}
|
|
8892
|
+
}
|
|
8893
|
+
|
|
8894
|
+
// 获取车辆状态的中文文案
|
|
8895
|
+
const getVehicleStateText = (vehicleState) => {
|
|
8896
|
+
switch (vehicleState) {
|
|
8897
|
+
case RobotStatus.PARKED:
|
|
8898
|
+
return 'PARKED';
|
|
8899
|
+
case RobotStatus.CHARGING:
|
|
8900
|
+
return 'CHARGING';
|
|
8901
|
+
case RobotStatus.STANDBY:
|
|
8902
|
+
return 'STANDBY';
|
|
8903
|
+
case RobotStatus.MOWING:
|
|
8904
|
+
return 'MOWING';
|
|
8905
|
+
case RobotStatus.WORKING:
|
|
8906
|
+
return 'WORKING';
|
|
8907
|
+
case RobotStatus.MAPPING:
|
|
8908
|
+
return 'MAPPING';
|
|
8909
|
+
case RobotStatus.ERROR:
|
|
8910
|
+
return 'ERROR';
|
|
8911
|
+
case RobotStatus.UPGRADING:
|
|
8912
|
+
return 'UPGRADING';
|
|
8913
|
+
case RobotStatus.DISCONNECTED:
|
|
8914
|
+
return 'DISCONNECTED';
|
|
8915
|
+
case RobotStatus.TASK_DELAY:
|
|
8916
|
+
return 'TASK_DELAY';
|
|
8917
|
+
case RobotStatus.UNKNOWN:
|
|
8918
|
+
return '未知';
|
|
8919
|
+
default:
|
|
8920
|
+
return `未知状态(${vehicleState})`;
|
|
8921
|
+
}
|
|
8922
|
+
};
|
|
8827
8923
|
// 验证GPS坐标是否有效
|
|
8828
8924
|
const isValidGpsCoordinate = (coordinate) => {
|
|
8829
8925
|
if (!coordinate || coordinate.length < 2)
|
|
@@ -8837,35 +8933,76 @@ const isValidGpsCoordinate = (coordinate) => {
|
|
|
8837
8933
|
!(Math.abs(lng) < 0.001 && Math.abs(lat) < 0.001) // 排除接近(0,0)的坐标
|
|
8838
8934
|
);
|
|
8839
8935
|
};
|
|
8936
|
+
// 旋转坐标点
|
|
8937
|
+
const rotateCoordinate = (point, center, angleRadians) => {
|
|
8938
|
+
const [x, y] = point;
|
|
8939
|
+
const [cx, cy] = center;
|
|
8940
|
+
// 将点移动到原点
|
|
8941
|
+
const dx = x - cx;
|
|
8942
|
+
const dy = y - cy;
|
|
8943
|
+
// 应用旋转矩阵
|
|
8944
|
+
const cos = Math.cos(angleRadians);
|
|
8945
|
+
const sin = Math.sin(angleRadians);
|
|
8946
|
+
const rotatedX = dx * cos - dy * sin;
|
|
8947
|
+
const rotatedY = dx * sin + dy * cos;
|
|
8948
|
+
// 移回原位置
|
|
8949
|
+
return [rotatedX + cx, rotatedY + cy];
|
|
8950
|
+
};
|
|
8840
8951
|
// 获取有效的GPS边界
|
|
8841
|
-
const getValidGpsBounds = (mapData) => {
|
|
8952
|
+
const getValidGpsBounds = (mapData, rotation = 0) => {
|
|
8953
|
+
let bounds;
|
|
8842
8954
|
// 首先尝试使用地图数据中的GPS坐标
|
|
8843
8955
|
if (isValidGpsCoordinate(mapData.sw_gps) && isValidGpsCoordinate(mapData.ne_gps)) {
|
|
8844
|
-
|
|
8956
|
+
bounds = {
|
|
8845
8957
|
sw: mapData.sw_gps,
|
|
8846
8958
|
ne: mapData.ne_gps,
|
|
8847
8959
|
};
|
|
8848
8960
|
}
|
|
8849
|
-
|
|
8850
|
-
|
|
8851
|
-
|
|
8852
|
-
|
|
8853
|
-
|
|
8854
|
-
|
|
8855
|
-
|
|
8961
|
+
else {
|
|
8962
|
+
// 如果GPS坐标无效,尝试从地图几何数据估算
|
|
8963
|
+
const { sw, ne } = estimateGpsFromMapBounds(mapData);
|
|
8964
|
+
if (sw && ne) {
|
|
8965
|
+
console.warn('GPS坐标无效,使用地图几何数据估算边界:', sw, ne);
|
|
8966
|
+
bounds = {
|
|
8967
|
+
sw: [sw[0], sw[1]],
|
|
8968
|
+
ne: [ne[0], ne[1]],
|
|
8969
|
+
};
|
|
8970
|
+
}
|
|
8971
|
+
else {
|
|
8972
|
+
// 最后的fallback:使用默认坐标
|
|
8973
|
+
console.warn('无法获取有效的GPS边界,使用默认坐标');
|
|
8974
|
+
bounds = {
|
|
8975
|
+
sw: [-9.1562, -37.7503],
|
|
8976
|
+
ne: [31.247, 5.797],
|
|
8977
|
+
};
|
|
8978
|
+
}
|
|
8979
|
+
}
|
|
8980
|
+
// 如果有旋转角度,计算旋转后的边界
|
|
8981
|
+
if (rotation !== 0) {
|
|
8982
|
+
const angleRadians = (rotation * Math.PI) / 180; // 转换为弧度
|
|
8983
|
+
// 计算边界中心点
|
|
8984
|
+
const centerLng = (bounds.sw[0] + bounds.ne[0]) / 2;
|
|
8985
|
+
const centerLat = (bounds.sw[1] + bounds.ne[1]) / 2;
|
|
8986
|
+
const center = [centerLng, centerLat];
|
|
8987
|
+
// 旋转四个角点
|
|
8988
|
+
const sw = rotateCoordinate(bounds.sw, center, angleRadians);
|
|
8989
|
+
const ne = rotateCoordinate(bounds.ne, center, angleRadians);
|
|
8990
|
+
const se = rotateCoordinate([bounds.ne[0], bounds.sw[1]], center, angleRadians);
|
|
8991
|
+
const nw = rotateCoordinate([bounds.sw[0], bounds.ne[1]], center, angleRadians);
|
|
8992
|
+
// 计算旋转后的边界框(包含所有旋转后的点)
|
|
8993
|
+
const lngs = [sw[0], ne[0], se[0], nw[0]];
|
|
8994
|
+
const lats = [sw[1], ne[1], se[1], nw[1]];
|
|
8995
|
+
bounds = {
|
|
8996
|
+
sw: [Math.min(...lngs), Math.min(...lats)],
|
|
8997
|
+
ne: [Math.max(...lngs), Math.max(...lats)],
|
|
8856
8998
|
};
|
|
8857
8999
|
}
|
|
8858
|
-
|
|
8859
|
-
console.warn('无法获取有效的GPS边界,使用默认坐标');
|
|
8860
|
-
return {
|
|
8861
|
-
sw: [-9.1562, -37.7503],
|
|
8862
|
-
ne: [31.247, 5.797],
|
|
8863
|
-
};
|
|
9000
|
+
return bounds;
|
|
8864
9001
|
};
|
|
8865
9002
|
// 默认配置
|
|
8866
9003
|
const defaultMapConfig = DEFAULT_STYLES;
|
|
8867
9004
|
// 地图渲染器组件
|
|
8868
|
-
const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance, isEditMode = false, dragCallbacks, defaultTransform, }, ref) => {
|
|
9005
|
+
const MowerMapRenderer = 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) => {
|
|
8869
9006
|
const [elementCount, setElementCount] = useState(0);
|
|
8870
9007
|
const [pathCount, setPathCount] = useState(0);
|
|
8871
9008
|
const [currentError, setCurrentError] = useState(null);
|
|
@@ -8873,10 +9010,12 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
8873
9010
|
// const mapRef = useMap();
|
|
8874
9011
|
const [isGoogleMapsReady, setIsGoogleMapsReady] = useState(false);
|
|
8875
9012
|
const [hasInitializedBounds, setHasInitializedBounds] = useState(false);
|
|
8876
|
-
const { clearSubBoundaryBorder } = useSubBoundaryBorderStore();
|
|
9013
|
+
const { clearSubBoundaryBorder, clearObstacles, clearSvgElements } = useSubBoundaryBorderStore();
|
|
8877
9014
|
const currentProcessMowingStatusRef = useRef(false);
|
|
8878
9015
|
const { updateProcessStateIsMowing, processStateIsMowing } = useProcessMowingState();
|
|
8879
9016
|
const [mowPartitionData, setMowPartitionData] = useState(null);
|
|
9017
|
+
// Debug相关状态
|
|
9018
|
+
const [debugInfo, setDebugInfo] = useState({});
|
|
8880
9019
|
// 处理地图分区边界
|
|
8881
9020
|
const partitionBoundary = useMemo(() => {
|
|
8882
9021
|
const allBoundaryElements = [];
|
|
@@ -8901,7 +9040,12 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
8901
9040
|
const mowerPositionData = useMemo(() => {
|
|
8902
9041
|
// realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
|
|
8903
9042
|
if (!realTimeData || realTimeData.length === 0)
|
|
8904
|
-
return
|
|
9043
|
+
return {
|
|
9044
|
+
postureX: 0,
|
|
9045
|
+
postureY: 0,
|
|
9046
|
+
postureTheta: 0,
|
|
9047
|
+
vehicleState: RobotStatus.DISCONNECTED,
|
|
9048
|
+
};
|
|
8905
9049
|
let currentPositionData;
|
|
8906
9050
|
if (realTimeData.length === 1 && realTimeData[0].type === RealTimeDataType.LOCATION) {
|
|
8907
9051
|
currentPositionData = realTimeData[0];
|
|
@@ -8920,13 +9064,15 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
8920
9064
|
lastPostureTheta: currentPositionData?.lastPostureTheta
|
|
8921
9065
|
? Number(currentPositionData.lastPostureTheta)
|
|
8922
9066
|
: 0,
|
|
8923
|
-
lastPostureX: currentPositionData?.lastPostureX
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
9067
|
+
lastPostureX: currentPositionData?.lastPostureX
|
|
9068
|
+
? Number(currentPositionData.lastPostureX)
|
|
9069
|
+
: 0,
|
|
9070
|
+
lastPostureY: currentPositionData?.lastPostureY
|
|
9071
|
+
? Number(currentPositionData.lastPostureY)
|
|
9072
|
+
: 0,
|
|
9073
|
+
vehicleState: currentPositionData?.vehicleState || RobotStatus.DISCONNECTED,
|
|
8927
9074
|
};
|
|
8928
9075
|
}, [realTimeData, modelType]);
|
|
8929
|
-
console.log('mowerPositionData', mowerPositionData);
|
|
8930
9076
|
// 处理错误
|
|
8931
9077
|
const handleError = (error) => {
|
|
8932
9078
|
setCurrentError(error);
|
|
@@ -8942,18 +9088,17 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
8942
9088
|
return;
|
|
8943
9089
|
}
|
|
8944
9090
|
// 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
|
|
8945
|
-
const validBounds = getValidGpsBounds(mapJson);
|
|
9091
|
+
const validBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
8946
9092
|
// 地图数据中的坐标格式是 [longitude, latitude]
|
|
8947
|
-
const swLat = validBounds.sw[1];
|
|
8948
|
-
const swLng = validBounds.sw[0];
|
|
8949
|
-
const neLat = validBounds.ne[1];
|
|
8950
|
-
const neLng = validBounds.ne[0];
|
|
9093
|
+
const swLat = validBounds.sw[1] + defaultTransform.y;
|
|
9094
|
+
const swLng = validBounds.sw[0] + defaultTransform.x;
|
|
9095
|
+
const neLat = validBounds.ne[1] + defaultTransform.y;
|
|
9096
|
+
const neLng = validBounds.ne[0] + defaultTransform.x;
|
|
8951
9097
|
const googleBounds = new window.google.maps.LatLngBounds(new window.google.maps.LatLng(swLat, swLng), // 西南角
|
|
8952
9098
|
new window.google.maps.LatLng(neLat, neLng) // 东北角
|
|
8953
9099
|
);
|
|
8954
|
-
console.log('fitBounds----->', googleBounds);
|
|
8955
9100
|
mapRef.fitBounds(googleBounds);
|
|
8956
|
-
}, [mapJson, mapRef]);
|
|
9101
|
+
}, [mapJson, mapRef, defaultTransform]);
|
|
8957
9102
|
// 初始化Google Maps叠加层
|
|
8958
9103
|
const initializeGoogleMapsOverlay = async () => {
|
|
8959
9104
|
if (!mapJson)
|
|
@@ -8977,7 +9122,8 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
8977
9122
|
return;
|
|
8978
9123
|
}
|
|
8979
9124
|
// 将自定义边界转换为Google Maps LatLngBounds(使用有效的GPS坐标)
|
|
8980
|
-
|
|
9125
|
+
// 这里需要使用0度,需要原始的坐标点去计算元素的实际位置,只有在fitbounds的时候才需要使用旋转后的坐标点
|
|
9126
|
+
const validBounds = getValidGpsBounds(mapJson, 0);
|
|
8981
9127
|
// 地图数据中的坐标格式是 [longitude, latitude]
|
|
8982
9128
|
const swLat = validBounds.sw[1];
|
|
8983
9129
|
const swLng = validBounds.sw[0];
|
|
@@ -8992,7 +9138,7 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
8992
9138
|
overlayRef.current = null;
|
|
8993
9139
|
}
|
|
8994
9140
|
// 创建叠加层
|
|
8995
|
-
const overlay = new MowerMapOverlay(googleBounds, mapJson, partitionBoundary, mowerPositionData, pathJson || {}, isEditMode, mergedMapConfig, mergedAntennaConfig, null, defaultTransform, (count) => {
|
|
9141
|
+
const overlay = new MowerMapOverlay(googleBounds, mapJson, partitionBoundary, mowerPositionData, modelType, pathJson || {}, isEditMode, unitType, language, mergedMapConfig, mergedAntennaConfig, null, defaultTransform, (count) => {
|
|
8996
9142
|
setElementCount(count);
|
|
8997
9143
|
onMapLoad?.(count);
|
|
8998
9144
|
}, (count) => {
|
|
@@ -9013,12 +9159,27 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
9013
9159
|
handleError(`初始化Google Maps叠加层失败: ${error instanceof Error ? error.message : String(error)}`);
|
|
9014
9160
|
}
|
|
9015
9161
|
};
|
|
9162
|
+
const resetInCharginPie = useCallback(() => {
|
|
9163
|
+
const elements = MapDataProcessor.processMapData(mapJson, mergedMapConfig);
|
|
9164
|
+
const chargingPiles = elements.find((element) => element.type === 'charging_pile');
|
|
9165
|
+
if (!overlayRef.current)
|
|
9166
|
+
return;
|
|
9167
|
+
// 如果在充电桩上,则直接更新位置到充电桩的位置
|
|
9168
|
+
overlayRef.current.updatePosition({
|
|
9169
|
+
...mowerPositionData,
|
|
9170
|
+
postureX: chargingPiles?.originalData.position[0],
|
|
9171
|
+
postureY: chargingPiles?.originalData.position[1],
|
|
9172
|
+
postureTheta: chargingPiles?.originalData.direction - Math.PI || 0,
|
|
9173
|
+
}, 0);
|
|
9174
|
+
}, [mapJson, mowerPositionData]);
|
|
9016
9175
|
// 初始化效果
|
|
9017
9176
|
useEffect(() => {
|
|
9018
9177
|
initializeGoogleMapsOverlay();
|
|
9019
9178
|
// 清理函数
|
|
9020
9179
|
return () => {
|
|
9021
9180
|
clearSubBoundaryBorder();
|
|
9181
|
+
clearObstacles();
|
|
9182
|
+
clearSvgElements();
|
|
9022
9183
|
updateProcessStateIsMowing(false);
|
|
9023
9184
|
currentProcessMowingStatusRef.current = false;
|
|
9024
9185
|
if (overlayRef.current) {
|
|
@@ -9049,10 +9210,9 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
9049
9210
|
const inChargingPiles = [RobotStatus.CHARGING, RobotStatus.PARKED];
|
|
9050
9211
|
const isOffLine = mowerPositionData.vehicleState === RobotStatus.DISCONNECTED;
|
|
9051
9212
|
const isInChargingPile = inChargingPiles.includes(mowerPositionData.vehicleState);
|
|
9052
|
-
console.log('isInChargingPile-----------》', isInChargingPile, mowerPositionData);
|
|
9053
9213
|
// 如果在充电桩上,则直接更新位置到充电桩的位置
|
|
9214
|
+
console.log('usefeect mowerPositionData----->', mowerPositionData, isInChargingPile);
|
|
9054
9215
|
if (isInChargingPile) {
|
|
9055
|
-
console.log('isInChargingPile', isInChargingPile, mowerPositionData);
|
|
9056
9216
|
overlayRef.current.updatePosition({
|
|
9057
9217
|
...mowerPositionData,
|
|
9058
9218
|
postureX: chargingPiles?.originalData.position[0],
|
|
@@ -9065,7 +9225,6 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
9065
9225
|
const positonOutOfRange = isOutOfRange(mowerPositionData);
|
|
9066
9226
|
const positionValid = isInvalidPosition(mowerPositionData);
|
|
9067
9227
|
const isStandby = mowerPositionData.vehicleState === RobotStatus.STANDBY;
|
|
9068
|
-
console.log('positonOutOfRange', positonOutOfRange, positionValid, isOffLine);
|
|
9069
9228
|
if (positonOutOfRange || positionValid || isOffLine) {
|
|
9070
9229
|
// 初始信息是通过后端接口获取的,此时当前位置数据不可用的时候,可以取上一次的位置数据
|
|
9071
9230
|
// mowerPositionData 中可能会包含上一次的位置数据,
|
|
@@ -9085,29 +9244,165 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
9085
9244
|
}
|
|
9086
9245
|
}
|
|
9087
9246
|
else {
|
|
9088
|
-
console.log('hook updatePosition----->', mowerPositionData);
|
|
9089
9247
|
overlayRef.current.updatePosition(mowerPositionData, isStandby ? 0 : 2000);
|
|
9090
9248
|
}
|
|
9091
9249
|
}
|
|
9092
9250
|
}, [mowerPositionData]);
|
|
9251
|
+
// 更新debug信息
|
|
9252
|
+
useEffect(() => {
|
|
9253
|
+
if (!debug)
|
|
9254
|
+
return;
|
|
9255
|
+
const updateDebugInfo = () => {
|
|
9256
|
+
const newDebugInfo = {};
|
|
9257
|
+
// 获取地图GPS边界
|
|
9258
|
+
if (mapJson) {
|
|
9259
|
+
newDebugInfo.mapBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
9260
|
+
}
|
|
9261
|
+
// 获取SVG viewBox信息
|
|
9262
|
+
if (overlayRef.current) {
|
|
9263
|
+
const overlay = overlayRef.current;
|
|
9264
|
+
const svgMapView = overlay.getSvgMapView?.();
|
|
9265
|
+
if (svgMapView) {
|
|
9266
|
+
const viewBoxInfo = svgMapView.getViewBoxInfo();
|
|
9267
|
+
// 计算实际的米单位数据(除以缩放比例)
|
|
9268
|
+
const SCALE_FACTOR = 50; // 根据项目中的缩放因子
|
|
9269
|
+
newDebugInfo.viewBox = {
|
|
9270
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9271
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9272
|
+
width: viewBoxInfo.width / SCALE_FACTOR,
|
|
9273
|
+
height: viewBoxInfo.height / SCALE_FACTOR,
|
|
9274
|
+
scale: SCALE_FACTOR,
|
|
9275
|
+
// 计算左下角和右上角坐标
|
|
9276
|
+
sw: {
|
|
9277
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9278
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9279
|
+
},
|
|
9280
|
+
ne: {
|
|
9281
|
+
x: (viewBoxInfo.x + viewBoxInfo.width) / SCALE_FACTOR,
|
|
9282
|
+
y: (viewBoxInfo.y + viewBoxInfo.height) / SCALE_FACTOR,
|
|
9283
|
+
},
|
|
9284
|
+
};
|
|
9285
|
+
}
|
|
9286
|
+
}
|
|
9287
|
+
// 获取当前割草机位置
|
|
9288
|
+
if (mowerPositionData) {
|
|
9289
|
+
newDebugInfo.mowerPosition = {
|
|
9290
|
+
x: mowerPositionData.postureX || 0,
|
|
9291
|
+
y: mowerPositionData.postureY || 0,
|
|
9292
|
+
theta: mowerPositionData.postureTheta || 0,
|
|
9293
|
+
lastX: mowerPositionData.lastPostureX || 0,
|
|
9294
|
+
lastY: mowerPositionData.lastPostureY || 0,
|
|
9295
|
+
lastTheta: mowerPositionData.lastPostureTheta || 0,
|
|
9296
|
+
vehicleState: mowerPositionData.vehicleState || RobotStatus.UNKNOWN,
|
|
9297
|
+
vehicleStateText: getVehicleStateText(mowerPositionData.vehicleState || RobotStatus.UNKNOWN),
|
|
9298
|
+
};
|
|
9299
|
+
}
|
|
9300
|
+
// 获取当前割草地块数据
|
|
9301
|
+
newDebugInfo.partitionData = mowPartitionData;
|
|
9302
|
+
setDebugInfo(newDebugInfo);
|
|
9303
|
+
};
|
|
9304
|
+
updateDebugInfo();
|
|
9305
|
+
}, [debug, mapJson, mowerPositionData, mowPartitionData, defaultTransform]);
|
|
9306
|
+
// 当关键数据变化时立即更新debug信息
|
|
9307
|
+
useEffect(() => {
|
|
9308
|
+
if (!debug)
|
|
9309
|
+
return;
|
|
9310
|
+
const updateDebugInfo = () => {
|
|
9311
|
+
const newDebugInfo = {};
|
|
9312
|
+
// 获取地图GPS边界
|
|
9313
|
+
if (mapJson) {
|
|
9314
|
+
newDebugInfo.mapBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
9315
|
+
}
|
|
9316
|
+
// 获取SVG viewBox信息
|
|
9317
|
+
if (overlayRef.current) {
|
|
9318
|
+
const overlay = overlayRef.current;
|
|
9319
|
+
const svgMapView = overlay.getSvgMapView?.();
|
|
9320
|
+
if (svgMapView) {
|
|
9321
|
+
const viewBoxInfo = svgMapView.getViewBoxInfo();
|
|
9322
|
+
// 计算实际的米单位数据(除以缩放比例)
|
|
9323
|
+
const SCALE_FACTOR = 50; // 根据项目中的缩放因子
|
|
9324
|
+
newDebugInfo.viewBox = {
|
|
9325
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9326
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9327
|
+
width: viewBoxInfo.width / SCALE_FACTOR,
|
|
9328
|
+
height: viewBoxInfo.height / SCALE_FACTOR,
|
|
9329
|
+
scale: SCALE_FACTOR,
|
|
9330
|
+
// 计算左下角和右上角坐标
|
|
9331
|
+
sw: {
|
|
9332
|
+
x: viewBoxInfo.x / SCALE_FACTOR,
|
|
9333
|
+
y: viewBoxInfo.y / SCALE_FACTOR,
|
|
9334
|
+
},
|
|
9335
|
+
ne: {
|
|
9336
|
+
x: (viewBoxInfo.x + viewBoxInfo.width) / SCALE_FACTOR,
|
|
9337
|
+
y: (viewBoxInfo.y + viewBoxInfo.height) / SCALE_FACTOR,
|
|
9338
|
+
},
|
|
9339
|
+
};
|
|
9340
|
+
}
|
|
9341
|
+
}
|
|
9342
|
+
// 获取当前割草机位置
|
|
9343
|
+
if (mowerPositionData) {
|
|
9344
|
+
newDebugInfo.mowerPosition = {
|
|
9345
|
+
x: mowerPositionData.postureX || 0,
|
|
9346
|
+
y: mowerPositionData.postureY || 0,
|
|
9347
|
+
theta: mowerPositionData.postureTheta || 0,
|
|
9348
|
+
lastX: mowerPositionData.lastPostureX || 0,
|
|
9349
|
+
lastY: mowerPositionData.lastPostureY || 0,
|
|
9350
|
+
lastTheta: mowerPositionData.lastPostureTheta || 0,
|
|
9351
|
+
vehicleState: mowerPositionData.vehicleState || RobotStatus.UNKNOWN,
|
|
9352
|
+
vehicleStateText: getVehicleStateText(mowerPositionData.vehicleState || RobotStatus.UNKNOWN),
|
|
9353
|
+
};
|
|
9354
|
+
}
|
|
9355
|
+
// 获取当前割草地块数据
|
|
9356
|
+
newDebugInfo.partitionData = mowPartitionData;
|
|
9357
|
+
setDebugInfo(newDebugInfo);
|
|
9358
|
+
};
|
|
9359
|
+
updateDebugInfo();
|
|
9360
|
+
}, [debug, mowerPositionData, mowPartitionData]);
|
|
9093
9361
|
useEffect(() => {
|
|
9094
|
-
if (!
|
|
9095
|
-
|
|
9096
|
-
|
|
9097
|
-
|
|
9098
|
-
|
|
9099
|
-
|
|
9362
|
+
if (!realTimeData || realTimeData.length === 0 || !Array.isArray(realTimeData)) {
|
|
9363
|
+
return;
|
|
9364
|
+
}
|
|
9365
|
+
console.log('usefeect realTimeData----->', realTimeData, mapJson, pathJson, overlayRef.current);
|
|
9366
|
+
let curMowPartitionData = mowPartitionData;
|
|
9367
|
+
// realtime中包含当前割草任务的数据,根据数据进行path路径和边界的高亮操作,
|
|
9368
|
+
const mowingPartition = realTimeData.find((item) => item.type === RealTimeDataType.PARTITION);
|
|
9369
|
+
if (mowingPartition) {
|
|
9370
|
+
setMowPartitionData(mowingPartition);
|
|
9371
|
+
curMowPartitionData = mowingPartition;
|
|
9372
|
+
}
|
|
9373
|
+
const positionData = realTimeData?.find((item) => item?.type === RealTimeDataType.LOCATION);
|
|
9374
|
+
const statusData = realTimeData?.find((item) => item?.type === RealTimeDataType.STATUS);
|
|
9375
|
+
if (statusData || positionData) {
|
|
9376
|
+
const currentStatus = statusData?.vehicleState || positionData?.vehicleState;
|
|
9377
|
+
// 车辆回桩不会回传最后的park的位置,所以根据实时数据的状态数据判断车辆回到桩上
|
|
9378
|
+
if ([RobotStatus.CHARGING, RobotStatus.PARKED].includes(currentStatus || RobotStatus.UNKNOWN)) {
|
|
9379
|
+
resetInCharginPie();
|
|
9380
|
+
}
|
|
9381
|
+
else if (currentStatus === RobotStatus.WORKING) {
|
|
9382
|
+
// 兜底收不到割草地块的实时数据,使用状态来兜底
|
|
9383
|
+
overlayRef.current.resetBorderLayerHighlight();
|
|
9384
|
+
setMowPartitionData(null);
|
|
9385
|
+
curMowPartitionData = null;
|
|
9386
|
+
}
|
|
9387
|
+
else if (currentStatus === RobotStatus.MOWING &&
|
|
9388
|
+
curMowPartitionData &&
|
|
9389
|
+
!curMowPartitionData?.partitionIds) {
|
|
9390
|
+
// 如果当前是割草状态,但是地块数据初始化过且不存在则认为是全局割草,则把所有地块都高亮
|
|
9391
|
+
const allPartitionIds = mapJson?.sub_maps?.map((item) => item?.id);
|
|
9392
|
+
setMowPartitionData({
|
|
9393
|
+
partitionIds: allPartitionIds,
|
|
9394
|
+
});
|
|
9395
|
+
curMowPartitionData = {
|
|
9396
|
+
partitionIds: allPartitionIds,
|
|
9397
|
+
};
|
|
9398
|
+
}
|
|
9399
|
+
}
|
|
9400
|
+
if (!mapJson || !pathJson || !overlayRef.current)
|
|
9100
9401
|
return;
|
|
9101
9402
|
// 根据后端推送的实时数据,进行不同处理
|
|
9102
|
-
// TODO:需要根据返回的数据,处理车辆的移动位置
|
|
9103
|
-
console.log('realTimeData----->', realTimeData);
|
|
9104
|
-
// realtime中包含当前割草任务的数据,根据数据进行path路径和边界的高亮操作
|
|
9105
|
-
const curMowPartitionData = realTimeData.find((item) => item.type === RealTimeDataType.PARTITION) || mowPartitionData;
|
|
9106
9403
|
if (curMowPartitionData) {
|
|
9107
|
-
setMowPartitionData(curMowPartitionData);
|
|
9108
9404
|
const isMowing = curMowPartitionData?.partitionIds && curMowPartitionData.partitionIds.length > 0;
|
|
9109
9405
|
overlayRef.current.updateMowPartitionData(curMowPartitionData);
|
|
9110
|
-
console.log('isMowing', isMowing, curMowPartitionData);
|
|
9111
9406
|
if (!isMowing) {
|
|
9112
9407
|
overlayRef.current.resetBorderLayerHighlight();
|
|
9113
9408
|
}
|
|
@@ -9145,14 +9440,11 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
9145
9440
|
}
|
|
9146
9441
|
}, [realTimeData, mapJson, pathJson]);
|
|
9147
9442
|
useEffect(() => {
|
|
9148
|
-
console.log('defaultTransform----->', defaultTransform);
|
|
9149
9443
|
if (!overlayRef.current || !defaultTransform)
|
|
9150
9444
|
return;
|
|
9151
|
-
|
|
9152
|
-
return;
|
|
9153
|
-
}
|
|
9445
|
+
console.log('defaultTransform----->', defaultTransform, overlayRef.current, mapJson);
|
|
9154
9446
|
overlayRef.current?.setTransform(defaultTransform);
|
|
9155
|
-
const validBounds = getValidGpsBounds(mapJson);
|
|
9447
|
+
const validBounds = getValidGpsBounds(mapJson, defaultTransform?.rotation);
|
|
9156
9448
|
// 地图数据中的坐标格式是 [longitude, latitude]
|
|
9157
9449
|
const swLat = validBounds.sw[1] + defaultTransform.y;
|
|
9158
9450
|
const swLng = validBounds.sw[0] + defaultTransform.x;
|
|
@@ -9198,12 +9490,32 @@ const MowerMapRenderer = forwardRef(({ mapConfig, modelType, mapRef, mapJson, pa
|
|
|
9198
9490
|
setTransform: (t) => overlayRef.current?.setTransform(t),
|
|
9199
9491
|
resetToDefaultTransform: () => overlayRef.current?.resetToDefaultTransform(),
|
|
9200
9492
|
}));
|
|
9493
|
+
// Debug信息组件
|
|
9494
|
+
const DebugInfo = () => {
|
|
9495
|
+
if (!debug)
|
|
9496
|
+
return null;
|
|
9497
|
+
return (jsxs("div", { style: {
|
|
9498
|
+
position: 'fixed',
|
|
9499
|
+
bottom: '10px',
|
|
9500
|
+
left: '10px',
|
|
9501
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
9502
|
+
color: 'white',
|
|
9503
|
+
padding: '10px',
|
|
9504
|
+
borderRadius: '5px',
|
|
9505
|
+
fontSize: '12px',
|
|
9506
|
+
fontFamily: 'monospace',
|
|
9507
|
+
zIndex: 10000,
|
|
9508
|
+
maxWidth: '300px',
|
|
9509
|
+
lineHeight: '1.4',
|
|
9510
|
+
}, children: [jsx("div", { style: { fontWeight: 'bold', marginBottom: '8px' }, children: "\uD83D\uDC1B Debug Info" }), debugInfo.mapBounds && (jsxs("div", { style: { marginBottom: '6px' }, children: [jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDCCD Map GPS Bounds:" }), jsxs("div", { children: ["SW: [", debugInfo.mapBounds.sw[0].toFixed(6), ", ", debugInfo.mapBounds.sw[1].toFixed(6), "]"] }), jsxs("div", { children: ["NE: [", debugInfo.mapBounds.ne[0].toFixed(6), ", ", debugInfo.mapBounds.ne[1].toFixed(6), "]"] })] })), debugInfo.viewBox && (jsxs("div", { style: { marginBottom: '6px' }, children: [jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDCD0 SVG ViewBox (meters):" }), jsxs("div", { children: ["SW: [", debugInfo.viewBox.sw.x.toFixed(2), ", ", debugInfo.viewBox.sw.y.toFixed(2), "]"] }), jsxs("div", { children: ["NE: [", debugInfo.viewBox.ne.x.toFixed(2), ", ", debugInfo.viewBox.ne.y.toFixed(2), "]"] }), jsxs("div", { children: ["Size: ", debugInfo.viewBox.width.toFixed(2), "m \u00D7 ", debugInfo.viewBox.height.toFixed(2), "m"] }), jsxs("div", { children: ["Scale: 1:", debugInfo.viewBox.scale] })] })), debugInfo.mowerPosition && (jsxs("div", { style: { marginBottom: '6px' }, children: [jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDE9C Mower Position:" }), jsxs("div", { children: ["Current: X=", debugInfo.mowerPosition.x.toFixed(2), ", Y=", debugInfo.mowerPosition.y.toFixed(2)] }), jsxs("div", { children: ["Theta: ", ((debugInfo.mowerPosition.theta * 180) / Math.PI).toFixed(1), "\u00B0"] }), jsxs("div", { children: ["Last: X=", debugInfo.mowerPosition.lastX.toFixed(2), ", Y=", debugInfo.mowerPosition.lastY.toFixed(2)] }), jsxs("div", { children: ["Last Theta: ", ((debugInfo.mowerPosition.lastTheta * 180) / Math.PI).toFixed(1), "\u00B0"] }), jsxs("div", { children: ["Status: ", debugInfo.mowerPosition.vehicleStateText, " (", debugInfo.mowerPosition.vehicleState, ")"] })] })), debugInfo.partitionData && (jsxs("div", { style: { marginBottom: '6px' }, children: [jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDD32 Mow Partition Data:" }), jsxs("div", { children: ["Type: ", debugInfo.partitionData.type || 'N/A'] }), debugInfo.partitionData.partitionIds &&
|
|
9511
|
+
debugInfo.partitionData.partitionIds.length > 0 ? (jsxs("div", { children: ["Active IDs: [", debugInfo.partitionData.partitionIds.join(', '), "]"] })) : (jsx("div", { children: "No active partitions" })), debugInfo.partitionData.time && (jsxs("div", { children: ["Updated: ", new Date(debugInfo.partitionData.time).toLocaleTimeString()] }))] })), !debugInfo.partitionData && (jsxs("div", { style: { marginBottom: '6px' }, children: [jsx("div", { style: { fontWeight: 'bold' }, children: "\uD83D\uDD32 Mow Partition Data:" }), jsx("div", { style: { color: '#888' }, children: "No partition data available" })] }))] }));
|
|
9512
|
+
};
|
|
9201
9513
|
// 错误显示
|
|
9202
9514
|
if (currentError) {
|
|
9203
|
-
return (
|
|
9515
|
+
return (jsxs("div", { className: className, style: style, children: [jsxs("div", { style: { color: 'red', padding: '10px' }, children: ["\u9519\u8BEF: ", currentError] }), jsx(DebugInfo, {})] }));
|
|
9204
9516
|
}
|
|
9205
|
-
// 使用goole maps
|
|
9206
|
-
return null;
|
|
9517
|
+
// 使用goole maps自定义叠加层,返回debug信息(如果启用)
|
|
9518
|
+
return debug ? jsx(DebugInfo, {}) : null;
|
|
9207
9519
|
});
|
|
9208
9520
|
MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
9209
9521
|
|