This commit is contained in:
2025-09-23 14:38:08 +08:00
parent 783de5cb7a
commit 16a04a9a90
8 changed files with 125 additions and 63 deletions

View File

@ -27,7 +27,7 @@ const convertToImage = (container, options = {}) => {
useCORS: true,//允许跨域
allowTaint: false, //允许跨域数据污染'被污染'的canvas
tainttest: true,
foreignObjectRendering: true, //在浏览器支持的情况下使用ForeignObject模式渲染图片
foreignObjectRendering: true, //在浏览器支持的情况下使用ForeignObject模式渲染图片
...options
};
@ -241,11 +241,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
start() {
if (sdk.viewer.scene.imageryLayers._layers.length <= 1) {
this.error = '未加载底图!'
window.ELEMENT && window.ELEMENT.Message({
message: this.error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: this.error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: this.error })
console.warn(this.error)
return
}
@ -258,11 +259,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
}
if (!haveBaseMap) {
this.error = '未加载底图!'
window.ELEMENT && window.ELEMENT.Message({
message: this.error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: this.error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: this.error })
console.warn(this.error)
return
}
@ -327,11 +329,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
if (!layer) {
if (!flag) {
_this.error = '当前范围内未找到底图数据!'
window.ELEMENT && window.ELEMENT.Message({
message: _this.error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: _this.error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: _this.error })
console.warn(_this.error)
}
return
@ -372,11 +375,12 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
);
if (!MinTile || !MaxTile) {
let error = '超出地球范围!'
window.ELEMENT && window.ELEMENT.Message({
message: error,
type: 'warning',
duration: 1500
});
// window.ELEMENT && window.ELEMENT.Message({
// message: error,
// type: 'warning',
// duration: 1500
// });
tools.message({ type: 'warning', text: error })
console.warn(error)
return
}
@ -704,4 +708,4 @@ async function ScreenShotHD(sdk, options = {}, cd = () => { }) {
}
export { ScreenShot, ScreenShotHD }
export { ScreenShot, ScreenShotHD }