-
Notifications
You must be signed in to change notification settings - Fork 11
/
index.html
128 lines (117 loc) · 3.42 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="en">
<head>
<title>Graticule</title>
<script src="Cesium/Cesium.js"></script>
<script src="Graticule.js"></script>
<script src="InfoWindow.js"></script>
<style>
@import url(Cesium/Widgets/CesiumWidget/CesiumWidget.css);
#cesiumContainer {
position: absolute;
top: 0px;
left: 0;
height: 100%;
width: 100%;
margin: 0;
overflow: hidden;
padding: 0;
font-family: sans-serif;
}
#toolbar {
position: absolute;
top: 0px;
left: 0;
display: inline;
margin: 10px;
padding: 0px;
background: white;
}
#logging {
position: absolute;
bottom: 0px;
right: 0;
display: inline;
margin: 10px;
padding: 10px;
background: white;
}
/*
css rules for the infowindow
*/
.infoWindow {
position: absolute;
min-width: 100px;
max-width: 300px;
}
.infoWindow .frame {
padding: 10px;
border: 1px solid black;
background: white;
}
.infoWindow .close {
float: right;
margin: 5px 2px;
font-size: small;
color: gray;
cursor: pointer;
}
.infoWindow .arrow {
position: absolute;
bottom: -8px;
left: 50%;
margin-left: -10px;
border-right: 10px solid transparent;
border-left: 10px solid transparent;
border-top: 10px solid white;
}
body {
padding: 0;
margin: 0;
overflow: hidden;
}
</style>
</head>
<body onload="start()">
<div id="cesiumContainer"></div>
<div id="toolbar">
<button id="gridToggle">Toggle the grid display on/off</button>
</div>
<div id="logging">
</div>
<script>
function start() {
// create the almighty cesium widget
var cesiumWidget = new Cesium.CesiumWidget('cesiumContainer', {
scene3DOnly: true
});
var scene = cesiumWidget.scene;
var graticule = new Graticule({
tileWidth: 512,
tileHeight: 512,
numLines: 10
}, scene);
cesiumWidget.scene.imageryLayers.addImageryProvider(graticule);
document.getElementById("gridToggle").onclick = function(e) {
graticule.setVisible(!graticule.isVisible())
};
var cesiumTerrainProviderHeightmaps = new Cesium.CesiumTerrainProvider({
url : 'https://cesiumjs.org/smallterrain',
credit : 'Terrain data courtesy Analytical Graphics, Inc.'
});
scene.terrainProvider = cesiumTerrainProviderHeightmaps;
var testWidget = document.createElement('button');
testWidget.innerHTML = 'Test';
testWidget.onclick = function(){alert('Clicked!')};
var infoWindow = new InfoWindow({}, cesiumWidget);
infoWindow.showAt(10, 0, testWidget);
infoWindow.setVisible(true);
scene.primitives.add(infoWindow);
var logging = document.getElementById('logging');
function loggingMessage(message) {
logging.innerHTML = message;
}
}
</script>
</body>
</html>