Browse Source

listenMouseHandlerSence 增加经纬度提示

master
DIAMOND 11 months ago
parent
commit
f0bc4246ae
  1. 12
      src/utils/earthMap/listenMouseHandlerSence.ts

12
src/utils/earthMap/listenMouseHandlerSence.ts

@ -6,7 +6,10 @@
import { toRefs, watch, nextTick, ref, reactive, onMounted } from 'vue';
import { message } from 'ant-design-vue';
import dwPng from '@/assets/images/rotationXYZ.png';
import hide from '@/assets/earthMap/hide.png';
import rotationXYZ from '@/assets/images/rotationXYZ.png';
import { MeasurementType } from '/@/utils/earthMap/earthSDKEnum';
// 添加地图上的鼠标监听事件
let pin: any = undefined;
@ -31,7 +34,7 @@ export default function listenMouseHandlerSence(enablePointer = false, that) {
window.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK
);
// console.log("enablePointer", enablePointer);
window.$earth.analyzation.measurement.type = MeasurementType.POINT;
if (enablePointer) {
viewer.cesiumWidget.screenSpaceEventHandler.setInputAction((event) => {
let cartesian = viewer.scene.globe.pick(viewer.camera.getPickRay(event.position), viewer.scene);
@ -54,7 +57,7 @@ export default function listenMouseHandlerSence(enablePointer = false, that) {
//destroy方法有问题无法成功销毁,故选择trycatch
try {
console.log("pin",pin);
window.$earth.analyzation.measurement.clearResults();
pin && pin.destroy();
pin = undefined
} catch (error) {
@ -63,8 +66,9 @@ export default function listenMouseHandlerSence(enablePointer = false, that) {
}
pin = new window.XE.Obj.Pin(window.$earth);
pin.position = [cartographic.longitude, cartographic.latitude, pointAlt];
pin.imageUrl = dwPng;
// pin.imageUrl = dwPng;
pin.imageUrl = hide;
// window.$uia.showPropertyWindow(pin)
let cposition = [window.$earth.camera.position[0], window.$earth.camera.position[1], window.$earth.camera.position[2]];
if (pin) {
position = [pin.position[0], pin.position[1], pin.position[2]];

Loading…
Cancel
Save