cesium截


//截图
import {Sobject} from '@/Common/Commonjs/Sobject' 
import ManagerCesium from '@/Common/Manager/ManagerCesium'
let Cesium = require('cesium/Cesium')
import canvas2image from '../lib/Canvas2Image';

export default class Screenshot {

    _class = "Screenshot";


    static getInstance() {
        if (!this.instance) {
            this.instance = new Screenshot();
        }
        return this.instance;
    }


    constructor(content) {
    }

    SaveSceneToImg()
    {
        let canvas = ManagerCesium.getInstance().viewer.scene.canvas;
        let imageWidth = 500;
        let genimg = canvas2image.Canvas2Image.convertToImage(canvas, imageWidth, imageWidth * canvas.height / canvas.width,'png');
        console.log("截图",genimg.src);
        return genimg.src;
    }

    remove(){
        
    }
}

你可能感兴趣的:(cesium截)