|
2 | 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
3 | 3 |
|
4 | 4 | <head> |
5 | | - <meta charset='utf-8' /> |
6 | | - <meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' /> |
| 5 | + <meta charset="utf-8" /> |
| 6 | + <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> |
7 | 7 | <title>场景操作</title> |
8 | 8 | <!--引入第三方的jquery脚本库--> |
9 | 9 | <script include="jquery" src="./static/libs/include-lib-local.js"></script> |
|
19 | 19 | function init() { |
20 | 20 | //构造三维视图类(视图容器div的id,三维视图设置参数) |
21 | 21 | webGlobe = new Cesium.WebSceneControl('GlobeView', { |
22 | | - terrainExaggeration: 1, |
| 22 | + terrainExaggeration: 1 |
23 | 23 | }); |
24 | 24 | //初始化视图功能管理类 |
25 | 25 | sceneManager = new CesiumZondy.Manager.SceneManager({ |
|
28 | 28 | } |
29 | 29 |
|
30 | 30 | function zoomin() { |
31 | | - sceneManager.zoomIn();//放大 |
| 31 | + sceneManager.zoomIn(); //放大 |
32 | 32 | } |
33 | 33 |
|
34 | 34 | function zoomout() { |
35 | | - sceneManager.zoomOut();//缩小 |
| 35 | + sceneManager.zoomOut(); //缩小 |
36 | 36 | } |
37 | 37 |
|
38 | 38 | function gohome() { |
39 | | - sceneManager.goHome();//复位 |
| 39 | + sceneManager.goHome(); //复位 |
40 | 40 | } |
41 | 41 |
|
42 | 42 | function start() { |
43 | | - sceneManager.openRotation();//开启自转 |
| 43 | + sceneManager.openRotation(); //开启自转 |
44 | 44 | } |
45 | 45 |
|
46 | 46 | function stop() { |
47 | | - sceneManager.closeRotation();//关闭自转 |
| 47 | + sceneManager.closeRotation(); //关闭自转 |
48 | 48 | } |
49 | 49 |
|
50 | | - function change() { |
51 | | - var skybox = new Cesium.SkyBox({ |
52 | | - sources: { |
53 | | - positiveX: './static/libs/cdn/Cesium/Assets/Textures/SkyBox2/front.jpg', |
54 | | - negativeX: './static/libs/cdn/Cesium/Assets/Textures/SkyBox2/back.jpg', |
55 | | - positiveY: './static/libs/cdn/Cesium/Assets/Textures/SkyBox2/left.jpg', |
56 | | - negativeY: './static/libs/cdn/Cesium/Assets/Textures/SkyBox2/right.jpg', |
57 | | - positiveZ: './static/libs/cdn/Cesium/Assets/Textures/SkyBox2/top.jpg', |
58 | | - negativeZ: './static/libs/cdn/Cesium/Assets/Textures/SkyBox2/bottom.jpg' |
59 | | - } |
60 | | - }); |
61 | | - sceneManager.changeSkyBox(skybox); |
| 50 | + function change(value) { |
| 51 | + switch (value) { |
| 52 | + case 'skybox': |
| 53 | + var skybox = new Cesium.SkyBox({ |
| 54 | + sources: { |
| 55 | + positiveX: './static/libs/cdn/Cesium/Assets/Textures/SkyBox/tycho2t3_80_px.jpg', |
| 56 | + negativeX: './static/libs/cdn/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mx.jpg', |
| 57 | + positiveY: './static/libs/cdn/Cesium/Assets/Textures/SkyBox/tycho2t3_80_py.jpg', |
| 58 | + negativeY: './static/libs/cdn/Cesium/Assets/Textures/SkyBox/tycho2t3_80_my.jpg', |
| 59 | + positiveZ: './static/libs/cdn/Cesium/Assets/Textures/SkyBox/tycho2t3_80_pz.jpg', |
| 60 | + negativeZ: './static/libs/cdn/Cesium/Assets/Textures/SkyBox/tycho2t3_80_mz.jpg' |
| 61 | + } |
| 62 | + }); |
| 63 | + sceneManager.changeSkyBox(skybox); |
| 64 | + } |
| 65 | + switch (value) { |
| 66 | + case 'skybox2': |
| 67 | + var skybox = new Cesium.SkyBox({ |
| 68 | + sources: { |
| 69 | + positiveX: './static/data/skybox/SkyBox2/tycho2t3_80_px.jpg', |
| 70 | + negativeX: './static/data/skybox/SkyBox2/tycho2t3_80_mx.jpg', |
| 71 | + positiveY: './static/data/skybox/SkyBox2/tycho2t3_80_py.jpg', |
| 72 | + negativeY: './static/data/skybox/SkyBox2/tycho2t3_80_my.jpg', |
| 73 | + positiveZ: './static/data/skybox/SkyBox2/tycho2t3_80_pz.jpg', |
| 74 | + negativeZ: './static/data/skybox/SkyBox2/tycho2t3_80_mz.jpg' |
| 75 | + } |
| 76 | + }); |
| 77 | + sceneManager.changeSkyBox(skybox); |
| 78 | + } |
| 79 | + switch (value) { |
| 80 | + case 'skybox3': |
| 81 | + var skybox = new Cesium.SkyBox({ |
| 82 | + sources: { |
| 83 | + positiveX: './static/data/skybox/SkyBox3/tycho2t3_80_px.jpg', |
| 84 | + negativeX: './static/data/skybox/SkyBox3/tycho2t3_80_mx.jpg', |
| 85 | + positiveY: './static/data/skybox/SkyBox3/tycho2t3_80_py.jpg', |
| 86 | + negativeY: './static/data/skybox/SkyBox3/tycho2t3_80_my.jpg', |
| 87 | + positiveZ: './static/data/skybox/SkyBox3/tycho2t3_80_pz.jpg', |
| 88 | + negativeZ: './static/data/skybox/SkyBox3/tycho2t3_80_mz.jpg' |
| 89 | + } |
| 90 | + }); |
| 91 | + sceneManager.changeSkyBox(skybox); |
| 92 | + } |
| 93 | + switch (value) { |
| 94 | + case 'skybox4': |
| 95 | + var skybox = new Cesium.SkyBox({ |
| 96 | + sources: { |
| 97 | + positiveX: './static/data/skybox/SkyBox4/tycho2t3_80_px.jpg', |
| 98 | + negativeX: './static/data/skybox/SkyBox4/tycho2t3_80_mx.jpg', |
| 99 | + positiveY: './static/data/skybox/SkyBox4/tycho2t3_80_py.jpg', |
| 100 | + negativeY: './static/data/skybox/SkyBox4/tycho2t3_80_my.jpg', |
| 101 | + positiveZ: './static/data/skybox/SkyBox4/tycho2t3_80_pz.jpg', |
| 102 | + negativeZ: './static/data/skybox/SkyBox4/tycho2t3_80_mz.jpg' |
| 103 | + } |
| 104 | + }); |
| 105 | + sceneManager.changeSkyBox(skybox); |
| 106 | + } |
| 107 | + switch (value) { |
| 108 | + case 'skybox5': |
| 109 | + var skybox = new Cesium.SkyBox({ |
| 110 | + sources: { |
| 111 | + positiveX: './static/data/skybox/SkyBox5/tycho2t3_80_px.jpg', |
| 112 | + negativeX: './static/data/skybox/SkyBox5/tycho2t3_80_mx.jpg', |
| 113 | + positiveY: './static/data/skybox/SkyBox5/tycho2t3_80_py.jpg', |
| 114 | + negativeY: './static/data/skybox/SkyBox5/tycho2t3_80_my.jpg', |
| 115 | + positiveZ: './static/data/skybox/SkyBox5/tycho2t3_80_pz.jpg', |
| 116 | + negativeZ: './static/data/skybox/SkyBox5/tycho2t3_80_mz.jpg' |
| 117 | + } |
| 118 | + }); |
| 119 | + sceneManager.changeSkyBox(skybox); |
| 120 | + } |
| 121 | + switch (value) { |
| 122 | + case 'skybox6': |
| 123 | + var skybox = new Cesium.SkyBox({ |
| 124 | + sources: { |
| 125 | + positiveX: './static/data/skybox/SkyBox6/tycho2t3_80_px.jpg', |
| 126 | + negativeX: './static/data/skybox/SkyBox6/tycho2t3_80_mx.jpg', |
| 127 | + positiveY: './static/data/skybox/SkyBox6/tycho2t3_80_py.jpg', |
| 128 | + negativeY: './static/data/skybox/SkyBox6/tycho2t3_80_my.jpg', |
| 129 | + positiveZ: './static/data/skybox/SkyBox6/tycho2t3_80_pz.jpg', |
| 130 | + negativeZ: './static/data/skybox/SkyBox6/tycho2t3_80_mz.jpg' |
| 131 | + } |
| 132 | + }); |
| 133 | + sceneManager.changeSkyBox(skybox); |
| 134 | + } |
62 | 135 | } |
63 | | - |
64 | 136 | </script> |
65 | 137 | </head> |
66 | 138 |
|
|
72 | 144 | <button id="goHome" onclick="gohome()">复位</button> |
73 | 145 | <button id="openRotation" onclick="start()">开启自转</button> |
74 | 146 | <button id="closeRotation" onclick="stop()">关闭自转</button> |
75 | | - <button id="change" onclick="change()">修改天空盒</button> |
| 147 | + <select onchange="change(this.value)"> |
| 148 | + <option value="skybox">初始天空盒</option> |
| 149 | + <option value="skybox2">天空盒2</option> |
| 150 | + <option value="skybox3">天空盒3</option> |
| 151 | + <option value="skybox4">天空盒4</option> |
| 152 | + <option value="skybox5">天空盒5</option> |
| 153 | + <option value="skybox6">天空盒6</option> |
| 154 | + </select> |
76 | 155 | </div> |
77 | 156 | </div> |
78 | 157 | </body> |
|
0 commit comments