-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.html
78 lines (69 loc) · 2.71 KB
/
map.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
<!DOCTYPE html>
<html>
<head lang="en">
<title>Quick Start</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0 maximum-scale=1.0 user-scalable=no">
<link rel="stylesheet" type="text/css" href="./NGR.css">
<script src="./NGR.min.js"></script>
</head>
<body style="height: 100%; margin: 0; padding: 0;">
<div id="map" style="width: 100%; height: 100%; margin: 0; padding: 0; position:absolute"></div>
<script>
(function () {
window.map = new NGR.View('map', {
appKey: "b5c9288627bd49fba1887e7e30644240"
});
window.res = new NGR.DataSource({
appKey: "b5c9288627bd49fba1887e7e30644240"
});
window.layers = {};
res.requestMaps().then(function (maps) {
res.requestPOIChildren(maps.list[0].poi).then(function(floors) {
return res.requestPlanarGraph(floors[0].id).then(function (layerInfo) {
console.log(layerInfo);
return NGR.IO.fetch({
url: './style.json',
onsuccess: JSON.parse
}).then(function (style) {
layers.frame = NGR.featureLayer(layerInfo, {
layerType: 'Frame',
styleConfig: style
});
layers.area = NGR.featureLayer(layerInfo, {
layerType: 'Area',
styleConfig: style
});
layers.annotation = NGR.featureLayer(layerInfo.Area, {
layerType: 'LogoLabel',
styleConfig: style
});
layers.facility = NGR.featureLayer(layerInfo.Facility, {
layerType: 'Facility',
styleConfig: style
});
layers.collision = NGR.layerGroup.collision({
margin: 3
});
layers.collision.addLayer(layers.annotation);
layers.collision.addLayer(layers.facility);
map.addLayer(layers.frame);
map.addLayer(layers.area);
map.addLayer(layers.collision);
map.render();
}).fail(function (e) {
return console.error(e, e.stack);
});
}).fail(function (e) {
return console.error(e, e.stack);
});
}).fail(function (e) {
return console.error(e, e.stack);
});
}).fail(function (e) {
return console.error(e, e.stack);
});
}).call(this);
</script>
</body>
</html>