Skip to content

Commit f73f01b

Browse files
author
David
committed
new octo viewer
1 parent 93262d9 commit f73f01b

File tree

4 files changed

+1129
-0
lines changed

4 files changed

+1129
-0
lines changed

geodata-3dtiles3/demo.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
var browser = null;
2+
var renderer = null;
3+
var map = null;
4+
var geodata = null;
5+
6+
(function startDemo() {
7+
8+
var params = vtsParseUrlParams();
9+
10+
params['positionInUrl'] = true;
11+
params['map'] = 'https://cdn.melown.com/mario/store/melown2015/map-config/melown/VTS-Tutorial-map/mapConfig.json';
12+
13+
params['view'] = {
14+
"surfaces": {},
15+
"freeLayers": {},
16+
"options": {}
17+
};
18+
19+
params['walkMode'] = true;
20+
params['fixedHeight'] = 47; //48???
21+
params['mapCheckTextureSize'] = true;
22+
params['mapTraverseToMeshNode'] = true;
23+
24+
//parse mapSplitSpace url param
25+
var params2 = vts.utils.getParamsFromUrl(window.location.href);
26+
27+
if (params2['fixedHeight']) {
28+
params['fixedHeight'] = parseFloat(params2['fixedHeight']);
29+
}
30+
31+
var urlParams = new URLSearchParams(window.location.search);
32+
33+
if(urlParams.has('mapNormalizeOctantTexelSize')) {
34+
var value = urlParams.get('mapNormalizeOctantTexelSize');
35+
params['mapNormalizeOctantTexelSize'] = (value == '1' || value == 'true');
36+
}
37+
38+
if(urlParams.has('mapTraverseToMeshNode')) {
39+
var value = urlParams.get('mapTraverseToMeshNode');
40+
params['mapTraverseToMeshNode'] = (value == '1' || value == 'true');
41+
}
42+
43+
if (!params['pos']) {
44+
params['pos'] = [ 'obj', 0.075365034865010019 * (180/Math.PI), 0.90892506334583045 * (180/Math.PI), 'float', 0.00, -23.00, -49.10, 0.00, 41033.50, 45.00 ]
45+
//params['pos'] = [ 'obj', -2.1362545626053979 * (180/Math.PI), 0.65953372844334801 * (180/Math.PI), 'float', 0.00, -23.00, -49.10, 0.00, 41033.50, 45.00 ]
46+
}
47+
48+
browser = vts.browser('map-div', params);
49+
50+
//check whether browser is supported
51+
if (!browser) {
52+
console.log('Your web browser does not support WebGL');
53+
return;
54+
}
55+
56+
//callback once is map config loaded
57+
browser.on('map-loaded', onMapLoaded);
58+
})();
59+
60+
61+
function onMapLoaded() {
62+
map = browser.map;
63+
64+
var freeLayer = {
65+
credits:[],
66+
displaySize:1024,
67+
extents:{"ll":[null,null,null],"ur":[null,null,null]},
68+
style:{},
69+
type:"geodata"
70+
};
71+
72+
freeLayer.geodata = { binPath : './tileset.json' };
73+
74+
//add free layer to the map
75+
map.addFreeLayer('geodatatest', freeLayer);
76+
77+
//add free layer to the list of free layers
78+
//which will be rendered on the map
79+
var view = map.getView();
80+
view.freeLayers.geodatatest = { options: { fastParse: true }};
81+
map.setView(view);
82+
}
83+
84+

geodata-3dtiles3/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<html>
2+
<head>
3+
<title>VTS Browser - Geodata Geojson Import From URL</title>
4+
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
5+
<link rel="stylesheet" type="text/css" href="./vts-browser.css" />
6+
<script type="text/javascript" src="./vts-browser.js"></script>
7+
<script src="//cdn.melown.com/libs/vtsjs/support/v2/start-browser.js"></script>
8+
</head>
9+
10+
<body style = "padding: 0; margin: 0;">
11+
<div id="map-div" style="width:100%; height:100%;">
12+
</div>
13+
<script type="text/javascript" src="demo.js"></script>
14+
</body>
15+
</html>

0 commit comments

Comments
 (0)