生成库位检测点
This commit is contained in:
parent
cd75476893
commit
ceee6eb86e
@ -881,7 +881,7 @@ onMounted(() => {
|
||||
robotListTimerRef.value = setInterval(() => {
|
||||
if (document.hidden) return // 页面不可见时暂停轮询
|
||||
getRobotByFloorAndAreaList()
|
||||
}, 10000)
|
||||
}, 20000)
|
||||
|
||||
// 监听页面可见性变化
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
|
@ -449,6 +449,7 @@
|
||||
v-if="imgBgObj.width && imgBgObj.height"
|
||||
>
|
||||
<!-- <map-scale-tool :stepLength="50" :width="imgBgObj.width" :height="imgBgObj.height"> -->
|
||||
<!-- transform: `scale(${state.imageChangeMultiple}) rotate(-5deg)`, -->
|
||||
<div
|
||||
class="map-bg"
|
||||
:style="{
|
||||
@ -1317,7 +1318,7 @@ const mapClick = (e) => {
|
||||
locationWidePx: 8,
|
||||
angle: 0,
|
||||
draggable: true,
|
||||
resizable: true,
|
||||
resizable: false,
|
||||
rotatable: false,
|
||||
lockAspectRatio: false,
|
||||
mapImageUrl: '',
|
||||
@ -2144,53 +2145,100 @@ const deleteSingleNode = () => {
|
||||
}
|
||||
|
||||
//生成检测点
|
||||
const generateDetectionPoint = () => {
|
||||
const generateDetectionPoint = async () => {
|
||||
if (state.contextMenu.currentIndex === -1) return
|
||||
|
||||
const { locationX, locationY } = state.contextMenu.currentItem
|
||||
const { locationX, locationY, locationYaw } = state.contextMenu.currentItem
|
||||
|
||||
const radian = 1.57 //弧度
|
||||
const newId = await MapApi.getNodeId()
|
||||
const distance = 1 / Number(imgBgObj.resolution) //距离米
|
||||
|
||||
// 将弧度转换为角度(用于理解,实际计算仍使用弧度)
|
||||
const angle = radian * (180 / Math.PI)
|
||||
const angle = locationYaw * (180 / Math.PI)
|
||||
|
||||
// 根据角度和距离计算新的坐标
|
||||
// 正东方向为0度,正北方向为90度,正西方向为180度,正南方向为-90度
|
||||
const newX = Number((Number(locationX) + distance * Math.cos(radian)).toFixed(2))
|
||||
const newY = Number((Number(locationY) - distance * Math.sin(radian)).toFixed(2))
|
||||
const newX = Number((Number(locationX) + distance * Math.cos(locationYaw)).toFixed(2))
|
||||
const newY = Number((Number(locationY) - distance * Math.sin(locationYaw)).toFixed(2))
|
||||
|
||||
let actualPoint = disposeEventPoint(newX, newY)
|
||||
//先校验这个点是否存在,比较一位小数
|
||||
const isDuplicate = state.allMapPointInfo.some(
|
||||
(item) =>
|
||||
Number(item.locationX).toFixed(1) === Number(newX).toFixed(1) &&
|
||||
Number(item.locationY).toFixed(1) === Number(newY).toFixed(1)
|
||||
)
|
||||
|
||||
let pointItem = {
|
||||
positionMapId: imgBgObj.positionMapId,
|
||||
layerSelectionShow: true,
|
||||
locationX: newX,
|
||||
locationY: newY,
|
||||
actualLocationX: actualPoint.actualLocationX,
|
||||
actualLocationY: actualPoint.actualLocationY,
|
||||
locationDeep: 40,
|
||||
locationWide: 40,
|
||||
locationDeepPx: 8,
|
||||
locationWidePx: 8,
|
||||
angle: 0,
|
||||
draggable: true,
|
||||
resizable: true,
|
||||
rotatable: false,
|
||||
lockAspectRatio: false,
|
||||
mapImageUrl: '',
|
||||
locationYaw: 0,
|
||||
type: 1,
|
||||
dataList: [],
|
||||
dataObj: {}
|
||||
if (!isDuplicate) {
|
||||
let actualPoint = disposeEventPoint(newX, newY)
|
||||
let pointItem = {
|
||||
id: newId,
|
||||
positionMapId: imgBgObj.positionMapId,
|
||||
layerSelectionShow: true,
|
||||
locationX: newX,
|
||||
locationY: newY,
|
||||
actualLocationX: actualPoint.actualLocationX,
|
||||
actualLocationY: actualPoint.actualLocationY,
|
||||
locationDeep: 40,
|
||||
locationWide: 40,
|
||||
locationDeepPx: 8,
|
||||
locationWidePx: 8,
|
||||
angle: 0,
|
||||
draggable: true,
|
||||
resizable: false,
|
||||
rotatable: false,
|
||||
lockAspectRatio: false,
|
||||
mapImageUrl: '',
|
||||
locationYaw: 0,
|
||||
type: 1,
|
||||
dataList: [],
|
||||
dataObj: {}
|
||||
}
|
||||
|
||||
//生成监测点和库位之间的路线 不确定开始点是库位还是检测点
|
||||
let newRoute = {
|
||||
isSelected: false,
|
||||
startingPointId: undefined,
|
||||
endPointId: undefined,
|
||||
startPointX: undefined,
|
||||
startPointY: undefined,
|
||||
endPointX: undefined,
|
||||
endPointY: undefined,
|
||||
actualStartPointX: undefined,
|
||||
actualStartPointY: undefined,
|
||||
actualEndPointX: undefined,
|
||||
actualEndPointY: undefined,
|
||||
actualBeginControlX: '',
|
||||
actualBeginControlY: '',
|
||||
actualEndControlX: '',
|
||||
actualEndControlY: '',
|
||||
beginControlX: 0,
|
||||
beginControlY: 0,
|
||||
endControlX: 0,
|
||||
endControlY: 0,
|
||||
expansionZoneFront: 0,
|
||||
expansionZoneAfter: 0,
|
||||
expansionZoneLeft: 0,
|
||||
expansionZoneRight: 0,
|
||||
method: 0,
|
||||
direction: 2, //1单2双
|
||||
forwardSpeedLimit: 1.5,
|
||||
reverseSpeedLimit: 0.4,
|
||||
toward: 0,
|
||||
startingSortNum: undefined,
|
||||
endPointSortNum: undefined
|
||||
}
|
||||
|
||||
// 将新创建的点添加到地图点列表中
|
||||
state.allMapPointInfo.push(pointItem)
|
||||
//将路线加入到路线列表中
|
||||
// state.mapRouteList.push(newRoute)
|
||||
|
||||
addEditHistory()
|
||||
// 隐藏右击菜单
|
||||
hideContextMenu()
|
||||
} else {
|
||||
message.warning('该点已存在')
|
||||
}
|
||||
|
||||
// 将新创建的点添加到地图点列表中
|
||||
state.allMapPointInfo.push(pointItem)
|
||||
|
||||
addEditHistory()
|
||||
// 隐藏右击菜单
|
||||
hideContextMenu()
|
||||
}
|
||||
|
||||
//复制
|
||||
@ -2318,7 +2366,7 @@ const entryActualNodeFormSubmit = () => {
|
||||
locationWidePx: 8,
|
||||
angle: 0,
|
||||
draggable: true,
|
||||
resizable: true,
|
||||
resizable: false,
|
||||
rotatable: false,
|
||||
lockAspectRatio: false, //横纵比
|
||||
mapImageUrl: '',
|
||||
@ -2446,7 +2494,7 @@ const markFormSubmit = async () => {
|
||||
locationWidePx: 8,
|
||||
angle: 0,
|
||||
draggable: true,
|
||||
resizable: true,
|
||||
resizable: false,
|
||||
rotatable: false,
|
||||
lockAspectRatio: false, //横纵比
|
||||
mapImageUrl: '',
|
||||
@ -3299,7 +3347,7 @@ const handleChooseRoute = async (item, index, type, e) => {
|
||||
locationWidePx: 8,
|
||||
angle: 0,
|
||||
draggable: true,
|
||||
resizable: true,
|
||||
resizable: false,
|
||||
rotatable: false,
|
||||
lockAspectRatio: false, //横纵比
|
||||
mapImageUrl: '',
|
||||
|
Loading…
Reference in New Issue
Block a user