|
|
|
@ -10,7 +10,7 @@ |
|
|
|
:style="{ cursor: isDrawing ? 'crosshair' : 'default' }" |
|
|
|
> |
|
|
|
<!-- cesiummap组件 --> |
|
|
|
<cesiumMap :drawDomClick="drawDom"/> |
|
|
|
<cesiumMap :drawDomClick="drawDom" ref="cesiumMapRef"/> |
|
|
|
<div class="map-overlay-text"> |
|
|
|
<i class="el-icon-location-outline text-3xl mb-2 block"></i> |
|
|
|
<p>二维GIS地图区域</p> |
|
|
|
@ -363,6 +363,7 @@ |
|
|
|
@resolve-conflict="resolveConflict" |
|
|
|
@run-conflict-check="runConflictCheck" |
|
|
|
@open-platform-dialog="openPlatformDialog" |
|
|
|
@create-route="addRoute" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 左下角工具面板 --> |
|
|
|
@ -709,30 +710,22 @@ export default { |
|
|
|
} |
|
|
|
this.showCreateRouteDialog = false; |
|
|
|
this.isDrawing = true; |
|
|
|
// 启用绘制状态 |
|
|
|
this.drawDom = true; |
|
|
|
// 通知cesiumMap开始绘制线 |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.cesiumMapRef && this.$refs.cesiumMapRef.toggleDrawing) { |
|
|
|
this.$refs.cesiumMapRef.toggleDrawing('line'); |
|
|
|
} |
|
|
|
}); |
|
|
|
this.$message.info('进入绘制模式:左键点击地图添加航点,右键结束绘制'); |
|
|
|
}, |
|
|
|
// 3. 【核心】地图点击事件处理 |
|
|
|
// 注意:这个方法需要绑定到地图容器的 @click 上,或者在你的 cesiumMap 组件回调里调用 |
|
|
|
// 注意:这个方法现在不需要处理绘制,因为绘制由cesiumMap组件内部处理 |
|
|
|
handleMapClick(event) { |
|
|
|
if (!this.isDrawing) return; |
|
|
|
|
|
|
|
// 模拟获取点击的经纬度,实际项目中请从 cesium 事件中获取 |
|
|
|
// const position = event.position || { lat: 30, lng: 120 }; |
|
|
|
|
|
|
|
// 暂存位置,打开航点录入弹窗 |
|
|
|
// this.tempClickPosition = position; |
|
|
|
|
|
|
|
// 重置表单,自动生成默认值 |
|
|
|
const nextIndex = this.pendingRoute.points.length + 1; |
|
|
|
this.waypointForm = { |
|
|
|
name: `WP-${nextIndex}`, |
|
|
|
altitude: 5000, |
|
|
|
speed: 800, |
|
|
|
time: '', |
|
|
|
radius: 5 |
|
|
|
}; |
|
|
|
|
|
|
|
this.showWaypointDialog = true; |
|
|
|
// 如果当前处于绘制模式,此事件会被cesiumMap组件内部处理 |
|
|
|
// 不需要在这里处理点击事件 |
|
|
|
console.log("地图点击事件", event); |
|
|
|
}, |
|
|
|
// 4. 确认添加一个航点 |
|
|
|
confirmWaypoint() { |
|
|
|
@ -749,7 +742,12 @@ export default { |
|
|
|
// 5. 右键结束绘制 |
|
|
|
finishDrawing() { |
|
|
|
if (!this.isDrawing) return; |
|
|
|
|
|
|
|
|
|
|
|
// 停止地图绘制模式 |
|
|
|
if (this.$refs.cesiumMapRef && this.$refs.cesiumMapRef.stopDrawing) { |
|
|
|
this.$refs.cesiumMapRef.stopDrawing(); |
|
|
|
} |
|
|
|
|
|
|
|
if (this.pendingRoute.points.length < 2) { |
|
|
|
this.$message.warning('航线至少需要2个航点'); |
|
|
|
return; |
|
|
|
@ -766,6 +764,8 @@ export default { |
|
|
|
|
|
|
|
this.routes.push(finalRoute); |
|
|
|
this.isDrawing = false; |
|
|
|
this.drawDom = false; // 关闭绘制状态 |
|
|
|
|
|
|
|
this.selectRoute(finalRoute); // 选中新航线 |
|
|
|
this.$message.success('航线绘制完成!'); |
|
|
|
}, |
|
|
|
@ -853,6 +853,7 @@ export default { |
|
|
|
// 文件下拉菜单方法 |
|
|
|
newPlan() { |
|
|
|
this.$message.success('新建计划'); |
|
|
|
this.addRoute(); |
|
|
|
// 这里可以添加新建计划的逻辑 |
|
|
|
}, |
|
|
|
|
|
|
|
@ -1068,7 +1069,22 @@ export default { |
|
|
|
this.isRightPanelHidden = false; |
|
|
|
} |
|
|
|
} else if(item.id === 'modify'){ |
|
|
|
this.drawDom = !this.drawDom |
|
|
|
// 启动绘制模式 |
|
|
|
this.drawDom = !this.drawDom; |
|
|
|
if (this.drawDom) { |
|
|
|
this.isDrawing = true; |
|
|
|
// 通知cesiumMap开始绘制线 |
|
|
|
this.$nextTick(() => { |
|
|
|
if (this.$refs.cesiumMapRef) { |
|
|
|
// 如果cesiumMap有toggleDrawing方法,调用它开始绘制线 |
|
|
|
if (this.$refs.cesiumMapRef.toggleDrawing) { |
|
|
|
this.$refs.cesiumMapRef.toggleDrawing('line'); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
this.isDrawing = false; |
|
|
|
} |
|
|
|
console.log(this.drawDom,999999) |
|
|
|
} |
|
|
|
if (item.id === 'deduction') { |
|
|
|
|