Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions examples/3dtiles_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,12 @@
// Add one imagery layer to the scene. This layer's properties are
// defined in a json file, but it cou ld be defined as a plain js
// object. See `Layer` documentation for more info.
Fetcher.json('./layers/JSONLayers/OPENSM.json').then((config) => {
const colorLayer = new ColorLayer('Ortho', {
...config,
source: new TMSSource(config.source),
});
view.addLayer(colorLayer);
const openSmConfig = await Fetcher.json('./layers/JSONLayers/OPENSM.json');
const colorLayer = new ColorLayer('Ortho', {
...openSmConfig,
source: new TMSSource(openSmConfig.source),
});
view.addLayer(colorLayer);

// ---- Add 3D terrain ----

Expand All @@ -136,8 +135,10 @@
var elevationLayer = new itowns.ElevationLayer(config.id, config);
view.addLayer(elevationLayer);
}
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);

// ---------- 3D Tiles loading

Expand Down
15 changes: 8 additions & 7 deletions examples/copc_3d_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,21 @@
// Add one imagery layer to the scene and the miniView
// This layer is defined in a json file but it could be defined as a plain js
// object. See Layer* for more info.
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
var layer = new itowns.ColorLayer('Ortho', config);
view.addLayer(layer);
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
var orthoLayer = new itowns.ColorLayer('Ortho', orthoConfig);
view.addLayer(orthoLayer);
// Add two elevation layers.
// These will deform iTowns globe geometry to represent terrain elevation.
function addElevationLayerFromConfig(config) {
config.source = new itowns.WMTSSource(config.source);
var layer = new itowns.ElevationLayer(config.id, config);
view.addLayer(layer);
}
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);

var layer;

Expand Down
18 changes: 8 additions & 10 deletions examples/effects_postprocessing.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,14 @@
r.render(postprocessScene, cam);
};

itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
var layer = new itowns.ColorLayer('Ortho', config);
view.addLayer(layer);
});
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
var layer = new itowns.ElevationLayer(config.id, config);
view.addLayer(layer);
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
var orthoLayer = new itowns.ColorLayer('Ortho', orthoConfig);
view.addLayer(orthoLayer);
const ignMntConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT.json');
ignMntConfig.source = new itowns.WMTSSource(ignMntConfig.source);
var elevationLayer = new itowns.ElevationLayer(ignMntConfig.id, ignMntConfig);
view.addLayer(elevationLayer);
window.view = view;
window.itowns = itowns;
window.THREE = THREE;
Expand Down
27 changes: 13 additions & 14 deletions examples/effects_split.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,15 @@
// This layer is defined in a json file but it could be defined as a plain js
// object. See Layer* for more info.

const pOrtho = itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
orthoLayer = new itowns.ColorLayer('Ortho', config);
view.addLayer(orthoLayer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
orthoLayer = new itowns.ColorLayer('Ortho', orthoConfig);
view.addLayer(orthoLayer).then(menuGlobe.addLayerGUI.bind(menuGlobe));

const pOsm = itowns.Fetcher.json('./layers/JSONLayers/OPENSM.json').then(function _(config) {
config.source = new itowns.TMSSource(config.source);
osmLayer = new itowns.ColorLayer('OSM', config);
view.addLayer(osmLayer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
});
const osmConfig = await itowns.Fetcher.json('./layers/JSONLayers/OPENSM.json');
osmConfig.source = new itowns.TMSSource(osmConfig.source);
osmLayer = new itowns.ColorLayer('OSM', osmConfig);
view.addLayer(osmLayer).then(menuGlobe.addLayerGUI.bind(menuGlobe));

// Add two elevation layers.
// These will deform iTowns globe geometry to represent terrain elevation.
Expand All @@ -101,8 +99,10 @@
var layer = new itowns.ElevationLayer(config.id, config);
view.addLayer(layer);
}
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);

// Slide handling
function splitSliderMove(evt) {
Expand Down Expand Up @@ -155,8 +155,7 @@
}

// Override default rendering method when color layers are ready
Promise.all([pOrtho, pOsm]).then(
function _() { view.render = splitRendering; }).catch(console.error);
view.render = splitRendering;
window.view = view;
window.itowns = itowns;
window.THREE = THREE;
Expand Down
15 changes: 8 additions & 7 deletions examples/effects_stereo.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,21 @@
// Add one imagery layer to the scene
// This layer is defined in a json file but it could be defined as a plain js
// object. See Layer* for more info.
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
const source = new itowns.WMTSSource(config.source);
const layer = new itowns.ColorLayer(config.id, { source });
view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
const orthoSource = new itowns.WMTSSource(orthoConfig.source);
const orthoLayer = new itowns.ColorLayer(orthoConfig.id, { source: orthoSource });
view.addLayer(orthoLayer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
// Add two elevation layers.
// These will deform iTowns globe geometry to represent terrain elevation.
function addElevationLayerFromConfig(config) {
config.source = new itowns.WMTSSource(config.source);
const layer = new itowns.ElevationLayer(config.id, config);
view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
}
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);

