-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlocal_lib.html
89 lines (68 loc) · 2.49 KB
/
local_lib.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="/lib/cesium_1_124/Build/CesiumUnminified/Widgets/widgets.css" rel="stylesheet">
<style>
html, body {
margin: 0;
padding: 0;
}
#cesiumContainer {
height: 100%;
}
</style>
</head>
<body>
<div id="cesiumContainer"></div>
<script type="module">
import {
Viewer, Ion, Ellipsoid,
Cesium3DTileStyle, Cesium3DTileset,
VerticalOrigin, HorizontalOrigin, Cartographic,
BoundingSphere, HeadingPitchRange, LabelStyle,
TileCoordinatesImageryProvider
} from "/lib/cesium_1_124/Build/CesiumUnminified/index.js"
Ion.defaultAccessToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIyYzRjNzYyYi1kMTUzLTRmMjUtYjA2My04NjJmN2U4NGRhOWMiLCJpZCI6MTEwMzQ1LCJpYXQiOjE3MDE3OTQ3Mjd9.c3YxZQaQVpQyVab1-trMHGNMXsTaMJ_GB305G_OPsrk';
const viewer = new Viewer('cesiumContainer', {});
//viewer.imageryLayers.addImageryProvider(new TileCoordinatesImageryProvider());
await addTileset();
flyTo();
async function addTileset() {
const style = new Cesium3DTileStyle({
pointSize: "1.0",
color: "rgba(10, 180, 255, 0.77)",
labelColor: "rgba(180, 180, 255, 1)",
labelOutlineWidth: 4,
labelStyle: LabelStyle.FILL_AND_OUTLINE,
labelOutlineColor: "color('black')",
labelOutlineWidth: "1.0",
labelHorizontalOrigin: HorizontalOrigin.CENTER,
pixelOffset: "[0, -15]",
anchorLineEnabled: "true",
heightOffset: "500.0",
anchorLineColor: "rgba(255, 255, 255, 1)",
verticalOrigin: VerticalOrigin.BOTTOM,
distanceDisplayCondition: "vec2(0.0, 5.5e8)",
// disableDepthTestDistance: 100000,
translucencyByDistance: "vec4(10000, 0, 20000, 1)",
font: '"30px sans-serif"',
labelText: '"${title} (${size})"',
});
// const tseturl = '/data/pnts-tileset.json';
const tseturl = '/data/pnts-implicit.json';
const tset = await Cesium3DTileset.fromUrl(tseturl);
viewer.scene.primitives.add(tset);
tset.style = style;
}
function flyTo() {
const position = Ellipsoid.WGS84.cartographicToCartesian(Cartographic.fromDegrees(0.0, 0.0, 0.0));
viewer.scene.camera.flyToBoundingSphere(
new BoundingSphere(position, 0.0), {
offset: new HeadingPitchRange(0.0, -3.14159 / 4, 5000000)
});
}
</script>
</div>
</body>
</html>