let timeOut = null;
export function creatPoiLayer(write, local, entity, keyMatch) {
if (window.poiLayerObj) {
window.poiLayerObj.deleteObject()
}
let description = `
`;
for (let key in write) {
description += `
${keyMatch ? keyMatch[key] : key}
${write[key]}
`
}
description += '
';
window.poiLayerObj = sgworld.Creator.createDivPoint('', {
lon: local[0],
lat: local[1]
}, {
id: 'POI',
type: "custom",
offset: ["c", 60],
description,
near: 0,
far: 8000000
});
if (timeOut) {
clearTimeout(timeOut);
}
const cartesian3 = Cesium.Cartesian3.fromDegrees(local[0], local[1], 10);
let distance = sgworld.Core.getPointToCameraDistance(Viewer, cartesian3);
Viewer.flyTo(entity, {
offset: {
heading: sgworld.Viewer.camera.heading,
pitch: sgworld.Viewer.camera.pitch,
range: distance
},
duration: 1,
});
}