//Cesium 三维地图
import win.ui;
/*DSG{{*/
var winform = win.form(text="Cesium三维地图演示 - 按鼠标左键拖拽移动（同时按住 Ctrl 旋转)，按鼠标右键拖拽缩放";right=1231;bottom=783;bgcolor=16777215)
winform.add()
/*}}*/

import web.view;
var wb = web.view(winform);
 
//导出为Javascript中的 aardio 对象，
wb.external = {
    winform = winform
}

var html = /**
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <script src="./cesium/cesium-1.79.1/package/build/Cesium/Cesium.js"></script>
    <style type="text/css">
    @import url(./cesium/cesium-1.79.1/package/build/Cesium/Widgets/widgets.css);
    
    html,body,#cesiumContainer {
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
      }
    </style>
</head>
<body>
<div id="cesiumContainer"></div> 

<script>
window.onload = function () {
    /*
    可到https://cesium.com/ion/注册账号，
    登录后切换到「Access Tokens」页面点「Create token」然后复制 token到下面
    Cesium.Ion.defaultAccessToken = "token"
    */
    
	let viewer = new Cesium.Viewer("cesiumContainer")
}

document.onfullscreenchange = function(event ){
    //调用 aardio 窗口的全屏函数
	aardio.winform.fullscreen(!!document.fullscreenElement);
}
</script>

</body>
</html>
**/
string.save("/cesium.html",html);

import web.npm;
web.npm.download("cesium","1.79.1","/cesium");	
 
import wsock.tcp.simpleHttpServer;
var url = wsock.tcp.simpleHttpServer.startUrl("cesium.html");
wb.go(url);

winform.show();
win.loopMessage();