生成库位检测点
This commit is contained in:
parent
cd75476893
commit
ceee6eb86e
@ -881,7 +881,7 @@ onMounted(() => {
|
|||||||
robotListTimerRef.value = setInterval(() => {
|
robotListTimerRef.value = setInterval(() => {
|
||||||
if (document.hidden) return // 页面不可见时暂停轮询
|
if (document.hidden) return // 页面不可见时暂停轮询
|
||||||
getRobotByFloorAndAreaList()
|
getRobotByFloorAndAreaList()
|
||||||
}, 10000)
|
}, 20000)
|
||||||
|
|
||||||
// 监听页面可见性变化
|
// 监听页面可见性变化
|
||||||
document.addEventListener('visibilitychange', () => {
|
document.addEventListener('visibilitychange', () => {
|
||||||
|
@ -449,6 +449,7 @@
|
|||||||
v-if="imgBgObj.width && imgBgObj.height"
|
v-if="imgBgObj.width && imgBgObj.height"
|
||||||
>
|
>
|
||||||
<!-- <map-scale-tool :stepLength="50" :width="imgBgObj.width" :height="imgBgObj.height"> -->
|
<!-- <map-scale-tool :stepLength="50" :width="imgBgObj.width" :height="imgBgObj.height"> -->
|
||||||
|
<!-- transform: `scale(${state.imageChangeMultiple}) rotate(-5deg)`, -->
|
||||||
<div
|
<div
|
||||||
class="map-bg"
|
class="map-bg"
|
||||||
:style="{
|
:style="{
|
||||||
@ -1317,7 +1318,7 @@ const mapClick = (e) => {
|
|||||||
locationWidePx: 8,
|
locationWidePx: 8,
|
||||||
angle: 0,
|
angle: 0,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
resizable: true,
|
resizable: false,
|
||||||
rotatable: false,
|
rotatable: false,
|
||||||
lockAspectRatio: false,
|
lockAspectRatio: false,
|
||||||
mapImageUrl: '',
|
mapImageUrl: '',
|
||||||
@ -2144,53 +2145,100 @@ const deleteSingleNode = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//生成检测点
|
//生成检测点
|
||||||
const generateDetectionPoint = () => {
|
const generateDetectionPoint = async () => {
|
||||||
if (state.contextMenu.currentIndex === -1) return
|
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 distance = 1 / Number(imgBgObj.resolution) //距离米
|
||||||
|
|
||||||
// 将弧度转换为角度(用于理解,实际计算仍使用弧度)
|
// 将弧度转换为角度(用于理解,实际计算仍使用弧度)
|
||||||
const angle = radian * (180 / Math.PI)
|
const angle = locationYaw * (180 / Math.PI)
|
||||||
|
|
||||||
// 根据角度和距离计算新的坐标
|
// 根据角度和距离计算新的坐标
|
||||||
// 正东方向为0度,正北方向为90度,正西方向为180度,正南方向为-90度
|
// 正东方向为0度,正北方向为90度,正西方向为180度,正南方向为-90度
|
||||||
const newX = Number((Number(locationX) + distance * Math.cos(radian)).toFixed(2))
|
const newX = Number((Number(locationX) + distance * Math.cos(locationYaw)).toFixed(2))
|
||||||
const newY = Number((Number(locationY) - distance * Math.sin(radian)).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 = {
|
if (!isDuplicate) {
|
||||||
positionMapId: imgBgObj.positionMapId,
|
let actualPoint = disposeEventPoint(newX, newY)
|
||||||
layerSelectionShow: true,
|
let pointItem = {
|
||||||
locationX: newX,
|
id: newId,
|
||||||
locationY: newY,
|
positionMapId: imgBgObj.positionMapId,
|
||||||
actualLocationX: actualPoint.actualLocationX,
|
layerSelectionShow: true,
|
||||||
actualLocationY: actualPoint.actualLocationY,
|
locationX: newX,
|
||||||
locationDeep: 40,
|
locationY: newY,
|
||||||
locationWide: 40,
|
actualLocationX: actualPoint.actualLocationX,
|
||||||
locationDeepPx: 8,
|
actualLocationY: actualPoint.actualLocationY,
|
||||||
locationWidePx: 8,
|
locationDeep: 40,
|
||||||
angle: 0,
|
locationWide: 40,
|
||||||
draggable: true,
|
locationDeepPx: 8,
|
||||||
resizable: true,
|
locationWidePx: 8,
|
||||||
rotatable: false,
|
angle: 0,
|
||||||
lockAspectRatio: false,
|
draggable: true,
|
||||||
mapImageUrl: '',
|
resizable: false,
|
||||||
locationYaw: 0,
|
rotatable: false,
|
||||||
type: 1,
|
lockAspectRatio: false,
|
||||||
dataList: [],
|
mapImageUrl: '',
|
||||||
dataObj: {}
|
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,
|
locationWidePx: 8,
|
||||||
angle: 0,
|
angle: 0,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
resizable: true,
|
resizable: false,
|
||||||
rotatable: false,
|
rotatable: false,
|
||||||
lockAspectRatio: false, //横纵比
|
lockAspectRatio: false, //横纵比
|
||||||
mapImageUrl: '',
|
mapImageUrl: '',
|
||||||
@ -2446,7 +2494,7 @@ const markFormSubmit = async () => {
|
|||||||
locationWidePx: 8,
|
locationWidePx: 8,
|
||||||
angle: 0,
|
angle: 0,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
resizable: true,
|
resizable: false,
|
||||||
rotatable: false,
|
rotatable: false,
|
||||||
lockAspectRatio: false, //横纵比
|
lockAspectRatio: false, //横纵比
|
||||||
mapImageUrl: '',
|
mapImageUrl: '',
|
||||||
@ -3299,7 +3347,7 @@ const handleChooseRoute = async (item, index, type, e) => {
|
|||||||
locationWidePx: 8,
|
locationWidePx: 8,
|
||||||
angle: 0,
|
angle: 0,
|
||||||
draggable: true,
|
draggable: true,
|
||||||
resizable: true,
|
resizable: false,
|
||||||
rotatable: false,
|
rotatable: false,
|
||||||
lockAspectRatio: false, //横纵比
|
lockAspectRatio: false, //横纵比
|
||||||
mapImageUrl: '',
|
mapImageUrl: '',
|
||||||
|
Loading…
Reference in New Issue
Block a user