Skip to content

Commit

Permalink
feat(index.html): auto-redirect to examples (#2478)
Browse files Browse the repository at this point in the history
  • Loading branch information
HoloTheDrunk authored Dec 17, 2024
1 parent 09a016f commit 1e171ff
Showing 1 changed file with 10 additions and 77 deletions.
87 changes: 10 additions & 77 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,84 +1,17 @@
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Globe</title>
<link rel="stylesheet" type="text/css" href="examples/css/example.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js"></script>
</head>
<body>
<div id="viewerDiv" class="viewer"></div>
<script src="examples/js/GUI/GuiTools.js"></script>
<script src="dist/itowns.js"></script>
<script src="dist/debug.js"></script>
<script type="text/javascript">
/* global itowns,document,GuiTools, debug, window */
var placement = {
coord: new itowns.Coordinates('EPSG:4326', 2.351323, 48.856712),
range: 25000000,
}

// iTowns namespace defined here
var viewerDiv = document.getElementById('viewerDiv');
var view = new itowns.GlobeView(viewerDiv, placement);
var menuGlobe = new GuiTools('menuDiv', view);

function createWMTSSourceFromConfig(config) {
config.source = new itowns.WMTSSource(config.source);
return config;
}

function addColorLayerFromConfig(config) {
var layer = new itowns.ColorLayer(config.id, config);
view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
}

itowns.Fetcher.json('examples/layers/JSONLayers/Ortho.json').then(createWMTSSourceFromConfig).then(addColorLayerFromConfig);
itowns.Fetcher.json('examples/layers/JSONLayers/ScanEX.json').then(createWMTSSourceFromConfig).then(addColorLayerFromConfig);
itowns.Fetcher.json('examples/layers/JSONLayers/Region.json')
.then(function _(config) {
config.source = new itowns.WMSSource(config.source);
return config;
}).then(addColorLayerFromConfig);
<!--- This file is only loaded when serving iTowns locally. -->

itowns.Fetcher.json('examples/layers/JSONLayers/Cada.json').then(createWMTSSourceFromConfig).then(addColorLayerFromConfig);
itowns.Fetcher.json('examples/layers/JSONLayers/Administrative.json').then(createWMTSSourceFromConfig).then(addColorLayerFromConfig);
itowns.Fetcher.json('examples/layers/JSONLayers/Transport.json').then(createWMTSSourceFromConfig).then(addColorLayerFromConfig);
itowns.Fetcher.json('examples/layers/JSONLayers/Railways.json').then(createWMTSSourceFromConfig).then(addColorLayerFromConfig);
itowns.Fetcher.json('examples/layers/JSONLayers/Denomination.json').then(createWMTSSourceFromConfig).then(addColorLayerFromConfig);

function addElevationLayerFromConfig(config) {
var layer = new itowns.ElevationLayer(config.id, config);
view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
}

itowns.Fetcher.json('examples/layers/JSONLayers/WORLD_DTM.json')
.then(createWMTSSourceFromConfig).then(addElevationLayerFromConfig);
itowns.Fetcher.json('examples/layers/JSONLayers/IGN_MNT_HIGHRES.json')
.then(createWMTSSourceFromConfig).then(addElevationLayerFromConfig);

const atmosphere = view.getLayerById('atmosphere');
menuGlobe.addGUI('RealisticLighting', false, function (v) {
atmosphere.setRealisticOn(v);
view.notifyChange(atmosphere);
});
<html>

// eslint-disable-next-line prefer-arrow-callback
view.addEventListener(itowns.GLOBE_VIEW_EVENTS.GLOBE_INITIALIZED, function m() {
// eslint-disable-next-line no-console
console.info('Globe initialized');
});
<head>
<title>iTowns - redirecting...</title>
</head>

const d = new debug.Debug(view, menuGlobe.gui);
debug.createTileDebugUI(menuGlobe.gui, view, view.tileLayer, d);
window.view = view;
<body>
<script type="text/javascript">
window.location.href = 'examples/';
</script>
</body>

</script>
</body>
</html>

0 comments on commit 1e171ff

Please sign in to comment.