4, cesium scene showing the printing member of FIG.

cesium scene showing the printing member of FIG.

3d rendering of the page screenshots, and can be downloaded to the local; code is as follows:

. 1   function printscreenScene () {
 2          var Image = new new Image (); // Create Object img 
. 3          viewer.render (); // re-rendering interface 
. 4          Image viewer.scene.canvas.toDataURL = ( "Image / PNG" );
 5          $ ( "# printscreenScene_save") the Find ( "img") attr ( "src", Image);.. // add an img tag element 
6          $ ( "# printscreenScene_save img") Show () addClass ( "Show.". );
 . 7          the saveFile (Image, 111);// calls the print function member of FIG. 
8      }
 . 9  
10      @ printing member of FIG 
. 11      var saveFile = function (data, filename) {
12         var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a');
13         save_link.href = data;
14         save_link.download = filename;
15 
16         var event = document.createEvent('MouseEvents');
17         event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
18         save_link.dispatchEvent(event);
19     };

Rendering as follows:

 

 Click on a button (the button is to do your own button or div) to achieve the screenshot and store locally. Screenshot also need to set its width and height and position.

 

If you do not understand my case, you can also refer to http://support.supermap.com.cn:8090/webgl/examples/editor.html#outputScene this web site has a map-case scenario.

 

Related study group: 854 184 700

Guess you like

Origin www.cnblogs.com/yaosusu/p/11484443.html