Example1.html 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <meta name="xbsj-labels" content="Earth起步"></meta>
  8. <title>创建地球</title>
  9. <!-- 0 引入js文件 -->
  10. <script src="../../../XbsjEarth/XbsjEarth.js"></script>
  11. <style>
  12. html,
  13. body {
  14. width: 100%;
  15. height: 100%;
  16. margin: 0px;
  17. padding: 0px;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <div id="earthContainer" style="width: 100%; height: 100%; background: grey">
  23. </div>
  24. <script>
  25. var earth;
  26. var bgImagery;
  27. function startup() {
  28. earth = new XE.Earth('earthContainer');
  29. earth.sceneTree.root = {
  30. "children": [
  31. {
  32. "czmObject": {
  33. "name": "默认离线影像",
  34. "xbsjType": "Imagery",
  35. "xbsjImageryProvider": {
  36. "createTileMapServiceImageryProvider": {
  37. "url": XE.HTML.cesiumDir + 'Assets/Textures/NaturalEarthII',
  38. "fileExtension": 'jpg',
  39. },
  40. "type": "createTileMapServiceImageryProvider"
  41. }
  42. }
  43. },
  44. ]
  45. };
  46. }
  47. window.earth = earth;
  48. // 1 XE.ready()会加载Cesium.js等其他资源,注意ready()返回一个Promise对象。
  49. XE.ready().then(startup);
  50. </script>
  51. </body>
  52. </html>