@fleet-frontend/mower-maps 0.2.0-beta.1 → 0.2.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/edit.d.ts.map +1 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/styles.d.ts.map +1 -0
- package/dist/{src/context → context}/common.d.ts +5 -0
- package/dist/context/common.d.ts.map +1 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/{src/context → context}/mapEdit.d.ts +22 -54
- package/dist/context/mapEdit.d.ts.map +1 -0
- package/dist/{src/context → context}/mapRequest.d.ts.map +1 -1
- package/dist/context/svgEdit.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +1281 -2195
- package/dist/index.js +1499 -2390
- package/dist/processor/MapDataProcessor.d.ts.map +1 -0
- package/dist/processor/PathDataProcessor.d.ts.map +1 -0
- package/dist/processor/builder/AntennaDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/BoundaryDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/ChannelDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/ChargingPileDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/ObstacleDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/PathDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/PointDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/SvgElementDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/VisionOffDataBuilder.d.ts.map +1 -0
- package/dist/processor/builder/index.d.ts.map +1 -0
- package/dist/{src/processor → processor}/index.d.ts +1 -0
- package/dist/processor/index.d.ts.map +1 -0
- package/dist/{src/processor → processor}/unified/BaseData.d.ts +3 -4
- package/dist/processor/unified/BaseData.d.ts.map +1 -0
- package/dist/processor/unified/UnifiedMapDataProcessor.d.ts.map +1 -0
- package/dist/processor/unified/index.d.ts.map +1 -0
- package/dist/processor/unified/initData.d.ts.map +1 -0
- package/dist/render/AntennaManager.d.ts.map +1 -0
- package/dist/render/BoundaryLabelsManager.d.ts.map +1 -0
- package/dist/render/BoundarySvgRender.d.ts +10 -0
- package/dist/render/BoundarySvgRender.d.ts.map +1 -0
- package/dist/render/ChargingPileManager.d.ts.map +1 -0
- package/dist/render/MowerMapOverlay.d.ts.map +1 -0
- package/dist/render/MowerMapRenderer.d.ts.map +1 -0
- package/dist/render/MowerPositionManager.d.ts.map +1 -0
- package/dist/render/Overlay/domHelper.d.ts.map +1 -0
- package/dist/render/Overlay/overlay.d.ts.map +1 -0
- package/dist/render/Overlay/overlayView.d.ts.map +1 -0
- package/dist/render/SvgMapView.d.ts.map +1 -0
- package/dist/render/antennas/index.d.ts.map +1 -0
- package/dist/render/antennas/useAntennaInfo.d.ts.map +1 -0
- package/dist/render/boundaryLabels/index.d.ts.map +1 -0
- package/dist/render/boundaryLabels/useBoundaryLabels.d.ts.map +1 -0
- package/dist/render/charginPile/index.d.ts.map +1 -0
- package/dist/render/charginPile/useChargingPile.d.ts.map +1 -0
- package/dist/render/components/CustomModal/index.d.ts.map +1 -0
- package/dist/render/components/CutHeightSlider/index.d.ts.map +1 -0
- package/dist/render/drag/drag.d.ts.map +1 -0
- package/dist/render/drag/index.d.ts.map +1 -0
- package/dist/render/drag/rotate.d.ts.map +1 -0
- package/dist/render/drag/useDrag.d.ts.map +1 -0
- package/dist/render/layers/AntennaLayer.d.ts.map +1 -0
- package/dist/render/layers/BaseLayer.d.ts.map +1 -0
- package/dist/render/layers/BoundaryBorderLayer.d.ts.map +1 -0
- package/dist/render/layers/BoundaryLayer.d.ts.map +1 -0
- package/dist/render/layers/ChannelLayer.d.ts.map +1 -0
- package/dist/render/layers/ChargingPileLayer.d.ts.map +1 -0
- package/dist/render/layers/DrawLayer.d.ts.map +1 -0
- package/dist/render/layers/ObstacleLayer.d.ts +34 -0
- package/dist/render/layers/ObstacleLayer.d.ts.map +1 -0
- package/dist/render/layers/PathLayer.d.ts.map +1 -0
- package/dist/render/layers/PointLayer.d.ts.map +1 -0
- package/dist/render/layers/SvgElementLayer.d.ts.map +1 -0
- package/dist/render/layers/VisionOffLayer.d.ts.map +1 -0
- package/dist/render/layers/index.d.ts.map +1 -0
- package/dist/render/layers/types.d.ts.map +1 -0
- package/dist/render/mowerPosition/index.d.ts.map +1 -0
- package/dist/render/mowerPosition/usePosition.d.ts.map +1 -0
- package/dist/{src/render → render}/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts +1 -1
- package/dist/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/AddEntry/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/Crosshair/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/boundary.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/DirectLine.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/util.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +1 -0
- package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts +1 -1
- package/dist/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/HeightModal/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/Item/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/MowingEdgeModal/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts +8 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts +10 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/components/OtherInfo/index.d.ts.map +1 -0
- package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts +4 -4
- package/dist/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/doodle.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/HandleElementInfo/visionOff.d.ts.map +1 -0
- package/dist/render/svgEditMap/components/contants.d.ts.map +1 -0
- package/dist/{src/render → render}/svgEditMap/hooks/useCheckElement.d.ts +1 -1
- package/dist/render/svgEditMap/hooks/useCheckElement.d.ts.map +1 -0
- package/dist/render/svgEditMap/hooks/useCreateVisionOffElement.d.ts.map +1 -0
- package/dist/render/svgEditMap/hooks/useHistoryHandle.d.ts.map +1 -0
- package/dist/render/svgEditMap/hooks/usePolygonDrawing.d.ts.map +1 -0
- package/dist/{src/render → render}/svgEditMap/index.d.ts +13 -1
- package/dist/render/svgEditMap/index.d.ts.map +1 -0
- package/dist/render/svgElement/BoundaryElement/index.d.ts.map +1 -0
- package/dist/render/svgElement/ChannelClipPath/index.d.ts.map +1 -0
- package/dist/render/svgElement/ChannelElement/index.d.ts.map +1 -0
- package/dist/render/svgElement/DoodleElement/index.d.ts.map +1 -0
- package/dist/render/svgElement/DoodleTransform/index.d.ts.map +1 -0
- package/dist/render/svgElement/Gelement/index.d.ts.map +1 -0
- package/dist/render/svgElement/Mobile/CreateObstacleElement/coordinateUtils.d.ts.map +1 -0
- package/dist/{src/render → render}/svgElement/Mobile/CreateObstacleElement/index.d.ts +4 -1
- package/dist/render/svgElement/Mobile/CreateObstacleElement/index.d.ts.map +1 -0
- package/dist/render/svgElement/ObstacleElement/index.d.ts.map +1 -0
- package/dist/{src/render → render}/svgElement/PolygonELement/components/DistanceLabels.d.ts +1 -0
- package/dist/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +1 -0
- package/dist/{src/render → render}/svgElement/PolygonELement/components/DragDistanceIndicator.d.ts +1 -0
- package/dist/render/svgElement/PolygonELement/components/DragDistanceIndicator.d.ts.map +1 -0
- package/dist/render/svgElement/PolygonELement/dashPath/index.d.ts.map +1 -0
- package/dist/{src/render → render}/svgElement/PolygonELement/index.d.ts +1 -1
- package/dist/render/svgElement/PolygonELement/index.d.ts.map +1 -0
- package/dist/render/svgElement/PolygonELement/vertex/index.d.ts.map +1 -0
- package/dist/render/svgElement/TextElement/index.d.ts.map +1 -0
- package/dist/{src/render → render}/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts +1 -0
- package/dist/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +1 -0
- package/dist/render/svgElement/TransformWrapper/DoodleTransformWrapper/useDoodleTransform.d.ts.map +1 -0
- package/dist/render/svgElement/TransformWrapper/HandleIcon/index.d.ts.map +1 -0
- package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +1 -0
- package/dist/render/svgElement/TransformWrapper/VisionOffTransformWrapper/useVisionOffTransform.d.ts.map +1 -0
- package/dist/render/svgElement/VisionOffElement/index.d.ts.map +1 -0
- package/dist/render/svgElement/index.d.ts.map +1 -0
- package/dist/render/svgMap/index.d.ts.map +1 -0
- package/dist/render/svgMap/useSvgMapView.d.ts.map +1 -0
- package/dist/store/useCurrentMowingDataStore.d.ts.map +1 -0
- package/dist/store/usePartitionDataStore.d.ts.map +1 -0
- package/dist/types/antenna.d.ts.map +1 -0
- package/dist/types/common.d.ts.map +1 -0
- package/dist/types/constants.d.ts.map +1 -0
- package/dist/types/edit.d.ts.map +1 -0
- package/dist/types/elements.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/layers.d.ts.map +1 -0
- package/dist/types/map.d.ts.map +1 -0
- package/dist/types/path.d.ts.map +1 -0
- package/dist/types/processor.d.ts.map +1 -0
- package/dist/types/realTime.d.ts.map +1 -0
- package/dist/{src/types → types}/renderer.d.ts +16 -2
- package/dist/types/renderer.d.ts.map +1 -0
- package/dist/types/store.d.ts.map +1 -0
- package/dist/types/ui.d.ts.map +1 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/utils/boundaryUtils.d.ts.map +1 -0
- package/dist/utils/common.d.ts.map +1 -0
- package/dist/utils/coordinates.d.ts.map +1 -0
- package/dist/utils/dateTimeUtils.d.ts.map +1 -0
- package/dist/utils/display.d.ts.map +1 -0
- package/dist/utils/formatUtils.d.ts.map +1 -0
- package/dist/utils/geometryUtils.d.ts.map +1 -0
- package/dist/utils/handleRealTime.d.ts.map +1 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/mapBounds.d.ts.map +1 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/mower.d.ts.map +1 -0
- package/dist/utils/pathSegments.d.ts.map +1 -0
- package/dist/utils/pointInBoundary.d.ts.map +1 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/svgParserNative.d.ts.map +1 -0
- package/dist/utils/svgTransform.d.ts.map +1 -0
- package/dist/utils/touchEvents.d.ts.map +1 -0
- package/dist/utils/unionFind.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/dev/components/AddPonit/index.d.ts +0 -35
- package/dist/dev/components/AddPonit/index.d.ts.map +0 -1
- package/dist/src/config/constants.d.ts.map +0 -1
- package/dist/src/config/edit.d.ts.map +0 -1
- package/dist/src/config/index.d.ts.map +0 -1
- package/dist/src/config/styles.d.ts.map +0 -1
- package/dist/src/context/common.d.ts.map +0 -1
- package/dist/src/context/index.d.ts.map +0 -1
- package/dist/src/context/mapEdit.d.ts.map +0 -1
- package/dist/src/context/svgEdit.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -10
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/processor/MapDataProcessor.d.ts.map +0 -1
- package/dist/src/processor/PathDataProcessor.d.ts.map +0 -1
- package/dist/src/processor/builder/AntennaDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/BoundaryDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/ChannelDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/ChargingPileDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/ObstacleDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/PathDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/PointDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/SvgElementDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/VisionOffDataBuilder.d.ts.map +0 -1
- package/dist/src/processor/builder/index.d.ts.map +0 -1
- package/dist/src/processor/index.d.ts.map +0 -1
- package/dist/src/processor/unified/BaseData.d.ts.map +0 -1
- package/dist/src/processor/unified/UnifiedMapDataProcessor.d.ts.map +0 -1
- package/dist/src/processor/unified/index.d.ts.map +0 -1
- package/dist/src/processor/unified/initData.d.ts.map +0 -1
- package/dist/src/render/AntennaManager.d.ts.map +0 -1
- package/dist/src/render/BoundaryLabelsManager.d.ts.map +0 -1
- package/dist/src/render/ChargingPileManager.d.ts.map +0 -1
- package/dist/src/render/MowerMapOverlay.d.ts.map +0 -1
- package/dist/src/render/MowerMapRenderer.d.ts.map +0 -1
- package/dist/src/render/MowerPositionManager.d.ts.map +0 -1
- package/dist/src/render/Overlay/domHelper.d.ts.map +0 -1
- package/dist/src/render/Overlay/overlay.d.ts.map +0 -1
- package/dist/src/render/Overlay/overlayView.d.ts.map +0 -1
- package/dist/src/render/SvgMapView.d.ts.map +0 -1
- package/dist/src/render/antennas/index.d.ts.map +0 -1
- package/dist/src/render/antennas/useAntennaInfo.d.ts.map +0 -1
- package/dist/src/render/boundaryLabels/index.d.ts.map +0 -1
- package/dist/src/render/boundaryLabels/useBoundaryLabels.d.ts.map +0 -1
- package/dist/src/render/charginPile/index.d.ts.map +0 -1
- package/dist/src/render/charginPile/useChargingPile.d.ts.map +0 -1
- package/dist/src/render/components/CustomModal/index.d.ts.map +0 -1
- package/dist/src/render/components/CutHeightSlider/index.d.ts.map +0 -1
- package/dist/src/render/drag/drag.d.ts.map +0 -1
- package/dist/src/render/drag/index.d.ts.map +0 -1
- package/dist/src/render/drag/rotate.d.ts.map +0 -1
- package/dist/src/render/drag/useDrag.d.ts.map +0 -1
- package/dist/src/render/layers/AntennaLayer.d.ts.map +0 -1
- package/dist/src/render/layers/BaseLayer.d.ts.map +0 -1
- package/dist/src/render/layers/BoundaryBorderLayer.d.ts.map +0 -1
- package/dist/src/render/layers/BoundaryLayer.d.ts.map +0 -1
- package/dist/src/render/layers/ChannelLayer.d.ts.map +0 -1
- package/dist/src/render/layers/ChargingPileLayer.d.ts.map +0 -1
- package/dist/src/render/layers/DrawLayer.d.ts.map +0 -1
- package/dist/src/render/layers/ObstacleLayer.d.ts +0 -18
- package/dist/src/render/layers/ObstacleLayer.d.ts.map +0 -1
- package/dist/src/render/layers/PathLayer.d.ts.map +0 -1
- package/dist/src/render/layers/PointLayer.d.ts.map +0 -1
- package/dist/src/render/layers/SvgElementLayer.d.ts.map +0 -1
- package/dist/src/render/layers/VisionOffLayer.d.ts.map +0 -1
- package/dist/src/render/layers/index.d.ts.map +0 -1
- package/dist/src/render/layers/types.d.ts.map +0 -1
- package/dist/src/render/mowerPosition/index.d.ts.map +0 -1
- package/dist/src/render/mowerPosition/usePosition.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/AddEntry/components/DoodleModal/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/AddEntry/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/Crosshair/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/boundary.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/DirectLine.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/util.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Header/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/HeightModal/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/Item/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/MowingEdgeModal/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts +0 -7
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts +0 -9
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/NameEdit/nameModal.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/OtherInfo/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/components/TimePeriod/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/doodle.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/index.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/obstacle.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/HandleElementInfo/visionOff.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/components/contants.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/hooks/useCheckElement.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/hooks/useCreateVisionOffElement.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/hooks/useHistoryHandle.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/hooks/usePolygonDrawing.d.ts.map +0 -1
- package/dist/src/render/svgEditMap/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/BoundaryElement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/ChannelClipPath/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/ChannelElement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/DoodleElement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/DoodleTransform/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/Gelement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/Mobile/CreateObstacleElement/coordinateUtils.d.ts.map +0 -1
- package/dist/src/render/svgElement/Mobile/CreateObstacleElement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/ObstacleElement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/PolygonELement/components/DistanceLabels.d.ts.map +0 -1
- package/dist/src/render/svgElement/PolygonELement/components/DragDistanceIndicator.d.ts.map +0 -1
- package/dist/src/render/svgElement/PolygonELement/dashPath/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/PolygonELement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/PolygonELement/vertex/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/TextElement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/TransformWrapper/DoodleTransformWrapper/DoodleTransformWrapper.d.ts.map +0 -1
- package/dist/src/render/svgElement/TransformWrapper/DoodleTransformWrapper/useDoodleTransform.d.ts.map +0 -1
- package/dist/src/render/svgElement/TransformWrapper/HandleIcon/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts.map +0 -1
- package/dist/src/render/svgElement/TransformWrapper/VisionOffTransformWrapper/useVisionOffTransform.d.ts.map +0 -1
- package/dist/src/render/svgElement/VisionOffElement/index.d.ts.map +0 -1
- package/dist/src/render/svgElement/index.d.ts.map +0 -1
- package/dist/src/render/svgMap/index.d.ts.map +0 -1
- package/dist/src/render/svgMap/useSvgMapView.d.ts.map +0 -1
- package/dist/src/store/useCurrentMowingDataStore.d.ts.map +0 -1
- package/dist/src/store/usePartitionDataStore.d.ts.map +0 -1
- package/dist/src/types/antenna.d.ts.map +0 -1
- package/dist/src/types/common.d.ts.map +0 -1
- package/dist/src/types/constants.d.ts.map +0 -1
- package/dist/src/types/edit.d.ts.map +0 -1
- package/dist/src/types/elements.d.ts.map +0 -1
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/layers.d.ts.map +0 -1
- package/dist/src/types/map.d.ts.map +0 -1
- package/dist/src/types/path.d.ts.map +0 -1
- package/dist/src/types/processor.d.ts.map +0 -1
- package/dist/src/types/realTime.d.ts.map +0 -1
- package/dist/src/types/renderer.d.ts.map +0 -1
- package/dist/src/types/store.d.ts.map +0 -1
- package/dist/src/types/ui.d.ts.map +0 -1
- package/dist/src/types/utils.d.ts.map +0 -1
- package/dist/src/utils/boundaryUtils.d.ts.map +0 -1
- package/dist/src/utils/common.d.ts.map +0 -1
- package/dist/src/utils/coordinates.d.ts.map +0 -1
- package/dist/src/utils/dateTimeUtils.d.ts.map +0 -1
- package/dist/src/utils/display.d.ts.map +0 -1
- package/dist/src/utils/formatUtils.d.ts.map +0 -1
- package/dist/src/utils/geometryUtils.d.ts.map +0 -1
- package/dist/src/utils/handleRealTime.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/mapBounds.d.ts.map +0 -1
- package/dist/src/utils/math.d.ts.map +0 -1
- package/dist/src/utils/mower.d.ts.map +0 -1
- package/dist/src/utils/pathSegments.d.ts.map +0 -1
- package/dist/src/utils/pointInBoundary.d.ts.map +0 -1
- package/dist/src/utils/sleep.d.ts.map +0 -1
- package/dist/src/utils/svgParserNative.d.ts.map +0 -1
- package/dist/src/utils/svgTransform.d.ts.map +0 -1
- package/dist/src/utils/touchEvents.d.ts.map +0 -1
- package/dist/src/utils/unionFind.d.ts.map +0 -1
- /package/dist/{src/config → config}/constants.d.ts +0 -0
- /package/dist/{src/config → config}/edit.d.ts +0 -0
- /package/dist/{src/config → config}/index.d.ts +0 -0
- /package/dist/{src/config → config}/styles.d.ts +0 -0
- /package/dist/{src/context → context}/index.d.ts +0 -0
- /package/dist/{src/context → context}/mapRequest.d.ts +0 -0
- /package/dist/{src/context → context}/svgEdit.d.ts +0 -0
- /package/dist/{src/processor → processor}/MapDataProcessor.d.ts +0 -0
- /package/dist/{src/processor → processor}/PathDataProcessor.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/AntennaDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/BoundaryDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/ChannelDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/ChargingPileDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/ObstacleDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/PathDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/PointDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/SvgElementDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/VisionOffDataBuilder.d.ts +0 -0
- /package/dist/{src/processor → processor}/builder/index.d.ts +0 -0
- /package/dist/{src/processor → processor}/unified/UnifiedMapDataProcessor.d.ts +0 -0
- /package/dist/{src/processor → processor}/unified/index.d.ts +0 -0
- /package/dist/{src/processor → processor}/unified/initData.d.ts +0 -0
- /package/dist/{src/render → render}/AntennaManager.d.ts +0 -0
- /package/dist/{src/render → render}/BoundaryLabelsManager.d.ts +0 -0
- /package/dist/{src/render → render}/ChargingPileManager.d.ts +0 -0
- /package/dist/{src/render → render}/MowerMapOverlay.d.ts +0 -0
- /package/dist/{src/render → render}/MowerMapRenderer.d.ts +0 -0
- /package/dist/{src/render → render}/MowerPositionManager.d.ts +0 -0
- /package/dist/{src/render → render}/Overlay/domHelper.d.ts +0 -0
- /package/dist/{src/render → render}/Overlay/overlay.d.ts +0 -0
- /package/dist/{src/render → render}/Overlay/overlayView.d.ts +0 -0
- /package/dist/{src/render → render}/SvgMapView.d.ts +0 -0
- /package/dist/{src/render → render}/antennas/index.d.ts +0 -0
- /package/dist/{src/render → render}/antennas/useAntennaInfo.d.ts +0 -0
- /package/dist/{src/render → render}/boundaryLabels/index.d.ts +0 -0
- /package/dist/{src/render → render}/boundaryLabels/useBoundaryLabels.d.ts +0 -0
- /package/dist/{src/render → render}/charginPile/index.d.ts +0 -0
- /package/dist/{src/render → render}/charginPile/useChargingPile.d.ts +0 -0
- /package/dist/{src/render → render}/components/CustomModal/index.d.ts +0 -0
- /package/dist/{src/render → render}/components/CutHeightSlider/index.d.ts +0 -0
- /package/dist/{src/render → render}/drag/drag.d.ts +0 -0
- /package/dist/{src/render → render}/drag/index.d.ts +0 -0
- /package/dist/{src/render → render}/drag/rotate.d.ts +0 -0
- /package/dist/{src/render → render}/drag/useDrag.d.ts +0 -0
- /package/dist/{src/render → render}/layers/AntennaLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/BaseLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/BoundaryBorderLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/BoundaryLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/ChannelLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/ChargingPileLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/DrawLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/PathLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/PointLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/SvgElementLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/VisionOffLayer.d.ts +0 -0
- /package/dist/{src/render → render}/layers/index.d.ts +0 -0
- /package/dist/{src/render → render}/layers/types.d.ts +0 -0
- /package/dist/{src/render → render}/mowerPosition/index.d.ts +0 -0
- /package/dist/{src/render → render}/mowerPosition/usePosition.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/AddEntry/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/Crosshair/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/boundary.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/DirectLine.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/DirectionModal/component/MowDirection/util.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/DirectionModal/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/HeightModal/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/Item/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/MowingEdgeModal/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/components/OtherInfo/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/doodle.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/obstacle.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/HandleElementInfo/visionOff.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/components/contants.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/hooks/useCreateVisionOffElement.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/hooks/useHistoryHandle.d.ts +0 -0
- /package/dist/{src/render → render}/svgEditMap/hooks/usePolygonDrawing.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/BoundaryElement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/ChannelClipPath/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/ChannelElement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/DoodleElement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/DoodleTransform/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/Gelement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/Mobile/CreateObstacleElement/coordinateUtils.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/ObstacleElement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/PolygonELement/dashPath/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/PolygonELement/vertex/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/TextElement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/TransformWrapper/DoodleTransformWrapper/useDoodleTransform.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/TransformWrapper/HandleIcon/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/TransformWrapper/VisionOffTransformWrapper/VisionOffTransformWrapper.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/TransformWrapper/VisionOffTransformWrapper/useVisionOffTransform.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/VisionOffElement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgElement/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgMap/index.d.ts +0 -0
- /package/dist/{src/render → render}/svgMap/useSvgMapView.d.ts +0 -0
- /package/dist/{src/store → store}/useCurrentMowingDataStore.d.ts +0 -0
- /package/dist/{src/store → store}/usePartitionDataStore.d.ts +0 -0
- /package/dist/{src/types → types}/antenna.d.ts +0 -0
- /package/dist/{src/types → types}/common.d.ts +0 -0
- /package/dist/{src/types → types}/constants.d.ts +0 -0
- /package/dist/{src/types → types}/edit.d.ts +0 -0
- /package/dist/{src/types → types}/elements.d.ts +0 -0
- /package/dist/{src/types → types}/index.d.ts +0 -0
- /package/dist/{src/types → types}/layers.d.ts +0 -0
- /package/dist/{src/types → types}/map.d.ts +0 -0
- /package/dist/{src/types → types}/path.d.ts +0 -0
- /package/dist/{src/types → types}/processor.d.ts +0 -0
- /package/dist/{src/types → types}/realTime.d.ts +0 -0
- /package/dist/{src/types → types}/store.d.ts +0 -0
- /package/dist/{src/types → types}/ui.d.ts +0 -0
- /package/dist/{src/types → types}/utils.d.ts +0 -0
- /package/dist/{src/utils → utils}/boundaryUtils.d.ts +0 -0
- /package/dist/{src/utils → utils}/common.d.ts +0 -0
- /package/dist/{src/utils → utils}/coordinates.d.ts +0 -0
- /package/dist/{src/utils → utils}/dateTimeUtils.d.ts +0 -0
- /package/dist/{src/utils → utils}/display.d.ts +0 -0
- /package/dist/{src/utils → utils}/formatUtils.d.ts +0 -0
- /package/dist/{src/utils → utils}/geometryUtils.d.ts +0 -0
- /package/dist/{src/utils → utils}/handleRealTime.d.ts +0 -0
- /package/dist/{src/utils → utils}/index.d.ts +0 -0
- /package/dist/{src/utils → utils}/mapBounds.d.ts +0 -0
- /package/dist/{src/utils → utils}/math.d.ts +0 -0
- /package/dist/{src/utils → utils}/mower.d.ts +0 -0
- /package/dist/{src/utils → utils}/pathSegments.d.ts +0 -0
- /package/dist/{src/utils → utils}/pointInBoundary.d.ts +0 -0
- /package/dist/{src/utils → utils}/sleep.d.ts +0 -0
- /package/dist/{src/utils → utils}/svgParserNative.d.ts +0 -0
- /package/dist/{src/utils → utils}/svgTransform.d.ts +0 -0
- /package/dist/{src/utils → utils}/touchEvents.d.ts +0 -0
- /package/dist/{src/utils → utils}/unionFind.d.ts +0 -0
package/dist/index.esm.js
CHANGED
|
@@ -2,7 +2,6 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { memo, useMemo, useEffect, useState, useRef, useCallback, createContext, useContext, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
|
|
4
4
|
import ReactDOM from 'react-dom';
|
|
5
|
-
import { Modal, message, Popover, Input, Switch, Slider, Radio, Button, DatePicker, Select } from 'antd';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* 常量和枚举类型定义
|
|
@@ -190,14 +189,13 @@ class ChannelData extends BaseData {
|
|
|
190
189
|
* 障碍物数据类
|
|
191
190
|
*/
|
|
192
191
|
class ObstacleData extends BaseData {
|
|
193
|
-
constructor(originalData, level,
|
|
192
|
+
constructor(originalData, level, style) {
|
|
194
193
|
const convertedPoints = convertPointsFormat(originalData?.points) || [];
|
|
195
194
|
super(originalData?.id, DataType.OBSTACLE, level, RenderType.POLYGON, convertedPoints, originalData);
|
|
196
195
|
this.area = originalData?.area;
|
|
197
|
-
this.status = originalData?.status
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
200
|
-
this.isTimeLimit = isTimeLimit;
|
|
196
|
+
this.status = originalData?.status ?? 1;
|
|
197
|
+
this.start_timestamp = originalData?.start_timestamp;
|
|
198
|
+
this.end_timestamp = originalData?.end_timestamp;
|
|
201
199
|
this.name = originalData?.name || 'Obstacle';
|
|
202
200
|
this.style = style;
|
|
203
201
|
}
|
|
@@ -293,7 +291,7 @@ function initObstacle() {
|
|
|
293
291
|
const obstacle = {
|
|
294
292
|
id: null,
|
|
295
293
|
area: 0,
|
|
296
|
-
name: '
|
|
294
|
+
name: 'off-imit island',
|
|
297
295
|
status: 1,
|
|
298
296
|
end_timestamp: 0,
|
|
299
297
|
start_timestamp: 0,
|
|
@@ -329,8 +327,8 @@ function initDoodle() {
|
|
|
329
327
|
svg: '',
|
|
330
328
|
scale: 1,
|
|
331
329
|
direction: 0,
|
|
332
|
-
create_ts: Date.now(),
|
|
333
|
-
expiration_ts: Date.now() +
|
|
330
|
+
create_ts: Math.floor(Date.now() / 1000),
|
|
331
|
+
expiration_ts: Math.floor(Date.now() / 1000) + 3600 * 24 * 7, // 1小时后过期
|
|
334
332
|
type: 'TIME_LIMIT_OBSTACLE',
|
|
335
333
|
};
|
|
336
334
|
return new DoodleData(doodle, 100);
|
|
@@ -616,7 +614,7 @@ class UnifiedMapDataProcessor {
|
|
|
616
614
|
continue;
|
|
617
615
|
}
|
|
618
616
|
const obstacleData = new ObstacleData(element, 150, // 高层级
|
|
619
|
-
|
|
617
|
+
this.mapConfig.obstacle || {});
|
|
620
618
|
obstacleDataList.push(obstacleData);
|
|
621
619
|
}
|
|
622
620
|
catch (error) {
|
|
@@ -746,7 +744,7 @@ class UnifiedMapDataProcessor {
|
|
|
746
744
|
continue;
|
|
747
745
|
}
|
|
748
746
|
const obstacleData = new ObstacleData(element, 150, // 高层级
|
|
749
|
-
|
|
747
|
+
this.mapConfig.obstacle || {});
|
|
750
748
|
obstacleDataList.push(obstacleData);
|
|
751
749
|
}
|
|
752
750
|
}
|
|
@@ -1316,60 +1314,6 @@ function calculatePerpendicularFoot(point, lineStart, lineEnd) {
|
|
|
1316
1314
|
function isFootOnSegment(foot) {
|
|
1317
1315
|
return foot.param >= 0 && foot.param <= 1;
|
|
1318
1316
|
}
|
|
1319
|
-
/**
|
|
1320
|
-
* 计算多边形的面积和周长
|
|
1321
|
-
* @param coordinates 多边形顶点坐标数组 [[x1, y1], [x2, y2], ...]
|
|
1322
|
-
* @returns 包含面积和周长的对象
|
|
1323
|
-
*/
|
|
1324
|
-
function calculatePolygonAreaAndPerimeter(coordinates) {
|
|
1325
|
-
if (!coordinates || coordinates.length < 3) {
|
|
1326
|
-
return { area: 0, perimeter: 0 };
|
|
1327
|
-
}
|
|
1328
|
-
let area = 0;
|
|
1329
|
-
let perimeter = 0;
|
|
1330
|
-
const n = coordinates.length;
|
|
1331
|
-
// 使用鞋带公式(Shoelace formula)计算面积
|
|
1332
|
-
for (let i = 0; i < n; i++) {
|
|
1333
|
-
const j = (i + 1) % n;
|
|
1334
|
-
const [x1, y1] = coordinates[i];
|
|
1335
|
-
const [x2, y2] = coordinates[j];
|
|
1336
|
-
// 面积计算(鞋带公式)
|
|
1337
|
-
area += x1 * y2 - x2 * y1;
|
|
1338
|
-
// 周长计算(累加每条边的长度)
|
|
1339
|
-
const dx = x2 - x1;
|
|
1340
|
-
const dy = y2 - y1;
|
|
1341
|
-
perimeter += Math.sqrt(dx * dx + dy * dy);
|
|
1342
|
-
}
|
|
1343
|
-
// 面积取绝对值并除以2
|
|
1344
|
-
area = Math.abs(area) / 2;
|
|
1345
|
-
return {
|
|
1346
|
-
area,
|
|
1347
|
-
perimeter
|
|
1348
|
-
};
|
|
1349
|
-
}
|
|
1350
|
-
/**
|
|
1351
|
-
* 计算矩形的长和宽
|
|
1352
|
-
* @param points 矩形的4个顶点坐标 [[x1, y1], [x2, y2], [x3, y3], [x4, y4]]
|
|
1353
|
-
* @returns 包含宽和高的数组 [width, height]
|
|
1354
|
-
*/
|
|
1355
|
-
function calculateRectangleDimensions(points) {
|
|
1356
|
-
if (!points || points.length !== 4) {
|
|
1357
|
-
return [0, 0];
|
|
1358
|
-
}
|
|
1359
|
-
// 计算每条边的长度
|
|
1360
|
-
const sides = [
|
|
1361
|
-
Math.sqrt(Math.pow(points[1][0] - points[0][0], 2) + Math.pow(points[1][1] - points[0][1], 2)), // 0->1
|
|
1362
|
-
Math.sqrt(Math.pow(points[2][0] - points[1][0], 2) + Math.pow(points[2][1] - points[1][1], 2)), // 1->2
|
|
1363
|
-
Math.sqrt(Math.pow(points[3][0] - points[2][0], 2) + Math.pow(points[3][1] - points[2][1], 2)), // 2->3
|
|
1364
|
-
Math.sqrt(Math.pow(points[0][0] - points[3][0], 2) + Math.pow(points[0][1] - points[3][1], 2)) // 3->0
|
|
1365
|
-
];
|
|
1366
|
-
// 矩形的对边应该相等,所以我们取相邻的两条边作为宽和高
|
|
1367
|
-
// sides[0] 和 sides[2] 是对边,sides[1] 和 sides[3] 是对边
|
|
1368
|
-
const width = sides[0]; // 第一条边
|
|
1369
|
-
const height = sides[1]; // 相邻的第二条边
|
|
1370
|
-
// 返回宽和高的数组 [width, height] - 小的作为宽,大的作为高
|
|
1371
|
-
return width <= height ? [width, height] : [height, width];
|
|
1372
|
-
}
|
|
1373
1317
|
|
|
1374
1318
|
/**
|
|
1375
1319
|
* 按Python逻辑创建路径段:根据连续的两点之间的关系确定线段类型
|
|
@@ -2117,52 +2061,6 @@ function convertHeightsetToParams(value) {
|
|
|
2117
2061
|
cuttingHeight: value,
|
|
2118
2062
|
};
|
|
2119
2063
|
}
|
|
2120
|
-
function getDefaultAngle(recBaseAngle) {
|
|
2121
|
-
if (recBaseAngle > -15 && recBaseAngle <= 15) {
|
|
2122
|
-
return recBaseAngle;
|
|
2123
|
-
}
|
|
2124
|
-
else if (recBaseAngle > 15 && recBaseAngle <= 45) {
|
|
2125
|
-
return recBaseAngle - 30;
|
|
2126
|
-
}
|
|
2127
|
-
else if (recBaseAngle > 45 && recBaseAngle <= 75) {
|
|
2128
|
-
return recBaseAngle - 60;
|
|
2129
|
-
}
|
|
2130
|
-
else if (recBaseAngle > 75 && recBaseAngle <= 90) {
|
|
2131
|
-
return recBaseAngle - 90;
|
|
2132
|
-
}
|
|
2133
|
-
else if (recBaseAngle > -90 && recBaseAngle <= -75) {
|
|
2134
|
-
return recBaseAngle + 90;
|
|
2135
|
-
}
|
|
2136
|
-
else if (recBaseAngle > -75 && recBaseAngle <= -45) {
|
|
2137
|
-
return recBaseAngle + 60;
|
|
2138
|
-
}
|
|
2139
|
-
else if (recBaseAngle > -45 && recBaseAngle <= -15) {
|
|
2140
|
-
return recBaseAngle + 30;
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
function getSelectAngles(value) {
|
|
2144
|
-
const A = 1 << 0; // bit0 = 1
|
|
2145
|
-
const B = 1 << 1; // bit1 = 2
|
|
2146
|
-
const C = 1 << 2; // bit2 = 4
|
|
2147
|
-
const D = 1 << 3; // bit3 = 8
|
|
2148
|
-
const E = 1 << 4; // bit4 = 16
|
|
2149
|
-
const F = 1 << 5; // bit5 = 32
|
|
2150
|
-
const directions = [];
|
|
2151
|
-
// 检查每个位标志是否被设置
|
|
2152
|
-
if (value & A)
|
|
2153
|
-
directions.push(0, 180);
|
|
2154
|
-
if (value & B)
|
|
2155
|
-
directions.push(30, -150);
|
|
2156
|
-
if (value & C)
|
|
2157
|
-
directions.push(60, -120);
|
|
2158
|
-
if (value & D)
|
|
2159
|
-
directions.push(90, -90);
|
|
2160
|
-
if (value & E)
|
|
2161
|
-
directions.push(120, -60);
|
|
2162
|
-
if (value & F)
|
|
2163
|
-
directions.push(150, -30);
|
|
2164
|
-
return directions;
|
|
2165
|
-
}
|
|
2166
2064
|
|
|
2167
2065
|
/** Detect free variable `global` from Node.js. */
|
|
2168
2066
|
var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -3051,7 +2949,7 @@ function copyObject(source, props, object, customizer) {
|
|
|
3051
2949
|
}
|
|
3052
2950
|
|
|
3053
2951
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
3054
|
-
var nativeMax$
|
|
2952
|
+
var nativeMax$2 = Math.max;
|
|
3055
2953
|
|
|
3056
2954
|
/**
|
|
3057
2955
|
* A specialized version of `baseRest` which transforms the rest array.
|
|
@@ -3063,11 +2961,11 @@ var nativeMax$1 = Math.max;
|
|
|
3063
2961
|
* @returns {Function} Returns the new function.
|
|
3064
2962
|
*/
|
|
3065
2963
|
function overRest(func, start, transform) {
|
|
3066
|
-
start = nativeMax$
|
|
2964
|
+
start = nativeMax$2(start === undefined ? (func.length - 1) : start, 0);
|
|
3067
2965
|
return function() {
|
|
3068
2966
|
var args = arguments,
|
|
3069
2967
|
index = -1,
|
|
3070
|
-
length = nativeMax$
|
|
2968
|
+
length = nativeMax$2(args.length - start, 0),
|
|
3071
2969
|
array = Array(length);
|
|
3072
2970
|
|
|
3073
2971
|
while (++index < length) {
|
|
@@ -4069,7 +3967,7 @@ function isPlainObject(value) {
|
|
|
4069
3967
|
|
|
4070
3968
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
4071
3969
|
var nativeIsFinite = root$3.isFinite,
|
|
4072
|
-
nativeMin$
|
|
3970
|
+
nativeMin$2 = Math.min;
|
|
4073
3971
|
|
|
4074
3972
|
/**
|
|
4075
3973
|
* Creates a function like `_.round`.
|
|
@@ -4082,7 +3980,7 @@ function createRound(methodName) {
|
|
|
4082
3980
|
var func = Math[methodName];
|
|
4083
3981
|
return function(number, precision) {
|
|
4084
3982
|
number = toNumber$2(number);
|
|
4085
|
-
precision = precision == null ? 0 : nativeMin$
|
|
3983
|
+
precision = precision == null ? 0 : nativeMin$2(toInteger(precision), 292);
|
|
4086
3984
|
if (precision && nativeIsFinite(number)) {
|
|
4087
3985
|
// Shift with exponential notation to avoid floating-point issues.
|
|
4088
3986
|
// See [MDN](https://mdn.io/round#Examples) for more details.
|
|
@@ -4305,6 +4203,212 @@ function createBaseFor(fromRight) {
|
|
|
4305
4203
|
*/
|
|
4306
4204
|
var baseFor = createBaseFor();
|
|
4307
4205
|
|
|
4206
|
+
/**
|
|
4207
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
4208
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
4209
|
+
*
|
|
4210
|
+
* @static
|
|
4211
|
+
* @memberOf _
|
|
4212
|
+
* @since 2.4.0
|
|
4213
|
+
* @category Date
|
|
4214
|
+
* @returns {number} Returns the timestamp.
|
|
4215
|
+
* @example
|
|
4216
|
+
*
|
|
4217
|
+
* _.defer(function(stamp) {
|
|
4218
|
+
* console.log(_.now() - stamp);
|
|
4219
|
+
* }, _.now());
|
|
4220
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
4221
|
+
*/
|
|
4222
|
+
var now$2 = function() {
|
|
4223
|
+
return root$3.Date.now();
|
|
4224
|
+
};
|
|
4225
|
+
|
|
4226
|
+
/** Error message constants. */
|
|
4227
|
+
var FUNC_ERROR_TEXT$3 = 'Expected a function';
|
|
4228
|
+
|
|
4229
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
4230
|
+
var nativeMax$1 = Math.max,
|
|
4231
|
+
nativeMin$1 = Math.min;
|
|
4232
|
+
|
|
4233
|
+
/**
|
|
4234
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
4235
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
4236
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
4237
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
4238
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
4239
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
4240
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
4241
|
+
* calls to the debounced function return the result of the last `func`
|
|
4242
|
+
* invocation.
|
|
4243
|
+
*
|
|
4244
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4245
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
4246
|
+
* is invoked more than once during the `wait` timeout.
|
|
4247
|
+
*
|
|
4248
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4249
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4250
|
+
*
|
|
4251
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4252
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
4253
|
+
*
|
|
4254
|
+
* @static
|
|
4255
|
+
* @memberOf _
|
|
4256
|
+
* @since 0.1.0
|
|
4257
|
+
* @category Function
|
|
4258
|
+
* @param {Function} func The function to debounce.
|
|
4259
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
4260
|
+
* @param {Object} [options={}] The options object.
|
|
4261
|
+
* @param {boolean} [options.leading=false]
|
|
4262
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4263
|
+
* @param {number} [options.maxWait]
|
|
4264
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
4265
|
+
* @param {boolean} [options.trailing=true]
|
|
4266
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4267
|
+
* @returns {Function} Returns the new debounced function.
|
|
4268
|
+
* @example
|
|
4269
|
+
*
|
|
4270
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
4271
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
4272
|
+
*
|
|
4273
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
4274
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
4275
|
+
* 'leading': true,
|
|
4276
|
+
* 'trailing': false
|
|
4277
|
+
* }));
|
|
4278
|
+
*
|
|
4279
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
4280
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
4281
|
+
* var source = new EventSource('/stream');
|
|
4282
|
+
* jQuery(source).on('message', debounced);
|
|
4283
|
+
*
|
|
4284
|
+
* // Cancel the trailing debounced invocation.
|
|
4285
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
4286
|
+
*/
|
|
4287
|
+
function debounce$2(func, wait, options) {
|
|
4288
|
+
var lastArgs,
|
|
4289
|
+
lastThis,
|
|
4290
|
+
maxWait,
|
|
4291
|
+
result,
|
|
4292
|
+
timerId,
|
|
4293
|
+
lastCallTime,
|
|
4294
|
+
lastInvokeTime = 0,
|
|
4295
|
+
leading = false,
|
|
4296
|
+
maxing = false,
|
|
4297
|
+
trailing = true;
|
|
4298
|
+
|
|
4299
|
+
if (typeof func != 'function') {
|
|
4300
|
+
throw new TypeError(FUNC_ERROR_TEXT$3);
|
|
4301
|
+
}
|
|
4302
|
+
wait = toNumber$2(wait) || 0;
|
|
4303
|
+
if (isObject$4(options)) {
|
|
4304
|
+
leading = !!options.leading;
|
|
4305
|
+
maxing = 'maxWait' in options;
|
|
4306
|
+
maxWait = maxing ? nativeMax$1(toNumber$2(options.maxWait) || 0, wait) : maxWait;
|
|
4307
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4308
|
+
}
|
|
4309
|
+
|
|
4310
|
+
function invokeFunc(time) {
|
|
4311
|
+
var args = lastArgs,
|
|
4312
|
+
thisArg = lastThis;
|
|
4313
|
+
|
|
4314
|
+
lastArgs = lastThis = undefined;
|
|
4315
|
+
lastInvokeTime = time;
|
|
4316
|
+
result = func.apply(thisArg, args);
|
|
4317
|
+
return result;
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4320
|
+
function leadingEdge(time) {
|
|
4321
|
+
// Reset any `maxWait` timer.
|
|
4322
|
+
lastInvokeTime = time;
|
|
4323
|
+
// Start the timer for the trailing edge.
|
|
4324
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4325
|
+
// Invoke the leading edge.
|
|
4326
|
+
return leading ? invokeFunc(time) : result;
|
|
4327
|
+
}
|
|
4328
|
+
|
|
4329
|
+
function remainingWait(time) {
|
|
4330
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4331
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
4332
|
+
timeWaiting = wait - timeSinceLastCall;
|
|
4333
|
+
|
|
4334
|
+
return maxing
|
|
4335
|
+
? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke)
|
|
4336
|
+
: timeWaiting;
|
|
4337
|
+
}
|
|
4338
|
+
|
|
4339
|
+
function shouldInvoke(time) {
|
|
4340
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
4341
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
4342
|
+
|
|
4343
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
4344
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
4345
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
4346
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
4347
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
4348
|
+
}
|
|
4349
|
+
|
|
4350
|
+
function timerExpired() {
|
|
4351
|
+
var time = now$2();
|
|
4352
|
+
if (shouldInvoke(time)) {
|
|
4353
|
+
return trailingEdge(time);
|
|
4354
|
+
}
|
|
4355
|
+
// Restart the timer.
|
|
4356
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4359
|
+
function trailingEdge(time) {
|
|
4360
|
+
timerId = undefined;
|
|
4361
|
+
|
|
4362
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
4363
|
+
// debounced at least once.
|
|
4364
|
+
if (trailing && lastArgs) {
|
|
4365
|
+
return invokeFunc(time);
|
|
4366
|
+
}
|
|
4367
|
+
lastArgs = lastThis = undefined;
|
|
4368
|
+
return result;
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4371
|
+
function cancel() {
|
|
4372
|
+
if (timerId !== undefined) {
|
|
4373
|
+
clearTimeout(timerId);
|
|
4374
|
+
}
|
|
4375
|
+
lastInvokeTime = 0;
|
|
4376
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
4377
|
+
}
|
|
4378
|
+
|
|
4379
|
+
function flush() {
|
|
4380
|
+
return timerId === undefined ? result : trailingEdge(now$2());
|
|
4381
|
+
}
|
|
4382
|
+
|
|
4383
|
+
function debounced() {
|
|
4384
|
+
var time = now$2(),
|
|
4385
|
+
isInvoking = shouldInvoke(time);
|
|
4386
|
+
|
|
4387
|
+
lastArgs = arguments;
|
|
4388
|
+
lastThis = this;
|
|
4389
|
+
lastCallTime = time;
|
|
4390
|
+
|
|
4391
|
+
if (isInvoking) {
|
|
4392
|
+
if (timerId === undefined) {
|
|
4393
|
+
return leadingEdge(lastCallTime);
|
|
4394
|
+
}
|
|
4395
|
+
if (maxing) {
|
|
4396
|
+
// Handle invocations in a tight loop.
|
|
4397
|
+
clearTimeout(timerId);
|
|
4398
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4399
|
+
return invokeFunc(lastCallTime);
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
if (timerId === undefined) {
|
|
4403
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4404
|
+
}
|
|
4405
|
+
return result;
|
|
4406
|
+
}
|
|
4407
|
+
debounced.cancel = cancel;
|
|
4408
|
+
debounced.flush = flush;
|
|
4409
|
+
return debounced;
|
|
4410
|
+
}
|
|
4411
|
+
|
|
4308
4412
|
/**
|
|
4309
4413
|
* This function is like `assignValue` except that it doesn't assign
|
|
4310
4414
|
* `undefined` values.
|
|
@@ -4589,48 +4693,113 @@ var merge$1 = createAssigner(function(object, source, srcIndex) {
|
|
|
4589
4693
|
*/
|
|
4590
4694
|
var round = createRound('round');
|
|
4591
4695
|
|
|
4592
|
-
/**
|
|
4593
|
-
|
|
4594
|
-
*/
|
|
4595
|
-
/**
|
|
4596
|
-
* 路径段类型枚举
|
|
4597
|
-
*/
|
|
4598
|
-
var PathSegmentType;
|
|
4599
|
-
(function (PathSegmentType) {
|
|
4600
|
-
PathSegmentType["EDGE"] = "edge";
|
|
4601
|
-
PathSegmentType["MOWING"] = "mowing";
|
|
4602
|
-
PathSegmentType["TRANS"] = "trans";
|
|
4603
|
-
})(PathSegmentType || (PathSegmentType = {}));
|
|
4604
|
-
/**
|
|
4605
|
-
* 单位类型枚举
|
|
4606
|
-
*/
|
|
4607
|
-
var UnitsType;
|
|
4608
|
-
(function (UnitsType) {
|
|
4609
|
-
UnitsType["Metric"] = "Metric";
|
|
4610
|
-
UnitsType["Imperial"] = "Imperial";
|
|
4611
|
-
})(UnitsType || (UnitsType = {}));
|
|
4612
|
-
/**
|
|
4613
|
-
* 面积单位类型枚举
|
|
4614
|
-
*/
|
|
4615
|
-
var UnitsAreaType;
|
|
4616
|
-
(function (UnitsAreaType) {
|
|
4617
|
-
UnitsAreaType["SQUARE_METER"] = "m\u00B2";
|
|
4618
|
-
UnitsAreaType["SQUARE_FOOT"] = "ft\u00B2";
|
|
4619
|
-
UnitsAreaType["ACRE"] = "ac";
|
|
4620
|
-
})(UnitsAreaType || (UnitsAreaType = {}));
|
|
4621
|
-
/**
|
|
4622
|
-
* 长度单位类型枚举
|
|
4623
|
-
*/
|
|
4624
|
-
var UnitsLengthType;
|
|
4625
|
-
(function (UnitsLengthType) {
|
|
4626
|
-
UnitsLengthType["METER"] = "m";
|
|
4627
|
-
UnitsLengthType["FOOT"] = "ft";
|
|
4628
|
-
})(UnitsLengthType || (UnitsLengthType = {}));
|
|
4696
|
+
/** Error message constants. */
|
|
4697
|
+
var FUNC_ERROR_TEXT$2 = 'Expected a function';
|
|
4629
4698
|
|
|
4630
4699
|
/**
|
|
4631
|
-
*
|
|
4632
|
-
|
|
4633
|
-
|
|
4700
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
4701
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
4702
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
4703
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
4704
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
4705
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
4706
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
4707
|
+
* result of the last `func` invocation.
|
|
4708
|
+
*
|
|
4709
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4710
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
4711
|
+
* is invoked more than once during the `wait` timeout.
|
|
4712
|
+
*
|
|
4713
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4714
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4715
|
+
*
|
|
4716
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4717
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
4718
|
+
*
|
|
4719
|
+
* @static
|
|
4720
|
+
* @memberOf _
|
|
4721
|
+
* @since 0.1.0
|
|
4722
|
+
* @category Function
|
|
4723
|
+
* @param {Function} func The function to throttle.
|
|
4724
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
4725
|
+
* @param {Object} [options={}] The options object.
|
|
4726
|
+
* @param {boolean} [options.leading=true]
|
|
4727
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4728
|
+
* @param {boolean} [options.trailing=true]
|
|
4729
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4730
|
+
* @returns {Function} Returns the new throttled function.
|
|
4731
|
+
* @example
|
|
4732
|
+
*
|
|
4733
|
+
* // Avoid excessively updating the position while scrolling.
|
|
4734
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
4735
|
+
*
|
|
4736
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
4737
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
4738
|
+
* jQuery(element).on('click', throttled);
|
|
4739
|
+
*
|
|
4740
|
+
* // Cancel the trailing throttled invocation.
|
|
4741
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
4742
|
+
*/
|
|
4743
|
+
function throttle$2(func, wait, options) {
|
|
4744
|
+
var leading = true,
|
|
4745
|
+
trailing = true;
|
|
4746
|
+
|
|
4747
|
+
if (typeof func != 'function') {
|
|
4748
|
+
throw new TypeError(FUNC_ERROR_TEXT$2);
|
|
4749
|
+
}
|
|
4750
|
+
if (isObject$4(options)) {
|
|
4751
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
4752
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
4753
|
+
}
|
|
4754
|
+
return debounce$2(func, wait, {
|
|
4755
|
+
'leading': leading,
|
|
4756
|
+
'maxWait': wait,
|
|
4757
|
+
'trailing': trailing
|
|
4758
|
+
});
|
|
4759
|
+
}
|
|
4760
|
+
|
|
4761
|
+
/**
|
|
4762
|
+
* 工具模块类型定义
|
|
4763
|
+
*/
|
|
4764
|
+
/**
|
|
4765
|
+
* 路径段类型枚举
|
|
4766
|
+
*/
|
|
4767
|
+
var PathSegmentType;
|
|
4768
|
+
(function (PathSegmentType) {
|
|
4769
|
+
PathSegmentType["EDGE"] = "edge";
|
|
4770
|
+
PathSegmentType["MOWING"] = "mowing";
|
|
4771
|
+
PathSegmentType["TRANS"] = "trans";
|
|
4772
|
+
})(PathSegmentType || (PathSegmentType = {}));
|
|
4773
|
+
/**
|
|
4774
|
+
* 单位类型枚举
|
|
4775
|
+
*/
|
|
4776
|
+
var UnitsType;
|
|
4777
|
+
(function (UnitsType) {
|
|
4778
|
+
UnitsType["Metric"] = "Metric";
|
|
4779
|
+
UnitsType["Imperial"] = "Imperial";
|
|
4780
|
+
})(UnitsType || (UnitsType = {}));
|
|
4781
|
+
/**
|
|
4782
|
+
* 面积单位类型枚举
|
|
4783
|
+
*/
|
|
4784
|
+
var UnitsAreaType;
|
|
4785
|
+
(function (UnitsAreaType) {
|
|
4786
|
+
UnitsAreaType["SQUARE_METER"] = "m\u00B2";
|
|
4787
|
+
UnitsAreaType["SQUARE_FOOT"] = "ft\u00B2";
|
|
4788
|
+
UnitsAreaType["ACRE"] = "ac";
|
|
4789
|
+
})(UnitsAreaType || (UnitsAreaType = {}));
|
|
4790
|
+
/**
|
|
4791
|
+
* 长度单位类型枚举
|
|
4792
|
+
*/
|
|
4793
|
+
var UnitsLengthType;
|
|
4794
|
+
(function (UnitsLengthType) {
|
|
4795
|
+
UnitsLengthType["METER"] = "m";
|
|
4796
|
+
UnitsLengthType["FOOT"] = "ft";
|
|
4797
|
+
})(UnitsLengthType || (UnitsLengthType = {}));
|
|
4798
|
+
|
|
4799
|
+
/**
|
|
4800
|
+
* 默认航向相对于canvas的偏移角度: 航向默认是东
|
|
4801
|
+
*/
|
|
4802
|
+
const DIRECTION_DEGREE = 90; //正东相当于canvas的正北顺时针旋转90度
|
|
4634
4803
|
/**
|
|
4635
4804
|
* Convert meters to feet
|
|
4636
4805
|
* 1 meter = 3.28083989501312 feet
|
|
@@ -4804,18 +4973,6 @@ function convertAreaByUnits(area, type = UnitsType.Metric) {
|
|
|
4804
4973
|
unit: UnitsAreaType.ACRE,
|
|
4805
4974
|
};
|
|
4806
4975
|
}
|
|
4807
|
-
// 割草高度的转化
|
|
4808
|
-
function convertCutHeightFormatted(value) {
|
|
4809
|
-
return (Math.ceil(value * 0.03937 * 10) * 0.1).toFixed(1);
|
|
4810
|
-
}
|
|
4811
|
-
function getHeightUnit(unit) {
|
|
4812
|
-
return unit === UnitsType.Metric ? 'mm' : 'inch';
|
|
4813
|
-
}
|
|
4814
|
-
function generateHeightStr(value, unit, hasUnit = false) {
|
|
4815
|
-
const unitStr = getHeightUnit(unit);
|
|
4816
|
-
const height = unit === UnitsType.Metric ? value : convertCutHeightFormatted(value || 0);
|
|
4817
|
-
return hasUnit ? `${height} ${unitStr}` : value;
|
|
4818
|
-
}
|
|
4819
4976
|
|
|
4820
4977
|
/**
|
|
4821
4978
|
* 日期时间格式化工具函数
|
|
@@ -8422,12 +8579,12 @@ function styleInject(css, ref) {
|
|
|
8422
8579
|
}
|
|
8423
8580
|
}
|
|
8424
8581
|
|
|
8425
|
-
var css_248z$
|
|
8426
|
-
var styles$
|
|
8427
|
-
styleInject(css_248z$
|
|
8582
|
+
var css_248z$6 = ".index-module_edit__-5VvX {\n position: absolute;\n top: 0px;\n left: 0px;\n width: 100%;\n height: 100%;\n pointer-events: auto;\n z-index: 1000;\n cursor: move;\n touch-action: none;\n user-select: none;\n -webkit-tap-highlight-color: transparent;\n}\n.index-module_edit__-5VvX .index-module_border__JdNLM {\n position: absolute;\n inset: -10px;\n border: 2px dashed rgb(241, 102, 41);\n border-radius: 2px;\n pointer-events: none;\n}\n.index-module_edit__-5VvX .index-module_drag__uvdPG {\n position: absolute;\n inset: -10px;\n border-radius: 2px;\n}\n.index-module_edit__-5VvX .index-module_rotate__H-KIZ {\n position: absolute;\n top: -20px;\n right: -20px;\n width: 20px;\n height: 20px;\n cursor: grab;\n z-index: 1001;\n pointer-events: auto;\n}\n.index-module_edit__-5VvX .index-module_move__mZF8s {\n position: absolute;\n bottom: -20px;\n left: -20px;\n width: 20px;\n height: 20px;\n cursor: move;\n z-index: 1001;\n pointer-events: auto;\n}";
|
|
8583
|
+
var styles$6 = {"edit":"index-module_edit__-5VvX","border":"index-module_border__JdNLM","drag":"index-module_drag__uvdPG","rotate":"index-module_rotate__H-KIZ","move":"index-module_move__mZF8s"};
|
|
8584
|
+
styleInject(css_248z$6);
|
|
8428
8585
|
|
|
8429
8586
|
const RotateHandle = ({ onRotateStart, isRotating }) => {
|
|
8430
|
-
return (jsx("div", { className: styles$
|
|
8587
|
+
return (jsx("div", { className: styles$6.rotate, onMouseDown: (e) => onRotateStart(e), onTouchStart: (e) => onRotateStart(e), style: { cursor: isRotating ? 'grabbing' : 'grab' }, dangerouslySetInnerHTML: { __html: DEFAULT_ROTATE_ICON } }));
|
|
8431
8588
|
};
|
|
8432
8589
|
|
|
8433
8590
|
/**
|
|
@@ -8499,13 +8656,15 @@ const DragHandle = ({ onDragStart, isDragging }) => {
|
|
|
8499
8656
|
if (!isMobileDevice()) {
|
|
8500
8657
|
return null;
|
|
8501
8658
|
}
|
|
8502
|
-
return (jsx("div", { className: styles$
|
|
8659
|
+
return (jsx("div", { className: styles$6.move, onMouseDown: (e) => {
|
|
8503
8660
|
console.log('down');
|
|
8504
8661
|
onDragStart(e);
|
|
8505
8662
|
}, onTouchStart: (e) => onDragStart(e), onMouseUp: (e) => {
|
|
8506
8663
|
console.log('drag up');
|
|
8507
|
-
onDragEnd(e);
|
|
8508
|
-
},
|
|
8664
|
+
// onDragEnd(e);
|
|
8665
|
+
},
|
|
8666
|
+
// onTouchEnd={(e) => onDragEnd(e)}
|
|
8667
|
+
style: { cursor: isDragging ? 'grabbing' : 'move' }, dangerouslySetInnerHTML: { __html: DEFAULT_DRAG_ICON } }));
|
|
8509
8668
|
};
|
|
8510
8669
|
|
|
8511
8670
|
const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransformChange, isDragMap = false, }) => {
|
|
@@ -8531,7 +8690,7 @@ const MapDrag = ({ map: _map, dragCallbacks, onBoundaryLabelsCollapse, onTransfo
|
|
|
8531
8690
|
if (!isDragMap) {
|
|
8532
8691
|
return null;
|
|
8533
8692
|
}
|
|
8534
|
-
return (jsxs("div", { ref: containerRef, className: styles$
|
|
8693
|
+
return (jsxs("div", { ref: containerRef, className: styles$6.edit, style: { cursor: isDragging ? 'grabbing' : 'move' }, children: [jsx("div", { className: styles$6.border }), jsx(RotateHandle, { onRotateStart: handleRotateStart, isRotating: isRotating }), jsx("div", { className: styles$6.drag, onMouseDown: handleDragStartEvent, onTouchStart: handleDragStartEvent }), jsx(DragHandle, { onDragStart: handleDragStartEvent, isDragging: isDragging })] }));
|
|
8535
8694
|
};
|
|
8536
8695
|
|
|
8537
8696
|
/**
|
|
@@ -12242,11 +12401,74 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12242
12401
|
}
|
|
12243
12402
|
}
|
|
12244
12403
|
}
|
|
12404
|
+
/**
|
|
12405
|
+
* 将坐标点按type分组
|
|
12406
|
+
*/
|
|
12407
|
+
groupCoordinatesByType(coordinates) {
|
|
12408
|
+
const segments = [];
|
|
12409
|
+
let currentSegment = null;
|
|
12410
|
+
for (let i = 0; i < coordinates.length; i++) {
|
|
12411
|
+
const coord = coordinates[i];
|
|
12412
|
+
const type = coord[2] || 2; // 默认type为2
|
|
12413
|
+
if (!currentSegment || currentSegment.type !== type) {
|
|
12414
|
+
// 开始新的段
|
|
12415
|
+
if (currentSegment && currentSegment.points.length > 0) {
|
|
12416
|
+
// 为了连接线段,将当前点也加入上一段的结尾
|
|
12417
|
+
currentSegment.points.push(coord);
|
|
12418
|
+
}
|
|
12419
|
+
currentSegment = {
|
|
12420
|
+
type: type,
|
|
12421
|
+
points: [coord],
|
|
12422
|
+
};
|
|
12423
|
+
segments.push(currentSegment);
|
|
12424
|
+
}
|
|
12425
|
+
else {
|
|
12426
|
+
// 继续当前段
|
|
12427
|
+
currentSegment.points.push(coord);
|
|
12428
|
+
}
|
|
12429
|
+
}
|
|
12430
|
+
// 处理封闭边界:如果第一段和最后一段type相同,需要连接起来
|
|
12431
|
+
if (segments.length > 1 && segments[0].type === segments[segments.length - 1].type) {
|
|
12432
|
+
const firstSegment = segments[0];
|
|
12433
|
+
const lastSegment = segments[segments.length - 1];
|
|
12434
|
+
// 将第一个点添加到最后一段,形成封闭
|
|
12435
|
+
lastSegment.points.push(firstSegment.points[0]);
|
|
12436
|
+
}
|
|
12437
|
+
else if (segments.length === 1) {
|
|
12438
|
+
// 只有一段的情况,添加第一个点到末尾形成封闭
|
|
12439
|
+
segments[0].points.push(coordinates[0]);
|
|
12440
|
+
}
|
|
12441
|
+
return segments;
|
|
12442
|
+
}
|
|
12245
12443
|
/**
|
|
12246
12444
|
* 渲染障碍物元素
|
|
12247
12445
|
*/
|
|
12248
12446
|
renderObstacle(svgGroup, element) {
|
|
12249
|
-
const { coordinates, style } = element;
|
|
12447
|
+
const { coordinates, style, originalData } = element;
|
|
12448
|
+
const { status, start_timestamp, end_timestamp } = originalData || {};
|
|
12449
|
+
if (coordinates.length < 2 || status === 0) {
|
|
12450
|
+
return;
|
|
12451
|
+
}
|
|
12452
|
+
if (status === 1 &&
|
|
12453
|
+
(start_timestamp > Date.now() / 1000 || end_timestamp < Date.now() / 1000)) {
|
|
12454
|
+
return;
|
|
12455
|
+
}
|
|
12456
|
+
// 1. 先遍历所有的coordinates,把所有点分为若干段的path
|
|
12457
|
+
const pathSegments = this.groupCoordinatesByType(coordinates);
|
|
12458
|
+
// 2&3. 根据type处理每个path段
|
|
12459
|
+
pathSegments.forEach((segment) => {
|
|
12460
|
+
if (segment.points.length < 2)
|
|
12461
|
+
return;
|
|
12462
|
+
if (segment.type === 2) {
|
|
12463
|
+
// type=2: 直接添加到svgGroup中
|
|
12464
|
+
this.createDirectPath(svgGroup, segment.points, style);
|
|
12465
|
+
}
|
|
12466
|
+
else if (segment.type === 1) {
|
|
12467
|
+
// type=1: 使用PathMeasure逻辑生成平行路径
|
|
12468
|
+
// this.createDirectPath(svgGroup, segment.points, style);
|
|
12469
|
+
this.createParallelPathsWithMeasure(svgGroup, segment.points, style);
|
|
12470
|
+
}
|
|
12471
|
+
});
|
|
12250
12472
|
if (coordinates.length < 3)
|
|
12251
12473
|
return;
|
|
12252
12474
|
const polygon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
|
|
@@ -12254,7 +12476,7 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12254
12476
|
const points = coordinates.map((coord) => `${coord[0]},${coord[1]}`).join(' ');
|
|
12255
12477
|
polygon.setAttribute('points', points);
|
|
12256
12478
|
polygon.setAttribute('fill', style.fillColor || 'rgba(220, 53, 69, 0.2)');
|
|
12257
|
-
polygon.setAttribute('stroke',
|
|
12479
|
+
polygon.setAttribute('stroke', 'transparent');
|
|
12258
12480
|
// 确保最小线条宽度
|
|
12259
12481
|
const lineWidth = Math.max(style.lineWidth || 2, 0.5);
|
|
12260
12482
|
polygon.setAttribute('stroke-width', lineWidth.toString());
|
|
@@ -12265,84 +12487,191 @@ class ObstacleLayer extends BaseLayer {
|
|
|
12265
12487
|
polygon.classList.add('vector-obstacle');
|
|
12266
12488
|
svgGroup.appendChild(polygon);
|
|
12267
12489
|
}
|
|
12268
|
-
}
|
|
12269
|
-
|
|
12270
|
-
var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRBKfaGmQFuFazBpK0wYnmLSF6MYx557zt5Zv3vvO/Z4bDPZ9pl97rlnztnfXmt969s/g/AjKrN7nxwf634wBTFMYIQNAWASAcYjxAmI+T5EnAeIdFQnYwxHqwr6Z5s1g9ld20/Cj6AgrGBhkKva0/d1MUxBiFMxEjw7gGv5RyUWL+cfiCD/0I4KoULs04ensKkP7d716/OwQmVFAD/4yMGpLsJM7MJUiIGMGiDQwUBDYHR8DgocFG/54gQ0HRVUFQPnuoK6qvp0ec/u3767Dx+wfCDAXyKg2MWZELopBth1BJQAB6ujgY5RANNpRIbLuPnFETAaxgSUawYpVhawtdQV1XWN81hXu37ni3cfgssslwX4wQf/bqLD4f6uY6AdAaWDagYqdRi18qhrn/vmc61bRbIwZqAKmms9rw/Usbdn9+5Ld/VLBvzlhw/e17XtLIEcbzsG2SpgOQQkYe0wu7SDZqgRvS7Bcisq/oFVRAZqVlaQXDeRgKIDFtBNPd9Aved3d99zAC6hXDTg2dknx6sr3psJbbezZZBtB14TWApfAqmgyYPpnF07ZMIKeqLviymMoxIWY0VEJ6/zWNgsG5uGgTdANXBNwOf+4P4duy4Wx0UBnp3dP45jcJgsO6kgWxi2BLIdYtcGBisWDqHFji3qMbzIlY2jLZgRyxaUbl1hJiwBzLWBdqBNo0fNR90MxhC279597/xyWJYFPPvgfsqj8XA7HE60BLQVsAqazzt3aY5ZqmPU2A1s0sgunPwZFbVzNQNW+hLTsvnRrCwujbFCAYoa0xVbNjbs2g0DHxNrO/Cm15sfQ9y8HGhcDiyZ6nDbLkwMhwRwOCSQw2RdsjbVHK8pfg0wowoC1lwak9ZIgN3E4tYjgCuJa2XsujISkxiuKJYbVEsz0B6BbrDX6yXQMKw+MTt775KipboQYELx5HBIYBcI5MJZoHNYWFjgc1wYcr2AQ+4A6YgF7ozIHaKuLl6gtcQ2dw51mhCdxXvo5LN5Cco9nXmOPifa85Hfze/xmtuxQO1IbZLvhhPQdIc5BJeC1Cz1xcwD+/bSyybTixYYVEsNWGAQ0RpI1zqxprKzKSohqeAGdctiIbBScmIHds5G9W9TYJyjydb0UHZnsjF7EIbgIdM4P0S+Xui4STL6DNXnJbL6fBdnv7xvR9cNv1KAjXSOZEXqUbZiixrPnaQgIayOXZgaFDtmZAMeFKgpDW+gsLVf52aGWES3pC6rY3FNnhdNxPjvmpgxipAOAw6JjZu3bHvv+X/7p5eXBTw7+9jEMIb97cJwvATL4NldGay6YGv5lkFTj0PAUCorbYyTVdz2y1twxz13wurVP47/+39vgRmabzGTRjusaxQ1jjC9EV/RMU4DCM5HzvZQbfyF2+98vP/cUyPxfI5LdxXOdAvDCY6dVkCqVYcal2JdlZGtuRe/OIAZw+0ovukWvPqqD8Hnf/Muef6NN/wUPPvckXj69GmMOSnxbwl1BX0IKla9qJVbuELP7zG6G0elQLRKY2OcImI/fbm5xDdCWrNf+rNpYt0d4q5sXSGM1iyrhMTMLMQkedcPAYxmWXfXRMybNn1ypFOvvuon0QVJthikfK2AUh63DpXczuHDnqXkJhzCxmjVOKnNnZAdfTf1e7OPTS0JeNiFvfILchAwe0CrbIvGsIuAhiK2zI3Vrd3ywO5cvmfdug+P3KugneQCmETB4hlCiFHynYSOpcJWGL/z9opXtuKVFn78nJnzAuaeoAeYuOCUsICtCwxNG8rMppOFld0KkEgEIZaje4Atn/6UuHRZrr32IwrOTCzPgXL46NaH3DGgXiSSNXbgbN0an3CIubEIdHTNQO0fsXKKYUouM22hoIZay4MkDYlWbgWoKSjUhmkDmSZiOZVhp7d9+mZYXNas/jFwFgYoSStlLIYoaiQYq2HqCJRRZcDEaNjx162KVVZnLQVvVRNttbUML0mpsJX7ycLMzARmitOMqicXCcrImnocrLpZSC4cbHCgn9X/NBjXXfvhuP7Gnz4H8Pobr1d4RkVQpDGbKECzrt5jgw/1gqCf1cMk/1tcS7i1KbbZ8sI5EMjKs7N7xxPg0103LaMelosSqwa04w7o0hhXjiLuIMZRaaqfJSvwHdO/cvt5pSu7uJOWGCop7cy6zsDae8bcMefrTGoE2sbhLQOXdrun6kiOQZ8Jzc4EmLppm/aMsp8N90DjNYGNBVuKWAj22WPOcy/3PTFx3LrlFliq0PdZiKhaKghMPcRd3t25AGpvs7awBlAyxS64VC0HODSo6eKtAphNTU4xpfEpluVewpx2gtT2Ik8nGjwIiWyiiwZLh5s2/swFByYfXXeN83mRj8HJCkeEB7has2vmXcbe0QlU5W1wY4GB97AUt27OtM1k152FPKYNMqYtwapxhSmdSFHjVpgFS3kcLSQ/u+32C+GFK6/6EFqMgjGfaSy7wbsg5nOPJO5Wl58a4vSDqIRaTpam04p1d6eE2zWeXeBsu2qqaUM7ZdMzrotdMo6QFLtNzptmTn1bzGMBbdrWLT8PV1995QUBX7fuI1lX6xPjmtWrcf3662HDjR+D6667BtZSrB99/X/g4Ne/ASfe/f8MPWUv9zGeFw3UC5URGePh8bMYzIkNh1U70RCYDT5oX6SeojOiuXKMmaTS7ONo/+spA16uXLfuGtiw/nr8KAFbd+01MLnh47g4X8uzqOP4+hfvfyC5vbO3Tv9ius4Y+HIel5dhKfG+oSFc4zY941/YICD4wABVSekUK/eDzVCATUkVwGOk2MQN6z92UYD/6KHfh4spa9asLj0LER2052a9rgaqPJZtyKpTTzacnGQLT4SYeiDRvQn0ZFlnUI3ZLDBCSN0tv/fZ6Ttgpcvxt+bB5aa+x94dnT2iyhAZsHCDKsxTTXkMTallnGFPxGDa10CzZUdjdvHYsyiY8iOsXXslbL3tVljp8s1/7ctr9VV5sgiUt93j8lAyhNJgKX3RtYkmpAt+s2nj4II+jsRxmpbwREQOIRPJ9OHnNv7sspOCl1qIrGBw9NtmymCT2jafaxkhJQn5vsKsvXVgk8EHaGJyYx/16Beue4IpHVND6DkYHLekiCAvvHP7L8JKl2eePexxmtjK+l2vmjiV9ohNCtAqSQt8EZpCylosRNfG7sLoAhcgpUXU20OahNp62xSsXSYVXU55+pv9CGV2sGSQQMpVc/PocjfmpJ0GOZoCK7L2vHWfCXiLW5s+idnCPDSz4YoNBQGS+P/M1ilY6TJ47Q1y6e9lfe2aLo4eRtTWNhlvxlKR239krKSl48k0IDPvyI8oZV7B0FkDg8f45PqPXxSI4995m6x2+KLufYbvK0ZOkEgopk7w0IMsOTO7FZ5v7Z5n0jpKnybtHWlSzEBjemiMpuPAHypJwllz8NoxAn0DnGulY3D8+DwMXn8DBoNjcOr99+OaNWvwM1s3w3JlcPQNcGM4Sxdas5jc1wTF07oelrlDcuaiT+811OZX6co9NtWXHmEuWypb792YJSWkz1955NH4ue2/hCwSvn/qFLz40n8R0Lf5XNOGORefn6Lvl+qgDPYYfPfdd8HfY2Nne98o8qKNYP0TE8842fLkAMQBLVDg/NBWtoo5Tx8QIGS+WuTio/V3T7yLf/LYvvz2bH0s+S55BFnvQoCffvawd3pSdUZU6bnFuzR7eN/4hL7nT0jrs31atWmftyV4zbG+YAvZJ/QdwcW+U6I1Ini8x/JXbCqovO6xKDe8evT1JcGeOvU+/PMzz6EtyAFkokJIU0PZw6KaNPtomvy13tC1WEpJ3aCam5tl0urr8mzF7kLcDUZQOnehaV4tHmMxCB/paRufRmPGklSiNzGIO/Lvvzp4XYCdr/z7f7wCnn5MNxcBlIgS7XngnRyLZ6BxjGKS5j/PWGXGg6a5+rqnIvVGzIYGZ+Qynq32ZgR3BLVktLiB0v1SWLhnwptvvQ3nK//yzHN6r69kFOTp70nMbCyuvm9ayGbjbUeQCEG6IPtCBPCZpvqqrMX67pmRbQgpwA2gu1eaWk0uLtztgEy8pOZleWq8EOKRF89Z+oETJ74n1ndl57nFnx8t4/pzvZeVEG1CLdW69MrLrdhUTyXAB8jUWFd9XnVXF6j4nzQ/OYgAQ4zp1eiZQlKVu7KJsmhGNqUGDgAiZKH6rfPEcYrtEXFRMIdxgs6MauP0BxYk5sbjhfSa8Tz/p3Oz8wmw3bVHtgjZijuKf0sHGO9V3tHeHm1MnvUpk1pa+UvElXVMavyblLYWx/E/fOMfE8g0wRFN75kCzPnX/lusS3urtPWJwDa8ZYJW1XGP/0oC/JePPsAW7uu+qHSwpcFmXSO4yaNPrrk/lcQU083pnugjsFCwj/544cWXElh25zePfydTU4w5k1pXh0XZR7ulcj/WbRJl+6tqnrGdA5hLjU1h5TrqBjE5hMz04SOp0eIWPD61U2Is8Gvjoik9sx66m75w5D+Twfb99d9Ccb88IRSurV6cck4SJCAb3NSN0cHqNidebBxZGC+VipQdn7//8NnhmVsXzvK2hrO8rYEXqbDtujTn5eb0qDTNY+MXG74tHtGAseeIL+qXt9y8iecd8YUjr4CZ3wb1xX1JW6HtBRHLyhanuq6waXrQ8O6e3hisGhuDsVVXwKreqgMH/uKhe0t85255qOHeJjSvdnX3EzXP/tWBhlQBqqibzNjqstqfmuZaFbDowWRevr/w45EO1t9GAvpS0RMj6ay4NT0/ywpLnznD1LGRTS8EvK7ny9jN8BaVwX8fOfnJm245QwjuCGlOi6d/krIDGJm9dMloXOwNM+Fibo7ZTooJk6ozjYEWHpD81nleJ6tcSIBauNK9mChxWqetS7KjZ6y3ijes7fqbP3+4vyxgAf2tF1+ZvOnmcXrRxpj3Wpm6yc4rig5HARYdAflcW+uunr92PwFLeTEWFkQYDYfoik9sahvX2I1r3cIEPXLnXsPHqrmD+x556HzYlty2VLftHnrYQGKj6SE9lPdIcV5jYrCUlZky5hSc3DHn0Jg1UiyZPX3GzMhYXs/SSsxNIA2skhOlHQZc98iVJYZj04wNDv7Vw0tuRVwS8IEDcyd7sdtMrjLfU9ACXLb76b5HIQzfAetSzjvA03NKXSEx92gHFHXM6c6x2pBHdb6wcd5DLVsQ+ZD29XiTWu8d+rkdLlDqC305GLx85obJjU8RuGl62bhJRxihk5H4zB6LpsoKNsYiRLH0eZGFkAY34KoYc25VyL5/WkipQXVjjtkxZud3yHybv3bgD+fhcgFzOTZ4+eQNnyDQWE/R69dGI5xCCY2knRKOc1JeqQBMX2aBlsavWbTr7AWakEAhJrEoMzBK+mnGUGK2NxYJ7NGFCjY9cWDuxHJ4EC6h/Nrd9+2l9dadbdpumDeX+ipjKDajmaKE0iVC1kkptUqnuFtoLbvvJNOyC4tUtG3ETWOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
|
|
12271
|
-
|
|
12272
|
-
/**
|
|
12273
|
-
* 充电桩图层
|
|
12274
|
-
* 专门处理充电桩元素的渲染
|
|
12275
|
-
*/
|
|
12276
|
-
class ChargingPileLayer extends BaseLayer {
|
|
12277
|
-
constructor() {
|
|
12278
|
-
super();
|
|
12279
|
-
this.level = 8; // 中等层级
|
|
12280
|
-
this.type = LAYER_DEFAULT_TYPE.CHARGING_PILE;
|
|
12281
|
-
}
|
|
12282
12490
|
/**
|
|
12283
|
-
*
|
|
12491
|
+
* 创建直接路径(type=2)
|
|
12284
12492
|
*/
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
|
|
12288
|
-
|
|
12289
|
-
|
|
12290
|
-
for (
|
|
12291
|
-
|
|
12292
|
-
|
|
12493
|
+
createDirectPath(svgGroup, points, style) {
|
|
12494
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
12495
|
+
const strokeColor = style.lineColor;
|
|
12496
|
+
// 构建路径数据
|
|
12497
|
+
let pathData = '';
|
|
12498
|
+
for (let i = 0; i < points.length; i++) {
|
|
12499
|
+
const [x, y] = points[i];
|
|
12500
|
+
if (i === 0) {
|
|
12501
|
+
pathData += `M ${x} ${y}`;
|
|
12502
|
+
}
|
|
12503
|
+
else {
|
|
12504
|
+
pathData += ` L ${x} ${y}`;
|
|
12293
12505
|
}
|
|
12294
12506
|
}
|
|
12507
|
+
path.setAttribute('d', pathData);
|
|
12508
|
+
path.setAttribute('stroke', strokeColor);
|
|
12509
|
+
path.setAttribute('fill', 'none');
|
|
12510
|
+
// 确保最小线条宽度
|
|
12511
|
+
const lineWidth = dp2px(style.lineWidth || 3);
|
|
12512
|
+
path.setAttribute('stroke-width', lineWidth.toString());
|
|
12513
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
12514
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
12515
|
+
path.setAttribute('opacity', (style.opacity || 1).toString());
|
|
12516
|
+
path.setAttribute('vector-effect', 'non-scaling-stroke');
|
|
12517
|
+
path.classList.add('vector-obstacle');
|
|
12518
|
+
svgGroup.appendChild(path);
|
|
12295
12519
|
}
|
|
12296
12520
|
/**
|
|
12297
|
-
*
|
|
12298
|
-
*/
|
|
12299
|
-
renderChargingPile(svgGroup, element) {
|
|
12300
|
-
const { coordinates, style } = element;
|
|
12301
|
-
if (coordinates.length === 0)
|
|
12302
|
-
return;
|
|
12303
|
-
const center = coordinates[0];
|
|
12304
|
-
const size = style.radius ? style.radius * 2 : 55; // 默认55px大小
|
|
12305
|
-
const direction = element.originalData?.direction || 0;
|
|
12306
|
-
// 将弧度转换为角度
|
|
12307
|
-
const angle = (direction * 180) / Math.PI;
|
|
12308
|
-
const rotationDegree = 270 - angle; // 坐标系转换
|
|
12309
|
-
const image = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
12310
|
-
// 图片居中定位
|
|
12311
|
-
const x = center[0];
|
|
12312
|
-
const y = center[1];
|
|
12313
|
-
image.setAttribute('x', x.toString());
|
|
12314
|
-
image.setAttribute('y', y.toString());
|
|
12315
|
-
image.setAttribute('width', `${size}px`);
|
|
12316
|
-
image.setAttribute('height', `${size}px`);
|
|
12317
|
-
image.setAttribute('href', chargingPileImage);
|
|
12318
|
-
image.setAttribute('opacity', '0'); // 初始透明
|
|
12319
|
-
// 添加SVG原生动画,传入默认角度
|
|
12320
|
-
this.addChargingPileAnimation(image, center, rotationDegree);
|
|
12321
|
-
image.classList.add('vector-charging-pile');
|
|
12322
|
-
svgGroup.appendChild(image);
|
|
12323
|
-
}
|
|
12324
|
-
/**
|
|
12325
|
-
* 添加充电桩SVG原生动画
|
|
12521
|
+
* 使用PathMeasure逻辑创建平行路径(type=1)
|
|
12326
12522
|
*/
|
|
12327
|
-
|
|
12328
|
-
|
|
12329
|
-
const
|
|
12330
|
-
|
|
12331
|
-
|
|
12332
|
-
|
|
12333
|
-
|
|
12334
|
-
|
|
12335
|
-
//
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
|
|
12340
|
-
|
|
12341
|
-
|
|
12342
|
-
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
|
|
12523
|
+
createParallelPathsWithMeasure(svgGroup, points, style) {
|
|
12524
|
+
const strokeColor = style.lineColor;
|
|
12525
|
+
const lineWidth = dp2px(style.lineWidth || 3);
|
|
12526
|
+
// 获取当前SVG的缩放级别,计算固定屏幕像素间距
|
|
12527
|
+
const fixedScreenDistance = lineWidth; // 固定的屏幕像素距离
|
|
12528
|
+
const offsetDistance = fixedScreenDistance; // 转换为SVG坐标系距离
|
|
12529
|
+
// 直接对每个线段生成平行直线段
|
|
12530
|
+
const parallelPaths = this.generateStraightParallelPaths(points, offsetDistance);
|
|
12531
|
+
// 渲染两条平行虚线
|
|
12532
|
+
parallelPaths.forEach((pathData, index) => {
|
|
12533
|
+
if (!pathData)
|
|
12534
|
+
return;
|
|
12535
|
+
const path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
|
|
12536
|
+
path.setAttribute('d', pathData);
|
|
12537
|
+
path.setAttribute('fill', 'none');
|
|
12538
|
+
path.setAttribute('stroke', strokeColor);
|
|
12539
|
+
path.setAttribute('stroke-width', lineWidth.toString());
|
|
12540
|
+
path.setAttribute('stroke-linecap', 'round');
|
|
12541
|
+
path.setAttribute('stroke-linejoin', 'round');
|
|
12542
|
+
path.setAttribute('opacity', (style.opacity || 1).toString());
|
|
12543
|
+
// 使用CSS样式设置虚线,避免随SVG缩放变化
|
|
12544
|
+
// 或者可以根据当前缩放级别动态计算dash array
|
|
12545
|
+
path.style.strokeDasharray = `${lineWidth}px ${lineWidth * 2}px`;
|
|
12546
|
+
path.classList.add(`vector-boundary-parallel-${index + 1}`);
|
|
12547
|
+
svgGroup.appendChild(path);
|
|
12548
|
+
});
|
|
12549
|
+
}
|
|
12550
|
+
/**
|
|
12551
|
+
* 生成直线平行路径(每个线段分别处理)
|
|
12552
|
+
*/
|
|
12553
|
+
generateStraightParallelPaths(points, offsetDistance) {
|
|
12554
|
+
if (points.length < 2)
|
|
12555
|
+
return ['', ''];
|
|
12556
|
+
let parallelPath1Data = '';
|
|
12557
|
+
let parallelPath2Data = '';
|
|
12558
|
+
// 对每个线段分别计算平行线
|
|
12559
|
+
for (let i = 0; i < points.length - 1; i++) {
|
|
12560
|
+
const startPoint = points[i];
|
|
12561
|
+
const endPoint = points[i + 1];
|
|
12562
|
+
// 计算线段的方向向量
|
|
12563
|
+
const dx = endPoint[0] - startPoint[0];
|
|
12564
|
+
const dy = endPoint[1] - startPoint[1];
|
|
12565
|
+
const length = Math.sqrt(dx * dx + dy * dy);
|
|
12566
|
+
if (length === 0)
|
|
12567
|
+
continue; // 跳过零长度线段
|
|
12568
|
+
// 标准化方向向量
|
|
12569
|
+
const unitX = dx / length;
|
|
12570
|
+
const unitY = dy / length;
|
|
12571
|
+
// 计算垂直向量
|
|
12572
|
+
const perpendicularX = -unitY;
|
|
12573
|
+
const perpendicularY = unitX;
|
|
12574
|
+
// 计算平行线的起点和终点
|
|
12575
|
+
const start1X = startPoint[0] + perpendicularX * offsetDistance;
|
|
12576
|
+
const start1Y = startPoint[1] + perpendicularY * offsetDistance;
|
|
12577
|
+
const end1X = endPoint[0] + perpendicularX * offsetDistance;
|
|
12578
|
+
const end1Y = endPoint[1] + perpendicularY * offsetDistance;
|
|
12579
|
+
const start2X = startPoint[0] - perpendicularX * offsetDistance;
|
|
12580
|
+
const start2Y = startPoint[1] - perpendicularY * offsetDistance;
|
|
12581
|
+
const end2X = endPoint[0] - perpendicularX * offsetDistance;
|
|
12582
|
+
const end2Y = endPoint[1] - perpendicularY * offsetDistance;
|
|
12583
|
+
// 构建路径数据
|
|
12584
|
+
if (i === 0) {
|
|
12585
|
+
parallelPath1Data = `M ${start1X} ${start1Y}`;
|
|
12586
|
+
parallelPath2Data = `M ${start2X} ${start2Y}`;
|
|
12587
|
+
}
|
|
12588
|
+
else {
|
|
12589
|
+
parallelPath1Data += ` M ${start1X} ${start1Y}`;
|
|
12590
|
+
parallelPath2Data += ` M ${start2X} ${start2Y}`;
|
|
12591
|
+
}
|
|
12592
|
+
parallelPath1Data += ` L ${end1X} ${end1Y}`;
|
|
12593
|
+
parallelPath2Data += ` L ${end2X} ${end2Y}`;
|
|
12594
|
+
}
|
|
12595
|
+
return [parallelPath2Data, parallelPath1Data];
|
|
12596
|
+
}
|
|
12597
|
+
}
|
|
12598
|
+
|
|
12599
|
+
var chargingPileImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAYAAAA6/NlyAAAACXBIWXMAACE4AAAhOAFFljFgAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAABHHSURBVHgBtVtdjF3VdV7rnHPHtLbUkRrALwmDidSSgD1JqWQ3UMaNMaFq63FIKyoVZFRF6kMkbCmVcP9mrBARoJUnLRL9c+3WSVsqIkwrtRBKfaGmQFuFazBpK0wYnmLSF6MYx557zt5Zv3vvO/Z4bDPZ9pl97rlnztnfXmt969s/g/AjKrN7nxwf634wBTFMYIQNAWASAcYjxAmI+T5EnAeIdFQnYwxHqwr6Z5s1g9ld20/Cj6AgrGBhkKva0/d1MUxBiFMxEjw7gGv5RyUWL+cfiCD/0I4KoULs04ensKkP7d716/OwQmVFAD/4yMGpLsJM7MJUiIGMGiDQwUBDYHR8DgocFG/54gQ0HRVUFQPnuoK6qvp0ec/u3767Dx+wfCDAXyKg2MWZELopBth1BJQAB6ujgY5RANNpRIbLuPnFETAaxgSUawYpVhawtdQV1XWN81hXu37ni3cfgssslwX4wQf/bqLD4f6uY6AdAaWDagYqdRi18qhrn/vmc61bRbIwZqAKmms9rw/Usbdn9+5Ld/VLBvzlhw/e17XtLIEcbzsG2SpgOQQkYe0wu7SDZqgRvS7Bcisq/oFVRAZqVlaQXDeRgKIDFtBNPd9Aved3d99zAC6hXDTg2dknx6sr3psJbbezZZBtB14TWApfAqmgyYPpnF07ZMIKeqLviymMoxIWY0VEJ6/zWNgsG5uGgTdANXBNwOf+4P4duy4Wx0UBnp3dP45jcJgsO6kgWxi2BLIdYtcGBisWDqHFji3qMbzIlY2jLZgRyxaUbl1hJiwBzLWBdqBNo0fNR90MxhC279597/xyWJYFPPvgfsqj8XA7HE60BLQVsAqazzt3aY5ZqmPU2A1s0sgunPwZFbVzNQNW+hLTsvnRrCwujbFCAYoa0xVbNjbs2g0DHxNrO/Cm15sfQ9y8HGhcDiyZ6nDbLkwMhwRwOCSQw2RdsjbVHK8pfg0wowoC1lwak9ZIgN3E4tYjgCuJa2XsujISkxiuKJYbVEsz0B6BbrDX6yXQMKw+MTt775KipboQYELx5HBIYBcI5MJZoHNYWFjgc1wYcr2AQ+4A6YgF7ozIHaKuLl6gtcQ2dw51mhCdxXvo5LN5Cco9nXmOPifa85Hfze/xmtuxQO1IbZLvhhPQdIc5BJeC1Cz1xcwD+/bSyybTixYYVEsNWGAQ0RpI1zqxprKzKSohqeAGdctiIbBScmIHds5G9W9TYJyjydb0UHZnsjF7EIbgIdM4P0S+Xui4STL6DNXnJbL6fBdnv7xvR9cNv1KAjXSOZEXqUbZiixrPnaQgIayOXZgaFDtmZAMeFKgpDW+gsLVf52aGWES3pC6rY3FNnhdNxPjvmpgxipAOAw6JjZu3bHvv+X/7p5eXBTw7+9jEMIb97cJwvATL4NldGay6YGv5lkFTj0PAUCorbYyTVdz2y1twxz13wurVP47/+39vgRmabzGTRjusaxQ1jjC9EV/RMU4DCM5HzvZQbfyF2+98vP/cUyPxfI5LdxXOdAvDCY6dVkCqVYcal2JdlZGtuRe/OIAZw+0ovukWvPqqD8Hnf/Muef6NN/wUPPvckXj69GmMOSnxbwl1BX0IKla9qJVbuELP7zG6G0elQLRKY2OcImI/fbm5xDdCWrNf+rNpYt0d4q5sXSGM1iyrhMTMLMQkedcPAYxmWXfXRMybNn1ypFOvvuon0QVJthikfK2AUh63DpXczuHDnqXkJhzCxmjVOKnNnZAdfTf1e7OPTS0JeNiFvfILchAwe0CrbIvGsIuAhiK2zI3Vrd3ywO5cvmfdug+P3KugneQCmETB4hlCiFHynYSOpcJWGL/z9opXtuKVFn78nJnzAuaeoAeYuOCUsICtCwxNG8rMppOFld0KkEgEIZaje4Atn/6UuHRZrr32IwrOTCzPgXL46NaH3DGgXiSSNXbgbN0an3CIubEIdHTNQO0fsXKKYUouM22hoIZay4MkDYlWbgWoKSjUhmkDmSZiOZVhp7d9+mZYXNas/jFwFgYoSStlLIYoaiQYq2HqCJRRZcDEaNjx162KVVZnLQVvVRNttbUML0mpsJX7ycLMzARmitOMqicXCcrImnocrLpZSC4cbHCgn9X/NBjXXfvhuP7Gnz4H8Pobr1d4RkVQpDGbKECzrt5jgw/1gqCf1cMk/1tcS7i1KbbZ8sI5EMjKs7N7xxPg0103LaMelosSqwa04w7o0hhXjiLuIMZRaaqfJSvwHdO/cvt5pSu7uJOWGCop7cy6zsDae8bcMefrTGoE2sbhLQOXdrun6kiOQZ8Jzc4EmLppm/aMsp8N90DjNYGNBVuKWAj22WPOcy/3PTFx3LrlFliq0PdZiKhaKghMPcRd3t25AGpvs7awBlAyxS64VC0HODSo6eKtAphNTU4xpfEpluVewpx2gtT2Ik8nGjwIiWyiiwZLh5s2/swFByYfXXeN83mRj8HJCkeEB7has2vmXcbe0QlU5W1wY4GB97AUt27OtM1k152FPKYNMqYtwapxhSmdSFHjVpgFS3kcLSQ/u+32C+GFK6/6EFqMgjGfaSy7wbsg5nOPJO5Wl58a4vSDqIRaTpam04p1d6eE2zWeXeBsu2qqaUM7ZdMzrotdMo6QFLtNzptmTn1bzGMBbdrWLT8PV1995QUBX7fuI1lX6xPjmtWrcf3662HDjR+D6667BtZSrB99/X/g4Ne/ASfe/f8MPWUv9zGeFw3UC5URGePh8bMYzIkNh1U70RCYDT5oX6SeojOiuXKMmaTS7ONo/+spA16uXLfuGtiw/nr8KAFbd+01MLnh47g4X8uzqOP4+hfvfyC5vbO3Tv9ius4Y+HIel5dhKfG+oSFc4zY941/YICD4wABVSekUK/eDzVCATUkVwGOk2MQN6z92UYD/6KHfh4spa9asLj0LER2052a9rgaqPJZtyKpTTzacnGQLT4SYeiDRvQn0ZFlnUI3ZLDBCSN0tv/fZ6Ttgpcvxt+bB5aa+x94dnT2iyhAZsHCDKsxTTXkMTallnGFPxGDa10CzZUdjdvHYsyiY8iOsXXslbL3tVljp8s1/7ctr9VV5sgiUt93j8lAyhNJgKX3RtYkmpAt+s2nj4II+jsRxmpbwREQOIRPJ9OHnNv7sspOCl1qIrGBw9NtmymCT2jafaxkhJQn5vsKsvXVgk8EHaGJyYx/16Beue4IpHVND6DkYHLekiCAvvHP7L8JKl2eePexxmtjK+l2vmjiV9ohNCtAqSQt8EZpCylosRNfG7sLoAhcgpUXU20OahNp62xSsXSYVXU55+pv9CGV2sGSQQMpVc/PocjfmpJ0GOZoCK7L2vHWfCXiLW5s+idnCPDSz4YoNBQGS+P/M1ilY6TJ47Q1y6e9lfe2aLo4eRtTWNhlvxlKR239krKSl48k0IDPvyI8oZV7B0FkDg8f45PqPXxSI4995m6x2+KLufYbvK0ZOkEgopk7w0IMsOTO7FZ5v7Z5n0jpKnybtHWlSzEBjemiMpuPAHypJwllz8NoxAn0DnGulY3D8+DwMXn8DBoNjcOr99+OaNWvwM1s3w3JlcPQNcGM4Sxdas5jc1wTF07oelrlDcuaiT+811OZX6co9NtWXHmEuWypb792YJSWkz1955NH4ue2/hCwSvn/qFLz40n8R0Lf5XNOGORefn6Lvl+qgDPYYfPfdd8HfY2Nne98o8qKNYP0TE8842fLkAMQBLVDg/NBWtoo5Tx8QIGS+WuTio/V3T7yLf/LYvvz2bH0s+S55BFnvQoCffvawd3pSdUZU6bnFuzR7eN/4hL7nT0jrs31atWmftyV4zbG+YAvZJ/QdwcW+U6I1Ini8x/JXbCqovO6xKDe8evT1JcGeOvU+/PMzz6EtyAFkokJIU0PZw6KaNPtomvy13tC1WEpJ3aCam5tl0urr8mzF7kLcDUZQOnehaV4tHmMxCB/paRufRmPGklSiNzGIO/Lvvzp4XYCdr/z7f7wCnn5MNxcBlIgS7XngnRyLZ6BxjGKS5j/PWGXGg6a5+rqnIvVGzIYGZ+Qynq32ZgR3BLVktLiB0v1SWLhnwptvvQ3nK//yzHN6r69kFOTp70nMbCyuvm9ayGbjbUeQCEG6IPtCBPCZpvqqrMX67pmRbQgpwA2gu1eaWk0uLtztgEy8pOZleWq8EOKRF89Z+oETJ74n1ndl57nFnx8t4/pzvZeVEG1CLdW69MrLrdhUTyXAB8jUWFd9XnVXF6j4nzQ/OYgAQ4zp1eiZQlKVu7KJsmhGNqUGDgAiZKH6rfPEcYrtEXFRMIdxgs6MauP0BxYk5sbjhfSa8Tz/p3Oz8wmw3bVHtgjZijuKf0sHGO9V3tHeHm1MnvUpk1pa+UvElXVMavyblLYWx/E/fOMfE8g0wRFN75kCzPnX/lusS3urtPWJwDa8ZYJW1XGP/0oC/JePPsAW7uu+qHSwpcFmXSO4yaNPrrk/lcQU083pnugjsFCwj/544cWXElh25zePfydTU4w5k1pXh0XZR7ulcj/WbRJl+6tqnrGdA5hLjU1h5TrqBjE5hMz04SOp0eIWPD61U2Is8Gvjoik9sx66m75w5D+Twfb99d9Ccb88IRSurV6cck4SJCAb3NSN0cHqNidebBxZGC+VipQdn7//8NnhmVsXzvK2hrO8rYEXqbDtujTn5eb0qDTNY+MXG74tHtGAseeIL+qXt9y8iecd8YUjr4CZ3wb1xX1JW6HtBRHLyhanuq6waXrQ8O6e3hisGhuDsVVXwKreqgMH/uKhe0t85255qOHeJjSvdnX3EzXP/tWBhlQBqqibzNjqstqfmuZaFbDowWRevr/w45EO1t9GAvpS0RMj6ay4NT0/ywpLnznD1LGRTS8EvK7ny9jN8BaVwX8fOfnJm245QwjuCGlOi6d/krIDGJm9dMloXOwNM+Fibo7ZTooJk6ozjYEWHpD81nleJ6tcSIBauNK9mChxWqetS7KjZ6y3ijes7fqbP3+4vyxgAf2tF1+ZvOnmcXrRxpj3Wpm6yc4rig5HARYdAflcW+uunr92PwFLeTEWFkQYDYfoik9sahvX2I1r3cIEPXLnXsPHqrmD+x556HzYlty2VLftHnrYQGKj6SE9lPdIcV5jYrCUlZky5hSc3DHn0Jg1UiyZPX3GzMhYXs/SSsxNIA2skhOlHQZc98iVJYZj04wNDv7Vw0tuRVwS8IEDcyd7sdtMrjLfU9ACXLb76b5HIQzfAetSzjvA03NKXSEx92gHFHXM6c6x2pBHdb6wcd5DLVsQ+ZD29XiTWu8d+rkdLlDqC305GLx85obJjU8RuGl62bhJRxihk5H4zB6LpsoKNsYiRLH0eZGFkAY34KoYc25VyL5/WkipQXVjjtkxZud3yHybv3bgD+fhcgFzOTZ4+eQNnyDQWE/R69dGI5xCCY2knRKOc1JeqQBMX2aBlsavWbTr7AWakEAhJrEoMzBK+mnGUGK2NxYJ7NGFCjY9cWDuxHJ4EC6h/Nrd9+2l9dadbdpumDeX+ipjKDajmaKE0iVC1kkptUqnuFtoLbvvJNOyC4tUtG3ETWOxynssx3gf9R8Pm2r2EIXgxWC4JMBcfvXunTu6djhDi80TQ90aga2uv4Ivs0bfSZtHSQbLyMwSUekfruB0PF6ppMW8UVwAE9gebywlN66b3klilD2Pf31uDi6hLOvSi8u3X3t5sOGmT9FQqxqndk2iyZ50QKXjahPxqFrchL3WlQPS0Rkd9QgwG8DovujaUw4dlCnIqkiA+2NjzR2PH5x7Gi6xXLKFy3Lnb3xhOrRhL60tT3TFnwKIe/sejGDL6DpJgAXn+YSMx7iTk28O1z3SaUe8ZIc+hfCeJ772aB8us3wgwF4+d9cXplqIM6Hrprrgm9fSimSMaasE5JhGSG494iFMVKKgKvk7B94JT7D7NL2654m/v3ygXlYEsJfpu35rArCejm23jex7q/05D+qYOYHOORZcQSmFVYgpfunoY419ODP21UOH5lbsr9RWFHBZpqd3jsMVZybJyJTO4gbCPk6YJgjrRPZp+TFP7HaSMA9iFQfkyO/Awqr+SoIsyw8B5OTF820K0FQAAAAASUVORK5CYII=";
|
|
12600
|
+
|
|
12601
|
+
/**
|
|
12602
|
+
* 充电桩图层
|
|
12603
|
+
* 专门处理充电桩元素的渲染
|
|
12604
|
+
*/
|
|
12605
|
+
class ChargingPileLayer extends BaseLayer {
|
|
12606
|
+
constructor() {
|
|
12607
|
+
super();
|
|
12608
|
+
this.level = 8; // 中等层级
|
|
12609
|
+
this.type = LAYER_DEFAULT_TYPE.CHARGING_PILE;
|
|
12610
|
+
}
|
|
12611
|
+
/**
|
|
12612
|
+
* SVG渲染方法
|
|
12613
|
+
*/
|
|
12614
|
+
drawSVG(svgGroup) {
|
|
12615
|
+
if (!this.visible || this.elements.length === 0) {
|
|
12616
|
+
return;
|
|
12617
|
+
}
|
|
12618
|
+
// 只渲染充电桩类型的元素
|
|
12619
|
+
for (const element of this.elements) {
|
|
12620
|
+
if (element.type === 'charging_pile') {
|
|
12621
|
+
this.renderChargingPile(svgGroup, element);
|
|
12622
|
+
}
|
|
12623
|
+
}
|
|
12624
|
+
}
|
|
12625
|
+
/**
|
|
12626
|
+
* 渲染充电桩元素
|
|
12627
|
+
*/
|
|
12628
|
+
renderChargingPile(svgGroup, element) {
|
|
12629
|
+
const { coordinates, style } = element;
|
|
12630
|
+
if (coordinates.length === 0)
|
|
12631
|
+
return;
|
|
12632
|
+
const center = coordinates[0];
|
|
12633
|
+
const size = style.radius ? style.radius * 2 : 55; // 默认55px大小
|
|
12634
|
+
const direction = element.originalData?.direction || 0;
|
|
12635
|
+
// 将弧度转换为角度
|
|
12636
|
+
const angle = (direction * 180) / Math.PI;
|
|
12637
|
+
const rotationDegree = 270 - angle; // 坐标系转换
|
|
12638
|
+
const image = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
12639
|
+
// 图片居中定位
|
|
12640
|
+
const x = center[0];
|
|
12641
|
+
const y = center[1];
|
|
12642
|
+
image.setAttribute('x', x.toString());
|
|
12643
|
+
image.setAttribute('y', y.toString());
|
|
12644
|
+
image.setAttribute('width', `${size}px`);
|
|
12645
|
+
image.setAttribute('height', `${size}px`);
|
|
12646
|
+
image.setAttribute('href', chargingPileImage);
|
|
12647
|
+
image.setAttribute('opacity', '0'); // 初始透明
|
|
12648
|
+
// 添加SVG原生动画,传入默认角度
|
|
12649
|
+
this.addChargingPileAnimation(image, center, rotationDegree);
|
|
12650
|
+
image.classList.add('vector-charging-pile');
|
|
12651
|
+
svgGroup.appendChild(image);
|
|
12652
|
+
}
|
|
12653
|
+
/**
|
|
12654
|
+
* 添加充电桩SVG原生动画
|
|
12655
|
+
*/
|
|
12656
|
+
addChargingPileAnimation(image, center, defaultAngle) {
|
|
12657
|
+
// 透明度动画 - 先显示出来
|
|
12658
|
+
const animateOpacity = document.createElementNS('http://www.w3.org/2000/svg', 'animate');
|
|
12659
|
+
animateOpacity.setAttribute('attributeName', 'opacity');
|
|
12660
|
+
animateOpacity.setAttribute('values', '0;1');
|
|
12661
|
+
animateOpacity.setAttribute('dur', '0.5s');
|
|
12662
|
+
animateOpacity.setAttribute('fill', 'freeze');
|
|
12663
|
+
image.appendChild(animateOpacity);
|
|
12664
|
+
// 旋转动画 - 从180度旋转到默认角度
|
|
12665
|
+
const animateTransform = document.createElementNS('http://www.w3.org/2000/svg', 'animateTransform');
|
|
12666
|
+
animateTransform.setAttribute('attributeName', 'transform');
|
|
12667
|
+
animateTransform.setAttribute('type', 'rotate');
|
|
12668
|
+
animateTransform.setAttribute('values', `${180 + defaultAngle} ${center[0]} ${center[1]};${defaultAngle} ${center[0]} ${center[1]}`);
|
|
12669
|
+
animateTransform.setAttribute('dur', '1s');
|
|
12670
|
+
animateTransform.setAttribute('repeatCount', '1'); // 只播放一次
|
|
12671
|
+
animateTransform.setAttribute('begin', '0.5s'); // 延迟0.5秒开始,等透明度动画完成
|
|
12672
|
+
animateTransform.setAttribute('fill', 'freeze'); // 保持最终状态
|
|
12673
|
+
image.appendChild(animateTransform);
|
|
12674
|
+
}
|
|
12346
12675
|
}
|
|
12347
12676
|
|
|
12348
12677
|
/**
|
|
@@ -13726,6 +14055,7 @@ const CommonContext = createContext({
|
|
|
13726
14055
|
mapRef: null,
|
|
13727
14056
|
globalHeight: 0,
|
|
13728
14057
|
heightOptions: [],
|
|
14058
|
+
overlayScale: 1,
|
|
13729
14059
|
});
|
|
13730
14060
|
const CommonContextProvider = CommonContext.Provider;
|
|
13731
14061
|
const useCommonContext = () => useContext(CommonContext);
|
|
@@ -14068,7 +14398,6 @@ const SvgMapComponent = forwardRef(({ editMap, rotate, mapData, pathData, modelT
|
|
|
14068
14398
|
]);
|
|
14069
14399
|
// 初始化 SVG 地图
|
|
14070
14400
|
useEffect(() => {
|
|
14071
|
-
console.log('mapData svgMapView ->', containerRef.current, svgMapView, mapData, pathData);
|
|
14072
14401
|
if (containerRef.current && mapData && !svgMapView) {
|
|
14073
14402
|
console.log('Initializing SVG map view, containerRef->', containerRef.current);
|
|
14074
14403
|
initializeSvgMapView(containerRef.current);
|
|
@@ -14078,15 +14407,15 @@ const SvgMapComponent = forwardRef(({ editMap, rotate, mapData, pathData, modelT
|
|
|
14078
14407
|
width: '100%',
|
|
14079
14408
|
height: '100%',
|
|
14080
14409
|
position: 'relative',
|
|
14081
|
-
|
|
14410
|
+
display: editMap ? 'none' : 'block',
|
|
14082
14411
|
} }));
|
|
14083
14412
|
});
|
|
14084
14413
|
// 设置显示名称以便调试
|
|
14085
14414
|
SvgMapComponent.displayName = 'SvgMapComponent';
|
|
14086
14415
|
|
|
14087
|
-
var css_248z$
|
|
14088
|
-
var styles$
|
|
14089
|
-
styleInject(css_248z$
|
|
14416
|
+
var css_248z$5 = ".index-module_mowerPosition__yLpIU {\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n width: 100%;\n height: 100%;\n}";
|
|
14417
|
+
var styles$5 = {"mowerPosition":"index-module_mowerPosition__yLpIU"};
|
|
14418
|
+
styleInject(css_248z$5);
|
|
14090
14419
|
|
|
14091
14420
|
const usePosition = ({ mowerPositionData, viewBox, modelType, hasEdger, mapData, realTimeData, onMowingPositionChange, }) => {
|
|
14092
14421
|
// DOM 元素引用,用于直接操作
|
|
@@ -14312,7 +14641,7 @@ const MowerPosition = React__default.memo(({ editMap, mowerPositionData, viewBox
|
|
|
14312
14641
|
pointerEvents: 'none',
|
|
14313
14642
|
zIndex: 1000,
|
|
14314
14643
|
}), []);
|
|
14315
|
-
return (jsx("div", { className: styles$
|
|
14644
|
+
return (jsx("div", { className: styles$5.mowerPosition, style: containerStyle, children: jsx("div", { ref: elementRef, className: "mower-position", style: {
|
|
14316
14645
|
position: 'absolute',
|
|
14317
14646
|
width: 30,
|
|
14318
14647
|
height: 30,
|
|
@@ -14381,9 +14710,9 @@ const CharginPile = React__default.memo(({ mapData, mapConfig = {}, viewBox, rot
|
|
|
14381
14710
|
}, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }, `pile-${idx}`))) }));
|
|
14382
14711
|
});
|
|
14383
14712
|
|
|
14384
|
-
var css_248z$
|
|
14385
|
-
var styles$
|
|
14386
|
-
styleInject(css_248z$
|
|
14713
|
+
var css_248z$4 = ".index-module_container__7IatW {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.index-module_boundaryLabel__GDHFn {\n position: absolute;\n background-color: rgba(30, 30, 31, 0.6);\n color: rgb(255, 255, 255);\n padding: 6px;\n border-radius: 12px;\n font-size: 12px;\n font-weight: bold;\n max-width: 220px;\n pointer-events: auto;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);\n cursor: pointer;\n user-select: none;\n white-space: nowrap;\n}\n\n.index-module_base__qy2SG {\n font-size: 14px;\n}\n\n.index-module_extended__0TMAt {\n margin-top: 6px;\n font-size: 11px;\n opacity: 0.9;\n border-top: 1px solid rgba(255, 255, 255, 0.2);\n padding-top: 6px;\n}";
|
|
14714
|
+
var styles$4 = {"container":"index-module_container__7IatW","boundaryLabel":"index-module_boundaryLabel__GDHFn","base":"index-module_base__qy2SG","extended":"index-module_extended__0TMAt"};
|
|
14715
|
+
styleInject(css_248z$4);
|
|
14387
14716
|
|
|
14388
14717
|
const useBoundaryLabels = ({ mapData, pathData, unitType, viewBox, mowPartitionData, realTimeData = [], }) => {
|
|
14389
14718
|
const [processStateIsMowing, updateProcessStateIsMowing] = useState(false);
|
|
@@ -14426,7 +14755,7 @@ const useBoundaryLabels = ({ mapData, pathData, unitType, viewBox, mowPartitionD
|
|
|
14426
14755
|
}
|
|
14427
14756
|
}, [mapData, pathData, realTimeData]);
|
|
14428
14757
|
const items = useMemo(() => {
|
|
14429
|
-
console.log('boundartItme->', viewBox, mapData)
|
|
14758
|
+
// console.log('boundartItme->', viewBox, mapData)
|
|
14430
14759
|
if (!mapData || !viewBox)
|
|
14431
14760
|
return [];
|
|
14432
14761
|
// 构建边界数据
|
|
@@ -14469,7 +14798,7 @@ const useBoundaryLabels = ({ mapData, pathData, unitType, viewBox, mowPartitionD
|
|
|
14469
14798
|
function computePolygonCentroid(points) {
|
|
14470
14799
|
if (!points || points.length < 3)
|
|
14471
14800
|
return null;
|
|
14472
|
-
const valid = points.filter(p => p.length >= 2);
|
|
14801
|
+
const valid = points.filter((p) => p.length >= 2);
|
|
14473
14802
|
if (valid.length < 3)
|
|
14474
14803
|
return null;
|
|
14475
14804
|
const polygon = [...valid];
|
|
@@ -14537,7 +14866,7 @@ const BoundaryLabels = React__default.memo(({ editMap, mapData, pathData, unitTy
|
|
|
14537
14866
|
zIndex: expandedId != null ? 9999 : containerZIndex,
|
|
14538
14867
|
display: editMap ? 'none' : 'block',
|
|
14539
14868
|
}), [containerZIndex, expandedId, editMap]);
|
|
14540
|
-
return (jsx("div", { className: styles$
|
|
14869
|
+
return (jsx("div", { className: styles$4.container, style: containerStyle, children: items.map((item) => (jsxs("div", { className: `${styles$4.boundaryLabel} boundary-label`, "data-boundary-id": item.id, style: {
|
|
14541
14870
|
transform: `translate(-50%, -50%) rotate(${-rotation}deg)`,
|
|
14542
14871
|
left: `${item.leftPct}%`,
|
|
14543
14872
|
top: `${item.topPct}%`,
|
|
@@ -14547,12 +14876,12 @@ const BoundaryLabels = React__default.memo(({ editMap, mapData, pathData, unitTy
|
|
|
14547
14876
|
if (onlyRead)
|
|
14548
14877
|
return;
|
|
14549
14878
|
handleClick(item.id);
|
|
14550
|
-
}, children: [jsx("div", { className: styles$
|
|
14879
|
+
}, children: [jsx("div", { className: styles$4.base, children: item.baseText }), jsxs("div", { className: styles$4.extended, style: { display: expandedId === item.id ? 'block' : 'none' }, children: [jsx("div", { style: { marginBottom: 3, fontWeight: 'bold' }, children: item.coverageText }), jsx("div", { children: item.dateText })] })] }, item.id))) }));
|
|
14551
14880
|
});
|
|
14552
14881
|
|
|
14553
|
-
var css_248z$
|
|
14554
|
-
var styles$
|
|
14555
|
-
styleInject(css_248z$
|
|
14882
|
+
var css_248z$3 = ".index-module_container__gB52e {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n}\n\n.index-module_item__zHoZP {\n position: absolute;\n pointer-events: auto;\n}\n\n.index-module_icon__CS56A {\n position: relative;\n width: 24px;\n height: 24px;\n cursor: pointer;\n transition: transform 0.2s ease;\n}\n\n.index-module_tooltip__NMCmR {\n position: absolute;\n bottom: 40px;\n left: 0;\n background-color: rgb(247, 251, 255);\n color: rgb(65, 93, 116);\n padding: 10px;\n border-radius: 16px;\n font-size: 14px;\n text-align: left;\n}";
|
|
14883
|
+
var styles$3 = {"container":"index-module_container__gB52e","item":"index-module_item__zHoZP","icon":"index-module_icon__CS56A","tooltip":"index-module_tooltip__NMCmR"};
|
|
14884
|
+
styleInject(css_248z$3);
|
|
14556
14885
|
|
|
14557
14886
|
const useAntennaInfo = (data = [], options = {}) => {
|
|
14558
14887
|
const { viewBox } = options;
|
|
@@ -14661,13 +14990,13 @@ const Antennas = React__default.memo(({ editMap, antennaConfig = [], viewBox, ro
|
|
|
14661
14990
|
document.addEventListener('pointerdown', handleOutside);
|
|
14662
14991
|
return () => document.removeEventListener('pointerdown', handleOutside);
|
|
14663
14992
|
}, []);
|
|
14664
|
-
return (jsx("div", { className: styles$
|
|
14993
|
+
return (jsx("div", { className: styles$3.container, style: containerStyle, children: items.map((item) => (jsxs("div", { className: `antenna-container-item ${styles$3.item}`, style: {
|
|
14665
14994
|
left: `${item.leftPct}%`,
|
|
14666
14995
|
top: `${item.topPct}%`,
|
|
14667
14996
|
transform: `translate(calc(-50% + ${item.offsetX || 0}px), calc(-50% + ${item.offsetY || 0}px)) rotate(${-rotation}deg)`,
|
|
14668
14997
|
zIndex: openType === item.type ? 10000 : containerZIndex,
|
|
14669
14998
|
pointerEvents: onlyRead ? 'none' : 'auto',
|
|
14670
|
-
}, children: [jsx("div", { className: `antenna vector-antenna antenna-${item.type} ${item.isOnline ? 'antenna-online' : 'antenna-offline'} ${styles$
|
|
14999
|
+
}, children: [jsx("div", { className: `antenna vector-antenna antenna-${item.type} ${item.isOnline ? 'antenna-online' : 'antenna-offline'} ${styles$3.icon}`, style: {}, onClick: (e) => {
|
|
14671
15000
|
e.stopPropagation();
|
|
14672
15001
|
if (onlyRead)
|
|
14673
15002
|
return;
|
|
@@ -14682,7 +15011,7 @@ const Antennas = React__default.memo(({ editMap, antennaConfig = [], viewBox, ro
|
|
|
14682
15011
|
return;
|
|
14683
15012
|
e.currentTarget.style.transform =
|
|
14684
15013
|
'scale(1)';
|
|
14685
|
-
}, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }), jsxs("div", { className: styles$
|
|
15014
|
+
}, children: jsx("img", { src: item.imageSrc, style: { width: '100%', height: '100%', objectFit: 'contain', opacity: 1 } }) }), jsxs("div", { className: styles$3.tooltip, style: {
|
|
14686
15015
|
display: openType === item.type ? 'block' : 'none',
|
|
14687
15016
|
minWidth: item.tooltip.minWidth,
|
|
14688
15017
|
}, children: [jsx("div", { style: { marginBottom: 4, fontWeight: 600 }, children: item.tooltip.title }), jsxs("div", { style: { color: 'rgba(65, 93, 116, 1)', fontWeight: 400 }, children: [item.tooltip.statusText, item.tooltip.syncText || ''] })] })] }, `antenna-${item.type}`))) }));
|
|
@@ -14735,30 +15064,32 @@ function generateStraightParallelPaths(points, offsetDistance) {
|
|
|
14735
15064
|
}
|
|
14736
15065
|
return [parallelPath2Data, parallelPath1Data];
|
|
14737
15066
|
}
|
|
14738
|
-
const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className }) => {
|
|
15067
|
+
const DashPath = ({ points, stroke, strokeWidth, strokeOpacity, className, }) => {
|
|
14739
15068
|
const [parallelPath2Data, parallelPath1Data] = generateStraightParallelPaths(points, strokeWidth);
|
|
14740
|
-
return (jsxs(Fragment, { children: [jsx("path", {
|
|
15069
|
+
return (jsxs(Fragment, { children: [jsx("path", { fill: "none", d: parallelPath2Data, stroke: stroke, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${strokeWidth}px ${strokeWidth * 2}px`, style: { pointerEvents: 'none' }, vectorEffect: "non-scaling-stroke" }), jsx("path", { fill: "none", d: parallelPath1Data, stroke: stroke, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", strokeDasharray: `${strokeWidth}px ${strokeWidth * 2}px`, style: { pointerEvents: 'none' }, vectorEffect: "non-scaling-stroke" })] }));
|
|
14741
15070
|
};
|
|
14742
15071
|
|
|
14743
15072
|
const VertexElement = React__default.memo(({ r, stroke, ...props }) => {
|
|
14744
|
-
|
|
15073
|
+
const { overlayScale } = useCommonContext();
|
|
15074
|
+
const radius = typeof r === 'number' ? r : 12;
|
|
15075
|
+
return (jsx("circle", { r: radius * overlayScale, stroke: stroke || '#fff', fill: '#fff', strokeWidth: 2 * overlayScale, ...props }));
|
|
14745
15076
|
});
|
|
14746
15077
|
|
|
14747
|
-
var _path$
|
|
14748
|
-
function _extends$
|
|
14749
|
-
var SvgDelete
|
|
14750
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
15078
|
+
var _path$2;
|
|
15079
|
+
function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
|
|
15080
|
+
var SvgDelete = function SvgDelete(props) {
|
|
15081
|
+
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
14751
15082
|
xmlns: "http://www.w3.org/2000/svg",
|
|
14752
15083
|
width: 16,
|
|
14753
15084
|
height: 16,
|
|
14754
15085
|
fill: "none"
|
|
14755
|
-
}, props), _path$
|
|
15086
|
+
}, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
|
|
14756
15087
|
fill: "#FD494D",
|
|
14757
15088
|
d: "M6.667 12a.667.667 0 0 0 .666-.667v-4a.667.667 0 1 0-1.333 0v4a.667.667 0 0 0 .667.667m6.666-8h-2.666v-.667a2 2 0 0 0-2-2H7.333a2 2 0 0 0-2 2V4H2.667a.667.667 0 0 0 0 1.333h.666v7.334a2 2 0 0 0 2 2h5.334a2 2 0 0 0 2-2V5.333h.666a.667.667 0 1 0 0-1.333m-6.666-.667a.667.667 0 0 1 .666-.666h1.334a.667.667 0 0 1 .666.666V4H6.667zm4.666 9.334a.667.667 0 0 1-.666.666H5.333a.667.667 0 0 1-.666-.666V5.333h6.666zm-2-.667a.667.667 0 0 0 .667-.667v-4a.667.667 0 0 0-1.333 0v4a.667.667 0 0 0 .666.667"
|
|
14758
15089
|
})));
|
|
14759
15090
|
};
|
|
14760
15091
|
|
|
14761
|
-
const DragDistanceIndicator = ({ dragState, strokeColor, editMode = false, createMode = false, completed = false, }) => {
|
|
15092
|
+
const DragDistanceIndicator = ({ fontSize, dragState, strokeColor, editMode = false, createMode = false, completed = false, }) => {
|
|
14762
15093
|
// 计算两点间的距离(使用通用工具函数)
|
|
14763
15094
|
const calculateDistance$1 = React__default.useCallback((point1, point2) => {
|
|
14764
15095
|
const distance = calculateDistance(point1, point2);
|
|
@@ -14774,7 +15105,10 @@ const DragDistanceIndicator = ({ dragState, strokeColor, editMode = false, creat
|
|
|
14774
15105
|
return isFootOnSegment(foot);
|
|
14775
15106
|
}, []);
|
|
14776
15107
|
// 只在符合条件时渲染
|
|
14777
|
-
if (!(editMode || (createMode && completed)) ||
|
|
15108
|
+
if (!(editMode || (createMode && completed)) ||
|
|
15109
|
+
!dragState.isDragging ||
|
|
15110
|
+
dragState.dragIndex === -1 ||
|
|
15111
|
+
!dragState.currentPosition) {
|
|
14778
15112
|
return null;
|
|
14779
15113
|
}
|
|
14780
15114
|
return (jsx(Fragment, { children: dragState.dragType === 'new' && dragState.edgeInfo ? (
|
|
@@ -14785,7 +15119,7 @@ const DragDistanceIndicator = ({ dragState, strokeColor, editMode = false, creat
|
|
|
14785
15119
|
const foot = calculatePerpendicularFoot$1(currentPoint, startPoint, endPoint);
|
|
14786
15120
|
const distance = calculateDistance$1(currentPoint, foot);
|
|
14787
15121
|
const isOnSegment = isFootOnSegment$1(foot);
|
|
14788
|
-
return (jsxs(Fragment, { children: [jsx("line", { x1: currentPoint.x, y1: currentPoint.y, x2: foot.x, y2: foot.y, stroke: isOnSegment ?
|
|
15122
|
+
return (jsxs(Fragment, { children: [jsx("line", { x1: currentPoint.x, y1: currentPoint.y, x2: foot.x, y2: foot.y, stroke: isOnSegment ? '#ff6b6b' : '#ffa500', strokeWidth: "2", strokeDasharray: isOnSegment ? 'none' : '5,5', pointerEvents: "none" }), jsx(VertexElement, { r: "3", stroke: strokeColor, cx: foot.x, cy: foot.y, fill: isOnSegment ? '#ff6b6b' : '#ffa500', pointerEvents: "none" }), (() => {
|
|
14789
15123
|
const { param } = foot;
|
|
14790
15124
|
let lineStartX, lineStartY, lineEndX, lineEndY;
|
|
14791
15125
|
if (param >= 0 && param <= 1) {
|
|
@@ -14810,10 +15144,10 @@ const DragDistanceIndicator = ({ dragState, strokeColor, editMode = false, creat
|
|
|
14810
15144
|
lineEndY = foot.y;
|
|
14811
15145
|
}
|
|
14812
15146
|
return (jsx("line", { x1: lineStartX, y1: lineStartY, x2: lineEndX, y2: lineEndY, stroke: "#999", strokeWidth: "2", strokeDasharray: "3,3", pointerEvents: "none" }));
|
|
14813
|
-
})(), jsx("text", { x: (currentPoint.x + foot.x) / 2, y: (currentPoint.y + foot.y) / 2 - 10, textAnchor: "middle", fill:
|
|
15147
|
+
})(), jsx("text", { x: (currentPoint.x + foot.x) / 2, y: (currentPoint.y + foot.y) / 2 - 10, textAnchor: "middle", fill: '#ffa500', fontSize: fontSize, pointerEvents: "none", children: distance })] }));
|
|
14814
15148
|
})()) : dragState.dragType === 'existing' && dragState.originalPosition ? (
|
|
14815
15149
|
// 已有顶点拖拽:显示原始位置距离
|
|
14816
|
-
jsxs(Fragment, { children: [jsx("line", { x1: dragState.originalPosition[0], y1: dragState.originalPosition[1], x2: dragState.currentPosition[0], y2: dragState.currentPosition[1], stroke: "#999", strokeWidth: "2", strokeDasharray: "3,3", pointerEvents: "none" }), calculateDistance({ x: dragState.originalPosition[0], y: dragState.originalPosition[1] }, { x: dragState.currentPosition[0], y: dragState.currentPosition[1] }) > 0 ? jsx("text", { x: (dragState.originalPosition[0] + dragState.currentPosition[0]) / 2, y: (dragState.originalPosition[1] + dragState.currentPosition[1]) / 2 - 10, textAnchor: "middle", fill:
|
|
15150
|
+
jsxs(Fragment, { children: [jsx("line", { x1: dragState.originalPosition[0], y1: dragState.originalPosition[1], x2: dragState.currentPosition[0], y2: dragState.currentPosition[1], stroke: "#999", strokeWidth: "2", strokeDasharray: "3,3", pointerEvents: "none" }), calculateDistance({ x: dragState.originalPosition[0], y: dragState.originalPosition[1] }, { x: dragState.currentPosition[0], y: dragState.currentPosition[1] }) > 0 ? (jsx("text", { x: (dragState.originalPosition[0] + dragState.currentPosition[0]) / 2, y: (dragState.originalPosition[1] + dragState.currentPosition[1]) / 2 - 10, textAnchor: "middle", fill: '#999', fontSize: fontSize, pointerEvents: "none", children: calculateDistance$1({ x: dragState.originalPosition[0], y: dragState.originalPosition[1] }, { x: dragState.currentPosition[0], y: dragState.currentPosition[1] }) })) : null] })) : null }));
|
|
14817
15151
|
};
|
|
14818
15152
|
|
|
14819
15153
|
const normalizePadding = (padding) => {
|
|
@@ -14821,7 +15155,7 @@ const normalizePadding = (padding) => {
|
|
|
14821
15155
|
return { x: padding, y: padding };
|
|
14822
15156
|
return { x: padding?.x ?? 4, y: padding?.y ?? 2 };
|
|
14823
15157
|
};
|
|
14824
|
-
const TextElement = ({ x, y, fontSize =
|
|
15158
|
+
const TextElement = ({ x, y, fontSize = 30, fill = '#fff', text, background = 'rgba(0, 0, 0, 0.34)', padding = 2, rx = 4, ry = 4, backgroundStroke, backgroundStrokeWidth = 0, textAnchor = 'middle', alignmentBaseline = 'middle', className, style, rotate, pointerEvents = 'auto', onClick, onMouseEnter, onMouseLeave, children, }) => {
|
|
14825
15159
|
const textRef = useRef(null);
|
|
14826
15160
|
const [bbox, setBbox] = useState(null);
|
|
14827
15161
|
const pad = useMemo(() => normalizePadding(padding), [padding]);
|
|
@@ -14848,7 +15182,7 @@ const TextElement = ({ x, y, fontSize = 20, fill = '#fff', text, background = 'r
|
|
|
14848
15182
|
height: bbox.height + pad.y * 2,
|
|
14849
15183
|
};
|
|
14850
15184
|
}, [bbox, pad.x, pad.y]);
|
|
14851
|
-
return (jsxs("g", { className: className, style: style, pointerEvents: pointerEvents, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [background && rectProps && (jsx("rect", { x: rectProps.x, y: rectProps.y, width: rectProps.width, height: rectProps.height, rx: rx, ry: ry, fill: background, stroke: backgroundStroke, strokeWidth: backgroundStrokeWidth })), jsx("text", { ref: textRef, x: x, y: y, fontSize: fontSize, fill: fill, textAnchor: textAnchor, alignmentBaseline: alignmentBaseline,
|
|
15185
|
+
return (jsxs("g", { className: className, style: style, pointerEvents: pointerEvents, onClick: onClick, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, children: [background && rectProps && (jsx("rect", { x: rectProps.x, y: rectProps.y, width: rectProps.width, height: rectProps.height, rx: rx, ry: ry, fill: background, stroke: backgroundStroke, strokeWidth: backgroundStrokeWidth })), jsx("text", { ref: textRef, x: x, y: y, letterSpacing: -5, fontSize: fontSize, fill: fill, textAnchor: textAnchor, alignmentBaseline: alignmentBaseline,
|
|
14852
15186
|
// keep text crisp at various zoom levels
|
|
14853
15187
|
vectorEffect: "non-scaling-stroke", style: { pointerEvents: 'none' }, children: children || text })] }));
|
|
14854
15188
|
};
|
|
@@ -14873,14 +15207,12 @@ const calculatePhysicalDistance$1 = (point1, point2) => {
|
|
|
14873
15207
|
* @returns 中点坐标 [x, y]
|
|
14874
15208
|
*/
|
|
14875
15209
|
const calculateMidpoint$1 = (point1, point2) => {
|
|
14876
|
-
return [
|
|
14877
|
-
(point1[0] + point2[0]) / 2,
|
|
14878
|
-
(point1[1] + point2[1]) / 2
|
|
14879
|
-
];
|
|
15210
|
+
return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
|
|
14880
15211
|
};
|
|
14881
|
-
const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, }) => {
|
|
15212
|
+
const DistanceLabels = ({ coordinates, createMode = false, editMode = false, completed = false, showPoints = false, mousePos: _mousePos = null, ghostLastDistance = null, ghostLastMidpoint = null, ghostFirstDistance = null, ghostFirstMidpoint = null, fontSize = 30, }) => {
|
|
14882
15213
|
// 只在显示可操作顶点时显示距离
|
|
14883
|
-
if (!(createMode && showPoints || editMode || (createMode && completed)) ||
|
|
15214
|
+
if (!((createMode && showPoints) || editMode || (createMode && completed)) ||
|
|
15215
|
+
coordinates.length < 1) {
|
|
14884
15216
|
return null;
|
|
14885
15217
|
}
|
|
14886
15218
|
return (jsxs(Fragment, { children: [coordinates.map((coord, idx) => {
|
|
@@ -14892,16 +15224,16 @@ const DistanceLabels = ({ coordinates, createMode = false, editMode = false, com
|
|
|
14892
15224
|
}
|
|
14893
15225
|
const midpoint = calculateMidpoint$1(coord, nextCoord);
|
|
14894
15226
|
const distance = calculatePhysicalDistance$1(coord, nextCoord);
|
|
14895
|
-
return (jsx(TextElement, { x: midpoint[0], y: midpoint[1], textAnchor: "middle", alignmentBaseline: "middle", fontSize:
|
|
15227
|
+
return (jsx(TextElement, { x: midpoint[0], y: midpoint[1], textAnchor: "middle", alignmentBaseline: "middle", fontSize: fontSize, fill: "#fff", style: {
|
|
14896
15228
|
pointerEvents: 'none',
|
|
14897
15229
|
fontWeight: 'bold',
|
|
14898
15230
|
}, text: distance }, `distance-${idx}`));
|
|
14899
|
-
}), ghostLastDistance && ghostLastMidpoint && (jsx(TextElement, { x: ghostLastMidpoint[0], y: ghostLastMidpoint[1], text: ghostLastDistance })), ghostFirstDistance && ghostFirstMidpoint && (jsx(TextElement, { x: ghostFirstMidpoint[0], y: ghostFirstMidpoint[1], text: ghostFirstDistance }))] }));
|
|
15231
|
+
}), ghostLastDistance && ghostLastMidpoint && (jsx(TextElement, { fontSize: fontSize, x: ghostLastMidpoint[0], y: ghostLastMidpoint[1], text: ghostLastDistance })), ghostFirstDistance && ghostFirstMidpoint && (jsx(TextElement, { fontSize: fontSize, x: ghostFirstMidpoint[0], y: ghostFirstMidpoint[1], text: ghostFirstDistance }))] }));
|
|
14900
15232
|
};
|
|
14901
15233
|
|
|
14902
|
-
var css_248z$
|
|
14903
|
-
var styles$
|
|
14904
|
-
styleInject(css_248z$
|
|
15234
|
+
var css_248z$2 = ".index-module_polygonPathG__S-Bpl {\n pointer-events: stroke;\n cursor: pointer;\n}\n\n.index-module_vertex__-Qb1u {\n cursor: pointer;\n}\n\n.index-module_dragging__xSFdO {\n cursor: grabbing;\n}\n\n.index-module_createVertex__ldz2E {\n cursor: crosshair;\n}\n\n.index-module_addVertex__hrF71 {\n cursor: pointer;\n}\n\n.index-module_polygonPath__PynOn {\n pointer-events: stroke;\n cursor: pointer;\n}\n\n.index-module_notCreate__bFnkV {\n cursor: no-drop;\n}";
|
|
15235
|
+
var styles$2 = {"polygonPathG":"index-module_polygonPathG__S-Bpl","vertex":"index-module_vertex__-Qb1u","dragging":"index-module_dragging__xSFdO","addVertex":"index-module_addVertex__hrF71","polygonPath":"index-module_polygonPath__PynOn","notCreate":"index-module_notCreate__bFnkV"};
|
|
15236
|
+
styleInject(css_248z$2);
|
|
14905
15237
|
|
|
14906
15238
|
var CreateStatus;
|
|
14907
15239
|
(function (CreateStatus) {
|
|
@@ -14925,23 +15257,21 @@ var MobileEditMode;
|
|
|
14925
15257
|
MobileEditMode[MobileEditMode["EDIT"] = 1] = "EDIT";
|
|
14926
15258
|
MobileEditMode[MobileEditMode["CREATE"] = 2] = "CREATE";
|
|
14927
15259
|
})(MobileEditMode || (MobileEditMode = {}));
|
|
15260
|
+
var ClickEventType;
|
|
15261
|
+
(function (ClickEventType) {
|
|
15262
|
+
// 点击doodle的active time的时候触发
|
|
15263
|
+
ClickEventType["DOODLE_ACTIVE_TIME"] = "doodleActiveTime";
|
|
15264
|
+
})(ClickEventType || (ClickEventType = {}));
|
|
14928
15265
|
const INIT_EDIT_MAP_INFO = {
|
|
14929
|
-
minDistance: 0,
|
|
14930
15266
|
editMap: false,
|
|
14931
15267
|
selectElement: null,
|
|
14932
|
-
createMode:
|
|
15268
|
+
createMode: null,
|
|
14933
15269
|
elementType: undefined,
|
|
14934
15270
|
isShowDrag: false,
|
|
14935
15271
|
mobileMode: MobileEditMode.START,
|
|
14936
15272
|
allVisionOffPoints: [],
|
|
14937
15273
|
historyList: [],
|
|
14938
15274
|
currentHistoryIndex: 0,
|
|
14939
|
-
onHandleEnterRecord: () => Promise.resolve(),
|
|
14940
|
-
onHandleCompleteRecord: () => Promise.resolve(),
|
|
14941
|
-
onHandleStopRecord: () => Promise.resolve(),
|
|
14942
|
-
onSaveBoundaryData: () => Promise.resolve(),
|
|
14943
|
-
onSaveMap: () => Promise.resolve(),
|
|
14944
|
-
onHandleDeleteElement: () => Promise.resolve(),
|
|
14945
15275
|
};
|
|
14946
15276
|
const MapEditContext = createContext({
|
|
14947
15277
|
editMapInfo: { ...INIT_EDIT_MAP_INFO },
|
|
@@ -15026,7 +15356,7 @@ function isPointInPolygon(point, polygon) {
|
|
|
15026
15356
|
const yi = polygon[i].y;
|
|
15027
15357
|
const xj = polygon[j].x;
|
|
15028
15358
|
const yj = polygon[j].y;
|
|
15029
|
-
if (
|
|
15359
|
+
if (yi > y !== yj > y && x < ((xj - xi) * (y - yi)) / (yj - yi) + xi) {
|
|
15030
15360
|
inside = !inside;
|
|
15031
15361
|
}
|
|
15032
15362
|
}
|
|
@@ -15094,8 +15424,7 @@ function lineSegmentsIntersect(line1Start, line1End, line2Start, line2End) {
|
|
|
15094
15424
|
const d2 = direction(line2Start, line2End, line1End);
|
|
15095
15425
|
const d3 = direction(line1Start, line1End, line2Start);
|
|
15096
15426
|
const d4 = direction(line1Start, line1End, line2End);
|
|
15097
|
-
if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) &&
|
|
15098
|
-
((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) {
|
|
15427
|
+
if (((d1 > 0 && d2 < 0) || (d1 < 0 && d2 > 0)) && ((d3 > 0 && d4 < 0) || (d3 < 0 && d4 > 0))) {
|
|
15099
15428
|
return true;
|
|
15100
15429
|
}
|
|
15101
15430
|
if (d1 === 0 && onSegment(line2Start, line1Start, line2End))
|
|
@@ -15126,8 +15455,10 @@ function direction(p1, p2, p3) {
|
|
|
15126
15455
|
* @returns 是否在线段上
|
|
15127
15456
|
*/
|
|
15128
15457
|
function onSegment(p, q, r) {
|
|
15129
|
-
return q.x <= Math.max(p.x, r.x) &&
|
|
15130
|
-
q.
|
|
15458
|
+
return (q.x <= Math.max(p.x, r.x) &&
|
|
15459
|
+
q.x >= Math.min(p.x, r.x) &&
|
|
15460
|
+
q.y <= Math.max(p.y, r.y) &&
|
|
15461
|
+
q.y >= Math.min(p.y, r.y));
|
|
15131
15462
|
}
|
|
15132
15463
|
/**
|
|
15133
15464
|
* 判断两个多边形是否相交(包括边界相交、部分重叠、完全包含等所有情况)
|
|
@@ -15274,6 +15605,7 @@ const useCheckElement = () => {
|
|
|
15274
15605
|
}
|
|
15275
15606
|
// 检查距离是否大于 2m
|
|
15276
15607
|
const distance = polygonToPolygonDistance(doodlePoints, elementPoints);
|
|
15608
|
+
console.log('distance--->', distance, minDistance, doodlePoints, elementPoints);
|
|
15277
15609
|
if (distance < minDistance) {
|
|
15278
15610
|
const elementTypeName = {
|
|
15279
15611
|
[DataType.OBSTACLE]: '障碍物',
|
|
@@ -15283,7 +15615,7 @@ const useCheckElement = () => {
|
|
|
15283
15615
|
}[element.type] || '未知元素';
|
|
15284
15616
|
return {
|
|
15285
15617
|
isValid: false,
|
|
15286
|
-
reason: `Doodle 与${elementTypeName}距离过近 (${distance.toFixed(2) / SCALE_FACTOR}m < ${minDistance /
|
|
15618
|
+
reason: `Doodle 与${elementTypeName}距离过近 (${distance.toFixed(2) / SCALE_FACTOR}m < ${minDistance / SCALE_FACTOR}m)`,
|
|
15287
15619
|
};
|
|
15288
15620
|
}
|
|
15289
15621
|
}
|
|
@@ -15291,11 +15623,12 @@ const useCheckElement = () => {
|
|
|
15291
15623
|
console.log('Doodle 位置检查通过');
|
|
15292
15624
|
return { isValid: true };
|
|
15293
15625
|
}, [editMapInfo, svgElementDatas, minDistance]);
|
|
15294
|
-
const checkCanNotCreateAtPosition = useCallback((checkPoint) => {
|
|
15295
|
-
|
|
15626
|
+
const checkCanNotCreateAtPosition = useCallback((checkPoint, checkPoints) => {
|
|
15627
|
+
console.log('editMapInfo.elementType--->', editMapInfo);
|
|
15296
15628
|
if (!editMapInfo.elementType)
|
|
15297
15629
|
return false;
|
|
15298
|
-
const
|
|
15630
|
+
const currentPoints = editMapInfo?.selectElement?.points;
|
|
15631
|
+
const points = checkPoints || currentPoints;
|
|
15299
15632
|
const firstPoint = coordinatesToPoints$1(points)?.[0] || checkPoint;
|
|
15300
15633
|
const boundary = svgElementDatas?.[DataType.BOUNDARY] || [];
|
|
15301
15634
|
let currentBoundary = null;
|
|
@@ -15308,6 +15641,7 @@ const useCheckElement = () => {
|
|
|
15308
15641
|
break;
|
|
15309
15642
|
}
|
|
15310
15643
|
}
|
|
15644
|
+
console.log('currentBoundary--->', currentBoundary, points);
|
|
15311
15645
|
if (!currentBoundary)
|
|
15312
15646
|
return true;
|
|
15313
15647
|
if (!isPointInPolygon(checkPoint, coordinatesToPoints$1(currentBoundary.points)))
|
|
@@ -15316,7 +15650,7 @@ const useCheckElement = () => {
|
|
|
15316
15650
|
if (editMapInfo.elementType !== DataType.OBSTACLE)
|
|
15317
15651
|
return false;
|
|
15318
15652
|
// 获取当前正在创建的 obstacle 的点
|
|
15319
|
-
const currentObstaclePoints = coordinatesToPoints$1(points);
|
|
15653
|
+
const currentObstaclePoints = coordinatesToPoints$1(points) || [];
|
|
15320
15654
|
if (currentObstaclePoints.length === 0)
|
|
15321
15655
|
return false; // 还没有开始绘制
|
|
15322
15656
|
// 构建当前 obstacle 的多边形(包括检查点位置)
|
|
@@ -15347,7 +15681,6 @@ const useCheckElement = () => {
|
|
|
15347
15681
|
return doodleTransformedPoints.some((point) => isPointInPolygon(point, currentBoundaryPoints));
|
|
15348
15682
|
});
|
|
15349
15683
|
// 4. 检查当前 obstacle 和 doodle 不能相交,且间隔要大于2m
|
|
15350
|
-
const MIN_DISTANCE = 2 * SCALE_FACTOR; // 2m 最小距离要求
|
|
15351
15684
|
// console.log('doodlesInBoundary--->', doodlesInBoundary);
|
|
15352
15685
|
for (const doodle of doodlesInBoundary) {
|
|
15353
15686
|
const doodleTransformedPoints = transformSvgElements(doodle).flat();
|
|
@@ -15358,13 +15691,14 @@ const useCheckElement = () => {
|
|
|
15358
15691
|
}
|
|
15359
15692
|
// 检查距离
|
|
15360
15693
|
const distance = polygonToPolygonDistance(currentObstaclePolygon, doodleTransformedPoints);
|
|
15361
|
-
|
|
15362
|
-
|
|
15694
|
+
console.log('Obstacle-Doodle distance too close:', distance, 'required:', minDistance);
|
|
15695
|
+
if (distance < minDistance) {
|
|
15696
|
+
console.log('Obstacle-Doodle distance too close:', distance, 'required:', minDistance);
|
|
15363
15697
|
return true; // 显示不能创建的光标
|
|
15364
15698
|
}
|
|
15365
15699
|
}
|
|
15366
15700
|
return false;
|
|
15367
|
-
}, [editMapInfo.selectElement, editMapInfo.elementType, svgElementDatas]);
|
|
15701
|
+
}, [editMapInfo.selectElement, editMapInfo.elementType, svgElementDatas, minDistance]);
|
|
15368
15702
|
return {
|
|
15369
15703
|
checkDoodle,
|
|
15370
15704
|
checkCanNotCreateAtPosition,
|
|
@@ -15459,8 +15793,9 @@ const createPathData = (points) => {
|
|
|
15459
15793
|
}
|
|
15460
15794
|
return pathData;
|
|
15461
15795
|
};
|
|
15462
|
-
const PolygonElement = ({
|
|
15796
|
+
const PolygonElement = ({ points, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpacity = 1, strokeColor = '#000', strokeWidth = 2, strokeOpacity = 1, createMode = false, showPoints = false, onPointClick, completed = false, mousePos = null, editMode = false, onCoordinatesChange, onPathClick, onPolygonClick, onVertexDelete, draggable = true, // 新增参数,如果未指定则根据createMode和editMode自动判断
|
|
15463
15797
|
}) => {
|
|
15798
|
+
const { overlayScale } = useCommonContext();
|
|
15464
15799
|
const { svgRef } = useSvgEditContext();
|
|
15465
15800
|
const [dragState, setDragState] = useState({
|
|
15466
15801
|
isDragging: false,
|
|
@@ -15476,6 +15811,10 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15476
15811
|
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
15477
15812
|
const { editMapInfo } = useMapEditContext();
|
|
15478
15813
|
const { platform } = useCommonContext();
|
|
15814
|
+
// delete icon可能被上一个点遮挡,因为delete在右上方,所以手动处理点让点按照顺时针渲染,这样delete icon层级就会高一些
|
|
15815
|
+
const coordinates = useMemo(() => {
|
|
15816
|
+
return editMapInfo?.createMode === CreateStatus.CREATING ? points : [...points].reverse();
|
|
15817
|
+
}, [points, editMapInfo?.createMode]);
|
|
15479
15818
|
// 计算点到线段的垂足坐标(使用通用工具函数)
|
|
15480
15819
|
const calculatePerpendicularFoot$1 = useCallback((point, lineStart, lineEnd) => {
|
|
15481
15820
|
return calculatePerpendicularFoot(point, lineStart, lineEnd);
|
|
@@ -15614,15 +15953,25 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15614
15953
|
const showNotCreateCursor = useMemo(() => {
|
|
15615
15954
|
if (!dragState?.isDragging || !dragState?.currentPosition)
|
|
15616
15955
|
return false;
|
|
15956
|
+
console.log('------>', dragState, dragState.currentPosition);
|
|
15957
|
+
// 新建点可以使用editMapInfo中的点做距离校验,拖动已有点需要将拖动点替换为鼠标当前位置再判断
|
|
15958
|
+
if (dragState?.dragType === 'new')
|
|
15959
|
+
return (checkCanNotCreateAtPosition?.({
|
|
15960
|
+
x: dragState.currentPosition[0],
|
|
15961
|
+
y: dragState.currentPosition[1],
|
|
15962
|
+
}) === true);
|
|
15963
|
+
const prePoints = coordinates.slice(0, dragState.dragIndex);
|
|
15964
|
+
const afterPoints = coordinates.slice(dragState.dragIndex + 1);
|
|
15965
|
+
const checkPoints = [...prePoints, dragState.currentPosition, ...afterPoints];
|
|
15617
15966
|
return (checkCanNotCreateAtPosition?.({
|
|
15618
15967
|
x: dragState.currentPosition[0],
|
|
15619
15968
|
y: dragState.currentPosition[1],
|
|
15620
|
-
}) === true);
|
|
15621
|
-
}, [dragState.currentPosition, checkCanNotCreateAtPosition]);
|
|
15969
|
+
}, checkPoints) === true);
|
|
15970
|
+
}, [dragState.currentPosition, checkCanNotCreateAtPosition, coordinates]);
|
|
15622
15971
|
const generateVertexClassName = useMemo(() => {
|
|
15623
15972
|
if (!dragState.isDragging)
|
|
15624
|
-
return styles$
|
|
15625
|
-
return showNotCreateCursor ? styles$
|
|
15973
|
+
return styles$2.vertex;
|
|
15974
|
+
return showNotCreateCursor ? styles$2.notCreate : styles$2.dragging;
|
|
15626
15975
|
}, [dragState.isDragging, showNotCreateCursor]);
|
|
15627
15976
|
// 使用 useRef 来存储 requestAnimationFrame ID
|
|
15628
15977
|
const rafIdRef = useRef(null);
|
|
@@ -15684,8 +16033,6 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15684
16033
|
else {
|
|
15685
16034
|
// mouseUp 时才真正插入新顶点
|
|
15686
16035
|
newCoordinates.splice(dragState.newVertexIndex, 0, dragState.currentPosition);
|
|
15687
|
-
// 通知外部坐标变化
|
|
15688
|
-
onCoordinatesChange?.(newCoordinates);
|
|
15689
16036
|
}
|
|
15690
16037
|
}
|
|
15691
16038
|
else {
|
|
@@ -15696,9 +16043,11 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15696
16043
|
else {
|
|
15697
16044
|
newCoordinates[dragState.dragIndex] = dragState.currentPosition;
|
|
15698
16045
|
}
|
|
15699
|
-
// 通知外部坐标变化
|
|
15700
|
-
onCoordinatesChange?.(newCoordinates);
|
|
15701
16046
|
}
|
|
16047
|
+
const result = editMapInfo?.createMode === CreateStatus.CREATING
|
|
16048
|
+
? newCoordinates
|
|
16049
|
+
: newCoordinates.reverse();
|
|
16050
|
+
onCoordinatesChange?.(result);
|
|
15702
16051
|
}
|
|
15703
16052
|
setDragState({
|
|
15704
16053
|
isDragging: false,
|
|
@@ -15709,7 +16058,7 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15709
16058
|
edgeInfo: null,
|
|
15710
16059
|
dragType: null,
|
|
15711
16060
|
});
|
|
15712
|
-
}, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor]);
|
|
16061
|
+
}, [dragState, coordinates, onCoordinatesChange, showNotCreateCursor, editMapInfo?.createMode]);
|
|
15713
16062
|
// 添加全局事件监听(支持触摸和鼠标事件)
|
|
15714
16063
|
useEffect(() => {
|
|
15715
16064
|
if (dragState.isDragging) {
|
|
@@ -15781,22 +16130,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15781
16130
|
mousePos.y,
|
|
15782
16131
|
])
|
|
15783
16132
|
: null;
|
|
15784
|
-
const ghostFirstDistance = createMode &&
|
|
15785
|
-
mousePos &&
|
|
15786
|
-
renderCoordinates.length > 0 &&
|
|
15787
|
-
!completed &&
|
|
15788
|
-
renderCoordinates.length >= 3
|
|
16133
|
+
const ghostFirstDistance = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
15789
16134
|
? calculatePhysicalDistance(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
15790
16135
|
: null;
|
|
15791
16136
|
// 虚拟连线的中点坐标
|
|
15792
16137
|
const ghostLastMidpoint = createMode && mousePos && renderCoordinates.length > 0 && !completed
|
|
15793
16138
|
? calculateMidpoint(renderCoordinates[renderCoordinates.length - 1], [mousePos.x, mousePos.y])
|
|
15794
16139
|
: null;
|
|
15795
|
-
const ghostFirstMidpoint = createMode &&
|
|
15796
|
-
mousePos &&
|
|
15797
|
-
renderCoordinates.length > 0 &&
|
|
15798
|
-
!completed &&
|
|
15799
|
-
renderCoordinates.length >= 3
|
|
16140
|
+
const ghostFirstMidpoint = createMode && mousePos && !completed && renderCoordinates.length >= 1
|
|
15800
16141
|
? calculateMidpoint(renderCoordinates[0], [mousePos.x, mousePos.y])
|
|
15801
16142
|
: null;
|
|
15802
16143
|
return (jsxs(Fragment, { children: [(editMode || (createMode && completed)) &&
|
|
@@ -15808,24 +16149,24 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15808
16149
|
const nextIndex = (dragState.dragIndex + 1) % coordinates.length;
|
|
15809
16150
|
return (jsxs(Fragment, { children: [jsx("line", { x1: coordinates[prevIndex][0], y1: coordinates[prevIndex][1], x2: dragState.originalPosition[0], y2: dragState.originalPosition[1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none" }), jsx("line", { x1: dragState.originalPosition[0], y1: dragState.originalPosition[1], x2: coordinates[nextIndex][0], y2: coordinates[nextIndex][1], stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: 0.5, strokeDasharray: "5,5", pointerEvents: "none" })] }));
|
|
15810
16151
|
})()] })), renderCoordinates.length >= 3 && (jsx("polygon", { className: "vector-boundary-fill", points: polygonPoints, fill: fillColor, fillOpacity: fillOpacity, stroke: "none" // 边框透明
|
|
15811
|
-
, onClick: onPolygonClick })), jsxs("g", { className: styles$
|
|
16152
|
+
, onClick: onPolygonClick })), jsxs("g", { className: styles$2.polygonPathG, children: [renderCoordinates.length >= 2 &&
|
|
15812
16153
|
pathSegments.map((segment, index) => {
|
|
15813
16154
|
if (segment.points.length < 2)
|
|
15814
16155
|
return null;
|
|
15815
16156
|
const pathData = createPathData(segment.points);
|
|
15816
16157
|
const isDash = segment.type === 1;
|
|
15817
|
-
return (jsx("path", { d: pathData, fill: "none", stroke: isDash ? 'none' : strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", className: styles$
|
|
16158
|
+
return (jsx("path", { d: pathData, fill: "none", stroke: isDash ? 'none' : strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity, strokeLinecap: "round", strokeLinejoin: "round", className: styles$2.polygonPath, vectorEffect: "non-scaling-stroke", onClick: onPathClick }, index));
|
|
15818
16159
|
}), renderCoordinates.length >= 2 &&
|
|
15819
16160
|
dashPaths.map((segment, index) => {
|
|
15820
16161
|
if (segment.points.length < 2)
|
|
15821
16162
|
return null;
|
|
15822
|
-
return (jsx(DashPath, { className: styles$
|
|
16163
|
+
return (jsx(DashPath, { className: styles$2.polygonPath, points: segment.points, stroke: strokeColor, strokeWidth: strokeWidth, strokeOpacity: strokeOpacity }, index));
|
|
15823
16164
|
})] }), (editMode || (createMode && completed)) &&
|
|
15824
16165
|
renderCoordinates.length >= 2 &&
|
|
15825
16166
|
renderCoordinates.map((coord, index) => {
|
|
15826
16167
|
const nextCoord = renderCoordinates[(index + 1) % renderCoordinates.length];
|
|
15827
16168
|
const isDashPath = coord[2] === 1;
|
|
15828
|
-
return (jsx("line", { x1: coord[0], y1: coord[1], x2: nextCoord[0], y2: nextCoord[1], stroke: isDashPath ? 'transparent' : strokeColor, strokeWidth: strokeWidth, className: styles$
|
|
16169
|
+
return (jsx("line", { x1: coord[0], y1: coord[1], x2: nextCoord[0], y2: nextCoord[1], stroke: isDashPath ? 'transparent' : strokeColor, strokeWidth: strokeWidth, className: styles$2.addVertex, vectorEffect: "non-scaling-stroke", ...(platform === PlatformType.H5
|
|
15829
16170
|
? {
|
|
15830
16171
|
onTouchStart: createReactEventHandler((e) => handleEdgeClick(e, index)),
|
|
15831
16172
|
}
|
|
@@ -15850,14 +16191,14 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15850
16191
|
setHoverVertex(null);
|
|
15851
16192
|
},
|
|
15852
16193
|
}) }, `edge-${index}`));
|
|
15853
|
-
}), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >=
|
|
16194
|
+
}), ghostLastPath && (jsx("path", { d: ghostLastPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), ghostFirstPath && renderCoordinates.length >= 2 && (jsx("path", { d: ghostFirstPath, stroke: strokeColor, strokeWidth: strokeWidth, vectorEffect: "non-scaling-stroke", opacity: 0.7, onClick: onPathClick })), jsx(DragDistanceIndicator, { dragState: dragState, strokeColor: strokeColor, editMode: editMode, createMode: createMode, completed: completed, fontSize: 30 * overlayScale }), jsx(DistanceLabels, { coordinates: renderCoordinates, createMode: createMode, editMode: editMode, completed: completed, showPoints: showPoints, mousePos: mousePos, ghostLastDistance: ghostLastDistance, ghostLastMidpoint: ghostLastMidpoint, ghostFirstDistance: ghostFirstDistance, ghostFirstMidpoint: ghostFirstMidpoint, fontSize: 30 * overlayScale }), hoverVertex && !dragState.isDragging && (jsx(VertexElement, { cx: hoverVertex.position.x, cy: hoverVertex.position.y, stroke: strokeColor, strokeOpacity: 0.6, fill: "white", fillOpacity: 0.8, pointerEvents: "none" })), ((createMode && showPoints) || editMode || (createMode && completed)) &&
|
|
15854
16195
|
renderCoordinates.map((coord, idx) => {
|
|
15855
16196
|
// 判断当前顶点的状态
|
|
15856
16197
|
const isLastPoint = idx === renderCoordinates.length - 1;
|
|
15857
16198
|
const canComplete = createMode && !completed && renderCoordinates.length >= 3 && isLastPoint;
|
|
15858
16199
|
const isCreatedAndCanDrag = createMode && completed; // 创建完成后可拖拽
|
|
15859
16200
|
const isInEditMode = editMode;
|
|
15860
|
-
return (jsxs("g", { children: [jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
|
|
16201
|
+
return (jsxs("g", { children: [jsx(VertexElement, { className: generateVertexClassName, stroke: strokeColor, cx: coord[0], cy: coord[1], r: canComplete ? 16 : 12, onClick: (e) => handleVertexClick(e, idx), onDoubleClick: (e) => {
|
|
15861
16202
|
// 阻止双击事件冒泡到Google Maps
|
|
15862
16203
|
e.preventDefault();
|
|
15863
16204
|
e.stopPropagation();
|
|
@@ -15905,22 +16246,46 @@ const PolygonElement = ({ coordinates, fillColor = 'rgba(0, 0, 0, 0.1)', fillOpa
|
|
|
15905
16246
|
}
|
|
15906
16247
|
}
|
|
15907
16248
|
},
|
|
15908
|
-
|
|
16249
|
+
onMouseUp: (e) => {
|
|
16250
|
+
// 拖拽逻辑:编辑模式或创建完成后
|
|
16251
|
+
if (isInEditMode || isCreatedAndCanDrag) {
|
|
16252
|
+
if (draggable) {
|
|
16253
|
+
// 延迟执行mouseDown,等待可能的doubleClick
|
|
16254
|
+
if (mouseDownTimerRef.current !== null) {
|
|
16255
|
+
window.clearTimeout(mouseDownTimerRef.current);
|
|
16256
|
+
}
|
|
16257
|
+
}
|
|
16258
|
+
}
|
|
16259
|
+
},
|
|
16260
|
+
}) }), tooltipIndex === idx && (jsxs("g", { transform: `translate(${coord[0] + 4 * overlayScale * 2}, ${coord[1] - 4 * overlayScale * 2}) scale(${overlayScale * 2})`, onClick: (e) => {
|
|
15909
16261
|
e.preventDefault();
|
|
15910
16262
|
e.stopPropagation();
|
|
15911
16263
|
if (onVertexDelete &&
|
|
15912
16264
|
(editMode || (createMode && completed)) &&
|
|
15913
16265
|
coordinates.length > 3) {
|
|
15914
|
-
|
|
16266
|
+
// 当前是逆时针展示的,但是外部数据是顺时针的,所以idx需要转换一下
|
|
16267
|
+
onVertexDelete(renderCoordinates?.length - 1 - idx);
|
|
15915
16268
|
}
|
|
15916
16269
|
setTooltipIndex(null);
|
|
15917
|
-
}, style: { cursor: 'pointer' }, children: [jsx("rect", { x: 0, y: -24, width: 20, height: 20, rx: 2, ry: 2, fill: "#fff", strokeWidth: 1, filter: "url(#vertex-tooltip-shadow)" }), jsx("g", { transform: `translate(2, -22)`, children: jsx(SvgDelete
|
|
16270
|
+
}, style: { cursor: 'pointer' }, children: [jsx("rect", { x: 0, y: -24, width: 20, height: 20, rx: 2, ry: 2, fill: "#fff", strokeWidth: 1, filter: "url(#vertex-tooltip-shadow)" }), jsx("g", { transform: `translate(2, -22)`, children: jsx(SvgDelete, {}) })] })), canComplete && (jsx("g", { style: { pointerEvents: 'none' }, transform: `translate(${coord[0] - 5 * overlayScale * 3}, ${coord[1] - 2.5 * overlayScale * 3}) scale(${overlayScale * 3})`, children: jsx("svg", { width: "10", height: "5", viewBox: "0 0 6 5", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: jsx("path", { d: "M0.5 2.5L1.3452 3.3452C1.71469 3.71469 2.30636 3.73741 2.7031 3.39735L5.5 1", stroke: "#FF7A33", "stroke-linecap": "round" }) }) })
|
|
16271
|
+
// <rect
|
|
16272
|
+
// x={coord[0]}
|
|
16273
|
+
// y={coord[1]}
|
|
16274
|
+
// width={20}
|
|
16275
|
+
// height={20}
|
|
16276
|
+
// rx={2}
|
|
16277
|
+
// ry={2}
|
|
16278
|
+
// fill="transparent"
|
|
16279
|
+
// style={{ pointerEvents: 'none' }}
|
|
16280
|
+
// >
|
|
16281
|
+
// </rect>
|
|
16282
|
+
)] }, `vertex-${idx}`));
|
|
15918
16283
|
})] }));
|
|
15919
16284
|
};
|
|
15920
16285
|
|
|
15921
16286
|
const BoundaryElement = ({ data }) => {
|
|
15922
16287
|
const style = data.style || {};
|
|
15923
|
-
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
16288
|
+
const { editMapInfo, setEditMapInfo, onSelectElement } = useMapEditContext();
|
|
15924
16289
|
const { platform } = useCommonContext();
|
|
15925
16290
|
const currentPoints = useMemo(() => {
|
|
15926
16291
|
if (editMapInfo?.selectElement?.id === data.id) {
|
|
@@ -15933,15 +16298,16 @@ const BoundaryElement = ({ data }) => {
|
|
|
15933
16298
|
*/
|
|
15934
16299
|
const strokeWidth = useMemo(() => {
|
|
15935
16300
|
// 如果是h5选中的情况下,边界需要加粗
|
|
15936
|
-
if (
|
|
16301
|
+
if (editMapInfo?.selectElement?.id === data.id) {
|
|
15937
16302
|
return dp2px((style.lineWidth || 3) * 2);
|
|
15938
16303
|
}
|
|
15939
16304
|
return dp2px(style.lineWidth || 3);
|
|
15940
|
-
}, [
|
|
16305
|
+
}, [style, editMapInfo]);
|
|
15941
16306
|
/**
|
|
15942
16307
|
* 点击边界的回调
|
|
15943
16308
|
*/
|
|
15944
16309
|
const onPathClick = useCallback(() => {
|
|
16310
|
+
onSelectElement?.(DataType.BOUNDARY);
|
|
15945
16311
|
if (platform === PlatformType.H5) {
|
|
15946
16312
|
// 对于地块来说,如果当前有元素是在编辑和创建模式下,则不进行选中
|
|
15947
16313
|
if (editMapInfo.mobileMode === MobileEditMode.EDIT ||
|
|
@@ -15966,7 +16332,7 @@ const BoundaryElement = ({ data }) => {
|
|
|
15966
16332
|
}));
|
|
15967
16333
|
}
|
|
15968
16334
|
}, [platform, data, editMapInfo]);
|
|
15969
|
-
return (jsx(PolygonElement, {
|
|
16335
|
+
return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: onPathClick, onCoordinatesChange: (coordinates) => {
|
|
15970
16336
|
console.log('onCoordinatesChange', coordinates);
|
|
15971
16337
|
setEditMapInfo((prev) => ({
|
|
15972
16338
|
...prev,
|
|
@@ -16001,7 +16367,7 @@ const ChannelElement = ({ data }) => {
|
|
|
16001
16367
|
* @returns
|
|
16002
16368
|
*/
|
|
16003
16369
|
const useHistoryHandle = (props) => {
|
|
16004
|
-
const { maxHistoryCount =
|
|
16370
|
+
const { maxHistoryCount = 16 } = {};
|
|
16005
16371
|
const { setEditMapInfo } = useMapEditContext();
|
|
16006
16372
|
// redo
|
|
16007
16373
|
const redo = () => {
|
|
@@ -16036,7 +16402,12 @@ const useHistoryHandle = (props) => {
|
|
|
16036
16402
|
const addHistory = useCallback((history) => {
|
|
16037
16403
|
// 添加历史记录的时候,应该把当前的索引之后的所有历史记录都清空
|
|
16038
16404
|
setEditMapInfo((prev) => {
|
|
16039
|
-
console.log(
|
|
16405
|
+
// console.log(
|
|
16406
|
+
// 'addHistory->',
|
|
16407
|
+
// JSON.stringify(prev?.historyList),
|
|
16408
|
+
// prev?.historyList,
|
|
16409
|
+
// prev.currentHistoryIndex
|
|
16410
|
+
// );
|
|
16040
16411
|
if (!prev?.historyList || prev?.historyList?.length === 0) {
|
|
16041
16412
|
return {
|
|
16042
16413
|
...prev,
|
|
@@ -16045,13 +16416,13 @@ const useHistoryHandle = (props) => {
|
|
|
16045
16416
|
};
|
|
16046
16417
|
}
|
|
16047
16418
|
let newHistoryList = prev.historyList.slice(0, prev.currentHistoryIndex + 1);
|
|
16048
|
-
console.log('newHistoryList->', JSON.stringify(newHistoryList), newHistoryList);
|
|
16419
|
+
// console.log('newHistoryList->', JSON.stringify(newHistoryList), newHistoryList);
|
|
16049
16420
|
// 保持历史记录的条数不超过maxHistoryCount
|
|
16050
16421
|
if (newHistoryList.length >= maxHistoryCount) {
|
|
16051
16422
|
newHistoryList.shift();
|
|
16052
16423
|
}
|
|
16053
16424
|
newHistoryList = [...newHistoryList, history];
|
|
16054
|
-
console.log('newHistoryList result->', JSON.stringify(newHistoryList), newHistoryList);
|
|
16425
|
+
// console.log('newHistoryList result->', JSON.stringify(newHistoryList), newHistoryList);
|
|
16055
16426
|
return {
|
|
16056
16427
|
...prev,
|
|
16057
16428
|
historyList: newHistoryList,
|
|
@@ -16101,6 +16472,7 @@ const ObstacleElement = ({ data }) => {
|
|
|
16101
16472
|
}
|
|
16102
16473
|
}, [editMapInfo]);
|
|
16103
16474
|
const currentPoints = useMemo(() => {
|
|
16475
|
+
// 为了方便解决删除顶点的时候,delete icon被遮挡的问题,所以逆序一下
|
|
16104
16476
|
if (editMapInfo?.selectElement?.id === data.id) {
|
|
16105
16477
|
return editMapInfo.selectElement.points;
|
|
16106
16478
|
}
|
|
@@ -16115,7 +16487,7 @@ const ObstacleElement = ({ data }) => {
|
|
|
16115
16487
|
if (platform === PlatformType.H5 &&
|
|
16116
16488
|
editMapInfo?.selectElement?.id === data.id &&
|
|
16117
16489
|
editMapInfo.mobileMode === MobileEditMode.START) {
|
|
16118
|
-
return (style.lineWidth || 2) *
|
|
16490
|
+
return (style.lineWidth || 2) * 3;
|
|
16119
16491
|
}
|
|
16120
16492
|
return style.lineWidth || 2;
|
|
16121
16493
|
}, [platform, style, editMapInfo]);
|
|
@@ -16144,7 +16516,11 @@ const ObstacleElement = ({ data }) => {
|
|
|
16144
16516
|
setEditMapInfo((prev) => ({
|
|
16145
16517
|
...prev,
|
|
16146
16518
|
selectElement: data,
|
|
16147
|
-
historyList: [
|
|
16519
|
+
historyList: [
|
|
16520
|
+
{
|
|
16521
|
+
selectElement: data,
|
|
16522
|
+
},
|
|
16523
|
+
],
|
|
16148
16524
|
currentHistoryIndex: 0,
|
|
16149
16525
|
elementType: DataType.OBSTACLE,
|
|
16150
16526
|
editMap: true,
|
|
@@ -16158,7 +16534,7 @@ const ObstacleElement = ({ data }) => {
|
|
|
16158
16534
|
}
|
|
16159
16535
|
return editMapInfo?.selectElement?.id === data.id;
|
|
16160
16536
|
}, [editMapInfo, data, platform]);
|
|
16161
|
-
return (jsx(PolygonElement, {
|
|
16537
|
+
return (jsx(PolygonElement, { points: currentPoints, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: editMode, showPoints: editMapInfo?.selectElement?.id === data.id, onPathClick: onPathClick, onPolygonClick: () => {
|
|
16162
16538
|
if (platform === PlatformType.H5) {
|
|
16163
16539
|
onPathClick();
|
|
16164
16540
|
}
|
|
@@ -16585,15 +16961,15 @@ const useVisionOffTransform = (data, scaleConstraints
|
|
|
16585
16961
|
};
|
|
16586
16962
|
};
|
|
16587
16963
|
|
|
16588
|
-
var _g$
|
|
16589
|
-
function _extends$
|
|
16964
|
+
var _g$3, _defs$3;
|
|
16965
|
+
function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
|
|
16590
16966
|
var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
16591
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
16967
|
+
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
16592
16968
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16593
16969
|
width: 20,
|
|
16594
16970
|
height: 20,
|
|
16595
16971
|
fill: "none"
|
|
16596
|
-
}, props), _g$
|
|
16972
|
+
}, props), _g$3 || (_g$3 = /*#__PURE__*/React.createElement("g", {
|
|
16597
16973
|
clipPath: "url(#transform-delete_svg__a)"
|
|
16598
16974
|
}, /*#__PURE__*/React.createElement("circle", {
|
|
16599
16975
|
cx: 10,
|
|
@@ -16616,7 +16992,7 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
|
16616
16992
|
fill: "#fff",
|
|
16617
16993
|
rx: 0.8,
|
|
16618
16994
|
transform: "rotate(45 6.323 5.191)"
|
|
16619
|
-
}))), _defs$
|
|
16995
|
+
}))), _defs$3 || (_defs$3 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
16620
16996
|
id: "transform-delete_svg__b",
|
|
16621
16997
|
x1: 17.727,
|
|
16622
16998
|
x2: -1.215,
|
|
@@ -16636,15 +17012,15 @@ var SvgTransformDelete = function SvgTransformDelete(props) {
|
|
|
16636
17012
|
})))));
|
|
16637
17013
|
};
|
|
16638
17014
|
|
|
16639
|
-
var _g$
|
|
16640
|
-
function _extends$
|
|
17015
|
+
var _g$2, _defs$2;
|
|
17016
|
+
function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
|
|
16641
17017
|
var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
16642
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17018
|
+
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
16643
17019
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16644
17020
|
width: 21,
|
|
16645
17021
|
height: 20,
|
|
16646
17022
|
fill: "none"
|
|
16647
|
-
}, props), _g$
|
|
17023
|
+
}, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
|
|
16648
17024
|
clipPath: "url(#transform-rotate_svg__a)"
|
|
16649
17025
|
}, /*#__PURE__*/React.createElement("path", {
|
|
16650
17026
|
fill: "url(#transform-rotate_svg__b)",
|
|
@@ -16652,7 +17028,7 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
|
16652
17028
|
}), /*#__PURE__*/React.createElement("path", {
|
|
16653
17029
|
fill: "#fff",
|
|
16654
17030
|
d: "M11.602 14.719a5.447 5.447 0 0 1-6.608-5.116l-.004-.205a.818.818 0 0 1 1.633-.084l.004.084.01.285a3.81 3.81 0 0 0 2.127 3.137l.26.115a3.8 3.8 0 0 0 2.227.184l.276-.071q.29-.088.561-.219l-1.147-.441a.817.817 0 0 1 .587-1.525l2.54.977a.817.817 0 0 1 .316 1.308l.001.001a5.45 5.45 0 0 1-2.783 1.57M8.623 4.548a5.447 5.447 0 0 1 6.608 5.116l.004.204a.818.818 0 0 1-1.633.084l-.004-.084-.01-.284a3.81 3.81 0 0 0-2.127-3.138l-.26-.115a3.8 3.8 0 0 0-2.227-.184l-.276.072q-.29.087-.561.218l1.147.442a.817.817 0 0 1-.586 1.524l-2.542-.976a.817.817 0 0 1-.315-1.309 5.45 5.45 0 0 1 2.782-1.57"
|
|
16655
|
-
}))), _defs$
|
|
17031
|
+
}))), _defs$2 || (_defs$2 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
16656
17032
|
id: "transform-rotate_svg__b",
|
|
16657
17033
|
x1: 17.84,
|
|
16658
17034
|
x2: -1.103,
|
|
@@ -16672,15 +17048,15 @@ var SvgTransformRotate = function SvgTransformRotate(props) {
|
|
|
16672
17048
|
})))));
|
|
16673
17049
|
};
|
|
16674
17050
|
|
|
16675
|
-
var _g$
|
|
16676
|
-
function _extends$
|
|
17051
|
+
var _g$1, _defs$1;
|
|
17052
|
+
function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
|
|
16677
17053
|
var SvgTransformScale = function SvgTransformScale(props) {
|
|
16678
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17054
|
+
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
16679
17055
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16680
17056
|
width: 21,
|
|
16681
17057
|
height: 20,
|
|
16682
17058
|
fill: "none"
|
|
16683
|
-
}, props), _g$
|
|
17059
|
+
}, props), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
|
|
16684
17060
|
clipPath: "url(#transform-scale_svg__a)"
|
|
16685
17061
|
}, /*#__PURE__*/React.createElement("path", {
|
|
16686
17062
|
fill: "url(#transform-scale_svg__b)",
|
|
@@ -16688,7 +17064,7 @@ var SvgTransformScale = function SvgTransformScale(props) {
|
|
|
16688
17064
|
}), /*#__PURE__*/React.createElement("path", {
|
|
16689
17065
|
fill: "#fff",
|
|
16690
17066
|
d: "M5.078 8.265a.8.8 0 0 0 1.6.001v-.544l5.69 5.69h-.494a.8.8 0 0 0 0 1.6l2.474-.002a.8.8 0 0 0 .311-.062.8.8 0 0 0 .49-.738v-2.474a.8.8 0 1 0-1.6 0v.594L7.81 6.59h.544a.8.8 0 0 0 0-1.6H5.879a.8.8 0 0 0-.8.8z"
|
|
16691
|
-
}))), _defs$
|
|
17067
|
+
}))), _defs$1 || (_defs$1 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
16692
17068
|
id: "transform-scale_svg__b",
|
|
16693
17069
|
x1: 17.84,
|
|
16694
17070
|
x2: -1.103,
|
|
@@ -16708,15 +17084,15 @@ var SvgTransformScale = function SvgTransformScale(props) {
|
|
|
16708
17084
|
})))));
|
|
16709
17085
|
};
|
|
16710
17086
|
|
|
16711
|
-
var _g
|
|
16712
|
-
function _extends$
|
|
17087
|
+
var _g, _defs;
|
|
17088
|
+
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
16713
17089
|
var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
16714
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17090
|
+
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
16715
17091
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16716
17092
|
width: 20,
|
|
16717
17093
|
height: 20,
|
|
16718
17094
|
fill: "none"
|
|
16719
|
-
}, props), _g
|
|
17095
|
+
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
16720
17096
|
clipPath: "url(#transform-translate_svg__a)"
|
|
16721
17097
|
}, /*#__PURE__*/React.createElement("circle", {
|
|
16722
17098
|
cx: 10,
|
|
@@ -16726,7 +17102,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
|
16726
17102
|
}), /*#__PURE__*/React.createElement("path", {
|
|
16727
17103
|
fill: "#fff",
|
|
16728
17104
|
d: "M16.18 10.758a.8.8 0 0 0-.105-1.218l-1.66-1.66a.801.801 0 0 0-1.132 1.132l.383.381h-2.96V6.418l.385.386a.8.8 0 1 0 1.131-1.13l-1.75-1.75a.8.8 0 0 0-1.222.11L7.594 5.689a.8.8 0 0 0 1.131 1.13l.381-.38v2.954H6.137l.381-.38a.8.8 0 1 0-1.13-1.132l-1.752 1.75a.8.8 0 0 0 .106 1.22l1.66 1.66a.801.801 0 0 0 1.132-1.133l-.386-.385h2.958v2.972l-.38-.38a.8.8 0 0 0-1.132 1.131l1.751 1.75a.8.8 0 0 0 1.223-.11l1.654-1.655a.8.8 0 1 0-1.13-1.131l-.386.386v-2.963h2.978l-.385.384a.8.8 0 1 0 1.131 1.131z"
|
|
16729
|
-
}))), _defs
|
|
17105
|
+
}))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
16730
17106
|
id: "transform-translate_svg__b",
|
|
16731
17107
|
x1: 17.727,
|
|
16732
17108
|
x2: -1.215,
|
|
@@ -16747,6 +17123,7 @@ var SvgTransformTranslate = function SvgTransformTranslate(props) {
|
|
|
16747
17123
|
};
|
|
16748
17124
|
|
|
16749
17125
|
const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCancel, onDragEnd, onDragMove, disabled = false, className = '', scaleConstraints = { minEdgeLength: 0.5, maxEdgeLength: 10000 }, showInfo = true, }) => {
|
|
17126
|
+
const { overlayScale } = useCommonContext();
|
|
16750
17127
|
const { platform } = useCommonContext();
|
|
16751
17128
|
const { editMapInfo } = useMapEditContext();
|
|
16752
17129
|
const dataPoints = useMemo(() => {
|
|
@@ -16862,7 +17239,7 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16862
17239
|
return;
|
|
16863
17240
|
onDragMove?.(currentPoints.map((point) => [point.x, point.y]));
|
|
16864
17241
|
}, [currentPoints, isSelected, isDragging, isRotating, isScaling]);
|
|
16865
|
-
return (jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(PolygonElement, {
|
|
17242
|
+
return (jsxs("g", { ref: containerRef, className: `vision-off-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(PolygonElement, { points: visionOffData?.points, fillColor: style.fillColor, fillOpacity: style.fillOpacity, strokeColor: style.lineColor, strokeWidth: strokeWidth, editMode: false, onPathClick: () => {
|
|
16866
17243
|
onSelect?.();
|
|
16867
17244
|
}, onPolygonClick: () => {
|
|
16868
17245
|
if (platform === PlatformType.H5) {
|
|
@@ -16888,10 +17265,10 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16888
17265
|
const centerX = (minX + maxX) / 2;
|
|
16889
17266
|
// 计算尺寸显示框的位置(选择框下方)
|
|
16890
17267
|
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
16891
|
-
const infoBoxWidth = 140; // 信息框宽度
|
|
16892
|
-
const infoBoxHeight = 30; // 信息框高度
|
|
17268
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
17269
|
+
const infoBoxHeight = 30 * overlayScale; // 信息框高度
|
|
16893
17270
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
16894
|
-
const scale = isWeb ? 2 : 1;
|
|
17271
|
+
const scale = (isWeb ? 2 : 1) * overlayScale;
|
|
16895
17272
|
const offsetLeft = 10 * scale;
|
|
16896
17273
|
return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#9EA6BA", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
16897
17274
|
? {
|
|
@@ -16943,7 +17320,8 @@ const VisionOffTransformWrapper = ({ data, isSelected = false, onSelect, onCance
|
|
|
16943
17320
|
fontSize: '12px',
|
|
16944
17321
|
color: 'white',
|
|
16945
17322
|
fontWeight: '400',
|
|
16946
|
-
|
|
17323
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
17324
|
+
}, children: [dimensions.height, " m \u00D7 ", dimensions.width, " m"] }) }))] }));
|
|
16947
17325
|
})()] }));
|
|
16948
17326
|
};
|
|
16949
17327
|
|
|
@@ -17000,7 +17378,11 @@ const VisionOffElement = ({ data, onSelect }) => {
|
|
|
17000
17378
|
...prev,
|
|
17001
17379
|
selectElement: data,
|
|
17002
17380
|
elementType: DataType.VISION_OFF,
|
|
17003
|
-
historyList: [
|
|
17381
|
+
historyList: [
|
|
17382
|
+
{
|
|
17383
|
+
selectElement: data,
|
|
17384
|
+
},
|
|
17385
|
+
],
|
|
17004
17386
|
currentHistoryIndex: 0,
|
|
17005
17387
|
editMap: true,
|
|
17006
17388
|
isShowDrag: true,
|
|
@@ -17362,8 +17744,8 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
17362
17744
|
const scaledHeight = height * currentScale;
|
|
17363
17745
|
// 转换为米单位(假设SVG坐标单位是米)
|
|
17364
17746
|
// 这里可以根据实际的地图比例尺进行调整
|
|
17365
|
-
const widthInMeters = scaledWidth;
|
|
17366
|
-
const heightInMeters = scaledHeight;
|
|
17747
|
+
const widthInMeters = scaledWidth / SCALE_FACTOR;
|
|
17748
|
+
const heightInMeters = scaledHeight / SCALE_FACTOR;
|
|
17367
17749
|
return {
|
|
17368
17750
|
width: Math.round(widthInMeters * 100) / 100, // 保留2位小数
|
|
17369
17751
|
height: Math.round(heightInMeters * 100) / 100, // 保留2位小数
|
|
@@ -17395,15 +17777,15 @@ const useDoodleTransform = (data, onTransformChange, options) => {
|
|
|
17395
17777
|
};
|
|
17396
17778
|
};
|
|
17397
17779
|
|
|
17398
|
-
var _path$
|
|
17399
|
-
function _extends$
|
|
17780
|
+
var _path$1;
|
|
17781
|
+
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
17400
17782
|
var SvgTransformArrow = function SvgTransformArrow(props) {
|
|
17401
|
-
return /*#__PURE__*/React.createElement("svg", _extends$
|
|
17783
|
+
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
17402
17784
|
xmlns: "http://www.w3.org/2000/svg",
|
|
17403
17785
|
width: 7,
|
|
17404
17786
|
height: 11,
|
|
17405
17787
|
fill: "none"
|
|
17406
|
-
}, props), _path$
|
|
17788
|
+
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
17407
17789
|
fill: "#fff",
|
|
17408
17790
|
d: "M2.156 1.032a.777.777 0 0 0-1.061 0 .69.69 0 0 0-.062.943l.062.068 3.97 3.78-3.97 3.78a.69.69 0 0 0-.062.944l.062.067c.27.257.696.277.99.06l.07-.06 4.5-4.286a.69.69 0 0 0 .063-.943l-.062-.067z",
|
|
17409
17791
|
opacity: 0.5
|
|
@@ -17464,8 +17846,8 @@ const DoodleTransform = ({ data, isSelected: _isSelected, onSelect }) => {
|
|
|
17464
17846
|
}
|
|
17465
17847
|
};
|
|
17466
17848
|
|
|
17467
|
-
const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, }) => {
|
|
17468
|
-
const { platform } = useCommonContext();
|
|
17849
|
+
const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOperation = false, onSelect, onCancel, onTransformChange, disabled = false, className = '', minScale, onMinScaleReached, onDragMove, onDragEnd, showInfo = true, onClickInfo, }) => {
|
|
17850
|
+
const { platform, overlayScale } = useCommonContext();
|
|
17469
17851
|
// 使用自定义hook管理所有变换逻辑
|
|
17470
17852
|
const { currentCenter, currentScale, currentDirection, isDragging, isRotating, isScaling, initializeTransform, calculateSelectionBoxPoints, handleMouseDown, handleRotateStart, handleScaleStart, handleMouseMove, handleMouseUp, containerRef, dimensions, } = useDoodleTransform(data, onTransformChange, {
|
|
17471
17853
|
minScale,
|
|
@@ -17486,6 +17868,21 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17486
17868
|
};
|
|
17487
17869
|
}, [data?.svg, currentCenter, currentScale, currentDirection]);
|
|
17488
17870
|
const isWeb = useMemo(() => platform === 'web', [platform]);
|
|
17871
|
+
const activeTime = useMemo(() => {
|
|
17872
|
+
if (data.create_ts && data.expiration_ts) {
|
|
17873
|
+
return Math.floor((data.expiration_ts - data.create_ts) / (60 * 60 * 24));
|
|
17874
|
+
}
|
|
17875
|
+
return 0;
|
|
17876
|
+
}, [data]);
|
|
17877
|
+
const remainingTime = useMemo(() => {
|
|
17878
|
+
const currentTime = Math.floor(Date.now() / 1000);
|
|
17879
|
+
console.log('data.expiration_ts--', data.expiration_ts);
|
|
17880
|
+
if (data.expiration_ts <= currentTime) {
|
|
17881
|
+
return 0;
|
|
17882
|
+
}
|
|
17883
|
+
// 保留一位小数
|
|
17884
|
+
return ((data.expiration_ts - currentTime) / (24 * 60 * 60)).toFixed(1);
|
|
17885
|
+
}, [data]);
|
|
17489
17886
|
// 初始化变换状态
|
|
17490
17887
|
useEffect(() => {
|
|
17491
17888
|
initializeTransform();
|
|
@@ -17503,6 +17900,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17503
17900
|
onEnd: (event) => {
|
|
17504
17901
|
event.preventDefault();
|
|
17505
17902
|
handleMouseUp();
|
|
17903
|
+
onDragEnd?.(transformedData);
|
|
17506
17904
|
},
|
|
17507
17905
|
}, platform);
|
|
17508
17906
|
document.body.style.userSelect = 'none';
|
|
@@ -17565,7 +17963,18 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17565
17963
|
};
|
|
17566
17964
|
const selectionBoxWithoutOperation = () => {
|
|
17567
17965
|
const selectionBoxPoints = calculateSelectionBoxPoints();
|
|
17568
|
-
|
|
17966
|
+
// 计算选择框的边界
|
|
17967
|
+
const minX = Math.min(...selectionBoxPoints.map((p) => p.x));
|
|
17968
|
+
const maxX = Math.max(...selectionBoxPoints.map((p) => p.x));
|
|
17969
|
+
const maxY = Math.max(...selectionBoxPoints.map((p) => p.y));
|
|
17970
|
+
// 计算选择框的中心
|
|
17971
|
+
const centerX = (minX + maxX) / 2;
|
|
17972
|
+
// 计算尺寸显示框的位置(选择框下方)
|
|
17973
|
+
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
17974
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
17975
|
+
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
17976
|
+
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
17977
|
+
return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#B2B4B9", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
17569
17978
|
? {
|
|
17570
17979
|
onTouchStart: createReactEventHandler((e) => {
|
|
17571
17980
|
handleMouseDownWithDisabled(e);
|
|
@@ -17573,7 +17982,27 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17573
17982
|
}
|
|
17574
17983
|
: {
|
|
17575
17984
|
onMouseDown: handleMouseDownWithDisabled,
|
|
17576
|
-
}) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r:
|
|
17985
|
+
}) }), jsx("circle", { cx: selectionBoxPoints[0].x, cy: selectionBoxPoints[0].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[3].x, cy: selectionBoxPoints[3].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[1].x, cy: selectionBoxPoints[1].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), jsx("circle", { cx: selectionBoxPoints[2].x, cy: selectionBoxPoints[2].y, r: 10 * overlayScale, fill: "#B2B4B9", stroke: "none" }), platform === PlatformType.H5 && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
|
|
17986
|
+
onClickInfo?.();
|
|
17987
|
+
}, children: jsx("div", { style: {
|
|
17988
|
+
padding: '5px 6px',
|
|
17989
|
+
background: 'rgba(201, 209, 218, 1)',
|
|
17990
|
+
borderRadius: '10px',
|
|
17991
|
+
display: 'inline-flex',
|
|
17992
|
+
flexDirection: 'column',
|
|
17993
|
+
alignItems: 'flex-start',
|
|
17994
|
+
justifyContent: 'center',
|
|
17995
|
+
fontSize: '12px',
|
|
17996
|
+
color: 'white',
|
|
17997
|
+
fontWeight: '400',
|
|
17998
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
17999
|
+
}, children: jsx("div", { style: {
|
|
18000
|
+
display: 'flex',
|
|
18001
|
+
alignItems: 'center',
|
|
18002
|
+
justifyContent: 'center',
|
|
18003
|
+
gap: '10px',
|
|
18004
|
+
color: '#325069',
|
|
18005
|
+
}, children: jsxs("div", { children: ["Remaining Time: ", remainingTime] }) }) }) }))] }));
|
|
17577
18006
|
};
|
|
17578
18007
|
useEffect(() => {
|
|
17579
18008
|
const isMove = isDragging || isRotating || isScaling;
|
|
@@ -17590,7 +18019,8 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17590
18019
|
transformedData?.direction,
|
|
17591
18020
|
transformedData?.scale,
|
|
17592
18021
|
]);
|
|
17593
|
-
return (jsxs("g", { ref: containerRef, className: `doodle-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(DoodleTransform, { data: transformedData, onSelect: onSelect, isSelected: isSelected }),
|
|
18022
|
+
return (jsxs("g", { ref: containerRef, className: `doodle-transform-wrapper ${className} ${isSelected ? 'selected' : ''}`, "data-transform-wrapper": "true", children: [jsx(DoodleTransform, { data: transformedData, onSelect: onSelect, isSelected: isSelected }), isSelected && isSelectedWithoutOperation && selectionBoxWithoutOperation(), isSelected &&
|
|
18023
|
+
!isSelectedWithoutOperation &&
|
|
17594
18024
|
(() => {
|
|
17595
18025
|
const selectionBoxPoints = calculateSelectionBoxPoints();
|
|
17596
18026
|
// 计算 doodle 的边界框
|
|
@@ -17611,6 +18041,7 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17611
18041
|
onMouseDown: handleMouseDownWithDisabled,
|
|
17612
18042
|
}) }));
|
|
17613
18043
|
})(), isSelected &&
|
|
18044
|
+
!isSelectedWithoutOperation &&
|
|
17614
18045
|
(() => {
|
|
17615
18046
|
const selectionBoxPoints = calculateSelectionBoxPoints();
|
|
17616
18047
|
// 计算选择框的边界
|
|
@@ -17621,10 +18052,10 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17621
18052
|
const centerX = (minX + maxX) / 2;
|
|
17622
18053
|
// 计算尺寸显示框的位置(选择框下方)
|
|
17623
18054
|
const infoBoxY = maxY + 20; // 选择框下方20像素
|
|
17624
|
-
const infoBoxWidth = 140; // 信息框宽度
|
|
17625
|
-
const infoBoxHeight =
|
|
18055
|
+
const infoBoxWidth = 140 * overlayScale; // 信息框宽度
|
|
18056
|
+
const infoBoxHeight = 100 * overlayScale; // 信息框高度
|
|
17626
18057
|
const infoBoxX = centerX - infoBoxWidth / 2; // 居中对齐
|
|
17627
|
-
const scale = isWeb ? 2 : 1;
|
|
18058
|
+
const scale = (isWeb ? 2 : 1) * overlayScale;
|
|
17628
18059
|
const offsetLeft = 10 * scale;
|
|
17629
18060
|
return (jsxs(Fragment, { children: [jsx("polygon", { points: selectionBoxPoints.map((point) => `${point.x},${point.y}`).join(' '), fill: "none", stroke: "#9EA6BA", strokeWidth: "2", strokeDasharray: "5,5", vectorEffect: "non-scaling-stroke", style: { cursor: 'move' }, ...(platform === PlatformType.H5
|
|
17630
18061
|
? {
|
|
@@ -17666,7 +18097,9 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17666
18097
|
}
|
|
17667
18098
|
: {
|
|
17668
18099
|
onMouseDown: handleScaleStartWithDisabled,
|
|
17669
|
-
}), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) }), showInfo && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' },
|
|
18100
|
+
}), transform: `translate(${selectionBoxPoints[2].x}, ${selectionBoxPoints[2].y})`, children: jsx("g", { style: { cursor: 'pointer' }, transformOrigin: "center", transform: `translate(-${offsetLeft}, -${offsetLeft}) scale(${scale})`, children: jsx(SvgTransformScale, {}) }) }), showInfo && (jsx("foreignObject", { x: infoBoxX, y: infoBoxY, width: infoBoxWidth, height: infoBoxHeight, style: { textAlign: 'center' }, onClick: () => {
|
|
18101
|
+
onClickInfo?.();
|
|
18102
|
+
}, children: jsxs("div", { style: {
|
|
17670
18103
|
padding: '5px 6px',
|
|
17671
18104
|
background: 'linear-gradient(266.64deg, #F26A2A 4.1%, #F2942A 86.42%)',
|
|
17672
18105
|
borderRadius: '10px',
|
|
@@ -17677,28 +18110,31 @@ const DoodleTransformWrapper = ({ data, isSelected = false, isSelectedWithoutOpe
|
|
|
17677
18110
|
fontSize: '12px',
|
|
17678
18111
|
color: 'white',
|
|
17679
18112
|
fontWeight: '400',
|
|
17680
|
-
|
|
18113
|
+
// transform: `translate(0, ${50 * overlayScale}px) scale(${overlayScale})`,
|
|
18114
|
+
}, children: [jsxs("div", { children: [dimensions.width, " m \u00D7 ", dimensions.height, " m"] }), jsxs("div", { style: {
|
|
17681
18115
|
display: 'flex',
|
|
17682
18116
|
alignItems: 'center',
|
|
17683
18117
|
justifyContent: 'center',
|
|
17684
18118
|
gap: '10px',
|
|
17685
|
-
}, children: [
|
|
18119
|
+
}, children: [jsxs("div", { children: ["Active Time: ", activeTime] }), jsx(SvgTransformArrow, {})] })] }) }))] }));
|
|
17686
18120
|
})()] }));
|
|
17687
18121
|
};
|
|
17688
18122
|
|
|
17689
18123
|
const DoodleElement = ({ data }) => {
|
|
17690
|
-
const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
|
|
18124
|
+
const { editMapInfo, setEditMapInfo, onHandleEnterRecord, onHandleEvent } = useMapEditContext();
|
|
17691
18125
|
const { addHistory } = useHistoryHandle();
|
|
17692
|
-
const { platform } = useCommonContext();
|
|
18126
|
+
const { platform, doodleList } = useCommonContext();
|
|
17693
18127
|
const isSelected = useMemo(() => {
|
|
17694
|
-
if (platform === PlatformType.H5) {
|
|
17695
|
-
|
|
17696
|
-
|
|
17697
|
-
|
|
17698
|
-
|
|
17699
|
-
|
|
17700
|
-
}
|
|
17701
|
-
return editMapInfo?.isShowDrag && editMapInfo?.selectElement?.id === data.id;
|
|
18128
|
+
// if (platform === PlatformType.H5) {
|
|
18129
|
+
// if (
|
|
18130
|
+
// editMapInfo.mobileMode !== MobileEditMode.START &&
|
|
18131
|
+
// editMapInfo?.selectElement?.id === data.id
|
|
18132
|
+
// ) {
|
|
18133
|
+
// return true;
|
|
18134
|
+
// }
|
|
18135
|
+
// return editMapInfo?.isShowDrag && editMapInfo?.selectElement?.id === data.id;
|
|
18136
|
+
// }
|
|
18137
|
+
return editMapInfo?.elementType && editMapInfo?.selectElement?.id === data.id;
|
|
17702
18138
|
}, [editMapInfo, data]);
|
|
17703
18139
|
const originData = useMemo(() => {
|
|
17704
18140
|
if (editMapInfo?.selectElement?.id === data.id) {
|
|
@@ -17706,14 +18142,28 @@ const DoodleElement = ({ data }) => {
|
|
|
17706
18142
|
}
|
|
17707
18143
|
return data;
|
|
17708
18144
|
}, [data, editMapInfo?.selectElement]);
|
|
18145
|
+
const minScale = useMemo(() => {
|
|
18146
|
+
const doodleInfo = doodleList?.find((item) => {
|
|
18147
|
+
// 移除所有空白字符(包括\n、\r、\t等)进行比较
|
|
18148
|
+
const normalizedItemSvg = item.svgStr?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
|
|
18149
|
+
const normalizedOriginSvg = originData.svg?.replace(/[\s\n\r\t]+/g, '').replace(/\\n/g, '');
|
|
18150
|
+
// console.log('normalizedItemSvg--->', normalizedItemSvg, normalizedOriginSvg);
|
|
18151
|
+
return normalizedItemSvg === normalizedOriginSvg;
|
|
18152
|
+
});
|
|
18153
|
+
if (!doodleInfo) {
|
|
18154
|
+
return 1;
|
|
18155
|
+
}
|
|
18156
|
+
const minLength = doodleInfo?.minLength;
|
|
18157
|
+
const parseSvg = SvgParserNative.parseSvg(originData.svg);
|
|
18158
|
+
const svgMinLength = parseSvg.height / SCALE_FACTOR;
|
|
18159
|
+
return minLength / svgMinLength;
|
|
18160
|
+
}, [doodleList, originData]);
|
|
17709
18161
|
const isSelectedWithoutOperation = useMemo(() => {
|
|
18162
|
+
const isExistDoodle = Boolean(editMapInfo?.elementType && editMapInfo?.selectElement?.id === data.id && data?.id);
|
|
17710
18163
|
if (platform === PlatformType.H5) {
|
|
17711
|
-
|
|
17712
|
-
editMapInfo?.selectElement?.id === data.id) {
|
|
17713
|
-
return true;
|
|
17714
|
-
}
|
|
18164
|
+
return editMapInfo.mobileMode === MobileEditMode.START && isExistDoodle;
|
|
17715
18165
|
}
|
|
17716
|
-
return
|
|
18166
|
+
return isExistDoodle;
|
|
17717
18167
|
}, [editMapInfo, platform, data]);
|
|
17718
18168
|
const transformedElements = useMemo(() => {
|
|
17719
18169
|
return transformSvgElements(data);
|
|
@@ -17723,9 +18173,8 @@ const DoodleElement = ({ data }) => {
|
|
|
17723
18173
|
if (platform === PlatformType.H5) {
|
|
17724
18174
|
// h5编辑模式下,
|
|
17725
18175
|
// 如果是创建,只能选择新建的doodle
|
|
17726
|
-
if (
|
|
17727
|
-
editMapInfo.mobileMode === MobileEditMode.EDIT)
|
|
17728
|
-
editMapInfo.elementType !== DataType.DOODLE) {
|
|
18176
|
+
if (editMapInfo.mobileMode === MobileEditMode.CREATE ||
|
|
18177
|
+
editMapInfo.mobileMode === MobileEditMode.EDIT) {
|
|
17729
18178
|
return;
|
|
17730
18179
|
}
|
|
17731
18180
|
// 如果是编辑的话
|
|
@@ -17746,7 +18195,14 @@ const DoodleElement = ({ data }) => {
|
|
|
17746
18195
|
})?.then(() => {
|
|
17747
18196
|
setEditMapInfo((prev) => ({
|
|
17748
18197
|
...prev,
|
|
17749
|
-
historyList: [
|
|
18198
|
+
historyList: [
|
|
18199
|
+
{
|
|
18200
|
+
selectElement: {
|
|
18201
|
+
...data,
|
|
18202
|
+
transformedPoints: transformedElements,
|
|
18203
|
+
},
|
|
18204
|
+
},
|
|
18205
|
+
],
|
|
17750
18206
|
currentHistoryIndex: 0,
|
|
17751
18207
|
selectElement: {
|
|
17752
18208
|
...data,
|
|
@@ -17759,6 +18215,16 @@ const DoodleElement = ({ data }) => {
|
|
|
17759
18215
|
});
|
|
17760
18216
|
}, [data, onHandleEnterRecord, platform, editMapInfo]);
|
|
17761
18217
|
const handleCancel = useCallback(() => {
|
|
18218
|
+
if (platform === PlatformType.H5) {
|
|
18219
|
+
setEditMapInfo((prev) => ({
|
|
18220
|
+
...prev,
|
|
18221
|
+
selectElement: null,
|
|
18222
|
+
}));
|
|
18223
|
+
addHistory({
|
|
18224
|
+
selectElement: null,
|
|
18225
|
+
});
|
|
18226
|
+
return;
|
|
18227
|
+
}
|
|
17762
18228
|
setEditMapInfo((prev) => ({
|
|
17763
18229
|
...prev,
|
|
17764
18230
|
editMap: false,
|
|
@@ -17767,6 +18233,9 @@ const DoodleElement = ({ data }) => {
|
|
|
17767
18233
|
isShowDrag: false,
|
|
17768
18234
|
}));
|
|
17769
18235
|
}, []);
|
|
18236
|
+
const handleClickInfo = useCallback(() => {
|
|
18237
|
+
onHandleEvent?.(ClickEventType.DOODLE_ACTIVE_TIME);
|
|
18238
|
+
}, [onHandleEvent]);
|
|
17770
18239
|
// const handleDragMove = useCallback(
|
|
17771
18240
|
// (data: DoodleData) => {
|
|
17772
18241
|
// setEditMapInfo((prev: EditMapInfo) => ({
|
|
@@ -17794,7 +18263,8 @@ const DoodleElement = ({ data }) => {
|
|
|
17794
18263
|
},
|
|
17795
18264
|
});
|
|
17796
18265
|
}, [transformedElements]);
|
|
17797
|
-
|
|
18266
|
+
console.log('isSelectedWithoutOperation--->', editMapInfo, isSelectedWithoutOperation, isSelected);
|
|
18267
|
+
return (jsx(DoodleTransformWrapper, { data: originData, onTransformChange: handleTransformChange, isSelected: isSelected, isSelectedWithoutOperation: isSelectedWithoutOperation, onSelect: handleSelect, onCancel: handleCancel, onDragEnd: handleDragEnd, showInfo: platform === PlatformType.H5, onClickInfo: handleClickInfo, minScale: minScale }));
|
|
17798
18268
|
};
|
|
17799
18269
|
|
|
17800
18270
|
const SvgElement = React__default.memo(({ type, data, interactive = false }) => {
|
|
@@ -17839,9 +18309,9 @@ const GElement = ({ type, children }) => {
|
|
|
17839
18309
|
return jsx("g", { id: `layer-${type}`, children: children }, type);
|
|
17840
18310
|
};
|
|
17841
18311
|
|
|
17842
|
-
var css_248z$
|
|
17843
|
-
var styles$
|
|
17844
|
-
styleInject(css_248z$
|
|
18312
|
+
var css_248z$1 = ".index-module_mapEdit__XC5Gw {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 100%;\n height: 100%;\n cursor: default;\n}\n.index-module_mapEdit__XC5Gw.index-module_createMode__14EPH {\n cursor: crosshair;\n}\n.index-module_mapEdit__XC5Gw.index-module_notCreateCursor__1-OjF {\n cursor: no-drop;\n}";
|
|
18313
|
+
var styles$1 = {"mapEdit":"index-module_mapEdit__XC5Gw","createMode":"index-module_createMode__14EPH","notCreateCursor":"index-module_notCreateCursor__1-OjF"};
|
|
18314
|
+
styleInject(css_248z$1);
|
|
17845
18315
|
|
|
17846
18316
|
var classnames = {exports: {}};
|
|
17847
18317
|
|
|
@@ -17924,22 +18394,18 @@ var classnamesExports = classnames.exports;
|
|
|
17924
18394
|
var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
17925
18395
|
|
|
17926
18396
|
const ChannelClipPath = React__default.memo(() => {
|
|
17927
|
-
const {
|
|
17928
|
-
const {
|
|
18397
|
+
const { svgViewBox } = useCommonContext();
|
|
18398
|
+
const { svgElementDatas } = useSvgEditContext();
|
|
17929
18399
|
const boundaryData = svgElementDatas?.[DataType.BOUNDARY] || [];
|
|
17930
|
-
useEffect(() => {
|
|
17931
|
-
console.log('ChannelClipPath', svgElementDatas);
|
|
17932
|
-
}, [svgElementDatas]);
|
|
17933
|
-
// console.log('ChannelClipPath refresh', svgElementDatas, editMapInfo);
|
|
17934
18400
|
const [minX, minY, maxX, maxY] = useMemo(() => {
|
|
17935
|
-
const baseVal =
|
|
18401
|
+
const baseVal = svgViewBox;
|
|
17936
18402
|
return [
|
|
17937
18403
|
baseVal?.x || 0,
|
|
17938
18404
|
baseVal?.y || 0,
|
|
17939
18405
|
baseVal?.x + (baseVal?.width || 0),
|
|
17940
18406
|
baseVal?.y + (baseVal?.height || 0),
|
|
17941
18407
|
];
|
|
17942
|
-
}, [
|
|
18408
|
+
}, [svgViewBox]);
|
|
17943
18409
|
/**
|
|
17944
18410
|
* 判断多边形是否为逆时针方向
|
|
17945
18411
|
* 使用叉积法计算多边形的有向面积
|
|
@@ -18839,7 +19305,7 @@ function usePolygonDrawing(options = {}) {
|
|
|
18839
19305
|
const [mousePos, setMousePos] = useState(null);
|
|
18840
19306
|
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
18841
19307
|
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
18842
|
-
const { addHistory
|
|
19308
|
+
const { addHistory} = useHistoryHandle();
|
|
18843
19309
|
const points = useMemo(() => {
|
|
18844
19310
|
console.log('points->', editMapInfo?.selectElement?.points);
|
|
18845
19311
|
return editMapInfo?.selectElement?.points?.map((item) => ({ x: item[0], y: item[1] })) || [];
|
|
@@ -18893,8 +19359,13 @@ function usePolygonDrawing(options = {}) {
|
|
|
18893
19359
|
setEditMapInfo({
|
|
18894
19360
|
...editMapInfo,
|
|
18895
19361
|
createMode: CreateStatus.COMPLETED,
|
|
19362
|
+
historyList: [
|
|
19363
|
+
{
|
|
19364
|
+
selectElement: editMapInfo.selectElement,
|
|
19365
|
+
},
|
|
19366
|
+
],
|
|
19367
|
+
currentHistoryIndex: 0,
|
|
18896
19368
|
});
|
|
18897
|
-
clearHistory();
|
|
18898
19369
|
}
|
|
18899
19370
|
}, [points.length, editMapInfo]);
|
|
18900
19371
|
const reset = useCallback(() => {
|
|
@@ -19027,27 +19498,37 @@ const getScreenCenterSvgPoint = (svgElement, mapInstance) => {
|
|
|
19027
19498
|
*/
|
|
19028
19499
|
const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPointsChange, styles, points }, ref) => {
|
|
19029
19500
|
const { mapRef } = useCommonContext();
|
|
19501
|
+
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
19030
19502
|
// 使用固定的样式,确保能正常渲染
|
|
19031
19503
|
// 在十字准心位置添加点
|
|
19032
19504
|
const addPoint = useCallback(() => {
|
|
19033
19505
|
if (!enabled || !svgElement) {
|
|
19034
19506
|
console.warn('未启用创建模式或SVG元素不存在');
|
|
19035
|
-
return false;
|
|
19507
|
+
return { isValid: false, reason: '未启用创建模式或SVG元素不存在' };
|
|
19036
19508
|
}
|
|
19037
19509
|
if (!mapRef) {
|
|
19038
19510
|
console.warn('地图实例不存在');
|
|
19039
|
-
return false;
|
|
19511
|
+
return { isValid: false, reason: '地图实例不存在' };
|
|
19040
19512
|
}
|
|
19041
19513
|
const centerPoint = getScreenCenterSvgPoint(svgElement, mapRef);
|
|
19042
19514
|
if (!centerPoint) {
|
|
19043
19515
|
console.warn('无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内');
|
|
19044
|
-
|
|
19045
|
-
|
|
19046
|
-
|
|
19516
|
+
return { isValid: false, reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内' };
|
|
19517
|
+
}
|
|
19518
|
+
console.error('centerPoint--->', centerPoint);
|
|
19519
|
+
console.error('checkCanNotCreateAtPosition--->', checkCanNotCreateAtPosition(centerPoint));
|
|
19520
|
+
// 校验是否能打点
|
|
19521
|
+
if (checkCanNotCreateAtPosition(centerPoint)) {
|
|
19522
|
+
return {
|
|
19523
|
+
isValid: false,
|
|
19524
|
+
reason: '无法获取屏幕中心点的SVG坐标或点不在SVG可见区域内',
|
|
19525
|
+
};
|
|
19047
19526
|
}
|
|
19048
19527
|
const newPoints = [...points, centerPoint];
|
|
19049
19528
|
onPointsChange?.(newPoints);
|
|
19050
|
-
return
|
|
19529
|
+
return {
|
|
19530
|
+
isValid: true,
|
|
19531
|
+
};
|
|
19051
19532
|
}, [enabled, svgElement, mapRef, points, onPointsChange]);
|
|
19052
19533
|
// 撤销最后一个点
|
|
19053
19534
|
const undoLastPoint = useCallback(() => {
|
|
@@ -19081,7 +19562,7 @@ const CreateObstacleElement = forwardRef(({ enabled = false, svgElement, onPoint
|
|
|
19081
19562
|
if (!enabled || points.length === 0) {
|
|
19082
19563
|
return null;
|
|
19083
19564
|
}
|
|
19084
|
-
return (jsx(PolygonElement, {
|
|
19565
|
+
return (jsx(PolygonElement, { points: points.map((p) => [p.x, p.y, 2]), fillColor: styles.fillColor, fillOpacity: 0.3, strokeColor: styles.strokeColor, strokeWidth: 2, strokeOpacity: 1, createMode: true, showPoints: true, editMode: false, completed: true, draggable: false }));
|
|
19085
19566
|
});
|
|
19086
19567
|
CreateObstacleElement.displayName = 'CreateObstacleElement';
|
|
19087
19568
|
|
|
@@ -19134,10 +19615,10 @@ const useCreateVisionOffElement = () => {
|
|
|
19134
19615
|
|
|
19135
19616
|
const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChange }, ref) => {
|
|
19136
19617
|
const pointManagerRef = useRef(null);
|
|
19137
|
-
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
19138
|
-
const { getVisionOffPoints } = useCreateVisionOffElement();
|
|
19618
|
+
const { editMapInfo, setEditMapInfo, onSelectElement } = useMapEditContext();
|
|
19619
|
+
const { getVisionOffPoints, centerPoint } = useCreateVisionOffElement();
|
|
19139
19620
|
const { svgElementDatas } = useSvgEditContext();
|
|
19140
|
-
const { checkCanNotCreateAtPosition } = useCheckElement();
|
|
19621
|
+
const { checkCanNotCreateAtPosition, checkDoodle } = useCheckElement();
|
|
19141
19622
|
const svgRef = useRef(null);
|
|
19142
19623
|
const containerRef = useRef(null);
|
|
19143
19624
|
const { platform } = useCommonContext();
|
|
@@ -19152,6 +19633,24 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
19152
19633
|
const isCreating = useMemo(() => {
|
|
19153
19634
|
return editMapInfo.createMode === CreateStatus.CREATING;
|
|
19154
19635
|
}, [editMapInfo.createMode]);
|
|
19636
|
+
const centerBounds = useMemo(() => {
|
|
19637
|
+
if (!svgRef || !centerPoint)
|
|
19638
|
+
return null;
|
|
19639
|
+
const elementWidth = 50 * 10;
|
|
19640
|
+
const [minX, minY, maxX, maxY] = [
|
|
19641
|
+
centerPoint[0] - elementWidth / 2,
|
|
19642
|
+
centerPoint[1] - elementWidth / 2,
|
|
19643
|
+
centerPoint[0] + elementWidth / 2,
|
|
19644
|
+
centerPoint[1] + elementWidth / 2,
|
|
19645
|
+
];
|
|
19646
|
+
const elementPoints = [
|
|
19647
|
+
[minX, minY],
|
|
19648
|
+
[minX, maxY],
|
|
19649
|
+
[maxX, maxY],
|
|
19650
|
+
[maxX, minY],
|
|
19651
|
+
];
|
|
19652
|
+
return elementPoints;
|
|
19653
|
+
}, [centerPoint]);
|
|
19155
19654
|
// 调整SVG大小的函数
|
|
19156
19655
|
const adjustSvgSize = (layoutData) => {
|
|
19157
19656
|
const padding = 20; // 添加一些边距以避免内容贴边
|
|
@@ -19234,1761 +19733,231 @@ const SvgEditMap = forwardRef(({ mapJson, mapConfig, editMap, onEditInfoMapChang
|
|
|
19234
19733
|
addHistory({
|
|
19235
19734
|
selectElement: editMapInfo.selectElement,
|
|
19236
19735
|
allVisionOffPoints,
|
|
19237
|
-
});
|
|
19238
|
-
};
|
|
19239
|
-
|
|
19240
|
-
|
|
19241
|
-
|
|
19242
|
-
|
|
19243
|
-
|
|
19244
|
-
|
|
19245
|
-
|
|
19246
|
-
|
|
19247
|
-
|
|
19248
|
-
|
|
19249
|
-
|
|
19250
|
-
|
|
19251
|
-
|
|
19252
|
-
|
|
19253
|
-
|
|
19254
|
-
|
|
19255
|
-
|
|
19256
|
-
|
|
19257
|
-
|
|
19258
|
-
|
|
19259
|
-
|
|
19260
|
-
|
|
19261
|
-
getCreateObstaclePointCount: () => pointManagerRef.current?.getPointCount() || 0,
|
|
19262
|
-
// h5进入视觉失效区编辑模式
|
|
19263
|
-
enterVisionOffEditMode,
|
|
19264
|
-
// h5中添加视觉失效区
|
|
19265
|
-
addVisionOffPoint,
|
|
19266
|
-
// 重做
|
|
19267
|
-
redo,
|
|
19268
|
-
// 撤销
|
|
19269
|
-
undo,
|
|
19270
|
-
// 清空历史记录
|
|
19271
|
-
clearHistory,
|
|
19272
|
-
addHistory,
|
|
19273
|
-
}));
|
|
19274
|
-
// 初始化多边形绘制 Hook
|
|
19275
|
-
const { onSvgClick, onSvgMouseMove, onPointClick, points, completed, mousePos, updatePoints } = usePolygonDrawing({ createMode: isCreating });
|
|
19276
|
-
// 处理删除顶点
|
|
19277
|
-
const handleCreateVertexDelete = (vertexIndex) => {
|
|
19278
|
-
const newPoints = points?.filter((_, index) => index !== vertexIndex);
|
|
19279
|
-
updatePoints(newPoints);
|
|
19280
|
-
};
|
|
19281
|
-
// 基于鼠标位置的检查结果
|
|
19282
|
-
const showNotCreateCursor = useMemo(() => {
|
|
19283
|
-
if (!mousePos)
|
|
19284
|
-
return false;
|
|
19285
|
-
return checkCanNotCreateAtPosition(mousePos);
|
|
19286
|
-
}, [mousePos, checkCanNotCreateAtPosition]);
|
|
19287
|
-
console.log('editMapInfo--->', editMapInfo);
|
|
19288
|
-
return (jsx("div", { ref: containerRef, className: classNames(styles$d.mapEdit, {
|
|
19289
|
-
[styles$d.createMode]: isCreating,
|
|
19290
|
-
[styles$d.notCreateCursor]: showNotCreateCursor,
|
|
19291
|
-
}), style: {
|
|
19292
|
-
display: editMap ? 'block' : 'none',
|
|
19293
|
-
}, children: jsxs("svg", { style: {
|
|
19294
|
-
position: 'absolute',
|
|
19295
|
-
left: '50%',
|
|
19296
|
-
top: '50%',
|
|
19297
|
-
transform: 'translate(-50%, -50%)',
|
|
19298
|
-
// cursor: createMode ? 'crosshair' : editMode ? 'default' : 'move',
|
|
19299
|
-
// pointerEvents: 'auto', // 关键:允许接收鼠标事件
|
|
19300
|
-
}, xmlns: "http://www.w3.org/2000/svg", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", ref: svgRef, onClick: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgClick : undefined, onMouseMove: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgMouseMove : undefined, children: [jsxs("defs", { children: [jsx("filter", { id: "vertex-tooltip-shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: jsx("feDropShadow", { dx: "2", dy: "2", stdDeviation: "2", floodColor: "#000", floodOpacity: "0.12" }) }), jsxs("filter", { id: `path-hover-${DataType.BOUNDARY}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: BOUNDARY_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.VISION_OFF}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: VISION_OFF_AREA_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.OBSTACLE}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: OBSTACLE_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] })] }), Object.keys(svgElementDatas)
|
|
19301
|
-
?.sort?.((a, b) => {
|
|
19302
|
-
const aVal = a === editMapInfo.elementType ? 1 : 0;
|
|
19303
|
-
const bVal = b === editMapInfo.elementType ? 1 : 0;
|
|
19304
|
-
return aVal - bVal;
|
|
19305
|
-
})
|
|
19306
|
-
?.map((key) => {
|
|
19307
|
-
const elements = svgElementDatas[key] || [];
|
|
19308
|
-
return (jsxs(GElement, { type: key, data: elements, children: [key === 'channel' && jsx(ChannelClipPath, {}), elements.map((item) => (jsx(SvgElement, { type: key, data: item }, item?.id)))] }, key));
|
|
19309
|
-
}), platform === PlatformType.WEB &&
|
|
19310
|
-
editMapInfo.createMode &&
|
|
19311
|
-
editMapInfo.elementType !== DataType.DOODLE &&
|
|
19312
|
-
editMapInfo.elementType !== DataType.VISION_OFF &&
|
|
19313
|
-
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(PolygonElement, { coordinates: points?.length > 0
|
|
19314
|
-
? points.map((p) => [p.x, p.y, 2])
|
|
19315
|
-
: editMapInfo?.selectElement?.points, fillColor: createElementStyle.fillColor, strokeColor: createElementStyle.lineColor, strokeWidth: createElementStyle.lineWidth, createMode: editMapInfo.elementType !== DataType.VISION_OFF, showPoints: editMapInfo.elementType !== DataType.VISION_OFF, onPointClick: onPointClick, completed: completed, mousePos: mousePos, onVertexDelete: (vertexIndex) => handleCreateVertexDelete(vertexIndex), onCoordinatesChange: (newCoords) => {
|
|
19316
|
-
// 创建模式下的坐标变化(拖拽时)
|
|
19317
|
-
// 实时更新当前绘制的多边形
|
|
19318
|
-
updatePoints(newCoords.map((coord) => ({ x: coord[0], y: coord[1] })));
|
|
19319
|
-
}, svgRef: svgRef })), platform === PlatformType.WEB &&
|
|
19320
|
-
editMapInfo.createMode &&
|
|
19321
|
-
editMapInfo.elementType === DataType.VISION_OFF &&
|
|
19322
|
-
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(VisionOffElement, { data: {
|
|
19323
|
-
...editMapInfo?.selectElement,
|
|
19324
|
-
style: {
|
|
19325
|
-
fillColor: createElementStyle.fillColor,
|
|
19326
|
-
lineColor: createElementStyle.lineColor,
|
|
19327
|
-
lineWidth: createElementStyle.lineWidth,
|
|
19328
|
-
},
|
|
19329
|
-
} })), platform === PlatformType.WEB &&
|
|
19330
|
-
editMapInfo.createMode &&
|
|
19331
|
-
editMapInfo?.selectElement?.svg && (jsx(DoodleElement, { data: { ...editMapInfo?.selectElement } })), platform === PlatformType.H5 &&
|
|
19332
|
-
editMapInfo.elementType === DataType.OBSTACLE &&
|
|
19333
|
-
editMapInfo.mobileMode === MobileEditMode.CREATE && (jsx(CreateObstacleElement, { ref: pointManagerRef, styles: {
|
|
19334
|
-
fillColor: '#FF7133',
|
|
19335
|
-
strokeColor: '#FF7133',
|
|
19336
|
-
}, points: (editMapInfo?.selectElement?.points || []).map((p) => ({
|
|
19337
|
-
x: p[0],
|
|
19338
|
-
y: p[1],
|
|
19339
|
-
})), enabled: true, svgElement: svgRef.current, onPointsChange: (newPoints) => {
|
|
19340
|
-
const new_points = newPoints.map((p) => [p.x, p.y, 2]);
|
|
19341
|
-
setEditMapInfo((prev) => {
|
|
19342
|
-
return {
|
|
19343
|
-
...prev,
|
|
19344
|
-
selectElement: {
|
|
19345
|
-
...prev.selectElement,
|
|
19346
|
-
points: new_points,
|
|
19347
|
-
},
|
|
19348
|
-
elementType: DataType.OBSTACLE,
|
|
19349
|
-
mobileMode: MobileEditMode.CREATE,
|
|
19350
|
-
};
|
|
19351
|
-
});
|
|
19352
|
-
addHistory({
|
|
19353
|
-
selectElement: { ...editMapInfo?.selectElement, points: new_points },
|
|
19354
|
-
});
|
|
19355
|
-
} })), platform === PlatformType.H5 &&
|
|
19356
|
-
editMapInfo.elementType === DataType.VISION_OFF &&
|
|
19357
|
-
(editMapInfo.mobileMode === MobileEditMode.CREATE ||
|
|
19358
|
-
editMapInfo.mobileMode === MobileEditMode.EDIT) &&
|
|
19359
|
-
editMapInfo.allVisionOffPoints?.length > 0 &&
|
|
19360
|
-
editMapInfo.allVisionOffPoints.map((item) => (jsx(VisionOffElement, { data: {
|
|
19361
|
-
level: 100,
|
|
19362
|
-
renderType: RenderType.POLYGON,
|
|
19363
|
-
type: DataType.VISION_OFF,
|
|
19364
|
-
// ...editMapInfo.selectElement,
|
|
19365
|
-
originalData: {
|
|
19366
|
-
points: item.points,
|
|
19367
|
-
id: item.id,
|
|
19368
|
-
name: '',
|
|
19369
|
-
type: 'VISION_OFF_AREA',
|
|
19370
|
-
},
|
|
19371
|
-
style: {
|
|
19372
|
-
fillColor: createElementStyle.fillColor,
|
|
19373
|
-
lineColor: createElementStyle.lineColor,
|
|
19374
|
-
lineWidth: createElementStyle.lineWidth,
|
|
19375
|
-
},
|
|
19376
|
-
points: item.points,
|
|
19377
|
-
id: item.id,
|
|
19378
|
-
} })))] }) }));
|
|
19379
|
-
});
|
|
19380
|
-
SvgEditMap.displayName = 'SvgEditMap';
|
|
19381
|
-
|
|
19382
|
-
var css_248z$c = ".index-module_addEntry__QsQHD {\n position: absolute;\n right: 8px;\n top: 8px;\n cursor: pointer;\n z-index: 10;\n}\n.index-module_addEntry__QsQHD .index-module_icon__qIgA4 {\n padding: 6px;\n border-radius: 8px;\n background: #fff;\n box-shadow: 2px 2px 12px 0px rgba(0, 0, 0, 0.2);\n}\n\n.index-module_addItem__mglwZ {\n display: flex;\n align-items: center;\n padding: 4px;\n justify-content: flex-start;\n cursor: pointer;\n}\n.index-module_addItem__mglwZ:hover {\n box-shadow: 0px 0px 4px 0px rgba(0, 0, 0, 0.25);\n border-radius: 4px;\n}\n.index-module_addItem__mglwZ:not(:last-child) {\n margin-bottom: 6px;\n}\n.index-module_addItem__mglwZ .index-module_icon__qIgA4 {\n width: 16px;\n height: 16px;\n}\n.index-module_addItem__mglwZ .index-module_label__QqZ-9 {\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n color: rgb(158, 158, 158);\n margin-left: 4px;\n}";
|
|
19383
|
-
var styles$c = {"addEntry":"index-module_addEntry__QsQHD","icon":"index-module_icon__qIgA4","addItem":"index-module_addItem__mglwZ","label":"index-module_label__QqZ-9"};
|
|
19384
|
-
styleInject(css_248z$c);
|
|
19385
|
-
|
|
19386
|
-
var _rect$2, _path$a, _defs$3;
|
|
19387
|
-
function _extends$e() { return _extends$e = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$e.apply(null, arguments); }
|
|
19388
|
-
var SvgAddEntry = function SvgAddEntry(props) {
|
|
19389
|
-
return /*#__PURE__*/React.createElement("svg", _extends$e({
|
|
19390
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19391
|
-
width: 24,
|
|
19392
|
-
height: 24,
|
|
19393
|
-
fill: "none"
|
|
19394
|
-
}, props), _rect$2 || (_rect$2 = /*#__PURE__*/React.createElement("rect", {
|
|
19395
|
-
width: 10.95,
|
|
19396
|
-
height: 10.95,
|
|
19397
|
-
x: 10.613,
|
|
19398
|
-
y: 3.15,
|
|
19399
|
-
fill: "#1F1F1F",
|
|
19400
|
-
stroke: "url(#add-entry_svg__a)",
|
|
19401
|
-
strokeWidth: 0.3,
|
|
19402
|
-
opacity: 0.795,
|
|
19403
|
-
rx: 1.05
|
|
19404
|
-
})), /*#__PURE__*/React.createElement("foreignObject", {
|
|
19405
|
-
width: 23.468,
|
|
19406
|
-
height: 20.501,
|
|
19407
|
-
x: -1.543,
|
|
19408
|
-
y: 3.499
|
|
19409
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
19410
|
-
xmlns: "http://www.w3.org/1999/xhtml",
|
|
19411
|
-
style: {
|
|
19412
|
-
backdropFilter: "blur(1.63px)",
|
|
19413
|
-
clipPath: "url(#add-entry_svg__b)",
|
|
19414
|
-
height: "100%",
|
|
19415
|
-
width: "100%"
|
|
19416
|
-
}
|
|
19417
|
-
})), _path$a || (_path$a = /*#__PURE__*/React.createElement("path", {
|
|
19418
|
-
fill: "#1F1F1F",
|
|
19419
|
-
stroke: "url(#add-entry_svg__c)",
|
|
19420
|
-
strokeWidth: 0.3,
|
|
19421
|
-
d: "M9.302 7.402a1.05 1.05 0 0 1 1.778 0l7.27 11.578a1.05 1.05 0 0 1-.89 1.608H2.92a1.05 1.05 0 0 1-.889-1.608z",
|
|
19422
|
-
"data-figma-bg-blur-radius": 3.262
|
|
19423
|
-
})), _defs$3 || (_defs$3 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
|
|
19424
|
-
id: "add-entry_svg__a",
|
|
19425
|
-
x1: 16.851,
|
|
19426
|
-
x2: 20.384,
|
|
19427
|
-
y1: 10.392,
|
|
19428
|
-
y2: 4.767,
|
|
19429
|
-
gradientUnits: "userSpaceOnUse"
|
|
19430
|
-
}, /*#__PURE__*/React.createElement("stop", {
|
|
19431
|
-
stopColor: "#fff",
|
|
19432
|
-
stopOpacity: 0.01
|
|
19433
|
-
}), /*#__PURE__*/React.createElement("stop", {
|
|
19434
|
-
offset: 1,
|
|
19435
|
-
stopColor: "#fff"
|
|
19436
|
-
})), /*#__PURE__*/React.createElement("linearGradient", {
|
|
19437
|
-
id: "add-entry_svg__c",
|
|
19438
|
-
x1: 21.47,
|
|
19439
|
-
x2: 12.314,
|
|
19440
|
-
y1: 15.036,
|
|
19441
|
-
y2: 5.769,
|
|
19442
|
-
gradientUnits: "userSpaceOnUse"
|
|
19443
|
-
}, /*#__PURE__*/React.createElement("stop", {
|
|
19444
|
-
stopColor: "#fff",
|
|
19445
|
-
stopOpacity: 0.01
|
|
19446
|
-
}), /*#__PURE__*/React.createElement("stop", {
|
|
19447
|
-
offset: 1,
|
|
19448
|
-
stopColor: "#fff"
|
|
19449
|
-
})), /*#__PURE__*/React.createElement("clipPath", {
|
|
19450
|
-
id: "add-entry_svg__b",
|
|
19451
|
-
transform: "translate(1.543 -3.499)"
|
|
19452
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
19453
|
-
d: "M9.302 7.402a1.05 1.05 0 0 1 1.778 0l7.27 11.578a1.05 1.05 0 0 1-.89 1.608H2.92a1.05 1.05 0 0 1-.889-1.608z"
|
|
19454
|
-
})))));
|
|
19455
|
-
};
|
|
19456
|
-
|
|
19457
|
-
var _path$9, _path2$3, _path3;
|
|
19458
|
-
function _extends$d() { return _extends$d = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$d.apply(null, arguments); }
|
|
19459
|
-
var SvgBoundary = function SvgBoundary(props) {
|
|
19460
|
-
return /*#__PURE__*/React.createElement("svg", _extends$d({
|
|
19461
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19462
|
-
width: 16,
|
|
19463
|
-
height: 16,
|
|
19464
|
-
fill: "none"
|
|
19465
|
-
}, props), _path$9 || (_path$9 = /*#__PURE__*/React.createElement("path", {
|
|
19466
|
-
fill: "#1DBEAC",
|
|
19467
|
-
fillRule: "evenodd",
|
|
19468
|
-
d: "M3.385 2h9.23C13.38 2 14 2.62 14 3.385v9.23C14 13.38 13.38 14 12.615 14h-9.23C2.62 14 2 13.38 2 12.615v-9.23C2 2.62 2.62 2 3.385 2m9.692 1.385a.46.46 0 0 0-.462-.462h-9.23a.46.46 0 0 0-.462.462v9.23c0 .255.207.462.462.462h9.23a.46.46 0 0 0 .462-.462z",
|
|
19469
|
-
clipRule: "evenodd",
|
|
19470
|
-
opacity: 0.602
|
|
19471
|
-
})), _path2$3 || (_path2$3 = /*#__PURE__*/React.createElement("path", {
|
|
19472
|
-
fill: "#1DBEAC",
|
|
19473
|
-
d: "M12.615 2.923c.255 0 .462.207.462.462v9.23a.46.46 0 0 1-.462.462h-9.23a.46.46 0 0 1-.462-.462v-9.23c0-.255.207-.462.462-.462z",
|
|
19474
|
-
opacity: 0.152
|
|
19475
|
-
})), _path3 || (_path3 = /*#__PURE__*/React.createElement("path", {
|
|
19476
|
-
fill: "#1DBEAC",
|
|
19477
|
-
fillRule: "evenodd",
|
|
19478
|
-
d: "M2.833 2a.833.833 0 1 0 0 1.667.833.833 0 0 0 0-1.667m0 10.333a.833.833 0 1 0 0 1.667.833.833 0 0 0 0-1.667m9.5-9.5a.833.833 0 1 1 1.667 0 .833.833 0 0 1-1.667 0m.834 9.5a.833.833 0 1 0 0 1.667.833.833 0 0 0 0-1.667M6.49 10.333s.335-4.388 3.451-5.666c-1.725 2.439-1.725 5.666-1.725 5.666zm2.305 0s.548-4.108 2.872-4.816c-1.071 1.7-1.071 4.816-1.071 4.816zM6.87 5.517c-2.384 1.42-2.537 4.816-2.537 4.816h1.582s-.21-2.698.955-4.816",
|
|
19479
|
-
clipRule: "evenodd"
|
|
19480
|
-
})));
|
|
19481
|
-
};
|
|
19482
|
-
|
|
19483
|
-
var _path$8, _path2$2, _rect$1, _rect2$1;
|
|
19484
|
-
function _extends$c() { return _extends$c = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$c.apply(null, arguments); }
|
|
19485
|
-
var SvgLimitIsland = function SvgLimitIsland(props) {
|
|
19486
|
-
return /*#__PURE__*/React.createElement("svg", _extends$c({
|
|
19487
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19488
|
-
width: 16,
|
|
19489
|
-
height: 16,
|
|
19490
|
-
fill: "none"
|
|
19491
|
-
}, props), _path$8 || (_path$8 = /*#__PURE__*/React.createElement("path", {
|
|
19492
|
-
fill: "#FFA077",
|
|
19493
|
-
d: "M11.725 6.714c-1.019-.137-2.516-1.488-1.9-2.14.588-.621 1.91.344 1.9 2.14"
|
|
19494
|
-
})), _path2$2 || (_path2$2 = /*#__PURE__*/React.createElement("path", {
|
|
19495
|
-
fill: "#FF5D17",
|
|
19496
|
-
d: "M11.195 3.637c-.863.109-.623 2.341.354 3.024 1.603.79 2.575-.099 2.517-.459-.072-.445-.983-1.014-2.029-.274.455-.92-.08-2.387-.842-2.291M10.004 9.084l.308.87c1.202.178 2.002.494 2.002.856 0 .556-1.887 1.007-4.215 1.007-2.329 0-4.216-.451-4.217-1.007 0-.334.683-.63 1.733-.812l.593-1.679zm-.777-2.197.518 1.463-3.312-.667.443-1.253zM7.467 4.76a.535.535 0 0 1 1.01 0l.493 1.398L7.1 5.794z"
|
|
19497
|
-
})), _rect$1 || (_rect$1 = /*#__PURE__*/React.createElement("rect", {
|
|
19498
|
-
width: 14.237,
|
|
19499
|
-
height: 10.667,
|
|
19500
|
-
x: 0.882,
|
|
19501
|
-
y: 2.667,
|
|
19502
|
-
fill: "#F50",
|
|
19503
|
-
opacity: 0.15,
|
|
19504
|
-
rx: 2
|
|
19505
|
-
})), _rect2$1 || (_rect2$1 = /*#__PURE__*/React.createElement("rect", {
|
|
19506
|
-
width: 14.237,
|
|
19507
|
-
height: 10.667,
|
|
19508
|
-
x: 0.882,
|
|
19509
|
-
y: 2.667,
|
|
19510
|
-
stroke: "#FF5D17",
|
|
19511
|
-
strokeWidth: 0.867,
|
|
19512
|
-
rx: 2
|
|
19513
|
-
})));
|
|
19514
|
-
};
|
|
19515
|
-
|
|
19516
|
-
var _rect, _rect2, _rect3, _rect4, _g$3;
|
|
19517
|
-
function _extends$b() { return _extends$b = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$b.apply(null, arguments); }
|
|
19518
|
-
var SvgVisionFence = function SvgVisionFence(props) {
|
|
19519
|
-
return /*#__PURE__*/React.createElement("svg", _extends$b({
|
|
19520
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19521
|
-
width: 16,
|
|
19522
|
-
height: 16,
|
|
19523
|
-
fill: "none"
|
|
19524
|
-
}, props), _rect || (_rect = /*#__PURE__*/React.createElement("rect", {
|
|
19525
|
-
width: 14.333,
|
|
19526
|
-
height: 10.667,
|
|
19527
|
-
x: 0.833,
|
|
19528
|
-
y: 2.667,
|
|
19529
|
-
fill: "#B1D9FF",
|
|
19530
|
-
rx: 2.667
|
|
19531
|
-
})), _rect2 || (_rect2 = /*#__PURE__*/React.createElement("rect", {
|
|
19532
|
-
width: 13.333,
|
|
19533
|
-
height: 9.667,
|
|
19534
|
-
x: 1.333,
|
|
19535
|
-
y: 3.167,
|
|
19536
|
-
stroke: "#5C9DFF",
|
|
19537
|
-
strokeDasharray: "6.33 6.33",
|
|
19538
|
-
rx: 1.333
|
|
19539
|
-
})), _rect3 || (_rect3 = /*#__PURE__*/React.createElement("rect", {
|
|
19540
|
-
width: 6,
|
|
19541
|
-
height: 6,
|
|
19542
|
-
x: 5,
|
|
19543
|
-
y: 4.833,
|
|
19544
|
-
fill: "#B1D9FF",
|
|
19545
|
-
rx: 3
|
|
19546
|
-
})), /*#__PURE__*/React.createElement("mask", {
|
|
19547
|
-
id: "visionFence_svg__a",
|
|
19548
|
-
width: 6,
|
|
19549
|
-
height: 6,
|
|
19550
|
-
x: 5,
|
|
19551
|
-
y: 5,
|
|
19552
|
-
maskUnits: "userSpaceOnUse",
|
|
19553
|
-
style: {
|
|
19554
|
-
maskType: "alpha"
|
|
19555
|
-
}
|
|
19556
|
-
}, _rect4 || (_rect4 = /*#__PURE__*/React.createElement("rect", {
|
|
19557
|
-
width: 5.333,
|
|
19558
|
-
height: 5.333,
|
|
19559
|
-
x: 5.333,
|
|
19560
|
-
y: 5.5,
|
|
19561
|
-
fill: "#B1D9FF",
|
|
19562
|
-
rx: 2.667
|
|
19563
|
-
}))), _g$3 || (_g$3 = /*#__PURE__*/React.createElement("g", {
|
|
19564
|
-
fill: "#5C9DFF",
|
|
19565
|
-
mask: "url(#visionFence_svg__a)"
|
|
19566
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
19567
|
-
d: "m8.838 3.395.636.636-5.42 5.421-.637-.636zM9.896 4.452l.637.637-5.422 5.42-.636-.635zM10.954 5.51l.636.637-5.421 5.421-.636-.636zM12.172 6.547l.636.637-5.421 5.42-.636-.635z"
|
|
19568
|
-
}))));
|
|
19569
|
-
};
|
|
19570
|
-
|
|
19571
|
-
var _g$2, _defs$2;
|
|
19572
|
-
function _extends$a() { return _extends$a = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$a.apply(null, arguments); }
|
|
19573
|
-
var SvgDoodle = function SvgDoodle(props) {
|
|
19574
|
-
return /*#__PURE__*/React.createElement("svg", _extends$a({
|
|
19575
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19576
|
-
width: 16,
|
|
19577
|
-
height: 16,
|
|
19578
|
-
fill: "none"
|
|
19579
|
-
}, props), _g$2 || (_g$2 = /*#__PURE__*/React.createElement("g", {
|
|
19580
|
-
clipPath: "url(#doodle_svg__a)"
|
|
19581
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
19582
|
-
clipPath: "url(#doodle_svg__b)"
|
|
19583
|
-
}, /*#__PURE__*/React.createElement("rect", {
|
|
19584
|
-
width: 14.237,
|
|
19585
|
-
height: 10.667,
|
|
19586
|
-
x: 0.333,
|
|
19587
|
-
y: 4.332,
|
|
19588
|
-
fill: "#CBFCF7",
|
|
19589
|
-
stroke: "#9AEEE5",
|
|
19590
|
-
strokeWidth: 0.867,
|
|
19591
|
-
rx: 2
|
|
19592
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
19593
|
-
fill: "#F2FFFD",
|
|
19594
|
-
d: "M1.374 9.88a4 4 0 0 0 4 4h.546l.514-1.524c.073-.216-.087-.443-.312-.48-1.415-.229-3.6-1.485-4.399-4.639a.35.35 0 0 0-.135-.197c-.138.405-.214.84-.214 1.293z"
|
|
19595
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
19596
|
-
fill: "#50D0C2",
|
|
19597
|
-
d: "M15.814 2.13c-.352 2.267-6.501 9.305-8.003 9.43a.282.282 0 0 1-.238-.455L15.565.828c.398.332.293 1.015.249 1.303"
|
|
19598
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
19599
|
-
fill: "#50D0C2",
|
|
19600
|
-
d: "M14.208.95c-2.147.946-7.434 8.618-7.15 10.058a.2.2 0 0 0 .017.047.295.295 0 0 0 .498.051L15.565.826c-.437-.28-1.084.003-1.357.123"
|
|
19601
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
19602
|
-
fill: "#9CE7DE",
|
|
19603
|
-
d: "M7.76 11.558a.282.282 0 0 1-.187-.453.295.295 0 0 1-.498-.05.2.2 0 0 1-.016-.048c-.108-.55.598-2.01 1.63-3.658l2.297 1.689c-1.348 1.415-2.6 2.473-3.174 2.522a.2.2 0 0 1-.053-.002"
|
|
19604
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
19605
|
-
fill: "#50D0C2",
|
|
19606
|
-
d: "M5.602 11.02c.658-.873 1.769-1.145 2.482-.607.714.537.759 1.68.1 2.553-.657.873-2.733.94-2.733.94s-.507-2.013.15-2.886"
|
|
19607
|
-
})))), _defs$2 || (_defs$2 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("clipPath", {
|
|
19608
|
-
id: "doodle_svg__a"
|
|
19609
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
19610
|
-
fill: "#fff",
|
|
19611
|
-
d: "M0 0h16v16H0z"
|
|
19612
|
-
})), /*#__PURE__*/React.createElement("clipPath", {
|
|
19613
|
-
id: "doodle_svg__b"
|
|
19614
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
19615
|
-
fill: "#fff",
|
|
19616
|
-
d: "M0 0h16v16H0z"
|
|
19617
|
-
})))));
|
|
19618
|
-
};
|
|
19619
|
-
|
|
19620
|
-
var HandleElementMapType;
|
|
19621
|
-
(function (HandleElementMapType) {
|
|
19622
|
-
HandleElementMapType["name"] = "name";
|
|
19623
|
-
HandleElementMapType["focus"] = "focus";
|
|
19624
|
-
HandleElementMapType["delete"] = "delete";
|
|
19625
|
-
HandleElementMapType["timePeriod"] = "timePeriod";
|
|
19626
|
-
HandleElementMapType["area"] = "area";
|
|
19627
|
-
HandleElementMapType["dooleExist"] = "dooleExist";
|
|
19628
|
-
})(HandleElementMapType || (HandleElementMapType = {}));
|
|
19629
|
-
const DATE_TYPE_MAP = [
|
|
19630
|
-
{ type: DataType.BOUNDARY, label: 'Boundary', icon: jsx(SvgBoundary, {}) },
|
|
19631
|
-
{
|
|
19632
|
-
type: DataType.OBSTACLE,
|
|
19633
|
-
paramType: RecordTypeEnum.OBSTACLE,
|
|
19634
|
-
label: 'Off-limit island',
|
|
19635
|
-
icon: jsx(SvgLimitIsland, {}),
|
|
19636
|
-
},
|
|
19637
|
-
// { type: DataType.CHANNEL, label: 'Channel', icon: <ChannelIcon /> },
|
|
19638
|
-
{
|
|
19639
|
-
type: DataType.VISION_OFF,
|
|
19640
|
-
paramType: RecordTypeEnum.VISI_OFF,
|
|
19641
|
-
label: 'VisionFence-off zone',
|
|
19642
|
-
icon: jsx(SvgVisionFence, {}),
|
|
19643
|
-
},
|
|
19644
|
-
{
|
|
19645
|
-
type: DataType.DOODLE,
|
|
19646
|
-
paramType: RecordTypeEnum.DOODLE,
|
|
19647
|
-
label: 'Doodle',
|
|
19648
|
-
icon: jsx(SvgDoodle, {}),
|
|
19649
|
-
},
|
|
19650
|
-
];
|
|
19651
|
-
({
|
|
19652
|
-
[DataType.BOUNDARY]: {
|
|
19653
|
-
},
|
|
19654
|
-
[DataType.OBSTACLE]: {
|
|
19655
|
-
},
|
|
19656
|
-
[DataType.CHANNEL]: {
|
|
19657
|
-
},
|
|
19658
|
-
[DataType.VISION_OFF]: {
|
|
19659
|
-
},
|
|
19660
|
-
[DataType.DOODLE]: {
|
|
19661
|
-
},
|
|
19662
|
-
[DataType.PATH]: undefined,
|
|
19663
|
-
[DataType.ANTENNA]: undefined,
|
|
19664
|
-
[DataType.CHARGING_PILE]: undefined,
|
|
19665
|
-
});
|
|
19666
|
-
|
|
19667
|
-
var css_248z$b = ".ant-modal .ant-modal-body .ant-modal-confirm-title {\n text-align: center;\n}\n.ant-modal .ant-modal-body .ant-modal-confirm-btns {\n margin-top: 24px;\n}\n.ant-modal .ant-modal-body .ant-modal-confirm-btns .ant-btn + .ant-btn {\n margin-left: 24px;\n}\n\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal-title {\n text-align: center;\n padding: 10px 20px 0;\n font-size: 18px;\n}\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal-header {\n margin-bottom: 24px;\n}\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal .ant-modal-footer {\n margin-top: 24px;\n}\n.index-module_modal__fkxhn.index-module_center__d461v .ant-modal .ant-modal-footer .ant-btn + .ant-btn {\n margin-left: 24px;\n}";
|
|
19668
|
-
var styles$b = {"modal":"index-module_modal__fkxhn","center":"index-module_center__d461v"};
|
|
19669
|
-
styleInject(css_248z$b);
|
|
19670
|
-
|
|
19671
|
-
const CustomModal = ({ children, titleCenter, hasMinHeight, height, ...props }) => {
|
|
19672
|
-
return (jsx(Modal, { centered: true, styles: {
|
|
19673
|
-
body: {
|
|
19674
|
-
maxHeight: height ? `${height}px` : 'calc(100vh - 200px)',
|
|
19675
|
-
minHeight: hasMinHeight ? '520px' : undefined,
|
|
19676
|
-
overflow: 'auto',
|
|
19677
|
-
},
|
|
19678
|
-
}, wrapClassName: classNames(styles$b.modal, {
|
|
19679
|
-
[styles$b.center]: titleCenter,
|
|
19680
|
-
}), cancelButtonProps: { color: 'primary', variant: 'outlined' }, cancelText: 'Cancel', ...props, children: children }));
|
|
19681
|
-
};
|
|
19682
|
-
|
|
19683
|
-
var css_248z$a = ".index-module_doodleModal__EGNPW .index-module_title__ViZuB {\n font-weight: 400;\n font-size: 14px;\n line-height: 20px;\n color: rgb(29, 29, 29);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n max-height: 230px;\n overflow-y: auto;\n width: 470px;\n margin: 20px auto 0;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 {\n width: 70px;\n height: 70px;\n padding: 10px;\n border-radius: 8px;\n cursor: pointer;\n border: 2px solid transparent;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n transition: all 0.2s ease;\n position: relative;\n background: rgb(233, 242, 241);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7:hover {\n background-color: rgba(0, 0, 0, 0.05);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd {\n border: 2px solid rgb(110, 220, 207);\n background-color: rgba(110, 220, 207, 0.1);\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7.index-module_active__1OHfd .index-module_selectIcon__EFQF- {\n display: block;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_svgImage__2OT8- svg {\n width: 100%;\n height: 100%;\n}\n.index-module_doodleModal__EGNPW .index-module_content__h-60T .index-module_item__dvoq7 .index-module_selectIcon__EFQF- {\n position: absolute;\n bottom: 4px;\n right: 4px;\n display: none;\n}";
|
|
19684
|
-
var styles$a = {"doodleModal":"index-module_doodleModal__EGNPW","title":"index-module_title__ViZuB","content":"index-module_content__h-60T","item":"index-module_item__dvoq7","active":"index-module_active__1OHfd","selectIcon":"index-module_selectIcon__EFQF-","svgImage":"index-module_svgImage__2OT8-"};
|
|
19685
|
-
styleInject(css_248z$a);
|
|
19686
|
-
|
|
19687
|
-
var _path$7;
|
|
19688
|
-
function _extends$9() { return _extends$9 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$9.apply(null, arguments); }
|
|
19689
|
-
var SvgSelect = function SvgSelect(props) {
|
|
19690
|
-
return /*#__PURE__*/React.createElement("svg", _extends$9({
|
|
19691
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19692
|
-
width: 14,
|
|
19693
|
-
height: 12,
|
|
19694
|
-
fill: "none"
|
|
19695
|
-
}, props), _path$7 || (_path$7 = /*#__PURE__*/React.createElement("path", {
|
|
19696
|
-
stroke: "#6EDCCF",
|
|
19697
|
-
strokeWidth: 2,
|
|
19698
|
-
d: "m1 7.5 4 3L12.5 1"
|
|
19699
|
-
})));
|
|
19700
|
-
};
|
|
19701
|
-
|
|
19702
|
-
const DoodleModal = ({ open, onSelect, setOpen, doodleList, centerPoint }) => {
|
|
19703
|
-
const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
|
|
19704
|
-
const [selectedDoodle, setSelectedDoodle] = useState(null);
|
|
19705
|
-
const noNeed = useMemo(() => {
|
|
19706
|
-
return '1234567890QWERTYUIOPASDFGHJKLZXCVBNM';
|
|
19707
|
-
}, []);
|
|
19708
|
-
// 选择 Doodle
|
|
19709
|
-
const handleSelectDoodle = useCallback((item) => {
|
|
19710
|
-
setSelectedDoodle(item);
|
|
19711
|
-
}, []);
|
|
19712
|
-
// 确认选择
|
|
19713
|
-
const handleConfirm = useCallback(() => {
|
|
19714
|
-
if (selectedDoodle) {
|
|
19715
|
-
const newDoodle = initDoodle();
|
|
19716
|
-
const svg = selectedDoodle?.svgStr;
|
|
19717
|
-
const minLength = selectedDoodle.minLength;
|
|
19718
|
-
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
19719
|
-
const svgMinLength = Math.min(parseSvg.width, parseSvg.height) / SCALE_FACTOR;
|
|
19720
|
-
// 使用获取到的 SVG 内容,如果没有获取到则使用 URL
|
|
19721
|
-
newDoodle.svg = svg;
|
|
19722
|
-
newDoodle.scale = minLength / svgMinLength;
|
|
19723
|
-
newDoodle.direction = 0;
|
|
19724
|
-
newDoodle.center = restorePoint(centerPoint);
|
|
19725
|
-
onHandleEnterRecord?.({
|
|
19726
|
-
type: 1,
|
|
19727
|
-
function: 0,
|
|
19728
|
-
})?.then(() => {
|
|
19729
|
-
setEditMapInfo({
|
|
19730
|
-
...editMapInfo,
|
|
19731
|
-
historyList: [newDoodle],
|
|
19732
|
-
currentHistoryIndex: 0,
|
|
19733
|
-
createMode: CreateStatus.COMPLETED,
|
|
19734
|
-
elementType: DataType.DOODLE,
|
|
19735
|
-
selectElement: newDoodle,
|
|
19736
|
-
isShowDrag: true,
|
|
19737
|
-
});
|
|
19738
|
-
setOpen(false);
|
|
19739
|
-
onSelect?.(svg);
|
|
19740
|
-
}, (error) => {
|
|
19741
|
-
message.error('Save failed, please try again');
|
|
19742
|
-
});
|
|
19743
|
-
}
|
|
19744
|
-
}, [selectedDoodle, setEditMapInfo, editMapInfo, setOpen, onSelect, centerPoint]);
|
|
19745
|
-
return (jsx(CustomModal, { width: 560, title: "Creative logos", titleCenter: true, open: open, onOk: handleConfirm, onCancel: () => setOpen(false), okButtonProps: { disabled: !selectedDoodle }, afterClose: () => setSelectedDoodle(null), okText: "Confirm", cancelText: "Cancel", children: jsxs("div", { className: styles$a.doodleModal, children: [jsx("div", { className: styles$a.title, children: "Please select a doodle" }), jsx("div", { className: styles$a.content, children: doodleList
|
|
19746
|
-
?.filter((item) => !noNeed.includes(item.name))
|
|
19747
|
-
.map((item) => {
|
|
19748
|
-
return (jsxs("div", { className: classNames(styles$a.item, {
|
|
19749
|
-
[styles$a.active]: selectedDoodle?.svg === item.svg,
|
|
19750
|
-
}), onClick: () => handleSelectDoodle(item), children: [jsx("div", { className: styles$a.svgImage, dangerouslySetInnerHTML: { __html: item?.svgStr } }), jsx("div", { className: styles$a.selectIcon, children: jsx(SvgSelect, {}) })] }, item.id));
|
|
19751
|
-
}) })] }) }));
|
|
19752
|
-
};
|
|
19753
|
-
|
|
19754
|
-
const AddEntry = ({ doodleList, disabledObstacles, editMap }) => {
|
|
19755
|
-
const { svgRef } = useSvgEditContext();
|
|
19756
|
-
const { editMapInfo, setEditMapInfo, onHandleEnterRecord } = useMapEditContext();
|
|
19757
|
-
const divRef = useRef(null);
|
|
19758
|
-
const [open, setOpen] = useState(false);
|
|
19759
|
-
const [doodleOpen, setDoodleOpen] = useState(false);
|
|
19760
|
-
const centerPoint = useMemo(() => {
|
|
19761
|
-
if (!svgRef)
|
|
19762
|
-
return null;
|
|
19763
|
-
const baseVal = svgRef?.viewBox.baseVal;
|
|
19764
|
-
const center = [
|
|
19765
|
-
baseVal?.x + (baseVal?.width || 0) / 2,
|
|
19766
|
-
baseVal?.y + (baseVal?.height || 0) / 2,
|
|
19767
|
-
];
|
|
19768
|
-
return center;
|
|
19769
|
-
}, [svgRef?.viewBox?.baseVal?.x]);
|
|
19770
|
-
const centerBounds = useMemo(() => {
|
|
19771
|
-
if (!svgRef)
|
|
19772
|
-
return null;
|
|
19773
|
-
const elementWidth = 50 * 10;
|
|
19774
|
-
const [minX, minY, maxX, maxY] = [
|
|
19775
|
-
centerPoint[0] - elementWidth / 2,
|
|
19776
|
-
centerPoint[1] - elementWidth / 2,
|
|
19777
|
-
centerPoint[0] + elementWidth / 2,
|
|
19778
|
-
centerPoint[1] + elementWidth / 2,
|
|
19779
|
-
];
|
|
19780
|
-
const elementPoints = [
|
|
19781
|
-
[minX, minY],
|
|
19782
|
-
[minX, maxY],
|
|
19783
|
-
[maxX, maxY],
|
|
19784
|
-
[maxX, minY],
|
|
19785
|
-
];
|
|
19786
|
-
return elementPoints;
|
|
19787
|
-
}, [centerPoint]);
|
|
19788
|
-
const addNewElement = useCallback((type, item) => {
|
|
19789
|
-
setOpen(false);
|
|
19790
|
-
let newElement = null;
|
|
19791
|
-
if (type === DataType.BOUNDARY) {
|
|
19792
|
-
newElement = initBoundary();
|
|
19793
|
-
}
|
|
19794
|
-
else if (type === DataType.OBSTACLE) {
|
|
19795
|
-
newElement = initObstacle();
|
|
19796
|
-
}
|
|
19797
|
-
else if (type === DataType.CHANNEL) {
|
|
19798
|
-
newElement = initChannel();
|
|
19799
|
-
}
|
|
19800
|
-
else if (type === DataType.VISION_OFF) {
|
|
19801
|
-
newElement = initVisionOff();
|
|
19802
|
-
newElement.points = centerBounds;
|
|
19803
|
-
}
|
|
19804
|
-
else if (type === DataType.DOODLE) {
|
|
19805
|
-
return setDoodleOpen(true);
|
|
19806
|
-
}
|
|
19807
|
-
onHandleEnterRecord?.({
|
|
19808
|
-
type: item?.paramType,
|
|
19809
|
-
function: item?.type === DataType.OBSTACLE ? 0 : undefined,
|
|
19810
|
-
})?.then(() => {
|
|
19811
|
-
setEditMapInfo({
|
|
19812
|
-
...editMapInfo,
|
|
19813
|
-
historyList: [newElement],
|
|
19814
|
-
currentHistoryIndex: 0,
|
|
19815
|
-
createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
|
|
19816
|
-
elementType: type,
|
|
19817
|
-
selectElement: newElement,
|
|
19818
|
-
});
|
|
19819
|
-
}, (errorText) => {
|
|
19820
|
-
message.error('Save failed, please try again');
|
|
19821
|
-
});
|
|
19822
|
-
}, [centerBounds]);
|
|
19823
|
-
const addItems = useMemo(() => {
|
|
19824
|
-
return DATE_TYPE_MAP?.filter((item) => {
|
|
19825
|
-
if (item.type === DataType.OBSTACLE) {
|
|
19826
|
-
return !disabledObstacles;
|
|
19827
|
-
}
|
|
19828
|
-
return item.type !== DataType.BOUNDARY;
|
|
19829
|
-
});
|
|
19830
|
-
}, [disabledObstacles]);
|
|
19831
|
-
// console.log('addEntry->', editMapInfo, editMap);
|
|
19832
|
-
if (editMapInfo.createMode || editMapInfo.editMap || !editMap) {
|
|
19833
|
-
return null;
|
|
19834
|
-
}
|
|
19835
|
-
return (jsxs("div", { ref: divRef, className: styles$c.addEntry, children: [jsx(Popover, { open: open, onOpenChange: setOpen, arrow: false, placement: "leftTop", content: addItems?.map((item) => {
|
|
19836
|
-
return (jsxs("div", { className: styles$c.addItem, onClick: () => {
|
|
19837
|
-
addNewElement(item.type, item);
|
|
19838
|
-
}, children: [jsx("div", { className: styles$c.icon, children: item?.icon }), jsx("div", { className: styles$c.label, children: item?.label })] }, item.label));
|
|
19839
|
-
}), children: jsx("div", { className: styles$c.icon, children: jsx(SvgAddEntry, {}) }) }), jsx(DoodleModal, { centerPoint: centerPoint, doodleList: doodleList, open: doodleOpen, onOk: () => setDoodleOpen(false), setOpen: setDoodleOpen })] }));
|
|
19840
|
-
};
|
|
19841
|
-
|
|
19842
|
-
var css_248z$9 = ".index-module_handleElementInfo__vWIaf {\n position: absolute;\n right: 0;\n top: 0;\n border-radius: 8px;\n padding: 4px 8px;\n background: #fff;\n width: 265px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 {\n position: absolute;\n left: -96px;\n top: 0;\n display: flex;\n gap: 12px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u- {\n background: #fff;\n border-radius: 8px;\n padding: 6px;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X:not(.index-module_disabled__w6gCJ):hover,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-:not(.index-module_disabled__w6gCJ):hover {\n opacity: 0.8;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_undo__lPY1X.index-module_disabled__w6gCJ,\n.index-module_handleElementInfo__vWIaf .index-module_undoAndRedo__EKeA8 .index-module_redo__EU5u-.index-module_disabled__w6gCJ {\n color: #d8d8d8;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 0 0 4px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- input {\n padding: 2px 0;\n}\n.index-module_handleElementInfo__vWIaf .index-module_nameEdit__eVzQ- .index-module_edit__b0r9I {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_handleElementInfo__vWIaf .index-module_boundaryOther__FyJvt {\n padding-top: 4px;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_handleElementInfo__vWIaf .index-module_handle__4mIxr {\n border-top: 1px solid rgb(197, 197, 197);\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 8px 0;\n}\n\n.index-module_doodleInfo__bd2ua .index-module_time__1bUFf {\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_exist__gWtNo {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_doodleInfo__bd2ua .index-module_tip__1HNmj {\n color: #ff3f33;\n margin-top: 10px;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px;\n}\n\n.index-module_obstacleInfo__w6Sod .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}\n\n.index-module_areaInfo__-WJPL {\n color: #9e9e9e;\n width: 100%;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px; /* 114.286% */\n}\n.index-module_areaInfo__-WJPL .index-module_areaItem__fk-i2 {\n display: flex;\n justify-content: space-between;\n padding: 6px 0;\n}\n\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM {\n color: #1f1f1f;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 16px;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_value__x3-se {\n margin-left: auto;\n}\n.index-module_boundaryInfo__VfR-N .index-module_otherEdit__17SuM .index-module_otherItem__ATLFZ .index-module_icon__167WB {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_boundaryInfo__VfR-N .index-module_areaInfo__-WJPL {\n border-top: 1px solid rgb(197, 197, 197);\n}";
|
|
19843
|
-
var styles$9 = {"handleElementInfo":"index-module_handleElementInfo__vWIaf","undoAndRedo":"index-module_undoAndRedo__EKeA8","undo":"index-module_undo__lPY1X","redo":"index-module_redo__EU5u-","disabled":"index-module_disabled__w6gCJ","nameEdit":"index-module_nameEdit__eVzQ-","handle":"index-module_handle__4mIxr","doodleInfo":"index-module_doodleInfo__bd2ua","time":"index-module_time__1bUFf","exist":"index-module_exist__gWtNo","tip":"index-module_tip__1HNmj","obstacleInfo":"index-module_obstacleInfo__w6Sod","areaInfo":"index-module_areaInfo__-WJPL","areaItem":"index-module_areaItem__fk-i2","boundaryInfo":"index-module_boundaryInfo__VfR-N","otherEdit":"index-module_otherEdit__17SuM","otherItem":"index-module_otherItem__ATLFZ","value":"index-module_value__x3-se","icon":"index-module_icon__167WB"};
|
|
19844
|
-
styleInject(css_248z$9);
|
|
19845
|
-
|
|
19846
|
-
var css_248z$8 = ".index-module_infoHeader__l9F6q {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 8px 0;\n border-bottom: 1px solid rgb(197, 197, 197);\n}\n.index-module_infoHeader__l9F6q .index-module_headerIcon__sK1hg {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_infoHeader__l9F6q .index-module_headerName__UGnrH {\n margin-left: 4px;\n color: rgb(158, 158, 158);\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_focus__llcox {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}\n.index-module_infoHeader__l9F6q .index-module_headerHandle__ymh7f .index-module_delete__hD4-Q {\n width: 16px;\n height: 16px;\n margin-left: 8px;\n cursor: pointer;\n}";
|
|
19847
|
-
var styles$8 = {"infoHeader":"index-module_infoHeader__l9F6q","headerIcon":"index-module_headerIcon__sK1hg","headerName":"index-module_headerName__UGnrH","headerHandle":"index-module_headerHandle__ymh7f","focus":"index-module_focus__llcox","delete":"index-module_delete__hD4-Q"};
|
|
19848
|
-
styleInject(css_248z$8);
|
|
19849
|
-
|
|
19850
|
-
var _path$6;
|
|
19851
|
-
function _extends$8() { return _extends$8 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$8.apply(null, arguments); }
|
|
19852
|
-
var SvgFocus = function SvgFocus(props) {
|
|
19853
|
-
return /*#__PURE__*/React.createElement("svg", _extends$8({
|
|
19854
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19855
|
-
width: 16,
|
|
19856
|
-
height: 16,
|
|
19857
|
-
fill: "none"
|
|
19858
|
-
}, props), _path$6 || (_path$6 = /*#__PURE__*/React.createElement("path", {
|
|
19859
|
-
fill: "#FF5A00",
|
|
19860
|
-
d: "M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5m-1.733-4h-.022c-.728 0-1.306 0-1.77.038-.476.039-.878.12-1.246.307a3.17 3.17 0 0 0-1.384 1.384c-.187.367-.268.77-.307 1.246-.038.464-.038 1.042-.038 1.77v.022a.5.5 0 0 0 1 0c0-.755 0-1.292.035-1.711.033-.413.098-.67.201-.873.208-.408.54-.74.947-.947.203-.103.46-.167.873-.201.42-.034.956-.035 1.71-.035a.5.5 0 0 0 0-1m3.466 1c.756 0 1.292 0 1.711.035.413.033.67.098.873.201.408.208.74.54.947.947.103.203.167.46.201.873.034.42.035.956.035 1.71a.5.5 0 0 0 1 0v-.021c0-.728 0-1.306-.038-1.77-.039-.476-.12-.878-.307-1.246a3.17 3.17 0 0 0-1.384-1.384c-.368-.187-.77-.268-1.246-.307-.464-.038-1.042-.038-1.77-.038h-.022a.5.5 0 0 0 0 1M2.5 9.733a.5.5 0 0 0-1 0v.022c0 .728 0 1.306.038 1.77.039.476.12.878.307 1.246.304.596.788 1.08 1.384 1.384.367.187.77.268 1.246.307.464.038 1.042.038 1.77.038h.022a.5.5 0 0 0 0-1c-.755 0-1.292 0-1.711-.035-.413-.033-.67-.098-.873-.201a2.17 2.17 0 0 1-.947-.947c-.103-.203-.167-.46-.201-.873-.034-.42-.035-.956-.035-1.71m12 0a.5.5 0 0 0-1 0c0 .756 0 1.292-.035 1.711-.033.413-.098.67-.201.873-.208.408-.54.74-.947.947-.203.103-.46.167-.873.201-.42.034-.956.035-1.71.035a.5.5 0 0 0 0 1h.021c.728 0 1.306 0 1.77-.038.476-.039.878-.12 1.246-.307a3.17 3.17 0 0 0 1.384-1.384c.187-.368.268-.77.307-1.246.038-.464.038-1.042.038-1.77z"
|
|
19861
|
-
})));
|
|
19862
|
-
};
|
|
19863
|
-
|
|
19864
|
-
var _path$5;
|
|
19865
|
-
function _extends$7() { return _extends$7 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$7.apply(null, arguments); }
|
|
19866
|
-
var SvgDelete = function SvgDelete(props) {
|
|
19867
|
-
return /*#__PURE__*/React.createElement("svg", _extends$7({
|
|
19868
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19869
|
-
width: 16,
|
|
19870
|
-
height: 16,
|
|
19871
|
-
fill: "none"
|
|
19872
|
-
}, props), _path$5 || (_path$5 = /*#__PURE__*/React.createElement("path", {
|
|
19873
|
-
fill: "#FF5A00",
|
|
19874
|
-
d: "M4.667 14q-.55 0-.942-.391a1.29 1.29 0 0 1-.392-.942V4h-.666V2.667H6V2h4v.667h3.333V4h-.666v8.667q0 .549-.392.942-.39.391-.942.391zM6 11.333h1.333v-6H6zm2.667 0H10v-6H8.667z"
|
|
19875
|
-
})));
|
|
19876
|
-
};
|
|
19877
|
-
|
|
19878
|
-
const Header = ({ handleDelete, handleFocus, showFocus = false, showDelete = true, type }) => {
|
|
19879
|
-
const currentType = useMemo(() => {
|
|
19880
|
-
return DATE_TYPE_MAP.find((item) => item.type === type);
|
|
19881
|
-
}, [type]);
|
|
19882
|
-
return (jsxs("div", { className: styles$8.infoHeader, children: [jsx("div", { className: styles$8.headerIcon, children: currentType?.icon }), jsx("div", { className: styles$8.headerName, children: currentType?.label }), jsxs("div", { className: styles$8.headerHandle, children: [showFocus && (jsx("div", { className: styles$8.focus, onClick: handleFocus, children: jsx(SvgFocus, {}) })), showDelete && (jsx("div", { className: styles$8.delete, onClick: handleDelete, children: jsx(SvgDelete, {}) }))] })] }));
|
|
19883
|
-
};
|
|
19884
|
-
|
|
19885
|
-
var css_248z$7 = ".index-module_nameEdit__O5bL0 {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n width: 100%;\n}\n.index-module_nameEdit__O5bL0 .index-module_content__Bi2fa {\n flex: 1;\n line-height: 28px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.index-module_nameEdit__O5bL0 .index-module_edit__3yRM0 {\n width: 16px;\n height: 16px;\n cursor: pointer;\n}";
|
|
19886
|
-
var styles$7 = {"nameEdit":"index-module_nameEdit__O5bL0","content":"index-module_content__Bi2fa","edit":"index-module_edit__3yRM0"};
|
|
19887
|
-
styleInject(css_248z$7);
|
|
19888
|
-
|
|
19889
|
-
var _path$4;
|
|
19890
|
-
function _extends$6() { return _extends$6 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$6.apply(null, arguments); }
|
|
19891
|
-
var SvgEdit = function SvgEdit(props) {
|
|
19892
|
-
return /*#__PURE__*/React.createElement("svg", _extends$6({
|
|
19893
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19894
|
-
width: 16,
|
|
19895
|
-
height: 16,
|
|
19896
|
-
fill: "none"
|
|
19897
|
-
}, props), _path$4 || (_path$4 = /*#__PURE__*/React.createElement("path", {
|
|
19898
|
-
fill: "#FF5A00",
|
|
19899
|
-
d: "M9.068 1.916a.751.751 0 0 1 0 1.501h-4.9a.75.75 0 0 0-.75.75v7.667c0 .414.336.75.75.75h7.667c.414 0 .75-.336.75-.75v-4.9a.75.75 0 0 1 1.5 0v4.9a2.25 2.25 0 0 1-2.25 2.25H4.168a2.25 2.25 0 0 1-2.25-2.25V4.167a2.25 2.25 0 0 1 2.25-2.251zm3.735.22a.75.75 0 0 1 1.06 1.061L8.53 8.53a.75.75 0 0 1-1.06-1.06z"
|
|
19900
|
-
})));
|
|
19901
|
-
};
|
|
19902
|
-
|
|
19903
|
-
const NameModal = ({ name, open, setOpen, onOk }) => {
|
|
19904
|
-
const [nameValue, setNameValue] = useState('');
|
|
19905
|
-
useEffect(() => {
|
|
19906
|
-
if (open) {
|
|
19907
|
-
setNameValue(name || '');
|
|
19908
|
-
}
|
|
19909
|
-
}, [name, open]);
|
|
19910
|
-
return (jsx(CustomModal, { title: `${name}`, titleCenter: true, open: open, onOk: () => {
|
|
19911
|
-
onOk?.(nameValue);
|
|
19912
|
-
setOpen(false);
|
|
19913
|
-
}, onCancel: () => setOpen(false), okText: "Confirm", afterClose: () => {
|
|
19914
|
-
setNameValue('');
|
|
19915
|
-
}, children: jsx(Input, { maxLength: 120, showCount: true, placeholder: "Please enter boundary name", value: nameValue, onChange: (e) => setNameValue(e.target.value) }) }));
|
|
19916
|
-
};
|
|
19917
|
-
|
|
19918
|
-
const NameEdit = ({ name, onChange }) => {
|
|
19919
|
-
const [open, setOpen] = React__default.useState(false);
|
|
19920
|
-
return (jsxs(Fragment, { children: [jsxs("div", { className: styles$7.nameEdit, children: [jsx("div", { className: styles$7.content, children: name }), jsx("div", { className: styles$7.edit, onClick: () => setOpen(true), children: jsx(SvgEdit, {}) })] }), jsx(NameModal, { name: name, open: open, setOpen: setOpen, onOk: onChange })] }));
|
|
19921
|
-
};
|
|
19922
|
-
|
|
19923
|
-
var _path$3;
|
|
19924
|
-
function _extends$5() { return _extends$5 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$5.apply(null, arguments); }
|
|
19925
|
-
var SvgArrow = function SvgArrow(props) {
|
|
19926
|
-
return /*#__PURE__*/React.createElement("svg", _extends$5({
|
|
19927
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
19928
|
-
width: 16,
|
|
19929
|
-
height: 16,
|
|
19930
|
-
fill: "none"
|
|
19931
|
-
}, props), _path$3 || (_path$3 = /*#__PURE__*/React.createElement("path", {
|
|
19932
|
-
fill: "#FF5A00",
|
|
19933
|
-
d: "M11.523 7.704c.005.014.015.026.02.04.049.125.065.268.046.406a.73.73 0 0 1-.152.363l-3.88 4.638a.47.47 0 0 1-.377.182.49.49 0 0 1-.369-.208.77.77 0 0 1-.144-.477.76.76 0 0 1 .164-.466l3.483-4.162-3.468-4.224a.77.77 0 0 1-.15-.462c0-.172.053-.338.148-.463a.49.49 0 0 1 .36-.204.47.47 0 0 1 .371.17l3.845 4.682q.007.017.017.032.008.01.018.019c.032.04.046.09.067.134"
|
|
19934
|
-
})));
|
|
19935
|
-
};
|
|
19936
|
-
|
|
19937
|
-
var css_248z$6 = ".index-module_item__wwHEt {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n display: flex;\n align-items: center;\n padding: 8px 0;\n}";
|
|
19938
|
-
var styles$6 = {"item":"index-module_item__wwHEt"};
|
|
19939
|
-
styleInject(css_248z$6);
|
|
19940
|
-
|
|
19941
|
-
const Item = ({ children }) => {
|
|
19942
|
-
return (jsx("div", { className: styles$6.item, children: children }));
|
|
19943
|
-
};
|
|
19944
|
-
|
|
19945
|
-
var css_248z$5 = ".index-module_edgeMowing__kmHPN .index-module_item__O2omj {\n border-bottom: 1px solid #C5C5C5;\n margin-bottom: 20px;\n}\n.index-module_edgeMowing__kmHPN .index-module_item__O2omj .index-module_content__ENa5I {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 4px 0;\n}\n.index-module_edgeMowing__kmHPN .index-module_item__O2omj .index-module_tip__BoRNQ {\n color: #9E9E9E;\n font-size: 14px;\n font-weight: 400;\n line-height: 16px;\n padding: 10px 0;\n}";
|
|
19946
|
-
var styles$5 = {"edgeMowing":"index-module_edgeMowing__kmHPN","item":"index-module_item__O2omj","content":"index-module_content__ENa5I","tip":"index-module_tip__BoRNQ"};
|
|
19947
|
-
styleInject(css_248z$5);
|
|
19948
|
-
|
|
19949
|
-
const MowingEdgeModal = ({ open, setOpen, onChange, value }) => {
|
|
19950
|
-
const [currentValue, setCurrentValue] = useState({});
|
|
19951
|
-
const handleOk = () => {
|
|
19952
|
-
onChange(currentValue);
|
|
19953
|
-
setOpen(false);
|
|
19954
|
-
};
|
|
19955
|
-
useEffect(() => {
|
|
19956
|
-
if (!open)
|
|
19957
|
-
return;
|
|
19958
|
-
setCurrentValue(value);
|
|
19959
|
-
}, [open]);
|
|
19960
|
-
return (jsx(CustomModal, { title: "Edge Mowing", titleCenter: true, open: open, onCancel: () => setOpen(false), onOk: handleOk, afterClose: () => {
|
|
19961
|
-
setCurrentValue({});
|
|
19962
|
-
}, children: jsxs("div", { className: styles$5.edgeMowing, children: [jsxs("div", { className: styles$5.item, children: [jsxs("div", { className: styles$5.content, children: [jsx("div", { className: styles$5.label, children: "Mow along boundary" }), jsx("div", { className: styles$5.value, children: jsx(Switch, { checked: currentValue['edgeMowing'], onChange: (val) => setCurrentValue({
|
|
19963
|
-
obstacleMowEdge: currentValue?.obstacleMowEdge,
|
|
19964
|
-
edgeMowing: val,
|
|
19965
|
-
}) }) })] }), jsx("div", { className: styles$5.tip, children: "When enabled, the mower will mow along the selected boundary." })] }), jsxs("div", { className: styles$5.item, children: [jsxs("div", { className: styles$5.content, children: [jsx("div", { className: styles$5.label, children: "Mow around off-limit island" }), jsx("div", { className: styles$5.value, children: jsx(Switch, { value: currentValue['obstacleMowEdge'], onChange: (val) => setCurrentValue({
|
|
19966
|
-
obstacleMowEdge: val,
|
|
19967
|
-
edgeMowing: currentValue?.edgeMowing,
|
|
19968
|
-
}) }) })] }), jsx("div", { className: styles$5.tip, children: "When enabled, the mower will mow around the off-limit islands within the selected mowing zone." })] })] }) }));
|
|
19969
|
-
};
|
|
19970
|
-
|
|
19971
|
-
var css_248z$4 = ".index-module_zoneHeightModal__ehNMQ {\n padding: 0 10px;\n}\n.index-module_zoneHeightModal__ehNMQ .ant-radio-group {\n display: block;\n}\n.index-module_zoneHeightModal__ehNMQ .index-module_item__wQUzZ {\n display: flex;\n justify-content: space-between;\n align-items: center;\n font-size: 14px;\n opacity: 0.4;\n}\n.index-module_zoneHeightModal__ehNMQ .index-module_item__wQUzZ.index-module_checked__xbxQ4 {\n opacity: 1;\n}\n.index-module_zoneHeightModal__ehNMQ .index-module_item__wQUzZ:not(:last-child) {\n margin-bottom: 20px;\n}\n.index-module_zoneHeightModal__ehNMQ .index-module_item__wQUzZ .index-module_right__IuIfk {\n text-align: right;\n width: 300px;\n margin-left: auto;\n}";
|
|
19972
|
-
var styles$4 = {"zoneHeightModal":"index-module_zoneHeightModal__ehNMQ","item":"index-module_item__wQUzZ","checked":"index-module_checked__xbxQ4","right":"index-module_right__IuIfk"};
|
|
19973
|
-
styleInject(css_248z$4);
|
|
19974
|
-
|
|
19975
|
-
const CutHeightSlider = ({ units, value, onChange, heightOptions, ...rest }) => {
|
|
19976
|
-
const converteOptions = useCallback((options) => {
|
|
19977
|
-
return options.map((item) => ({
|
|
19978
|
-
label: units === UnitsType.Metric
|
|
19979
|
-
? `${item}`
|
|
19980
|
-
: `${convertCutHeightFormatted(item)}`,
|
|
19981
|
-
value: item,
|
|
19982
|
-
}));
|
|
19983
|
-
}, [units, convertCutHeightFormatted]);
|
|
19984
|
-
const options = useMemo(() => {
|
|
19985
|
-
if (heightOptions && heightOptions?.length > 0) {
|
|
19986
|
-
return converteOptions(heightOptions);
|
|
19987
|
-
}
|
|
19988
|
-
return [];
|
|
19989
|
-
}, [heightOptions, converteOptions]);
|
|
19990
|
-
return (jsx(Slider, { value: value, ...rest, tooltip: {
|
|
19991
|
-
open: false,
|
|
19992
|
-
}, step: null, min: options?.[0]?.value, max: options?.[options?.length - 1]?.value, marks: options?.reduce((acc, item) => {
|
|
19993
|
-
acc[item?.value] = {
|
|
19994
|
-
label: item?.label,
|
|
19995
|
-
style: {
|
|
19996
|
-
color: item?.value === Number(value)
|
|
19997
|
-
? 'rgba(241, 102, 41, 1)'
|
|
19998
|
-
: 'rgba(0, 0, 0, 0.20)',
|
|
19999
|
-
fontWeight: item?.value === Number(value) ? 'bold' : 'normal',
|
|
20000
|
-
},
|
|
20001
|
-
};
|
|
20002
|
-
return acc;
|
|
20003
|
-
}, {}), onChange: onChange }));
|
|
20004
|
-
};
|
|
20005
|
-
|
|
20006
|
-
var ZoneHeightModalTypeEnum;
|
|
20007
|
-
(function (ZoneHeightModalTypeEnum) {
|
|
20008
|
-
ZoneHeightModalTypeEnum[ZoneHeightModalTypeEnum["GLOBAL"] = 1] = "GLOBAL";
|
|
20009
|
-
ZoneHeightModalTypeEnum[ZoneHeightModalTypeEnum["RADIO"] = 0] = "RADIO";
|
|
20010
|
-
})(ZoneHeightModalTypeEnum || (ZoneHeightModalTypeEnum = {}));
|
|
20011
|
-
const HeightModal = ({ zoneName, open, setOpen, onChange, value, heightOptions, globalHeight, }) => {
|
|
20012
|
-
const { unitType } = useCommonContext();
|
|
20013
|
-
const [currentValue, setCurrentValue] = useState(value);
|
|
20014
|
-
const handleOk = useCallback(() => {
|
|
20015
|
-
setOpen(false);
|
|
20016
|
-
onChange?.(currentValue);
|
|
20017
|
-
}, [currentValue, setOpen, onChange]);
|
|
20018
|
-
const onHeightChange = useCallback((value) => {
|
|
20019
|
-
console.log('change->', value);
|
|
20020
|
-
setCurrentValue({
|
|
20021
|
-
cuttingHeight: value,
|
|
20022
|
-
isFlowGlobal: ZoneHeightModalTypeEnum.RADIO,
|
|
20023
|
-
});
|
|
20024
|
-
}, []);
|
|
20025
|
-
console.log('globalHeight', globalHeight, heightOptions);
|
|
20026
|
-
useEffect(() => {
|
|
20027
|
-
if (!open)
|
|
20028
|
-
return;
|
|
20029
|
-
setCurrentValue(value);
|
|
20030
|
-
}, [value, open]);
|
|
20031
|
-
return (jsx(CustomModal, { title: `${zoneName} cutting height`, titleCenter: true, width: 600, open: open, onCancel: () => setOpen(false), onOk: handleOk, okText: "Confirm", afterClose: () => { }, children: jsx("div", { className: styles$4.zoneHeightModal, children: jsxs(Radio.Group, { value: currentValue?.isFlowGlobal, onChange: (e) => setCurrentValue({
|
|
20032
|
-
isFlowGlobal: e.target.value,
|
|
20033
|
-
cuttingHeight: currentValue?.cuttingHeight,
|
|
20034
|
-
}), children: [jsxs("div", { className: classNames(styles$4.item, {
|
|
20035
|
-
[styles$4.checked]: currentValue?.isFlowGlobal === ZoneHeightModalTypeEnum.GLOBAL,
|
|
20036
|
-
}), children: [jsx("div", { className: styles$4.left, children: jsx(Radio, { value: ZoneHeightModalTypeEnum.GLOBAL, children: "Global" }) }), jsx("div", { className: styles$4.right, children: jsx("span", { style: { color: 'rgba(241, 102, 41, 1)' }, children: generateHeightStr(globalHeight, unitType, true) }) })] }), jsxs("div", { className: classNames(styles$4.item, {
|
|
20037
|
-
[styles$4.checked]: currentValue?.isFlowGlobal === ZoneHeightModalTypeEnum.RADIO,
|
|
20038
|
-
}), children: [jsx("div", { className: styles$4.left, children: jsxs(Radio, { value: ZoneHeightModalTypeEnum.RADIO, children: ["Customize zone height (", getHeightUnit(unitType), ")"] }) }), jsx("div", { className: styles$4.right, children: jsx(CutHeightSlider, { units: unitType, value: currentValue?.cuttingHeight, heightOptions: heightOptions, onChange: onHeightChange }) })] })] }) }) }));
|
|
20039
|
-
};
|
|
20040
|
-
|
|
20041
|
-
var css_248z$3 = ".index-module_directions__Hv0zx {\n color: #1d1d1d;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n}\n.index-module_directions__Hv0zx .index-module_default__sSWp4 {\n position: absolute;\n bottom: 20px;\n left: 9px;\n}\n.index-module_directions__Hv0zx .index-module_tips__VVEuO {\n line-height: 16px;\n}\n.index-module_directions__Hv0zx .index-module_optimal__07le4 {\n color: rgb(255, 113, 51);\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 6px;\n margin: 4px 0 12px;\n}\n.index-module_directions__Hv0zx .index-module_content__PiCFf {\n position: relative;\n width: 100%;\n margin-bottom: 12px;\n}\n.index-module_directions__Hv0zx .index-module_background__WM4u- {\n position: absolute;\n width: 100%;\n height: 300px;\n background: #f5f5f5;\n border-radius: 8px;\n z-index: 0;\n}\n.index-module_directions__Hv0zx .index-module_luppan__nGfH2 {\n inset: 0;\n z-index: 1;\n}\n.index-module_directions__Hv0zx .index-module_slideTip__RGnd1 {\n margin: 20px 0;\n}\n.index-module_directions__Hv0zx .index-module_slider__VDKnB {\n padding: 0 24px;\n}";
|
|
20042
|
-
var styles$3 = {"directions":"index-module_directions__Hv0zx","default":"index-module_default__sSWp4","tips":"index-module_tips__VVEuO","optimal":"index-module_optimal__07le4","content":"index-module_content__PiCFf","background":"index-module_background__WM4u-","luppan":"index-module_luppan__nGfH2","slideTip":"index-module_slideTip__RGnd1","slider":"index-module_slider__VDKnB"};
|
|
20043
|
-
styleInject(css_248z$3);
|
|
20044
|
-
|
|
20045
|
-
var css_248z$2 = ".style-module_commonModalContainer__WHZnl {\n width: inherit;\n height: inherit;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh {\n display: flex;\n flex-direction: column;\n width: 300px;\n height: 100%;\n position: relative;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directText__b7QUs {\n padding-top: 15px;\n color: #1d1d1d;\n text-align: center;\n font-size: 16px;\n font-weight: 600;\n line-height: 24px;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directOption__IFsis {\n position: absolute;\n width: 100%;\n height: 100%;\n border-radius: 50%;\n pointer-events: none;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directOption__IFsis .style-module_leftTop__H39Uk {\n width: 22px;\n height: 18px;\n position: absolute;\n top: -5px;\n left: 50%;\n transform: translate(-50%, 0) rotate(90deg);\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directOption__IFsis .style-module_rightBottom__f3c7n {\n width: 22px;\n height: 18px;\n position: absolute;\n bottom: -5px;\n left: 50%;\n transform: translate(-50%, 0) rotate(-90deg);\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n {\n flex: 1;\n min-height: 293px;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n .style-module_directDialPlate__zkFHk {\n position: relative;\n width: 293px;\n height: 293px;\n border-radius: 50%;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n .style-module_directDialPlate__zkFHk .style-module_directLineMain__p60DH {\n position: absolute;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n .style-module_directDialPlate__zkFHk .style-module_directLineMain__p60DH .style-module_directLineContent__D9N62 {\n position: absolute;\n left: 50%;\n top: 50%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n width: 18px;\n height: 224px;\n cursor: pointer;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n .style-module_directDialPlate__zkFHk .style-module_directLineMain__p60DH .style-module_directLineContent__D9N62 .style-module_directLineText__DOhL4 {\n flex: 1;\n display: flex;\n justify-content: center;\n align-items: center;\n font-size: 12px;\n font-weight: 600;\n line-height: 1;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n .style-module_directDialPlate__zkFHk .style-module_directLineMain__p60DH .style-module_directLineContent__D9N62 .style-module_directLine__ngnPh {\n width: 100%;\n height: 186px;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n .style-module_directDialPlate__zkFHk .style-module_directCenterCircle__YUrtv {\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n width: 28px;\n height: 28px;\n border: 6px solid #e0e0e6;\n background: #f2f3f6;\n border-radius: 50%;\n box-sizing: border-box;\n}\n.style-module_commonModalContainer__WHZnl .style-module_commonModalContent__UQ98C .style-module_content__tR9Fh .style-module_directDialPlateBox__tie9n .style-module_directDialPlate__zkFHk .style-module_directCenterCircle__YUrtv.style-module_active__ga2w0 {\n border-color: rgb(254, 226, 213);\n}";
|
|
20046
|
-
var styles$2 = {"commonModalContainer":"style-module_commonModalContainer__WHZnl","commonModalContent":"style-module_commonModalContent__UQ98C","content":"style-module_content__tR9Fh","directOption":"style-module_directOption__IFsis","leftTop":"style-module_leftTop__H39Uk","rightBottom":"style-module_rightBottom__f3c7n","directDialPlateBox":"style-module_directDialPlateBox__tie9n","directDialPlate":"style-module_directDialPlate__zkFHk","directLineMain":"style-module_directLineMain__p60DH","directLineContent":"style-module_directLineContent__D9N62","directLineText":"style-module_directLineText__DOhL4","directLine":"style-module_directLine__ngnPh","directCenterCircle":"style-module_directCenterCircle__YUrtv","active":"style-module_active__ga2w0"};
|
|
20047
|
-
styleInject(css_248z$2);
|
|
20048
|
-
|
|
20049
|
-
const DirectionLine = (props) => {
|
|
20050
|
-
const { selected = false, ...svgProps } = props;
|
|
20051
|
-
const colorMap = useMemo(() => {
|
|
20052
|
-
if (selected) {
|
|
20053
|
-
return {
|
|
20054
|
-
circleFill: '#FEE2D5',
|
|
20055
|
-
circleStroke: '#FF7133',
|
|
20056
|
-
line: '#FF7133',
|
|
20057
|
-
};
|
|
20058
|
-
}
|
|
20059
|
-
return {
|
|
20060
|
-
circleFill: '#E0E0E6',
|
|
20061
|
-
circleStroke: '#B3B4C3',
|
|
20062
|
-
line: '#D2D2E0',
|
|
20063
|
-
};
|
|
20064
|
-
}, [selected]);
|
|
20065
|
-
return (jsxs("svg", { width: "16", height: "186", viewBox: "0 0 16 186", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...svgProps, children: [jsx("path", { d: "M8.54148 10.4062L7.98535 175.173", stroke: colorMap.line, strokeWidth: "2", strokeDasharray: "5 5" }), jsx("circle", { cx: "8.26392", cy: "177.535", r: "6.67359", fill: colorMap.circleFill, stroke: colorMap.circleStroke, strokeWidth: "2" }), jsx("circle", { cx: "8.26344", cy: "8.47047", r: "6.67359", fill: colorMap.circleFill, stroke: colorMap.circleStroke, strokeWidth: "2" })] }));
|
|
20066
|
-
};
|
|
20067
|
-
|
|
20068
|
-
var _g$1, _defs$1;
|
|
20069
|
-
function _extends$4() { return _extends$4 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$4.apply(null, arguments); }
|
|
20070
|
-
var SvgDirectDialPlate = function SvgDirectDialPlate(props) {
|
|
20071
|
-
return /*#__PURE__*/React.createElement("svg", _extends$4({
|
|
20072
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20073
|
-
width: 293,
|
|
20074
|
-
height: 293,
|
|
20075
|
-
fill: "none"
|
|
20076
|
-
}, props), _g$1 || (_g$1 = /*#__PURE__*/React.createElement("g", {
|
|
20077
|
-
clipPath: "url(#direct-dial-plate_svg__a)"
|
|
20078
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
20079
|
-
opacity: 0.55
|
|
20080
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
20081
|
-
filter: "url(#direct-dial-plate_svg__b)",
|
|
20082
|
-
shapeRendering: "crispEdges"
|
|
20083
|
-
}, /*#__PURE__*/React.createElement("circle", {
|
|
20084
|
-
cx: 146.549,
|
|
20085
|
-
cy: 146.553,
|
|
20086
|
-
r: 133.643,
|
|
20087
|
-
fill: "#fff",
|
|
20088
|
-
fillOpacity: 0.65
|
|
20089
|
-
}), /*#__PURE__*/React.createElement("circle", {
|
|
20090
|
-
cx: 146.549,
|
|
20091
|
-
cy: 146.553,
|
|
20092
|
-
r: 133.643,
|
|
20093
|
-
stroke: "#C1C2D1"
|
|
20094
|
-
})), /*#__PURE__*/React.createElement("g", {
|
|
20095
|
-
filter: "url(#direct-dial-plate_svg__c)",
|
|
20096
|
-
shapeRendering: "crispEdges"
|
|
20097
|
-
}, /*#__PURE__*/React.createElement("circle", {
|
|
20098
|
-
cx: 146.549,
|
|
20099
|
-
cy: 146.553,
|
|
20100
|
-
r: 140,
|
|
20101
|
-
fill: "#fff",
|
|
20102
|
-
fillOpacity: 0.65
|
|
20103
|
-
}), /*#__PURE__*/React.createElement("circle", {
|
|
20104
|
-
cx: 146.549,
|
|
20105
|
-
cy: 146.553,
|
|
20106
|
-
r: 140,
|
|
20107
|
-
stroke: "#fff"
|
|
20108
|
-
})), /*#__PURE__*/React.createElement("circle", {
|
|
20109
|
-
cx: 146.549,
|
|
20110
|
-
cy: 146.553,
|
|
20111
|
-
r: 112,
|
|
20112
|
-
fill: "#fff",
|
|
20113
|
-
transform: "rotate(90 146.549 146.553)"
|
|
20114
|
-
})), /*#__PURE__*/React.createElement("circle", {
|
|
20115
|
-
cx: 146.549,
|
|
20116
|
-
cy: 146.553,
|
|
20117
|
-
r: 115,
|
|
20118
|
-
stroke: "#E0E0E6",
|
|
20119
|
-
strokeWidth: 6
|
|
20120
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
20121
|
-
fill: "#E0E0E7",
|
|
20122
|
-
d: "m24.863 157.648-.078-.895 6.163-.54q.037.449.075.896zm6.162-21.672-.076.894-6.159-.539.078-.894zm1.346-10.014q-.079.442-.153.886l-6.08-1.071.157-.885zm-6.074 42.25-.156-.885 6.077-1.072q.074.444.153.886zm2.344 10.398-.234-.868 5.954-1.595q.114.434.23.868zm5.95-62.523q-.117.434-.23.869l-5.953-1.594.233-.869zm3.08-9.641-.307.843-5.788-2.105.308-.844zm-5.788 82.319-.307-.845 5.788-2.107q.152.423.307.844zm4.114 9.833-.38-.815 5.587-2.605q.189.408.381.814zM41.585 97.11q-.191.405-.38.814l-5.587-2.604.38-.815zm-.63 110.924-.45-.778 5.345-3.086q.224.39.45.777zm5.347-119.88q-.228.388-.451.777l-5.344-3.084.45-.778zm.412 128.85-.515-.736 5.064-3.546q.256.369.515.735zm4.55-136.626-5.062-3.543.515-.735 5.062 3.544q-.259.366-.515.734m6.713-8.735q-.29.343-.577.688l-4.74-3.977.576-.688zm-4.74 153.795-.577-.689 4.74-3.977q.287.346.577.688zM72.33 57.402q-.345.286-.69.577l-3.977-4.74.689-.578zm-3.977 183.041-.689-.578 3.978-4.74q.342.29.688.577zm11.29-188.662-3.546-5.063.736-.515 3.545 5.062q-.368.256-.735.517M76.834 246.9l-.735-.516 3.545-5.062q.366.26.734.516zM88.93 45.853q-.39.224-.778.451l-3.087-5.346.779-.449zm-3.084 206.741-.779-.449 3.086-5.345q.388.227.778.451zM97.923 41.206q-.408.188-.814.38l-2.605-5.585.813-.38zm-2.604 216.276-.814-.38 2.604-5.585q.407.191.815.38zm9.86 4.043-.844-.307 2.107-5.788q.422.154.844.306zm2.109-224.158q-.423.15-.845.306l-2.107-5.787.845-.308zm8.07 227.327-.868-.233 1.595-5.951q.434.116.869.229zm1.598-230.331q-.435.113-.869.23l-1.595-5.95.868-.233zm8.817 232.599-.884-.156 1.072-6.076q.441.078.885.153zm1.075-234.742q-.444.075-.885.152l-1.072-6.075.884-.156zm10.037-1.27q-.448.037-.895.076l-.539-6.158.895-.078zm-.535 237.365-.895-.079.539-6.159q.447.04.896.077zm20.4 0-.538-6.162q.448-.036.894-.076l.539 6.16zm.36-237.288q-.446-.04-.894-.077l.538-6.16.894.078zm10.029 1.346q-.443-.077-.886-.153l1.071-6.078.885.156zm.187 234.589-1.071-6.08q.443-.075.886-.152l1.071 6.076zm9.688-232.369q-.434-.116-.868-.23l1.594-5.953.867.234zm.728 230.1-1.595-5.954q.435-.113.87-.23l1.593 5.951zm8.912-227.02q-.42-.154-.843-.306l2.106-5.789.844.307zm1.264 223.853-2.106-5.789.844-.307 2.107 5.788zm9.863-4.044-2.603-5.586q.407-.189.813-.38l2.605 5.587zm-1.788-215.894q-.406-.192-.814-.38l2.604-5.587.815.38zm8.954 4.716a98 98 0 0 0-.777-.451l3.086-5.345.778.45zm2.308 206.291-3.085-5.345q.39-.224.776-.451l3.086 5.347zm6.202-200.813q-.367-.26-.735-.516l3.546-5.064.735.515zm2.809 195.119-3.544-5.064.735-.515 3.545 5.063zm5.192-188.922q-.344-.29-.689-.577l3.977-4.74.689.578zm3.288 182.465-3.977-4.742q.345-.287.688-.578l3.978 4.741zM235.7 72.334q-.287-.345-.577-.69l4.741-3.978.577.689zm4.162 153.103-4.739-3.978q.29-.344.577-.689l4.74 3.978zm1.973-145.059q-.257-.368-.517-.734l5.063-3.545.515.735zm4.549 136.626-5.064-3.547q.26-.366.516-.735l5.063 3.547zm.863-128.074q-.224-.39-.45-.776l5.345-3.086.449.777zm4.897 119.105-5.346-3.087q.226-.387.45-.777l5.345 3.087zm-.25-110.112q-.19-.408-.38-.813l5.585-2.605.38.815zm5.205 100.675-5.585-2.606q.191-.405.381-.813l5.584 2.604zm-1.365-91.309q-.151-.423-.306-.844l5.788-2.107.306.845zm5.482 81.477-5.788-2.108q.155-.421.306-.844l5.789 2.108zm-2.479-71.811q-.114-.435-.23-.869l5.951-1.594.232.869zm5.722 61.656-5.951-1.596q.116-.434.229-.867l5.954 1.595zm-3.578-51.762q-.076-.444-.153-.886l6.078-1.071.156.885zm5.923 41.363-6.076-1.072.153-.885 6.079 1.072zm-4.654-31.325q-.035-.447-.075-.894l6.156-.538.079.894zm6.084 20.762-6.159-.54q.04-.447.075-.895l6.162.54z"
|
|
20123
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
20124
|
-
fill: "#B3B4C3",
|
|
20125
|
-
d: "M142.291 27.432v-11h1.684l5.82 8.27-1.339-.693h.97v-7.577h1.865v11h-1.677l-5.819-8.279 1.338.694h-.97v7.585zM57.438 66.693l-4.982-4.982.466-.466 7.337 1.287-.497.152.248-.248-4.14-4.14.463-.463 4.983 4.983-.453.452-7.354-1.278.5-.155-.248.249 4.143 4.143zM63.66 60.471l-6.353-3.611.49-.49 5.342 3.159.034-.035-3.052-5.448.466-.466 5.452 3.048.031-.03-3.156-5.346.487-.486 3.612 6.352-.435.436-5.387-2.942-.034.034 2.942 5.387zM52.28 232.95q-.53-.53-.753-1.105a2.3 2.3 0 0 1-.152-1.119q.07-.546.428-.98l.035-.042.47.47-.035.041a1.2 1.2 0 0 0-.27.698q-.024.396.163.818.189.424.573.808.376.376.79.542.419.162.801.11.387-.055.667-.335l.003-.003a1.07 1.07 0 0 0 .325-.843q-.022-.497-.466-1.204l-.398-.625q-.583-.922-.593-1.582-.007-.663.507-1.177l.004-.004q.397-.397.922-.486a2.1 2.1 0 0 1 1.09.11 2.9 2.9 0 0 1 1.064.704q.487.487.687 1.033.203.549.135 1.06-.063.51-.394.897l-.038.045-.47-.469.032-.045a1.2 1.2 0 0 0 .234-.628q.032-.357-.124-.739a2.15 2.15 0 0 0-.51-.732 2.2 2.2 0 0 0-.736-.501 1.47 1.47 0 0 0-.76-.11q-.367.048-.646.328l-.003.003a.98.98 0 0 0-.297.794q.03.467.47 1.16l.393.629q.405.638.539 1.139.138.504.028.911a1.7 1.7 0 0 1-.456.753l-.004.004a1.9 1.9 0 0 1-.994.545q-.552.103-1.14-.117-.586-.222-1.122-.756M56.209 236.672l3.611-6.353.49.49-3.159 5.341.035.035 5.448-3.052.466.466-3.049 5.452.032.031 5.344-3.156.487.487-6.353 3.611-.435-.435 2.942-5.386-.035-.035-5.386 2.942zM235.144 238.465q-.529.528-1.105.753a2.3 2.3 0 0 1-1.119.151 1.9 1.9 0 0 1-.98-.428l-.042-.034.47-.47.041.035q.301.245.698.269a1.75 1.75 0 0 0 .818-.162 2.7 2.7 0 0 0 .808-.573q.377-.377.542-.791.162-.417.111-.801a1.15 1.15 0 0 0-.335-.666l-.004-.004a1.07 1.07 0 0 0-.842-.324q-.498.02-1.205.466l-.625.397q-.922.583-1.581.594-.663.006-1.178-.508l-.003-.003a1.7 1.7 0 0 1-.487-.922 2.1 2.1 0 0 1 .11-1.091q.208-.566.705-1.064a2.9 2.9 0 0 1 1.032-.687q.549-.203 1.06-.134.511.061.898.393l.045.038-.47.47-.045-.031a1.18 1.18 0 0 0-.628-.235 1.6 1.6 0 0 0-.739.124 2.2 2.2 0 0 0-.732.511q-.345.346-.501.736a1.5 1.5 0 0 0-.11.759q.048.366.328.646l.003.003a.98.98 0 0 0 .794.297q.466-.03 1.161-.469l.628-.394q.64-.404 1.139-.539.504-.138.912-.027.406.11.753.456l.003.003q.442.442.545.994.104.553-.117 1.14-.22.587-.756 1.122M237.875 235.527l-4.982-4.983 3.007-3.007.425.425-2.538 2.538 1.796 1.795 2.413-2.414.421.422-2.413 2.413 1.916 1.916 2.538-2.537.424.424zM226.781 57.137l4.982-4.983.467.466-1.288 7.337-.152-.497.248.249 4.14-4.14.463.463-4.982 4.982-.453-.452 1.278-7.355.155.501-.248-.249-4.144 4.144zM231.943 62.298l4.982-4.982 3.008 3.007-.425.425-2.538-2.538-1.795 1.796 2.413 2.413-.421.421-2.413-2.413-1.917 1.916 2.538 2.538-.425.425zM266.486 152.604l-.197-11.065 6.803-.135.03 1.664-4.924.098.053 2.998 4.655-.092.028 1.572-4.655.092.057 3.167 4.923-.097.03 1.664zM146.805 276.672q-1.278 0-2.222-.378-.936-.377-1.476-1.052a2.8 2.8 0 0 1-.609-1.576l-.008-.102h1.903l.007.073q.047.443.366.77.327.326.867.515.541.182 1.233.182.663 0 1.172-.196.51-.196.799-.538.29-.348.29-.798v-.008a1.11 1.11 0 0 0-.465-.922q-.464-.363-1.529-.581l-1.18-.232q-1.69-.342-2.458-1.089-.762-.756-.761-1.924v-.007q0-.937.517-1.641.525-.705 1.439-1.097.92-.399 2.108-.399 1.218 0 2.108.392.89.384 1.4 1.053.51.667.571 1.51l.008.094h-1.872l-.016-.087a1.34 1.34 0 0 0-.357-.719 1.9 1.9 0 0 0-.754-.493 3.1 3.1 0 0 0-1.103-.182q-.602 0-1.073.182-.473.174-.746.493-.267.32-.267.77v.007q0 .552.449.915.457.363 1.484.567l1.18.239q1.157.233 1.88.617.723.385 1.058.959.342.565.342 1.365v.007q0 1.016-.525 1.757-.518.74-1.484 1.147-.959.407-2.276.407M16.514 152.004l-2.706-10h1.874l1.734 7.505h.098l1.993-7.505h1.601l2.014 7.505h.098l1.728-7.505h1.86l-2.7 10h-1.692l-2.056-7.159h-.105l-2.042 7.159z"
|
|
20126
|
-
}))), _defs$1 || (_defs$1 = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("filter", {
|
|
20127
|
-
id: "direct-dial-plate_svg__b",
|
|
20128
|
-
width: 276.285,
|
|
20129
|
-
height: 276.285,
|
|
20130
|
-
x: 8.406,
|
|
20131
|
-
y: 8.41,
|
|
20132
|
-
colorInterpolationFilters: "sRGB",
|
|
20133
|
-
filterUnits: "userSpaceOnUse"
|
|
20134
|
-
}, /*#__PURE__*/React.createElement("feFlood", {
|
|
20135
|
-
floodOpacity: 0,
|
|
20136
|
-
result: "BackgroundImageFix"
|
|
20137
|
-
}), /*#__PURE__*/React.createElement("feColorMatrix", {
|
|
20138
|
-
"in": "SourceAlpha",
|
|
20139
|
-
result: "hardAlpha",
|
|
20140
|
-
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
20141
|
-
}), /*#__PURE__*/React.createElement("feOffset", null), /*#__PURE__*/React.createElement("feGaussianBlur", {
|
|
20142
|
-
stdDeviation: 2
|
|
20143
|
-
}), /*#__PURE__*/React.createElement("feComposite", {
|
|
20144
|
-
in2: "hardAlpha",
|
|
20145
|
-
operator: "out"
|
|
20146
|
-
}), /*#__PURE__*/React.createElement("feColorMatrix", {
|
|
20147
|
-
values: "0 0 0 0 0.0683333 0 0 0 0 0.103468 0 0 0 0 0.133333 0 0 0 0.25 0"
|
|
20148
|
-
}), /*#__PURE__*/React.createElement("feBlend", {
|
|
20149
|
-
in2: "BackgroundImageFix",
|
|
20150
|
-
result: "effect1_dropShadow_10512_51195"
|
|
20151
|
-
}), /*#__PURE__*/React.createElement("feBlend", {
|
|
20152
|
-
"in": "SourceGraphic",
|
|
20153
|
-
in2: "effect1_dropShadow_10512_51195",
|
|
20154
|
-
result: "shape"
|
|
20155
|
-
})), /*#__PURE__*/React.createElement("filter", {
|
|
20156
|
-
id: "direct-dial-plate_svg__c",
|
|
20157
|
-
width: 291,
|
|
20158
|
-
height: 291,
|
|
20159
|
-
x: 1.049,
|
|
20160
|
-
y: 1.053,
|
|
20161
|
-
colorInterpolationFilters: "sRGB",
|
|
20162
|
-
filterUnits: "userSpaceOnUse"
|
|
20163
|
-
}, /*#__PURE__*/React.createElement("feFlood", {
|
|
20164
|
-
floodOpacity: 0,
|
|
20165
|
-
result: "BackgroundImageFix"
|
|
20166
|
-
}), /*#__PURE__*/React.createElement("feColorMatrix", {
|
|
20167
|
-
"in": "SourceAlpha",
|
|
20168
|
-
result: "hardAlpha",
|
|
20169
|
-
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
20170
|
-
}), /*#__PURE__*/React.createElement("feOffset", null), /*#__PURE__*/React.createElement("feGaussianBlur", {
|
|
20171
|
-
stdDeviation: 2.5
|
|
20172
|
-
}), /*#__PURE__*/React.createElement("feComposite", {
|
|
20173
|
-
in2: "hardAlpha",
|
|
20174
|
-
operator: "out"
|
|
20175
|
-
}), /*#__PURE__*/React.createElement("feColorMatrix", {
|
|
20176
|
-
values: "0 0 0 0 0.0683333 0 0 0 0 0.103468 0 0 0 0 0.133333 0 0 0 0.5 0"
|
|
20177
|
-
}), /*#__PURE__*/React.createElement("feBlend", {
|
|
20178
|
-
in2: "BackgroundImageFix",
|
|
20179
|
-
result: "effect1_dropShadow_10512_51195"
|
|
20180
|
-
}), /*#__PURE__*/React.createElement("feBlend", {
|
|
20181
|
-
"in": "SourceGraphic",
|
|
20182
|
-
in2: "effect1_dropShadow_10512_51195",
|
|
20183
|
-
result: "shape"
|
|
20184
|
-
})), /*#__PURE__*/React.createElement("clipPath", {
|
|
20185
|
-
id: "direct-dial-plate_svg__a"
|
|
20186
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
20187
|
-
fill: "#fff",
|
|
20188
|
-
d: "M.549 292.553v-292h292v292z"
|
|
20189
|
-
})))));
|
|
20190
|
-
};
|
|
20191
|
-
|
|
20192
|
-
var _g, _defs;
|
|
20193
|
-
function _extends$3() { return _extends$3 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$3.apply(null, arguments); }
|
|
20194
|
-
var SvgOption = function SvgOption(props) {
|
|
20195
|
-
return /*#__PURE__*/React.createElement("svg", _extends$3({
|
|
20196
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20197
|
-
width: 22,
|
|
20198
|
-
height: 18,
|
|
20199
|
-
fill: "none"
|
|
20200
|
-
}, props), _g || (_g = /*#__PURE__*/React.createElement("g", {
|
|
20201
|
-
filter: "url(#option_svg__a)"
|
|
20202
|
-
}, /*#__PURE__*/React.createElement("mask", {
|
|
20203
|
-
id: "option_svg__b",
|
|
20204
|
-
width: 18,
|
|
20205
|
-
height: 15,
|
|
20206
|
-
x: 2,
|
|
20207
|
-
y: 0.612,
|
|
20208
|
-
fill: "#000",
|
|
20209
|
-
maskUnits: "userSpaceOnUse"
|
|
20210
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
20211
|
-
fill: "#fff",
|
|
20212
|
-
d: "M2 .612h18v15H2z"
|
|
20213
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
20214
|
-
d: "M4 4.39a1 1 0 0 1 1.599-.801l4.419 3.302h7.27v1.992H10.32L5.6 12.412A1 1 0 0 1 4 11.61z"
|
|
20215
|
-
})), /*#__PURE__*/React.createElement("path", {
|
|
20216
|
-
fill: "currentColor",
|
|
20217
|
-
d: "M4 4.39a1 1 0 0 1 1.599-.801l4.419 3.302h7.27v1.992H10.32L5.6 12.412A1 1 0 0 1 4 11.61z"
|
|
20218
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
20219
|
-
fill: "#F5F6F8",
|
|
20220
|
-
d: "M5.599 3.589 4.4 5.19zm4.419 3.302L8.82 8.493l.533.398h.665zm7.27 0h2v-2h-2zm0 1.992v2h2v-2zm-6.968 0v-2h-.665l-.532.398zM5.6 12.412l1.196 1.603.001-.001zM4 11.61H2v.001zm0-7.22h2a1 1 0 0 1-1.599.8L5.6 3.59l1.197-1.602C4.818.509 2 1.919 2 4.39zm1.599-.801L4.402 5.19 8.82 8.493l1.198-1.602 1.197-1.603-4.42-3.301zm4.419 3.302v2h7.27v-4h-7.27zm7.27 0h-2v1.992h4V6.89zm0 1.992v-2H10.32v4h6.967zm-6.968 0L9.123 7.28 4.4 10.81 5.6 12.411l1.197 1.602 4.722-3.53zM5.6 12.412l-1.197-1.603a1 1 0 0 1 1.598.8l-2 .001-2 .001c0 2.466 2.815 3.882 4.795 2.404zM4 11.61h2V4.39H2v7.22z",
|
|
20221
|
-
mask: "url(#option_svg__b)"
|
|
20222
|
-
}))), _defs || (_defs = /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("filter", {
|
|
20223
|
-
id: "option_svg__a",
|
|
20224
|
-
width: 21.287,
|
|
20225
|
-
height: 17.232,
|
|
20226
|
-
x: 0,
|
|
20227
|
-
y: 0.384,
|
|
20228
|
-
colorInterpolationFilters: "sRGB",
|
|
20229
|
-
filterUnits: "userSpaceOnUse"
|
|
20230
|
-
}, /*#__PURE__*/React.createElement("feFlood", {
|
|
20231
|
-
floodOpacity: 0,
|
|
20232
|
-
result: "BackgroundImageFix"
|
|
20233
|
-
}), /*#__PURE__*/React.createElement("feColorMatrix", {
|
|
20234
|
-
"in": "SourceAlpha",
|
|
20235
|
-
result: "hardAlpha",
|
|
20236
|
-
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"
|
|
20237
|
-
}), /*#__PURE__*/React.createElement("feOffset", {
|
|
20238
|
-
dy: 1
|
|
20239
|
-
}), /*#__PURE__*/React.createElement("feGaussianBlur", {
|
|
20240
|
-
stdDeviation: 1
|
|
20241
|
-
}), /*#__PURE__*/React.createElement("feComposite", {
|
|
20242
|
-
in2: "hardAlpha",
|
|
20243
|
-
operator: "out"
|
|
20244
|
-
}), /*#__PURE__*/React.createElement("feColorMatrix", {
|
|
20245
|
-
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"
|
|
20246
|
-
}), /*#__PURE__*/React.createElement("feBlend", {
|
|
20247
|
-
in2: "BackgroundImageFix",
|
|
20248
|
-
result: "effect1_dropShadow_13071_1578"
|
|
20249
|
-
}), /*#__PURE__*/React.createElement("feBlend", {
|
|
20250
|
-
"in": "SourceGraphic",
|
|
20251
|
-
in2: "effect1_dropShadow_13071_1578",
|
|
20252
|
-
result: "shape"
|
|
20253
|
-
})))));
|
|
20254
|
-
};
|
|
20255
|
-
|
|
20256
|
-
// json中返回的是多选方向的加值,所以需要拆开
|
|
20257
|
-
function convertDirectionToParams(value) {
|
|
20258
|
-
const A = 1 << 0; // bit0 = 1
|
|
20259
|
-
const B = 1 << 1; // bit1 = 2
|
|
20260
|
-
const C = 1 << 2; // bit2 = 4
|
|
20261
|
-
const D = 1 << 3; // bit3 = 8
|
|
20262
|
-
const E = 1 << 4; // bit4 = 16
|
|
20263
|
-
const F = 1 << 5; // bit5 = 32
|
|
20264
|
-
const directions = [];
|
|
20265
|
-
// 检查每个位标志是否被设置
|
|
20266
|
-
if (value & A)
|
|
20267
|
-
directions.push(A);
|
|
20268
|
-
if (value & B)
|
|
20269
|
-
directions.push(B);
|
|
20270
|
-
if (value & C)
|
|
20271
|
-
directions.push(C);
|
|
20272
|
-
if (value & D)
|
|
20273
|
-
directions.push(D);
|
|
20274
|
-
if (value & E)
|
|
20275
|
-
directions.push(E);
|
|
20276
|
-
if (value & F)
|
|
20277
|
-
directions.push(F);
|
|
20278
|
-
return directions;
|
|
20279
|
-
}
|
|
20280
|
-
|
|
20281
|
-
const MowDirection_L = (props) => {
|
|
20282
|
-
const { value, angleValue, optionAngle = 45, zIndex = 10000, onChange,
|
|
20283
|
-
// children,
|
|
20284
|
-
} = props;
|
|
20285
|
-
const [angle, setAngle] = useState(0);
|
|
20286
|
-
const [lineList, setLineList] = useState([
|
|
20287
|
-
{
|
|
20288
|
-
value: 1 << 0,
|
|
20289
|
-
text: 'A',
|
|
20290
|
-
selected: false,
|
|
20291
|
-
},
|
|
20292
|
-
{
|
|
20293
|
-
value: 1 << 1,
|
|
20294
|
-
text: 'B',
|
|
20295
|
-
selected: false,
|
|
20296
|
-
},
|
|
20297
|
-
{
|
|
20298
|
-
value: 1 << 2,
|
|
20299
|
-
text: 'C',
|
|
20300
|
-
selected: false,
|
|
20301
|
-
},
|
|
20302
|
-
{
|
|
20303
|
-
value: 1 << 3,
|
|
20304
|
-
text: 'D',
|
|
20305
|
-
selected: false,
|
|
20306
|
-
},
|
|
20307
|
-
{
|
|
20308
|
-
value: 1 << 4,
|
|
20309
|
-
text: 'E',
|
|
20310
|
-
selected: false,
|
|
20311
|
-
},
|
|
20312
|
-
{
|
|
20313
|
-
value: 1 << 5,
|
|
20314
|
-
text: 'F',
|
|
20315
|
-
selected: false,
|
|
20316
|
-
},
|
|
20317
|
-
]);
|
|
20318
|
-
const hitRectAngle = useMemo(() => {
|
|
20319
|
-
const direction = lineList
|
|
20320
|
-
?.filter((item) => item?.selected)
|
|
20321
|
-
?.reduce((pre, line) => {
|
|
20322
|
-
return pre + line.value;
|
|
20323
|
-
}, 0);
|
|
20324
|
-
const angles = getSelectAngles(direction)?.map((item) => item + angleValue);
|
|
20325
|
-
return angles?.includes(optionAngle);
|
|
20326
|
-
}, [lineList, angleValue, optionAngle]);
|
|
20327
|
-
const allSelect = useMemo(() => {
|
|
20328
|
-
return lineList?.every((item) => item?.selected);
|
|
20329
|
-
}, [lineList]);
|
|
20330
|
-
useEffect(() => {
|
|
20331
|
-
setLineList(lineList.map((line) => ({
|
|
20332
|
-
...line,
|
|
20333
|
-
selected: convertDirectionToParams(value).includes(line.value),
|
|
20334
|
-
})));
|
|
20335
|
-
}, [value]);
|
|
20336
|
-
useEffect(() => {
|
|
20337
|
-
setAngle(angleValue);
|
|
20338
|
-
}, [angleValue]);
|
|
20339
|
-
console.log('hitRectAngle-->', hitRectAngle);
|
|
20340
|
-
const onLineClick = (index) => {
|
|
20341
|
-
const newLine = lineList.map((line, i) => {
|
|
20342
|
-
if (i === index) {
|
|
20343
|
-
return {
|
|
20344
|
-
...line,
|
|
20345
|
-
selected: !line.selected,
|
|
20346
|
-
};
|
|
20347
|
-
}
|
|
20348
|
-
return { ...line };
|
|
20349
|
-
});
|
|
20350
|
-
setLineList(newLine);
|
|
20351
|
-
onChange?.(newLine
|
|
20352
|
-
?.filter((item) => item?.selected)
|
|
20353
|
-
.reduce((pre, line) => {
|
|
20354
|
-
return pre + line.value;
|
|
20355
|
-
}, 0));
|
|
20356
|
-
};
|
|
20357
|
-
return (jsx("div", { className: styles$2.commonModalContainer, style: { zIndex }, children: jsx("div", { className: styles$2.commonModalContent, children: jsxs("div", { className: styles$2.content, children: [jsx("div", { className: styles$2.directDialPlateBox, children: jsxs("div", { className: styles$2.directDialPlate, children: [jsx(SvgDirectDialPlate, {}), jsx("div", { className: styles$2.directLineMain, style: {
|
|
20358
|
-
transform: `rotate(${angle}deg)`,
|
|
20359
|
-
}, children: lineList.map((line, index) => (jsxs("div", { className: styles$2.directLineContent, style: {
|
|
20360
|
-
transform: `translate(-50%, -50%) rotate(${30 * index}deg)`,
|
|
20361
|
-
}, children: [jsx("div", { className: styles$2.directLineText, style: {
|
|
20362
|
-
color: line.selected ? '#FF996C' : '#B3B4C3',
|
|
20363
|
-
}, children: line.text }), jsx(DirectionLine, { className: styles$2.directLine, selected: line.selected, onClick: () => onLineClick(index) }), jsx("div", { className: styles$2.directLineText, style: {
|
|
20364
|
-
transform: 'rotate(180deg)',
|
|
20365
|
-
color: line.selected ? '#FF996C' : '#B3B4C3',
|
|
20366
|
-
}, children: line.text })] }, line.value))) }), jsx("div", { className: classNames(styles$2.directCenterCircle, {
|
|
20367
|
-
[styles$2.active]: allSelect && hitRectAngle,
|
|
20368
|
-
}) })] }) }), jsxs("div", { className: styles$2.directOption, style: {
|
|
20369
|
-
transform: `rotate(${optionAngle}deg)`,
|
|
20370
|
-
color: hitRectAngle ? '#FF996C' : '#B3B4C3',
|
|
20371
|
-
}, children: [jsx("div", { className: styles$2.leftTop, children: jsx(SvgOption, {}) }), jsx("div", { className: styles$2.rightBottom, children: jsx(SvgOption, {}) })] })] }) }) }));
|
|
20372
|
-
};
|
|
20373
|
-
|
|
20374
|
-
const DirectionModal = ({ directionInfo, open, setOpen, zoneName, optionAngle, onChange, }) => {
|
|
20375
|
-
const { mapJson, mapConfig, drag } = useCommonContext();
|
|
20376
|
-
const { editMapInfo } = useMapEditContext();
|
|
20377
|
-
const { svgElementDatas } = useSvgEditContext();
|
|
20378
|
-
const [directions, setDirections] = useState(ALL_DIRECTION_SELECTED);
|
|
20379
|
-
const [angle, setAngle] = useState(MIN_DIRECTION_ANGLE);
|
|
20380
|
-
const canSetDefault = useMemo(() => {
|
|
20381
|
-
const angles = getSelectAngles(directions)?.map((item) => item + angle);
|
|
20382
|
-
const hitRectAngle = angles?.includes(optionAngle);
|
|
20383
|
-
return directions !== ALL_DIRECTION_SELECTED || !hitRectAngle;
|
|
20384
|
-
}, [directions, angle]);
|
|
20385
|
-
const canSave = useMemo(() => {
|
|
20386
|
-
return directions !== directionInfo?.direction || angle !== directionInfo?.angle;
|
|
20387
|
-
}, [directions, angle, directionInfo]);
|
|
20388
|
-
useEffect(() => {
|
|
20389
|
-
if (!open)
|
|
20390
|
-
return;
|
|
20391
|
-
setDirections(directionInfo.direction);
|
|
20392
|
-
setAngle(directionInfo.angle);
|
|
20393
|
-
}, [directionInfo, open]);
|
|
20394
|
-
const resetDirection = () => {
|
|
20395
|
-
setDirections(ALL_DIRECTION_SELECTED);
|
|
20396
|
-
const defaultAngle = getDefaultAngle(optionAngle);
|
|
20397
|
-
console.log('defaultAngle=>', defaultAngle, optionAngle);
|
|
20398
|
-
if (defaultAngle) {
|
|
20399
|
-
setAngle(defaultAngle);
|
|
20400
|
-
}
|
|
20401
|
-
};
|
|
20402
|
-
// 计算当前boundary的viewBox
|
|
20403
|
-
const boundaryViewBox = useMemo(() => {
|
|
20404
|
-
const currentBoundary = editMapInfo.selectElement;
|
|
20405
|
-
if (!currentBoundary?.points || currentBoundary.points.length === 0) {
|
|
20406
|
-
return null;
|
|
20407
|
-
}
|
|
20408
|
-
// 计算边界
|
|
20409
|
-
let minX = Infinity;
|
|
20410
|
-
let minY = Infinity;
|
|
20411
|
-
let maxX = -Infinity;
|
|
20412
|
-
let maxY = -Infinity;
|
|
20413
|
-
currentBoundary.points.forEach((point) => {
|
|
20414
|
-
minX = Math.min(minX, point[0]);
|
|
20415
|
-
minY = Math.min(minY, point[1]);
|
|
20416
|
-
maxX = Math.max(maxX, point[0]);
|
|
20417
|
-
maxY = Math.max(maxY, point[1]);
|
|
20418
|
-
});
|
|
20419
|
-
// 添加边距
|
|
20420
|
-
const padding = 50;
|
|
20421
|
-
const width = maxX - minX + padding * 2;
|
|
20422
|
-
const height = maxY - minY + padding * 2;
|
|
20423
|
-
return {
|
|
20424
|
-
x: minX - padding,
|
|
20425
|
-
y: minY - padding,
|
|
20426
|
-
width,
|
|
20427
|
-
height,
|
|
20428
|
-
};
|
|
20429
|
-
}, [editMapInfo.selectElement]);
|
|
20430
|
-
console.log('directionInfo=>', directionInfo, mapJson);
|
|
20431
|
-
return (jsx(CustomModal, { maskClosable: false, titleCenter: true, title: `${zoneName} mowing direction`, open: open, width: 600, onCancel: () => {
|
|
20432
|
-
setOpen(false);
|
|
20433
|
-
}, onOk: () => {
|
|
20434
|
-
onChange?.(directions, angle);
|
|
20435
|
-
setOpen(false);
|
|
20436
|
-
}, okText: "Confirm", cancelText: "Cancel", okButtonProps: { disabled: !canSave }, afterClose: () => {
|
|
20437
|
-
setDirections(ALL_DIRECTION_SELECTED);
|
|
20438
|
-
setAngle(MIN_DIRECTION_ANGLE);
|
|
20439
|
-
}, children: jsxs("div", { className: styles$3.directions, children: [jsx("div", { className: styles$3.default, children: jsx(Button, { disabled: !canSetDefault, variant: "link", color: "primary", onClick: resetDirection, children: "Default" }) }), jsx("div", { className: styles$3.tips, children: "\u4E00\u4E2A\u7B80\u77ED\u7684\u8BF4\u660E\uFF0C\u5E0C\u671B\u80FD\u5145\u5F53\u7B80\u5355\u7684\u6559\u7A0B\uFF0C\u9700\u8981\u53EF\u5FC3\u6839\u636EC\u7AEF\u5DF2\u6709\u7684\u6574\u5408\u4E00\u4E0B" }), jsxs("div", { className: styles$3.optimal, children: [jsx("div", { children: "*" }), jsx(SvgOption, {}), jsx("div", { className: styles$3.text, children: "Optimal direction" })] }), jsxs("div", { className: styles$3.content, children: [jsx("div", { className: styles$3.background, children: jsxs("div", { style: {
|
|
20440
|
-
position: 'relative',
|
|
20441
|
-
width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`,
|
|
20442
|
-
height: '300px',
|
|
20443
|
-
margin: '0 auto',
|
|
20444
|
-
}, children: [boundaryViewBox && (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${300 * (boundaryViewBox.width / boundaryViewBox.height)}px`, height: "300px", style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementDatas)?.map((key) => {
|
|
20445
|
-
return svgElementDatas[key]?.map((element) => {
|
|
20446
|
-
if (key === DataType.VISION_OFF)
|
|
20447
|
-
return null;
|
|
20448
|
-
return (jsx(GElement, { type: key, data: svgElementDatas[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
|
|
20449
|
-
});
|
|
20450
|
-
}) })), jsx(CharginPile, { mapData: mapJson, mapConfig: mapConfig, viewBox: boundaryViewBox || null, rotation: drag?.rotation })] }) }), jsx("div", { className: styles$3.luppan, children: jsx(MowDirection_L, { value: directions, angleValue: angle, optionAngle: optionAngle, onChange: (value) => {
|
|
20451
|
-
console.log('valie=>', value);
|
|
20452
|
-
setDirections(value);
|
|
20453
|
-
} }) })] }), jsx("div", { className: styles$3.slideTip, children: "\u7528\u6237\u8FD8\u53EF\u4EE5\u901A\u8FC7\u6ED1\u8F68\u5FAE\u8C03\u5272\u8349\u65B9\u5411\uFF08\u975E\u5FC5\u987B\uFF09" }), jsx("div", { className: styles$3.slider, children: jsx(Slider, { tooltip: {
|
|
20454
|
-
formatter: (value) => `${value}°`,
|
|
20455
|
-
}, min: MIN_DIRECTION_ANGLE, max: MAX_DIRECTION_ANGLE, value: angle, onChange: (value) => setAngle(value) }) })] }) }));
|
|
20456
|
-
};
|
|
20457
|
-
|
|
20458
|
-
const BoundaryInfo = ({ onHandleDelete }) => {
|
|
20459
|
-
const { unitType, heightOptions, globalHeight } = useCommonContext();
|
|
20460
|
-
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
20461
|
-
const nameValue = editMapInfo.selectElement?.name;
|
|
20462
|
-
const onHandleFocus = () => { };
|
|
20463
|
-
const [open, setOpen] = useState(false);
|
|
20464
|
-
const [heightOpen, setHeightOpen] = useState(false);
|
|
20465
|
-
const [directionOpen, setDirectionOpen] = useState(false);
|
|
20466
|
-
const sizeValue = useMemo(() => {
|
|
20467
|
-
const points = editMapInfo.selectElement?.points?.map((item) => [
|
|
20468
|
-
item[0] / SCALE_FACTOR,
|
|
20469
|
-
item[1] / SCALE_FACTOR,
|
|
20470
|
-
]);
|
|
20471
|
-
const { area: areaValue, perimeter: perimeterValue } = calculatePolygonAreaAndPerimeter(points) || {};
|
|
20472
|
-
const formatArea = convertAreaByUnits(areaValue);
|
|
20473
|
-
const formatPerimeter = convertDistanceByUnits(perimeterValue);
|
|
20474
|
-
return {
|
|
20475
|
-
area: formatArea.value,
|
|
20476
|
-
perimeter: formatPerimeter.value,
|
|
20477
|
-
};
|
|
20478
|
-
}, [editMapInfo.selectElement]);
|
|
20479
|
-
const edgeMowingValue = useMemo(() => {
|
|
20480
|
-
return {
|
|
20481
|
-
edgeMowing: editMapInfo?.selectElement?.edgeMowing,
|
|
20482
|
-
obstacleMowEdge: editMapInfo?.selectElement?.obstacleMowEdge,
|
|
20483
|
-
};
|
|
20484
|
-
}, [editMapInfo.selectElement]);
|
|
20485
|
-
const heightValue = useMemo(() => {
|
|
20486
|
-
return {
|
|
20487
|
-
isFlowGlobal: editMapInfo?.selectElement?.isFlowGlobal,
|
|
20488
|
-
cuttingHeight: editMapInfo?.selectElement?.cuttingHeight,
|
|
20489
|
-
};
|
|
20490
|
-
}, [editMapInfo.selectElement]);
|
|
20491
|
-
const directionInfo = useMemo(() => {
|
|
20492
|
-
return {
|
|
20493
|
-
direction: editMapInfo?.selectElement?.direction,
|
|
20494
|
-
angle: editMapInfo?.selectElement?.angle,
|
|
20495
|
-
};
|
|
20496
|
-
}, [editMapInfo.selectElement?.direction, editMapInfo.selectElement?.angle]);
|
|
20497
|
-
const optionAngle = useMemo(() => {
|
|
20498
|
-
return editMapInfo?.selectElement?.recBaseAngle;
|
|
20499
|
-
}, [editMapInfo.selectElement?.recBaseAngle]);
|
|
20500
|
-
console.log('height---->', editMapInfo?.selectElement, heightValue, edgeMowingValue);
|
|
20501
|
-
return (jsxs("div", { className: styles$9.boundaryInfo, children: [jsx(Header, { handleDelete: onHandleDelete, handleFocus: onHandleFocus, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { name: nameValue, onChange: (name) => {
|
|
20502
|
-
setEditMapInfo({
|
|
20503
|
-
...editMapInfo,
|
|
20504
|
-
isShowDrag: false,
|
|
20505
|
-
selectElement: {
|
|
20506
|
-
...editMapInfo.selectElement,
|
|
20507
|
-
name: name,
|
|
20508
|
-
},
|
|
20509
|
-
});
|
|
20510
|
-
} }) }), jsxs("div", { className: styles$9.otherEdit, children: [jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Height" }), jsx("div", { className: styles$9.value, children: generateHeightStr(heightValue?.cuttingHeight, unitType, true) }), jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20511
|
-
setHeightOpen(true);
|
|
20512
|
-
}, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Direction" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20513
|
-
setDirectionOpen(true);
|
|
20514
|
-
}, children: jsx(SvgArrow, {}) })] }) }), jsx(Item, { children: jsxs("div", { className: styles$9.otherItem, children: [jsx("div", { className: styles$9.label, children: "Mowing Edge" }), jsx("div", { className: styles$9.value }), jsx("div", { className: styles$9.icon, onClick: () => {
|
|
20515
|
-
setOpen(true);
|
|
20516
|
-
}, children: jsx(SvgArrow, {}) })] }) })] }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] }), jsx(MowingEdgeModal, { value: edgeMowingValue, onChange: (value) => {
|
|
20517
|
-
setEditMapInfo({
|
|
20518
|
-
...editMapInfo,
|
|
20519
|
-
selectElement: {
|
|
20520
|
-
...editMapInfo.selectElement,
|
|
20521
|
-
edgeMowing: value.edgeMowing ? 1 : 0,
|
|
20522
|
-
obstacleMowEdge: value.obstacleMowEdge ? 1 : 0,
|
|
20523
|
-
},
|
|
20524
|
-
});
|
|
20525
|
-
}, open: open, setOpen: setOpen }), jsx(HeightModal, { zoneName: editMapInfo.selectElement?.name, heightOptions: heightOptions, globalHeight: globalHeight, open: heightOpen, setOpen: setHeightOpen, value: heightValue, onChange: (value) => {
|
|
20526
|
-
setEditMapInfo({
|
|
20527
|
-
...editMapInfo,
|
|
20528
|
-
selectElement: {
|
|
20529
|
-
...editMapInfo.selectElement,
|
|
20530
|
-
cuttingHeight: value.cuttingHeight,
|
|
20531
|
-
isFlowGlobal: value.isFlowGlobal,
|
|
20532
|
-
},
|
|
20533
|
-
});
|
|
20534
|
-
} }), jsx(DirectionModal, { directionInfo: directionInfo, optionAngle: optionAngle, open: directionOpen, setOpen: setDirectionOpen, zoneName: editMapInfo.selectElement?.name, onChange: (direction, angle) => {
|
|
20535
|
-
setEditMapInfo({
|
|
20536
|
-
...editMapInfo,
|
|
20537
|
-
selectElement: {
|
|
20538
|
-
...editMapInfo.selectElement,
|
|
20539
|
-
direction,
|
|
20540
|
-
angle,
|
|
20541
|
-
},
|
|
20542
|
-
});
|
|
20543
|
-
} })] }));
|
|
20544
|
-
};
|
|
20545
|
-
|
|
20546
|
-
var css_248z$1 = ".index-module_timePeriod__EkVZl {\n display: flex;\n flex-direction: column;\n padding: 8px 0;\n border-top: 1px solid rgb(197, 197, 197);\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n padding: 0px 0 4px 0;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodTitle__lnYno {\n font-weight: 400;\n font-size: 14px;\n line-height: 16px;\n color: rgb(0, 0, 0);\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodHeader__CgJGW .index-module_timePeriodHandle__pjDTA {\n margin-left: auto;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n}\n.index-module_timePeriod__EkVZl .index-module_timePeriodContent__pTqdW .index-module_timePeriodRadioItem__3rd-r {\n line-height: 28px;\n}";
|
|
20547
|
-
var styles$1 = {"timePeriod":"index-module_timePeriod__EkVZl","timePeriodHeader":"index-module_timePeriodHeader__CgJGW","timePeriodTitle":"index-module_timePeriodTitle__lnYno","timePeriodHandle":"index-module_timePeriodHandle__pjDTA","timePeriodContent":"index-module_timePeriodContent__pTqdW","timePeriodRadioItem":"index-module_timePeriodRadioItem__3rd-r"};
|
|
20548
|
-
styleInject(css_248z$1);
|
|
20549
|
-
|
|
20550
|
-
var RadioValue;
|
|
20551
|
-
(function (RadioValue) {
|
|
20552
|
-
RadioValue[RadioValue["LONG_TIME"] = 0] = "LONG_TIME";
|
|
20553
|
-
RadioValue[RadioValue["SHORT_TIME"] = 1] = "SHORT_TIME";
|
|
20554
|
-
})(RadioValue || (RadioValue = {}));
|
|
20555
|
-
const TimePeriod = ({ value, onChange }) => {
|
|
20556
|
-
// eslint-disable-next-line no-undef
|
|
20557
|
-
const [date, setDate] = useState();
|
|
20558
|
-
const [open, setOpen] = useState(false);
|
|
20559
|
-
const [radioValue, setRadioValue] = useState(RadioValue.LONG_TIME);
|
|
20560
|
-
console.log('time period->', date, radioValue);
|
|
20561
|
-
return (jsxs("div", { className: styles$1.timePeriod, children: [jsxs("div", { className: styles$1.timePeriodHeader, children: [jsx("div", { className: styles$1.timePeriodTitle, children: "Enabled" }), jsx("div", { className: styles$1.timePeriodHandle, children: jsx(Switch, { checked: value.status === 1, onChange: (checked) => {
|
|
20562
|
-
onChange({
|
|
20563
|
-
...value,
|
|
20564
|
-
status: checked ? 1 : 0,
|
|
20565
|
-
});
|
|
20566
|
-
} }) })] }), jsx("div", { className: styles$1.timePeriodContent, children: jsxs(Radio.Group, { value: radioValue, onChange: (e) => {
|
|
20567
|
-
setRadioValue(e.target.value);
|
|
20568
|
-
if (e.target.value === RadioValue.LONG_TIME) {
|
|
20569
|
-
setDate(null);
|
|
20570
|
-
onChange({
|
|
20571
|
-
...value,
|
|
20572
|
-
startTimestamp: 0,
|
|
20573
|
-
endTimestamp: 0,
|
|
20574
|
-
});
|
|
20575
|
-
}
|
|
20576
|
-
else if (e.target.value === RadioValue.SHORT_TIME) {
|
|
20577
|
-
setOpen(true);
|
|
20578
|
-
// onChange({
|
|
20579
|
-
// ...value,
|
|
20580
|
-
// startTimestamp: dayjs().add(30, 'minute').unix(),
|
|
20581
|
-
// endTimestamp: dayjs().add(1, 'hour').unix(),
|
|
20582
|
-
// });
|
|
20583
|
-
}
|
|
20584
|
-
}, style: { display: 'flex', flexDirection: 'column', gap: '4px' }, children: [jsx(Radio, { value: RadioValue.LONG_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: "\u957F\u65F6\u95F4\u5F00\u542F" }) }), jsx(Radio, { value: RadioValue.SHORT_TIME, children: jsx("div", { className: styles$1.timePeriodRadioItem, children: jsx(DatePicker.RangePicker, { open: open, onOpenChange: (open) => {
|
|
20585
|
-
if (!open) {
|
|
20586
|
-
setRadioValue(RadioValue.LONG_TIME);
|
|
20587
|
-
}
|
|
20588
|
-
setOpen(open);
|
|
20589
|
-
}, value: date ? date : undefined, disabled: radioValue === RadioValue.LONG_TIME, showTime: { format: 'HH:mm' }, format: "MM/DD/YYYY HH:mm", preserveInvalidOnBlur: true, onChange: (dateValue, dateString) => {
|
|
20590
|
-
console.log('change->', dateValue);
|
|
20591
|
-
if (dateValue?.length === 2) {
|
|
20592
|
-
setDate(dateValue);
|
|
20593
|
-
onChange({
|
|
20594
|
-
status: RadioValue.SHORT_TIME,
|
|
20595
|
-
startTimestamp: dateValue[0].unix(),
|
|
20596
|
-
endTimestamp: dateValue[1].unix(),
|
|
20597
|
-
});
|
|
20598
|
-
}
|
|
20599
|
-
} }) }) })] }) })] }));
|
|
20600
|
-
};
|
|
20601
|
-
|
|
20602
|
-
const ObstacleInfo = ({ onHandleDelete }) => {
|
|
20603
|
-
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
20604
|
-
const nameValue = editMapInfo.selectElement?.name;
|
|
20605
|
-
console.log('obstacle->', editMapInfo.selectElement);
|
|
20606
|
-
const timePeriodValue = useMemo(() => {
|
|
20607
|
-
if (!editMapInfo.selectElement)
|
|
20608
|
-
return null;
|
|
20609
|
-
const status = editMapInfo.selectElement?.status;
|
|
20610
|
-
const startTimestamp = editMapInfo.selectElement?.start_timestamp;
|
|
20611
|
-
const endTimestamp = editMapInfo.selectElement?.end_timestamp;
|
|
20612
|
-
return {
|
|
20613
|
-
status,
|
|
20614
|
-
startTimestamp,
|
|
20615
|
-
endTimestamp,
|
|
20616
|
-
};
|
|
20617
|
-
}, [editMapInfo.selectElement]);
|
|
20618
|
-
const sizeValue = useMemo(() => {
|
|
20619
|
-
const points = editMapInfo.selectElement?.points?.map((item) => [
|
|
20620
|
-
item[0] / SCALE_FACTOR,
|
|
20621
|
-
item[1] / SCALE_FACTOR,
|
|
20622
|
-
]);
|
|
20623
|
-
const { area: areaValue, perimeter: perimeterValue } = calculatePolygonAreaAndPerimeter(points) || {};
|
|
20624
|
-
const formatArea = convertAreaByUnits(areaValue);
|
|
20625
|
-
const formatPerimeter = convertDistanceByUnits(perimeterValue);
|
|
20626
|
-
return {
|
|
20627
|
-
area: formatArea.value,
|
|
20628
|
-
perimeter: formatPerimeter.value,
|
|
20629
|
-
};
|
|
20630
|
-
}, [editMapInfo.selectElement]);
|
|
20631
|
-
return (jsxs("div", { className: styles$9.obstacleInfo, children: [jsx(Header, { handleDelete: () => {
|
|
20632
|
-
onHandleDelete();
|
|
20633
|
-
}, handleFocus: () => { }, type: editMapInfo.elementType }), jsx("div", { className: styles$9.nameEdit, children: jsx(NameEdit, { name: nameValue, onChange: (name) => {
|
|
20634
|
-
setEditMapInfo({
|
|
20635
|
-
...editMapInfo,
|
|
20636
|
-
isShowDrag: false,
|
|
20637
|
-
selectElement: {
|
|
20638
|
-
...editMapInfo.selectElement,
|
|
20639
|
-
name: name,
|
|
20640
|
-
},
|
|
20641
|
-
});
|
|
20642
|
-
} }) }), jsx("div", { className: styles$9.timePeriod, children: jsx(TimePeriod, { value: timePeriodValue, onChange: (value) => {
|
|
20643
|
-
setEditMapInfo({
|
|
20644
|
-
...editMapInfo,
|
|
20645
|
-
isShowDrag: editMapInfo?.isShowDrag || false,
|
|
20646
|
-
selectElement: {
|
|
20647
|
-
...editMapInfo.selectElement,
|
|
20648
|
-
status: value.status,
|
|
20649
|
-
start_timestamp: value.startTimestamp,
|
|
20650
|
-
end_timestamp: value.endTimestamp,
|
|
20651
|
-
},
|
|
20652
|
-
});
|
|
20653
|
-
} }) }), jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Area:" }), jsx("div", { className: styles$9.value, children: sizeValue?.area })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Perimeter:" }), jsx("div", { className: styles$9.value, children: sizeValue?.perimeter })] })] })] }));
|
|
20654
|
-
};
|
|
20655
|
-
|
|
20656
|
-
const DoodleInfo = ({ onHandleDelete }) => {
|
|
20657
|
-
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
20658
|
-
const options = useMemo(() => {
|
|
20659
|
-
return new Array(30).fill(0).map((_, index) => {
|
|
20660
|
-
return {
|
|
20661
|
-
label: `${index + 1}day`,
|
|
20662
|
-
value: index + 1,
|
|
20663
|
-
};
|
|
20664
|
-
});
|
|
20665
|
-
}, []);
|
|
20666
|
-
const isCreate = useMemo(() => {
|
|
20667
|
-
return editMapInfo?.createMode;
|
|
20668
|
-
}, [editMapInfo?.createMode]);
|
|
20669
|
-
const doodleInfo = useMemo(() => {
|
|
20670
|
-
if (!editMapInfo.selectElement)
|
|
20671
|
-
return null;
|
|
20672
|
-
const create_ts = editMapInfo?.selectElement?.create_ts;
|
|
20673
|
-
const expiration_ts = editMapInfo.selectElement.expiration_ts;
|
|
20674
|
-
const diff = expiration_ts - create_ts;
|
|
20675
|
-
const day = Math.floor(diff / (60 * 60 * 24 * 1000));
|
|
20676
|
-
console.log('create_ts->', create_ts, expiration_ts, day);
|
|
20677
|
-
return {
|
|
20678
|
-
day: day,
|
|
20679
|
-
};
|
|
20680
|
-
}, [editMapInfo?.selectElement]);
|
|
20681
|
-
const sizeValue = useMemo(() => {
|
|
20682
|
-
if (!editMapInfo.selectElement || !editMapInfo.selectElement.svg)
|
|
20683
|
-
return '';
|
|
20684
|
-
const svg = editMapInfo.selectElement?.svg;
|
|
20685
|
-
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
20686
|
-
const width = parseSvg.width / SCALE_FACTOR;
|
|
20687
|
-
const height = parseSvg.height / SCALE_FACTOR;
|
|
20688
|
-
console.log('parseSvg->', parseSvg);
|
|
20689
|
-
return `${width} m x ${height} m`;
|
|
20690
|
-
}, [editMapInfo.selectElement]);
|
|
20691
|
-
const handleChange = useCallback((day) => {
|
|
20692
|
-
const lastTime = Date.now() - editMapInfo.selectElement.create_ts;
|
|
20693
|
-
setEditMapInfo((pre) => {
|
|
20694
|
-
console.log('expiration_ts->', lastTime, day, lastTime + day * 24 * 60 * 60 * 1000);
|
|
20695
|
-
return {
|
|
20696
|
-
...pre,
|
|
20697
|
-
selectElement: {
|
|
20698
|
-
...pre.selectElement,
|
|
20699
|
-
expiration_ts: Date.now() + lastTime + day * 24 * 60 * 60 * 1000,
|
|
20700
|
-
},
|
|
20701
|
-
};
|
|
20702
|
-
});
|
|
20703
|
-
}, [editMapInfo.selectElement]);
|
|
20704
|
-
console.log('doodleInfo->', doodleInfo);
|
|
20705
|
-
return (jsxs("div", { className: styles$9.doodleInfo, children: [jsx(Header, { handleDelete: () => {
|
|
20706
|
-
onHandleDelete();
|
|
20707
|
-
}, handleFocus: () => { }, type: editMapInfo.elementType }), isCreate ? (jsx(Item, { children: jsxs("div", { className: styles$9.time, children: [jsxs("div", { className: styles$9.exist, children: [jsx("div", { className: styles$9.label, children: "Graph maintenance time" }), jsx("div", { className: styles$9.value, children: jsx(Select, { defaultValue: doodleInfo?.day, style: { width: 80 }, onChange: (value) => handleChange(value), options: options }) })] }), doodleInfo?.day >= 14 && (jsx("div", { className: styles$9.tip, children: "* If the doodle lasts over 14 days, the grass may grow too tall for the mower to mow later." }))] }) })) : (jsxs("div", { className: styles$9.areaInfo, children: [jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Graph maintenance time:" }), jsxs("div", { className: styles$9.value, children: [doodleInfo?.day, " day"] })] }), jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] })] }))] }));
|
|
20708
|
-
};
|
|
20709
|
-
|
|
20710
|
-
const VisionOffInfo = ({ onHandleDelete }) => {
|
|
20711
|
-
const { editMapInfo, setEditMapInfo } = useMapEditContext();
|
|
20712
|
-
const sizeValue = useMemo(() => {
|
|
20713
|
-
if (!editMapInfo.selectElement)
|
|
20714
|
-
return '';
|
|
20715
|
-
const points = editMapInfo.selectElement?.points;
|
|
20716
|
-
const [width, height] = calculateRectangleDimensions(points);
|
|
20717
|
-
const formatWidth = convertDistanceByUnits(width / SCALE_FACTOR);
|
|
20718
|
-
const formatHeight = convertDistanceByUnits(height / SCALE_FACTOR);
|
|
20719
|
-
return `${formatWidth.value} x ${formatHeight.value}`;
|
|
20720
|
-
}, [editMapInfo.selectElement]);
|
|
20721
|
-
return (jsxs("div", { className: "visionOffInfo", children: [jsx(Header, { handleDelete: () => {
|
|
20722
|
-
onHandleDelete?.();
|
|
20723
|
-
}, handleFocus: () => { }, type: DataType.VISION_OFF }), jsx("div", { className: styles$9.areaInfo, children: jsxs("div", { className: styles$9.areaItem, children: [jsx("div", { className: styles$9.label, children: "Size:" }), jsx("div", { className: styles$9.value, children: sizeValue })] }) })] }));
|
|
20724
|
-
};
|
|
20725
|
-
|
|
20726
|
-
var _path$2, _path2$1;
|
|
20727
|
-
function _extends$2() { return _extends$2 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$2.apply(null, arguments); }
|
|
20728
|
-
var SvgUndo = function SvgUndo(props) {
|
|
20729
|
-
return /*#__PURE__*/React.createElement("svg", _extends$2({
|
|
20730
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20731
|
-
width: 24,
|
|
20732
|
-
height: 24,
|
|
20733
|
-
fill: "none"
|
|
20734
|
-
}, props), _path$2 || (_path$2 = /*#__PURE__*/React.createElement("path", {
|
|
20735
|
-
stroke: "currentColor",
|
|
20736
|
-
strokeLinecap: "round",
|
|
20737
|
-
strokeLinejoin: "round",
|
|
20738
|
-
strokeWidth: 2,
|
|
20739
|
-
d: "M4.329 7.821h10.506a5.581 5.581 0 0 1 0 11.163h-5.27"
|
|
20740
|
-
})), _path2$1 || (_path2$1 = /*#__PURE__*/React.createElement("path", {
|
|
20741
|
-
stroke: "currentColor",
|
|
20742
|
-
strokeLinecap: "round",
|
|
20743
|
-
strokeLinejoin: "round",
|
|
20744
|
-
strokeWidth: 2,
|
|
20745
|
-
d: "m7.293 3.607-4.39 4.215 4.39 4.316"
|
|
20746
|
-
})));
|
|
20747
|
-
};
|
|
20748
|
-
|
|
20749
|
-
var _path$1, _path2;
|
|
20750
|
-
function _extends$1() { return _extends$1 = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends$1.apply(null, arguments); }
|
|
20751
|
-
var SvgRedo = function SvgRedo(props) {
|
|
20752
|
-
return /*#__PURE__*/React.createElement("svg", _extends$1({
|
|
20753
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
20754
|
-
width: 24,
|
|
20755
|
-
height: 24,
|
|
20756
|
-
fill: "none"
|
|
20757
|
-
}, props), _path$1 || (_path$1 = /*#__PURE__*/React.createElement("path", {
|
|
20758
|
-
stroke: "currentColor",
|
|
20759
|
-
strokeLinecap: "round",
|
|
20760
|
-
strokeLinejoin: "round",
|
|
20761
|
-
strokeWidth: 2,
|
|
20762
|
-
d: "M19.672 7.821H9.165a5.581 5.581 0 1 0 0 11.163h5.27"
|
|
20763
|
-
})), _path2 || (_path2 = /*#__PURE__*/React.createElement("path", {
|
|
20764
|
-
stroke: "currentColor",
|
|
20765
|
-
strokeLinecap: "round",
|
|
20766
|
-
strokeLinejoin: "round",
|
|
20767
|
-
strokeWidth: 2,
|
|
20768
|
-
d: "m16.708 3.607 4.389 4.215-4.39 4.315"
|
|
20769
|
-
})));
|
|
20770
|
-
};
|
|
20771
|
-
|
|
20772
|
-
const HandleElementInfo = () => {
|
|
20773
|
-
const { svgElementDatas } = useSvgEditContext();
|
|
20774
|
-
const { checkDoodle } = useCheckElement();
|
|
20775
|
-
const { undo, redo } = useHistoryHandle();
|
|
20776
|
-
const { editMapInfo, setEditMapInfo, onHandleStopRecord, onHandleCompleteRecord, onHandleDeleteElement, onUpdateBoundary, } = useMapEditContext();
|
|
20777
|
-
const currentType = useMemo(() => {
|
|
20778
|
-
return DATE_TYPE_MAP.find((item) => item.type === editMapInfo.elementType);
|
|
20779
|
-
}, [editMapInfo.elementType]);
|
|
20780
|
-
const isUndoDisabled = useMemo(() => {
|
|
20781
|
-
if (editMapInfo?.elementType === DataType.OBSTACLE &&
|
|
20782
|
-
editMapInfo?.createMode === CreateStatus.CREATING) {
|
|
20783
|
-
return !(editMapInfo?.currentHistoryIndex >= 0 && editMapInfo?.historyList?.length);
|
|
19736
|
+
});
|
|
19737
|
+
};
|
|
19738
|
+
const addDoodle = (selectedDoodle) => {
|
|
19739
|
+
const newDoodle = initDoodle();
|
|
19740
|
+
const svg = selectedDoodle?.svgStr;
|
|
19741
|
+
const minLength = selectedDoodle.minLength;
|
|
19742
|
+
const parseSvg = SvgParserNative.parseSvg(svg);
|
|
19743
|
+
const svgMinLength = parseSvg.height / SCALE_FACTOR;
|
|
19744
|
+
// 使用获取到的 SVG 内容,如果没有获取到则使用 URL
|
|
19745
|
+
newDoodle.svg = svg;
|
|
19746
|
+
newDoodle.scale = minLength / svgMinLength;
|
|
19747
|
+
newDoodle.direction = 0;
|
|
19748
|
+
newDoodle.center = restorePoint(centerPoint);
|
|
19749
|
+
if (platform === PlatformType.H5) {
|
|
19750
|
+
setEditMapInfo((prev) => ({
|
|
19751
|
+
...prev,
|
|
19752
|
+
currentHistoryIndex: 0,
|
|
19753
|
+
mobileMode: MobileEditMode.CREATE,
|
|
19754
|
+
elementType: DataType.DOODLE,
|
|
19755
|
+
selectElement: newDoodle,
|
|
19756
|
+
}));
|
|
19757
|
+
addHistory({
|
|
19758
|
+
selectElement: newDoodle,
|
|
19759
|
+
});
|
|
20784
19760
|
}
|
|
20785
19761
|
else {
|
|
20786
|
-
|
|
19762
|
+
setEditMapInfo({
|
|
19763
|
+
...editMapInfo,
|
|
19764
|
+
historyList: [
|
|
19765
|
+
{
|
|
19766
|
+
selectElement: newDoodle,
|
|
19767
|
+
},
|
|
19768
|
+
],
|
|
19769
|
+
currentHistoryIndex: 0,
|
|
19770
|
+
createMode: CreateStatus.COMPLETED,
|
|
19771
|
+
elementType: DataType.DOODLE,
|
|
19772
|
+
selectElement: newDoodle,
|
|
19773
|
+
isShowDrag: true,
|
|
19774
|
+
});
|
|
20787
19775
|
}
|
|
20788
|
-
}
|
|
20789
|
-
|
|
20790
|
-
|
|
20791
|
-
|
|
20792
|
-
|
|
20793
|
-
]);
|
|
20794
|
-
const idRedoDisabled = useMemo(() => {
|
|
20795
|
-
return !(editMapInfo?.currentHistoryIndex < editMapInfo?.historyList?.length - 1 &&
|
|
20796
|
-
editMapInfo?.historyList?.length);
|
|
20797
|
-
}, [editMapInfo?.currentHistoryIndex, editMapInfo?.historyList]);
|
|
20798
|
-
const handleUndo = useCallback(() => {
|
|
20799
|
-
undo();
|
|
20800
|
-
}, [undo]);
|
|
20801
|
-
const handleRedo = useCallback(() => {
|
|
20802
|
-
redo();
|
|
20803
|
-
}, [redo]);
|
|
20804
|
-
const renderElementData = useCallback((element) => {
|
|
20805
|
-
if (!editMapInfo.selectElement)
|
|
20806
|
-
return null;
|
|
20807
|
-
const data = {
|
|
20808
|
-
doodle: undefined,
|
|
20809
|
-
visionOffAreas: undefined,
|
|
20810
|
-
obstacle: undefined,
|
|
20811
|
-
boundary: undefined,
|
|
20812
|
-
};
|
|
20813
|
-
if (element?.type === DataType.DOODLE) {
|
|
20814
|
-
const doodleData = {
|
|
20815
|
-
center: element.center,
|
|
20816
|
-
direction: element.direction,
|
|
20817
|
-
scale: element.scale,
|
|
20818
|
-
svg: element.svg,
|
|
20819
|
-
expiration_ts: element.expiration_ts,
|
|
20820
|
-
create_ts: element.create_ts,
|
|
20821
|
-
};
|
|
20822
|
-
if (element?.id) {
|
|
20823
|
-
doodleData.id = element?.id;
|
|
20824
|
-
}
|
|
20825
|
-
data.doodle = JSON.stringify([doodleData]);
|
|
20826
|
-
}
|
|
20827
|
-
if (element?.type === DataType.VISION_OFF) {
|
|
20828
|
-
const visionOffArea = svgElementDatas?.[DataType.VISION_OFF]
|
|
20829
|
-
?.filter((item) => item.id !== element.id)
|
|
20830
|
-
?.map((item) => ({
|
|
20831
|
-
id: item.id,
|
|
20832
|
-
points: restorePointsFormat(item.points),
|
|
20833
|
-
})) || [];
|
|
20834
|
-
const visionOffAreaData = [
|
|
20835
|
-
...visionOffArea,
|
|
20836
|
-
{
|
|
20837
|
-
id: element?.id,
|
|
20838
|
-
points: restorePointsFormat(element.points),
|
|
20839
|
-
},
|
|
20840
|
-
]?.map((item) => {
|
|
20841
|
-
if (item?.id) {
|
|
20842
|
-
return {
|
|
20843
|
-
id: item.id,
|
|
20844
|
-
points: item.points,
|
|
20845
|
-
};
|
|
20846
|
-
}
|
|
20847
|
-
return {
|
|
20848
|
-
points: item.points,
|
|
20849
|
-
};
|
|
20850
|
-
}) || [];
|
|
20851
|
-
data.visionOffAreas = JSON.stringify(visionOffAreaData);
|
|
20852
|
-
}
|
|
20853
|
-
if (element?.type === DataType.OBSTACLE) {
|
|
20854
|
-
data.obstacle = {
|
|
20855
|
-
name: element?.name,
|
|
20856
|
-
status: element?.status || 1,
|
|
20857
|
-
end_timestamp: element?.end_timestamp || 1758870283,
|
|
20858
|
-
start_timestamp: element?.start_timestamp || 1768870283,
|
|
20859
|
-
points: restorePointsFormat(element.points),
|
|
20860
|
-
};
|
|
20861
|
-
if (element?.id) {
|
|
20862
|
-
data.obstacle.id = element?.id;
|
|
20863
|
-
}
|
|
19776
|
+
};
|
|
19777
|
+
const addElement = (type, item) => {
|
|
19778
|
+
let newElement = null;
|
|
19779
|
+
if (type === DataType.BOUNDARY) {
|
|
19780
|
+
newElement = initBoundary();
|
|
20864
19781
|
}
|
|
20865
|
-
if (
|
|
20866
|
-
|
|
20867
|
-
cuttingHeight: element?.cuttingHeight,
|
|
20868
|
-
isFlowGlobal: element?.isFlowGlobal,
|
|
20869
|
-
angle: element?.angle,
|
|
20870
|
-
direction: element?.direction,
|
|
20871
|
-
name: element?.name,
|
|
20872
|
-
edgeMowing: element?.edgeMowing,
|
|
20873
|
-
edgeVision: element?.edgeVision,
|
|
20874
|
-
obstacleMowEdge: element?.obstacleMowEdge,
|
|
20875
|
-
};
|
|
20876
|
-
if (element?.id) {
|
|
20877
|
-
data.boundary.id = element?.id;
|
|
20878
|
-
}
|
|
19782
|
+
else if (type === DataType.OBSTACLE) {
|
|
19783
|
+
newElement = initObstacle();
|
|
20879
19784
|
}
|
|
20880
|
-
|
|
20881
|
-
|
|
20882
|
-
const handleSave = useCallback(() => {
|
|
20883
|
-
const params = renderElementData(editMapInfo?.selectElement);
|
|
20884
|
-
const isObstacle = editMapInfo?.selectElement?.type === DataType.OBSTACLE;
|
|
20885
|
-
const hasNotEnoughPoints = params?.obstacle?.points?.length < 3;
|
|
20886
|
-
if (isObstacle && hasNotEnoughPoints) {
|
|
20887
|
-
message.error('Save failed, please draw a closed shape');
|
|
20888
|
-
return;
|
|
19785
|
+
else if (type === DataType.CHANNEL) {
|
|
19786
|
+
newElement = initChannel();
|
|
20889
19787
|
}
|
|
20890
|
-
|
|
20891
|
-
|
|
20892
|
-
|
|
20893
|
-
setEditMapInfo({
|
|
20894
|
-
...editMapInfo,
|
|
20895
|
-
createMode: null,
|
|
20896
|
-
elementType: null,
|
|
20897
|
-
selectElement: null,
|
|
20898
|
-
isShowDrag: false,
|
|
20899
|
-
});
|
|
20900
|
-
}, (errorText) => {
|
|
20901
|
-
message.error('Save failed, please try again');
|
|
20902
|
-
});
|
|
19788
|
+
else if (type === DataType.VISION_OFF) {
|
|
19789
|
+
newElement = initVisionOff();
|
|
19790
|
+
newElement.points = centerBounds;
|
|
20903
19791
|
}
|
|
20904
|
-
else {
|
|
20905
|
-
|
|
20906
|
-
|
|
20907
|
-
...editMapInfo,
|
|
20908
|
-
createMode: null,
|
|
20909
|
-
elementType: null,
|
|
20910
|
-
selectElement: null,
|
|
20911
|
-
isShowDrag: false,
|
|
20912
|
-
});
|
|
20913
|
-
}, (errorText) => {
|
|
20914
|
-
message.error('Save failed, please try again');
|
|
20915
|
-
});
|
|
19792
|
+
else if (type === DataType.DOODLE) {
|
|
19793
|
+
addDoodle(item);
|
|
19794
|
+
return;
|
|
20916
19795
|
}
|
|
20917
|
-
|
|
20918
|
-
|
|
20919
|
-
|
|
20920
|
-
|
|
20921
|
-
|
|
20922
|
-
|
|
20923
|
-
|
|
20924
|
-
|
|
20925
|
-
|
|
20926
|
-
|
|
19796
|
+
setEditMapInfo({
|
|
19797
|
+
...editMapInfo,
|
|
19798
|
+
historyList: [
|
|
19799
|
+
{
|
|
19800
|
+
selectElement: newElement,
|
|
19801
|
+
},
|
|
19802
|
+
],
|
|
19803
|
+
currentHistoryIndex: 0,
|
|
19804
|
+
createMode: type === DataType.VISION_OFF ? CreateStatus.COMPLETED : CreateStatus.CREATING,
|
|
19805
|
+
elementType: type,
|
|
19806
|
+
selectElement: newElement,
|
|
20927
19807
|
});
|
|
19808
|
+
};
|
|
19809
|
+
const saveElement = (type, item) => { };
|
|
19810
|
+
useEffect(() => {
|
|
19811
|
+
onEditInfoMapChange?.(editMapInfo);
|
|
20928
19812
|
}, [editMapInfo]);
|
|
20929
|
-
|
|
20930
|
-
|
|
20931
|
-
|
|
20932
|
-
|
|
20933
|
-
|
|
20934
|
-
|
|
20935
|
-
|
|
20936
|
-
|
|
20937
|
-
|
|
20938
|
-
|
|
20939
|
-
|
|
20940
|
-
|
|
20941
|
-
|
|
20942
|
-
|
|
20943
|
-
|
|
20944
|
-
|
|
20945
|
-
|
|
20946
|
-
|
|
20947
|
-
|
|
20948
|
-
|
|
20949
|
-
|
|
20950
|
-
|
|
20951
|
-
|
|
20952
|
-
|
|
20953
|
-
|
|
20954
|
-
|
|
19813
|
+
// 暴露ref方法
|
|
19814
|
+
useImperativeHandle(ref, () => ({
|
|
19815
|
+
adjustSvgSize,
|
|
19816
|
+
getSvgElement: () => svgRef.current,
|
|
19817
|
+
getContainerElement: () => containerRef.current,
|
|
19818
|
+
updateEditMapInfo,
|
|
19819
|
+
resetEditMapInfo,
|
|
19820
|
+
getEditMapInfo,
|
|
19821
|
+
// 十字准心点管理器方法
|
|
19822
|
+
addCreateObstaclePoint: () => {
|
|
19823
|
+
return pointManagerRef.current?.addPoint?.();
|
|
19824
|
+
},
|
|
19825
|
+
undoCreateObstaclePoint: () => {
|
|
19826
|
+
pointManagerRef.current?.undoLastPoint();
|
|
19827
|
+
},
|
|
19828
|
+
clearCreateObstaclePoints: () => {
|
|
19829
|
+
pointManagerRef.current?.clear();
|
|
19830
|
+
},
|
|
19831
|
+
getCreateObstaclePoints: () => pointManagerRef.current?.getPoints() || [],
|
|
19832
|
+
getCreateObstaclePointCount: () => pointManagerRef.current?.getPointCount() || 0,
|
|
19833
|
+
// h5进入视觉失效区编辑模式
|
|
19834
|
+
enterVisionOffEditMode,
|
|
19835
|
+
// h5中添加视觉失效区
|
|
19836
|
+
addVisionOffPoint,
|
|
19837
|
+
// 重做
|
|
19838
|
+
redo,
|
|
19839
|
+
// 撤销
|
|
19840
|
+
undo,
|
|
19841
|
+
// 清空历史记录
|
|
19842
|
+
clearHistory,
|
|
19843
|
+
addHistory,
|
|
19844
|
+
addDoodle,
|
|
19845
|
+
checkDoodle: () => checkDoodle?.(),
|
|
19846
|
+
addElement,
|
|
19847
|
+
saveElement,
|
|
19848
|
+
}));
|
|
19849
|
+
// 初始化多边形绘制 Hook
|
|
19850
|
+
const { onSvgClick, onSvgMouseMove, onPointClick, points, completed, mousePos, updatePoints } = usePolygonDrawing({ createMode: isCreating });
|
|
19851
|
+
// 处理删除顶点
|
|
19852
|
+
const handleCreateVertexDelete = (vertexIndex) => {
|
|
19853
|
+
const newPoints = points?.filter((_, index) => index !== vertexIndex);
|
|
19854
|
+
updatePoints(newPoints);
|
|
19855
|
+
};
|
|
19856
|
+
// 基于鼠标位置的检查结果
|
|
19857
|
+
const showNotCreateCursor = useMemo(() => {
|
|
19858
|
+
if (!mousePos)
|
|
19859
|
+
return false;
|
|
19860
|
+
return checkCanNotCreateAtPosition(mousePos);
|
|
19861
|
+
}, [mousePos, checkCanNotCreateAtPosition]);
|
|
19862
|
+
return (jsx("div", { ref: containerRef, className: classNames(styles$1.mapEdit, {
|
|
19863
|
+
[styles$1.createMode]: isCreating,
|
|
19864
|
+
[styles$1.notCreateCursor]: showNotCreateCursor,
|
|
19865
|
+
}), style: {
|
|
19866
|
+
display: editMap ? 'block' : 'none',
|
|
19867
|
+
}, children: jsxs("svg", { style: {
|
|
19868
|
+
position: 'absolute',
|
|
19869
|
+
left: '50%',
|
|
19870
|
+
top: '50%',
|
|
19871
|
+
transform: 'translate(-50%, -50%)',
|
|
19872
|
+
// cursor: createMode ? 'crosshair' : editMode ? 'default' : 'move',
|
|
19873
|
+
// pointerEvents: 'auto', // 关键:允许接收鼠标事件
|
|
19874
|
+
}, xmlns: "http://www.w3.org/2000/svg", "shape-rendering": "geometricPrecision", "text-rendering": "geometricPrecision", "image-rendering": "optimizeQuality", ref: svgRef, onClick: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgClick : undefined, onMouseMove: editMapInfo.createMode && platform !== PlatformType.H5 ? onSvgMouseMove : undefined, children: [jsxs("defs", { children: [jsx("filter", { id: "vertex-tooltip-shadow", x: "-50%", y: "-50%", width: "200%", height: "200%", children: jsx("feDropShadow", { dx: "2", dy: "2", stdDeviation: "2", floodColor: "#000", floodOpacity: "0.12" }) }), jsxs("filter", { id: `path-hover-${DataType.BOUNDARY}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: BOUNDARY_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.VISION_OFF}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: VISION_OFF_AREA_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] }), jsxs("filter", { id: `path-hover-${DataType.OBSTACLE}`, x: "-10%", y: "-10%", width: "120%", height: "120%", children: [jsx("feMorphology", { operator: "dilate", radius: "1", in: "SourceGraphic", result: "border" }), jsx("feFlood", { floodColor: OBSTACLE_STYLES.lineColor, floodOpacity: "1", result: "borderColor" }), jsx("feComposite", { in: "borderColor", in2: "border", operator: "in", result: "coloredBorder" }), jsxs("feMerge", { children: [jsx("feMergeNode", { in: "coloredBorder" }), jsx("feMergeNode", { in: "SourceGraphic" })] })] })] }), Object.keys(svgElementDatas)
|
|
19875
|
+
?.sort?.((a, b) => {
|
|
19876
|
+
if (a === DataType.BOUNDARY || b === DataType.BOUNDARY) {
|
|
19877
|
+
return 0;
|
|
20955
19878
|
}
|
|
20956
|
-
|
|
20957
|
-
|
|
20958
|
-
|
|
20959
|
-
|
|
20960
|
-
|
|
20961
|
-
|
|
20962
|
-
|
|
19879
|
+
const aVal = a === editMapInfo.elementType ? 1 : 0;
|
|
19880
|
+
const bVal = b === editMapInfo.elementType ? 1 : 0;
|
|
19881
|
+
return aVal - bVal;
|
|
19882
|
+
})
|
|
19883
|
+
?.map((key) => {
|
|
19884
|
+
const elements = svgElementDatas[key] || [];
|
|
19885
|
+
return (jsxs(GElement, { type: key, data: elements, children: [key === 'channel' && jsx(ChannelClipPath, {}), elements.map((item) => (jsx(SvgElement, { type: key, data: item }, item?.id)))] }, key));
|
|
19886
|
+
}), platform === PlatformType.WEB &&
|
|
19887
|
+
editMapInfo.createMode &&
|
|
19888
|
+
editMapInfo.elementType !== DataType.DOODLE &&
|
|
19889
|
+
editMapInfo.elementType !== DataType.VISION_OFF &&
|
|
19890
|
+
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(PolygonElement, { points: points?.length > 0
|
|
19891
|
+
? points.map((p) => [p.x, p.y, 2])
|
|
19892
|
+
: editMapInfo?.selectElement?.points, fillColor: createElementStyle.fillColor, strokeColor: createElementStyle.lineColor, strokeWidth: createElementStyle.lineWidth, createMode: editMapInfo.elementType !== DataType.VISION_OFF, showPoints: editMapInfo.elementType !== DataType.VISION_OFF, onPointClick: onPointClick, completed: completed, mousePos: mousePos, onVertexDelete: (vertexIndex) => handleCreateVertexDelete(vertexIndex), onCoordinatesChange: (newCoords) => {
|
|
19893
|
+
// 创建模式下的坐标变化(拖拽时)
|
|
19894
|
+
// 实时更新当前绘制的多边形
|
|
19895
|
+
updatePoints(newCoords.map((coord) => ({ x: coord[0], y: coord[1] })));
|
|
19896
|
+
}, svgRef: svgRef })), platform === PlatformType.WEB &&
|
|
19897
|
+
editMapInfo.createMode &&
|
|
19898
|
+
editMapInfo.elementType === DataType.VISION_OFF &&
|
|
19899
|
+
(points.length > 0 || editMapInfo?.selectElement?.points?.length > 0) && (jsx(VisionOffElement, { data: {
|
|
19900
|
+
...editMapInfo?.selectElement,
|
|
19901
|
+
style: {
|
|
19902
|
+
fillColor: createElementStyle.fillColor,
|
|
19903
|
+
lineColor: createElementStyle.lineColor,
|
|
19904
|
+
lineWidth: createElementStyle.lineWidth,
|
|
19905
|
+
},
|
|
19906
|
+
} })), platform === PlatformType.WEB &&
|
|
19907
|
+
editMapInfo.createMode &&
|
|
19908
|
+
editMapInfo?.selectElement?.svg && (jsx(DoodleElement, { data: { ...editMapInfo?.selectElement } })), platform === PlatformType.H5 &&
|
|
19909
|
+
editMapInfo.elementType === DataType.OBSTACLE &&
|
|
19910
|
+
editMapInfo.mobileMode === MobileEditMode.CREATE && (jsx(CreateObstacleElement, { ref: pointManagerRef, styles: {
|
|
19911
|
+
fillColor: '#FF7133',
|
|
19912
|
+
strokeColor: '#FF7133',
|
|
19913
|
+
}, points: (editMapInfo?.selectElement?.points || []).map((p) => ({
|
|
19914
|
+
x: p[0],
|
|
19915
|
+
y: p[1],
|
|
19916
|
+
})), enabled: true, svgElement: svgRef.current, onPointsChange: (newPoints) => {
|
|
19917
|
+
const new_points = newPoints.map((p) => [p.x, p.y, 2]);
|
|
19918
|
+
setEditMapInfo((prev) => {
|
|
19919
|
+
return {
|
|
19920
|
+
...prev,
|
|
19921
|
+
selectElement: {
|
|
19922
|
+
...prev.selectElement,
|
|
19923
|
+
points: new_points,
|
|
19924
|
+
},
|
|
19925
|
+
elementType: DataType.OBSTACLE,
|
|
19926
|
+
mobileMode: MobileEditMode.CREATE,
|
|
19927
|
+
};
|
|
20963
19928
|
});
|
|
20964
|
-
|
|
20965
|
-
|
|
20966
|
-
|
|
20967
|
-
|
|
20968
|
-
|
|
20969
|
-
|
|
20970
|
-
|
|
20971
|
-
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20975
|
-
|
|
20976
|
-
|
|
20977
|
-
|
|
20978
|
-
|
|
20979
|
-
|
|
20980
|
-
|
|
20981
|
-
|
|
20982
|
-
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
|
|
20990
|
-
},
|
|
20991
|
-
|
|
19929
|
+
addHistory({
|
|
19930
|
+
selectElement: { ...editMapInfo?.selectElement, points: new_points },
|
|
19931
|
+
});
|
|
19932
|
+
} })), platform === PlatformType.H5 &&
|
|
19933
|
+
editMapInfo.elementType === DataType.VISION_OFF &&
|
|
19934
|
+
(editMapInfo.mobileMode === MobileEditMode.CREATE ||
|
|
19935
|
+
editMapInfo.mobileMode === MobileEditMode.EDIT) &&
|
|
19936
|
+
editMapInfo.allVisionOffPoints?.length > 0 &&
|
|
19937
|
+
editMapInfo.allVisionOffPoints.map((item) => (jsx(VisionOffElement, { data: {
|
|
19938
|
+
level: 100,
|
|
19939
|
+
renderType: RenderType.POLYGON,
|
|
19940
|
+
type: DataType.VISION_OFF,
|
|
19941
|
+
// ...editMapInfo.selectElement,
|
|
19942
|
+
originalData: {
|
|
19943
|
+
points: item.points,
|
|
19944
|
+
id: item.id,
|
|
19945
|
+
name: '',
|
|
19946
|
+
type: 'VISION_OFF_AREA',
|
|
19947
|
+
},
|
|
19948
|
+
style: {
|
|
19949
|
+
fillColor: createElementStyle.fillColor,
|
|
19950
|
+
lineColor: createElementStyle.lineColor,
|
|
19951
|
+
lineWidth: createElementStyle.lineWidth,
|
|
19952
|
+
},
|
|
19953
|
+
points: item.points,
|
|
19954
|
+
id: item.id,
|
|
19955
|
+
} }))), platform === PlatformType.H5 &&
|
|
19956
|
+
editMapInfo.elementType === DataType.DOODLE &&
|
|
19957
|
+
editMapInfo.mobileMode === MobileEditMode.CREATE &&
|
|
19958
|
+
editMapInfo?.selectElement?.svg && (jsx(DoodleElement, { data: { ...editMapInfo?.selectElement } }))] }) }));
|
|
19959
|
+
});
|
|
19960
|
+
SvgEditMap.displayName = 'SvgEditMap';
|
|
20992
19961
|
|
|
20993
19962
|
var _path;
|
|
20994
19963
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
@@ -21113,7 +20082,7 @@ const defaultMapConfig = DEFAULT_STYLES;
|
|
|
21113
20082
|
// 地图渲染器组件
|
|
21114
20083
|
const MowerMapRenderer = forwardRef(({ sn, platform = PlatformType.WEB, edger = false, unitType = UnitsType.Imperial, language = 'en', onlyRead = false, mapConfig,
|
|
21115
20084
|
// pathConfig,
|
|
21116
|
-
modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, }, ref) => {
|
|
20085
|
+
modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, onPathLoad, onError, className, style, googleMapInstance: _googleMapInstance, dragMap = false, dragCallbacks, defaultTransform, debug: _debug = false, doodleList = [], editMap = false, unStructMapData, disabledObstacles = false, onHandleEnterRecord, onHandleCompleteRecord, onHandleStopRecord, onHandleDeleteElement, onSaveBoundaryData, onSaveMap, onEditInfoMapChange, onUpdateBoundary, heightOptions, globalHeight, onHandleEvent, onSelectElement, }, ref) => {
|
|
21117
20086
|
const [currentError, setCurrentError] = useState(null);
|
|
21118
20087
|
const overlayRef = useRef(null);
|
|
21119
20088
|
// const mapRef = useMap();
|
|
@@ -21128,14 +20097,15 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21128
20097
|
});
|
|
21129
20098
|
const [overlay, setOverlay] = useState(null);
|
|
21130
20099
|
const [overlayLayout, setOverlayLayout] = useState(null);
|
|
20100
|
+
const [overlayScale, setOverlayScale] = useState(1);
|
|
20101
|
+
// 参考zoom级别,在此级别时overlayScale=1,元素显示原始大小
|
|
20102
|
+
const REFERENCE_ZOOM = useMemo(() => {
|
|
20103
|
+
return platform === PlatformType.WEB ? 21 : 21;
|
|
20104
|
+
}, [platform]);
|
|
21131
20105
|
const svgMapRef = useRef(null);
|
|
21132
20106
|
const svgEditMapRef = useRef(null);
|
|
21133
20107
|
const [editMapInfo, setEditMapInfo] = useState({
|
|
21134
|
-
|
|
21135
|
-
selectElement: null,
|
|
21136
|
-
createMode: null,
|
|
21137
|
-
elementType: null,
|
|
21138
|
-
isShowDrag: false,
|
|
20108
|
+
...INIT_EDIT_MAP_INFO,
|
|
21139
20109
|
});
|
|
21140
20110
|
const minDistance = useMemo(() => {
|
|
21141
20111
|
return getMinSvgDistanceByModel(modelType);
|
|
@@ -21170,6 +20140,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21170
20140
|
onSaveMap,
|
|
21171
20141
|
onHandleDeleteElement,
|
|
21172
20142
|
onUpdateBoundary,
|
|
20143
|
+
onHandleEvent,
|
|
20144
|
+
onSelectElement,
|
|
21173
20145
|
};
|
|
21174
20146
|
}, [
|
|
21175
20147
|
minDistance,
|
|
@@ -21181,6 +20153,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21181
20153
|
onSaveBoundaryData,
|
|
21182
20154
|
onSaveMap,
|
|
21183
20155
|
onUpdateBoundary,
|
|
20156
|
+
onHandleEvent,
|
|
20157
|
+
onSelectElement,
|
|
21184
20158
|
]);
|
|
21185
20159
|
// 合并配置
|
|
21186
20160
|
const mergedMapConfig = useMemo(() => {
|
|
@@ -21213,6 +20187,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21213
20187
|
mapJson,
|
|
21214
20188
|
drag: defaultTransform,
|
|
21215
20189
|
mapRef,
|
|
20190
|
+
overlayScale,
|
|
20191
|
+
doodleList,
|
|
21216
20192
|
};
|
|
21217
20193
|
}, [
|
|
21218
20194
|
sn,
|
|
@@ -21226,6 +20202,8 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21226
20202
|
mapJson,
|
|
21227
20203
|
defaultTransform,
|
|
21228
20204
|
mapRef,
|
|
20205
|
+
overlayScale,
|
|
20206
|
+
doodleList,
|
|
21229
20207
|
]);
|
|
21230
20208
|
// console.log('svgElementDatas->', svgElementDatas, unStructMapData, commonValue);
|
|
21231
20209
|
// 处理地图分区边界
|
|
@@ -21244,7 +20222,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21244
20222
|
// }
|
|
21245
20223
|
// return allBoundaryElements;
|
|
21246
20224
|
// }, [mapJson]);
|
|
21247
|
-
useMemo(() => antennaConfig, [antennaConfig]);
|
|
21248
20225
|
const mowerPositionData = useMemo(() => {
|
|
21249
20226
|
// realTimeData 中包含三个种类的数据,之需要实时坐标的数据即可。
|
|
21250
20227
|
if (!realTimeData || realTimeData.length === 0)
|
|
@@ -21457,6 +20434,46 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21457
20434
|
useEffect(() => {
|
|
21458
20435
|
setDrag(defaultTransform ?? { x: 0, y: 0, rotation: 0 });
|
|
21459
20436
|
}, [defaultTransform]);
|
|
20437
|
+
// 监听地图zoom变化,计算缩放比例
|
|
20438
|
+
useEffect(() => {
|
|
20439
|
+
if (!mapRef)
|
|
20440
|
+
return;
|
|
20441
|
+
const updateScale = () => {
|
|
20442
|
+
const currentZoom = mapRef.getZoom();
|
|
20443
|
+
if (currentZoom === undefined)
|
|
20444
|
+
return;
|
|
20445
|
+
// 基于固定的参考zoom级别计算overlayScale
|
|
20446
|
+
const zoomDiff = currentZoom - REFERENCE_ZOOM;
|
|
20447
|
+
const scale = Math.pow(2, -zoomDiff); // 负数实现反向缩放
|
|
20448
|
+
console.log('scale', scale, currentZoom, zoomDiff);
|
|
20449
|
+
setOverlayScale(scale < 1 ? 1 : scale);
|
|
20450
|
+
// if (scale < 1) {
|
|
20451
|
+
// setOverlayScale(1);
|
|
20452
|
+
// } else if (scale > 4) {
|
|
20453
|
+
// setOverlayScale(4);
|
|
20454
|
+
// } else {
|
|
20455
|
+
// setOverlayScale(scale);
|
|
20456
|
+
// }
|
|
20457
|
+
};
|
|
20458
|
+
// 使用lodash throttle进行节流处理: 100ms内只执行一次
|
|
20459
|
+
const handleZoomChanged = throttle$2(updateScale, 50);
|
|
20460
|
+
// 添加zoom监听
|
|
20461
|
+
const listener = mapRef.addListener('zoom_changed', handleZoomChanged);
|
|
20462
|
+
// 初始化时获取当前zoom
|
|
20463
|
+
updateScale();
|
|
20464
|
+
return () => {
|
|
20465
|
+
if (listener) {
|
|
20466
|
+
window.google.maps.event.removeListener(listener);
|
|
20467
|
+
}
|
|
20468
|
+
// 取消未执行的节流函数
|
|
20469
|
+
handleZoomChanged.cancel();
|
|
20470
|
+
};
|
|
20471
|
+
}, [mapRef]);
|
|
20472
|
+
useEffect(() => {
|
|
20473
|
+
if (!editMap) {
|
|
20474
|
+
setEditMapInfo(INIT_EDIT_MAP_INFO);
|
|
20475
|
+
}
|
|
20476
|
+
}, [editMap]);
|
|
21460
20477
|
useEffect(() => {
|
|
21461
20478
|
if (!mapJson)
|
|
21462
20479
|
return;
|
|
@@ -21527,6 +20544,14 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21527
20544
|
clearHistory: () => svgEditMapRef.current?.clearHistory(),
|
|
21528
20545
|
// 添加历史记录
|
|
21529
20546
|
addHistory: (history) => svgEditMapRef.current?.addHistory(history),
|
|
20547
|
+
// 添加doodle
|
|
20548
|
+
addDoodle: (doodle) => svgEditMapRef.current?.addDoodle(doodle),
|
|
20549
|
+
// 检查doodle
|
|
20550
|
+
checkDoodle: () => svgEditMapRef.current?.checkDoodle?.(),
|
|
20551
|
+
// 增加元素(web)
|
|
20552
|
+
addElement: (type, item) => svgEditMapRef.current?.addElement(type, item),
|
|
20553
|
+
// 保存元素
|
|
20554
|
+
saveElement: (type, item) => svgEditMapRef.current?.saveElement(type, item),
|
|
21530
20555
|
}));
|
|
21531
20556
|
/**
|
|
21532
20557
|
* 根据割草机的位置更新路径
|
|
@@ -21541,7 +20566,7 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21541
20566
|
}
|
|
21542
20567
|
// console.log('mowerrender------->', svgViewBox);
|
|
21543
20568
|
// 使用goole maps自定义叠加层,返回debug信息(如果启用)
|
|
21544
|
-
return (jsx(CommonContextProvider, { value: commonValue, children: jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxs(MapEditContextProvider, { value: mapEditValue, children: [platform !== PlatformType.H5 && (
|
|
20569
|
+
return (jsx(CommonContextProvider, { value: commonValue, children: jsx(SvgEditContextProvider, { value: svgEditValue, children: jsxs(MapEditContextProvider, { value: mapEditValue, children: [platform !== PlatformType.H5 && (jsx(Fragment, {})), platform === PlatformType.H5 && jsx(Crosshair, {}), jsxs(OverlayViewF, { onLoad: (lay) => {
|
|
21545
20570
|
setOverlay(lay);
|
|
21546
20571
|
}, onDraw: (style) => {
|
|
21547
20572
|
const layout = Object.keys(style).reduce((pre, cur) => {
|
|
@@ -21551,7 +20576,6 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21551
20576
|
pre[cur] = parseFloat(curLayout);
|
|
21552
20577
|
return pre;
|
|
21553
20578
|
}, {});
|
|
21554
|
-
// console.log('setedit svg ------------->', layout);
|
|
21555
20579
|
if (layout?.width && layout?.height) {
|
|
21556
20580
|
svgEditMapRef?.current?.adjustSvgSize?.(layout);
|
|
21557
20581
|
setOverlayLayout(layout);
|
|
@@ -21560,4 +20584,66 @@ modelType, mapRef, mapJson, pathJson, realTimeData, antennaConfig, onMapLoad, on
|
|
|
21560
20584
|
});
|
|
21561
20585
|
MowerMapRenderer.displayName = 'MowerMapRenderer';
|
|
21562
20586
|
|
|
21563
|
-
|
|
20587
|
+
const BoundarySvgRender = React__default.memo(({ mapJson, id, maxWidth = 300 }) => {
|
|
20588
|
+
const svgElementData = useMemo(() => {
|
|
20589
|
+
const data = UnifiedMapDataProcessor.processMapData(mapJson, DEFAULT_STYLES) || {};
|
|
20590
|
+
return data;
|
|
20591
|
+
}, [mapJson, DEFAULT_STYLES]);
|
|
20592
|
+
const boundaryInfo = useMemo(() => {
|
|
20593
|
+
const boundary = svgElementData.boundary.find((item) => item.id === id);
|
|
20594
|
+
return boundary;
|
|
20595
|
+
}, [id, svgElementData]);
|
|
20596
|
+
// 计算当前boundary的viewBox
|
|
20597
|
+
const boundaryViewBox = useMemo(() => {
|
|
20598
|
+
if (!boundaryInfo?.points || boundaryInfo.points.length === 0) {
|
|
20599
|
+
return null;
|
|
20600
|
+
}
|
|
20601
|
+
// 计算边界
|
|
20602
|
+
let minX = Infinity;
|
|
20603
|
+
let minY = Infinity;
|
|
20604
|
+
let maxX = -Infinity;
|
|
20605
|
+
let maxY = -Infinity;
|
|
20606
|
+
boundaryInfo.points.forEach((point) => {
|
|
20607
|
+
minX = Math.min(minX, point[0]);
|
|
20608
|
+
minY = Math.min(minY, point[1]);
|
|
20609
|
+
maxX = Math.max(maxX, point[0]);
|
|
20610
|
+
maxY = Math.max(maxY, point[1]);
|
|
20611
|
+
});
|
|
20612
|
+
// 添加边距
|
|
20613
|
+
const padding = 50;
|
|
20614
|
+
const width = maxX - minX + padding * 2;
|
|
20615
|
+
const height = maxY - minY + padding * 2;
|
|
20616
|
+
return {
|
|
20617
|
+
x: minX - padding,
|
|
20618
|
+
y: minY - padding,
|
|
20619
|
+
width,
|
|
20620
|
+
height,
|
|
20621
|
+
};
|
|
20622
|
+
}, [boundaryInfo]);
|
|
20623
|
+
const style = useMemo(() => {
|
|
20624
|
+
if (boundaryViewBox?.width > boundaryViewBox?.height) {
|
|
20625
|
+
return {
|
|
20626
|
+
width: maxWidth,
|
|
20627
|
+
height: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
20628
|
+
};
|
|
20629
|
+
}
|
|
20630
|
+
return {
|
|
20631
|
+
width: maxWidth * (boundaryViewBox.height / boundaryViewBox.width),
|
|
20632
|
+
height: maxWidth,
|
|
20633
|
+
};
|
|
20634
|
+
}, [boundaryViewBox, maxWidth]);
|
|
20635
|
+
return (jsxs("div", { style: {
|
|
20636
|
+
position: 'relative',
|
|
20637
|
+
width: style.width,
|
|
20638
|
+
height: style.height,
|
|
20639
|
+
margin: '0 auto',
|
|
20640
|
+
}, children: [jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: `${boundaryViewBox.x} ${boundaryViewBox.y} ${boundaryViewBox.width} ${boundaryViewBox.height}`, width: `${style.width}px`, height: `${style.height}px`, style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: Object.keys(svgElementData)?.map((key) => {
|
|
20641
|
+
return svgElementData[key]?.map((element) => {
|
|
20642
|
+
if (key === DataType.VISION_OFF)
|
|
20643
|
+
return null;
|
|
20644
|
+
return (jsx(GElement, { type: key, data: svgElementData[key], children: jsx(SvgElement, { type: key, data: element, onSelect: () => { }, onCancel: () => { } }, element.id) }, key));
|
|
20645
|
+
});
|
|
20646
|
+
}) }), jsx(CharginPile, { mapData: mapJson, mapConfig: DEFAULT_STYLES, viewBox: boundaryViewBox || null, rotation: 0 })] }));
|
|
20647
|
+
});
|
|
20648
|
+
|
|
20649
|
+
export { ALL_DIRECTION_SELECTED, AntennaData, AntennaDataBuilder, BaseData, BoundaryData, BoundarySvgRender, ChannelData, ChargingPileData, CreateStatus, DataType, DoodleData, MAX_DIRECTION_ANGLE, MIN_DIRECTION_ANGLE, MapDataProcessor, MobileEditMode, MowerMapRenderer, ObstacleData, PathData, PathDataProcessor, PlatformType, RecordFunctionEnum, RecordTypeEnum, RenderType, SCALE_FACTOR, SvgParserNative, UnifiedMapDataProcessor, VisionOffData, calculateMapGpsCenter, estimateGpsFromMapBounds, initBoundary, initChannel, initDoodle, initObstacle, initVisionOff, restorePointsFormat };
|