-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
112 lines (98 loc) · 3.39 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/cesium/1.118.2/Cesium.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/cesium/1.118.2/Widgets/widgets.min.css" rel="stylesheet">
<style>
html, body, #cesiumContainer {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
overflow: hidden;
}
.toolbar-left {
display: block;
position: absolute;
top: 5px;
left: 5px;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script type="module">
var viewer = new Cesium.Viewer('cesiumContainer', {
animation: false,
baseLayerPicker: false,
fullscreenButton: true,
vrButton: false,
geocoder: true,
homeButton: false,
infoBox: true,
selectionIndicator: true,
timeline: false,
shadows: false,
navigationHelpButton: false,
navigationInstructionsInitiallyVisible: true,
scene3DOnly: true,
geocoder: false,
shouldAnimate: true,
baseLayer: new Cesium.ImageryLayer(new Cesium.UrlTemplateImageryProvider({
url: "https://service.pdok.nl/brt/achtergrondkaart/wmts/v2_0/grijs/EPSG:3857/{z}/{x}/{y}.png",
maximumLevel: 19,
}))
});
viewer.scene.globe.baseColor = Cesium.Color.WHITE;
var terrainProvider = await Cesium.CesiumTerrainProvider.fromUrl('https://api.pdok.nl/kadaster/3d-basisvoorziening/ogc/v1_0/collections/digitaalterreinmodel/quantized-mesh');
viewer.scene.terrainProvider = terrainProvider;
viewer.scene.globe.depthTestAgainstTerrain=true;
const tilesetDtbVlakken = await Cesium.Cesium3DTileset.fromUrl(
"./dtb_vlakken/tileset.json"
);
var translation = new Cesium.Cartesian3(0, 0, 5);
var modelMatrix = Cesium.Matrix4.fromTranslation(translation);
tilesetDtbVlakken.modelMatrix = modelMatrix;
viewer.scene.primitives.add(tilesetDtbVlakken);
const tilesetPunten = await Cesium.Cesium3DTileset.fromUrl(
"./dtb_punten/tileset.json"
);
viewer.scene.primitives.add(tilesetPunten);
// todo: voeg hier code toe
viewer.scene.globe.depthTestAgainstTerrain = true;
viewer.scene.globe.enableLighting = false;
viewer.scene.highDynamicRange = false;
viewer.zoomTo(tilesetDtbVlakken, new Cesium.HeadingPitchRange(0, -0.5, 0));
const normalColor = Cesium.Color.WHITE;
let currentColor = Cesium.Color.YELLOW;
// 3D Tileset highlighting
const highlighted = {
feature: undefined,
originalColor: new Cesium.Color(),
};
// Color a feature yellow on hover.
viewer.screenSpaceEventHandler.setInputAction(function onMouseMove(
movement
) {
// If a feature was previously highlighted, undo the highlight
if (Cesium.defined(highlighted.feature)) {
highlighted.feature.color = highlighted.originalColor;
highlighted.feature = undefined;
}
// Pick a new feature
const pickedFeature = viewer.scene.pick(movement.endPosition);
// Highlight the feature if it's not already selected.
if (pickedFeature instanceof Cesium.Cesium3DTileFeature) {
highlighted.feature = pickedFeature;
Cesium.Color.clone(
pickedFeature.color,
highlighted.originalColor
);
pickedFeature.color = currentColor;
}
},
Cesium.ScreenSpaceEventType.MOUSE_MOVE);
</script>
</body>
</html>