/* eslint-disable no-unused-vars */
function updateEyeSep(value) {
Expand Down
15 changes: 8 additions & 7 deletions examples/entwine_3d_loader.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,10 @@
// Add one imagery layer to the scene and the miniView
// This layer is defined in a json file but it could be defined as a plain js
// object. See Layer* for more info.
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
var layer = new itowns.ColorLayer('Ortho', config);
view.addLayer(layer);
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
var orthoLayer = new itowns.ColorLayer('Ortho', orthoConfig);
view.addLayer(orthoLayer);

// Add two elevation layers.
// These will deform iTowns globe geometry to represent terrain elevation.
Expand All @@ -74,8 +73,10 @@
var layer = new itowns.ElevationLayer(config.id, config);
view.addLayer(layer);
}
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);

// Check if an url had been given as an argument
// and parse to get url and options.
Expand Down
17 changes: 9 additions & 8 deletions examples/geoid_geoidLayer.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@

// Add one imagery layer to the scene. This layer's properties are defined in a json file, but it could be
// defined as a plain js object. See `Layer` documentation for more info.
itowns.Fetcher.json('layers/JSONLayers/Ortho.json').then((config) => {
config.source = new itowns.WMTSSource(config.source);
view.addLayer(
new itowns.ColorLayer(config.id, config),
).then(debugMenu.addLayerGUI.bind(debugMenu));
});
const orthoConfig = await itowns.Fetcher.json('layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
view.addLayer(
new itowns.ColorLayer(orthoConfig.id, orthoConfig),
).then(debugMenu.addLayerGUI.bind(debugMenu));

// Add two elevaion layers, each with a different level of detail. Here again, each layer's properties are
// defined in a json file.
Expand All @@ -77,8 +76,10 @@
new itowns.ElevationLayer(config.id, config),
).then(debugMenu.addLayerGUI.bind(debugMenu));
}
itowns.Fetcher.json('layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);



Expand Down
19 changes: 10 additions & 9 deletions examples/itowns-potree.html
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,12 @@

// Add one imagery layer to the scene. This layer's properties are defined in a json file, but it could be
// defined as a plain js object. See `Layer` documentation for more info.
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
config.source.zoom = { max: 19, min: 3 };
itownsViewer.addLayer(
new itowns.ColorLayer(config.id, config),
);
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
orthoConfig.source.zoom = { max: 19, min: 3 };
itownsViewer.addLayer(
new itowns.ColorLayer(orthoConfig.id, orthoConfig),
);

// Add two elevaion layers, each with a different level of detail. Here again, each layer's properties are
// defined in a json file.
Expand All @@ -211,8 +210,10 @@
new itowns.ElevationLayer(config.id, config),
);
}
itowns.Fetcher.json('layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);



Expand Down
17 changes: 9 additions & 8 deletions examples/misc_camera_animation.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@

// Add one imagery layer to the scene. This layer's properties are defined in a json file, but it could be
// defined as a plain js object. See `Layer` documentation for more info.
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
view.addLayer(
new itowns.ColorLayer('Ortho', config),
);
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
view.addLayer(
new itowns.ColorLayer('Ortho', orthoConfig),
);



Expand All @@ -76,8 +75,10 @@
new itowns.ElevationLayer(config.id, config),
);
}
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);



Expand Down
15 changes: 8 additions & 7 deletions examples/misc_camera_traveling.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@
// Add one imagery layer to the scene and the miniView.
// This layer is defined in a json file but it could be defined as a plain js
// object. See Layer for more info.
itowns.Fetcher.json('./layers/JSONLayers/Ortho.json').then(function _(config) {
config.source = new itowns.WMTSSource(config.source);
const orthoLayer = new itowns.ColorLayer('Ortho', config);
view.addLayer(orthoLayer);
});
const orthoConfig = await itowns.Fetcher.json('./layers/JSONLayers/Ortho.json');
orthoConfig.source = new itowns.WMTSSource(orthoConfig.source);
const orthoLayer = new itowns.ColorLayer('Ortho', orthoConfig);
view.addLayer(orthoLayer);

// Add two elevation layers.
// These will deform iTowns globe geometry to represent terrain elevation.
Expand All @@ -84,8 +83,10 @@
let layer = new itowns.ElevationLayer(config.id, config);
view.addLayer(layer);
}
itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json').then(addElevationLayerFromConfig);
itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json').then(addElevationLayerFromConfig);
const ignMntHighResConfig = await itowns.Fetcher.json('./layers/JSONLayers/IGN_MNT_HIGHRES.json');
addElevationLayerFromConfig(ignMntHighResConfig);
const worldDtmConfig = await itowns.Fetcher.json('./layers/JSONLayers/WORLD_DTM.json');
addElevationLayerFromConfig(worldDtmConfig);


// ---------- Select camera positions and travel through these positions : ----------
Expand Down
Loading
Loading