diff --git a/.eslintrc.cjs b/.eslintrc.cjs
index bef0ef66c3..0006ab9edd 100644
--- a/.eslintrc.cjs
+++ b/.eslintrc.cjs
@@ -137,7 +137,14 @@ module.exports = {
'plugin:@typescript-eslint/recommended',
],
rules: {
- '@stylistic/max-len': ['warn', 80],
+ '@stylistic/max-len': ['warn', {
+ code: 100,
+ comments: 80,
+ ignoreUrls: true,
+ }],
+ // see https://typescript-eslint.io/rules/no-use-before-define/
+ 'no-use-before-define': 'off',
+ '@typescript-eslint/no-use-before-define': 'error',
'valid-jsdoc': 'off',
'tsdoc/syntax': 'warn',
},
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index c8d65507f8..bcb91e0cb5 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -19,11 +19,11 @@ jobs:
steps:
# Use specific Node.js version
- - uses: actions/checkout@v3
- - name: Use Node.js 18.x
- uses: actions/setup-node@v3
+ - uses: actions/checkout@v4
+ - name: Use Node.js 22.x
+ uses: actions/setup-node@v4
with:
- node-version: 18.x
+ node-version: 22.x
cache: 'npm'
# Install packages
@@ -84,11 +84,11 @@ jobs:
steps:
# Use specific Node.js version
- - uses: actions/checkout@v3
- - name: Use Node.js 18.x
- uses: actions/setup-node@v3
+ - uses: actions/checkout@v4
+ - name: Use Node.js 22.x
+ uses: actions/setup-node@v4
with:
- node-version: 18.x
+ node-version: 22.x
cache: 'npm'
# Install packages
@@ -114,11 +114,11 @@ jobs:
steps:
# Use specific Node.js version
- - uses: actions/checkout@v3
- - name: Use Node.js 18.x
- uses: actions/setup-node@v3
+ - uses: actions/checkout@v4
+ - name: Use Node.js 22.x
+ uses: actions/setup-node@v4
with:
- node-version: 18.x
+ node-version: 22.x
cache: 'npm'
# Install packages
@@ -149,7 +149,7 @@ jobs:
contents: write
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
# fetch all branches
fetch-depth: 0
@@ -157,9 +157,9 @@ jobs:
# Configure git user for later command induced commits
- uses: fregante/setup-git-user@v1
- - uses: actions/setup-node@v3
+ - uses: actions/setup-node@v4
with:
- node-version: 18
+ node-version: 22.x
registry-url: https://registry.npmjs.org/
- run: npm ci
@@ -261,12 +261,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- - name: Use Node.js 18.x
- uses: actions/setup-node@v3
+ - name: Use Node.js 22.x
+ uses: actions/setup-node@v4
with:
- node-version: 18.x
+ node-version: 22.x
- name: Message commit
run: echo "is RELEASE => ${{ github.event.head_commit.message }} !!"
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 26fd14e0d3..0f352716b1 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -49,6 +49,7 @@ The following people have contributed to iTowns.
* [Sogelink](https://www.sogelink.com/)
* [Kévin ETOURNEAU](https://github.com/ketourneau)
* [Alexis DELFORGES](https://github.com/pourfex)
+ * [Tim Ebben](https://github.com/tebben)
The following organizations are the current maintainers of iTowns:
* IGN (http://www.ign.fr)
diff --git a/examples/3dtiles_25d.html b/examples/3dtiles_25d.html
deleted file mode 100644
index 41cc65ad15..0000000000
--- a/examples/3dtiles_25d.html
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
- Itowns - 3D Tiles on 2.5D map example
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/3dtiles_basic.html b/examples/3dtiles_basic.html
deleted file mode 100644
index 9db050b8a3..0000000000
--- a/examples/3dtiles_basic.html
+++ /dev/null
@@ -1,94 +0,0 @@
-
-
-
- Itowns - 3d-tiles example
-
-
-
-
-
-
-
-
-
-
-
Feature Information:
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/3dtiles_batch_table.html b/examples/3dtiles_batch_table.html
deleted file mode 100644
index 4471f98eb4..0000000000
--- a/examples/3dtiles_batch_table.html
+++ /dev/null
@@ -1,86 +0,0 @@
-
-
-
- Itowns - 3d-tiles hierarchy example
-
-
-
-
-
-
-
-
-
-
-
Feature Information:
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/3dtiles_ion.html b/examples/3dtiles_ion.html
deleted file mode 100644
index 3ef10b4227..0000000000
--- a/examples/3dtiles_ion.html
+++ /dev/null
@@ -1,126 +0,0 @@
-
-
-
- Itowns - 3d-tiles from Cesium ion example
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
This example displays a dataset representing extruded OSM buildings from Cesium ion
- with Cesium default access token. Zoom to any place in the world to see the buildings.
- Buildings may appear to "fly" above the ground in some places, this is due to the combination
- of precision errors of this dataset and of the 3D terrain we use in this example.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/examples/3dtiles_loader.html b/examples/3dtiles_loader.html
index 3d701f7f60..176cea5c1b 100644
--- a/examples/3dtiles_loader.html
+++ b/examples/3dtiles_loader.html
@@ -11,7 +11,15 @@
@@ -21,12 +29,17 @@
Specify the URL of a tileset to load:
-
- Load
-
+
Load
+
+
Load Lyon 1 (Mesh)
+
Load Sete (Point Cloud)
+
Load Lille (Mesh)
+
+
+
Display feature information by clicking on it
Feature Information:
-
+
@@ -52,28 +65,17 @@
const {
TMSSource, WMTSSource, OGC3DTilesSource,
- ColorLayer, ElevationLayer, OGC3DTilesLayer,
+ ColorLayer, ElevationLayer, OGC3DTilesLayer, PNTS_SIZE_MODE,
GlobeView, Coordinates, Fetcher,
} = itowns;
- const uri = new URL(location);
- const state = {
- // URL to tileset JSON
- tileset: uri.searchParams.get('tileset'),
- // Cesium ION /
- assetId: uri.searchParams.get('assetId'),
- };
-
- function setURL(url) {
- if (!url) return;
+ window.layer = null; // 3D Tiles layer
- uri.searchParams.set('tileset', url);
- history.pushState(null, '', `?${uri.searchParams.toString()}`);
+ const uri = new URL(location);
- location.reload();
- }
+ window.gui = new dat.GUI();
- // ---- CREATE A GlobeView FOR SUPPORTING DATA VISUALIZATION ----
+ // ---- Create a GlobeView ----
// Define camera initial position
const placement = {
@@ -85,45 +87,87 @@
const viewerDiv = document.getElementById('viewerDiv');
// Create a GlobeView
- const view = new GlobeView(viewerDiv, placement, {});
+ const view = new GlobeView(viewerDiv, placement, {
+ controls: {
+ minDistance: 100,
+ }
+ });
+
+ // Enable various compression support for 3D Tiles tileset:
+ // - `KHR_draco_mesh_compression` mesh compression extension
+ // - `KHR_texture_basisu` texture compresion extension
+ itowns.enableDracoLoader('./libs/draco/');
+ itowns.enableKtx2Loader('./lib/basis/', view.renderer);
// Add ambient light to globally illuminates all objects
- const light = new AmbientLight(0x404040, 15);
+ const light = new AmbientLight(0x404040, 40);
view.scene.add(light);
// Setup loading screen
setupLoadingScreen(viewerDiv, view);
- // Setup debug menu
- const menuGlobe = new GuiTools('menuDiv', view, 300);
- debug.createTileDebugUI(menuGlobe.gui, view, view.tileLayer);
-
-
- // ---- ADD A BASEMAP ----
+ // ---- Add a basemap ----
// 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 layer = new ColorLayer('Ortho', {
+ const colorLayer = new ColorLayer('Ortho', {
...config,
source: new TMSSource(config.source),
});
- view.addLayer(layer).then(menuGlobe.addLayerGUI.bind(menuGlobe));
+ view.addLayer(colorLayer);
});
- // ---- ADD 3D TILES TILESET ----
+ // ---- Add 3D terrain ----
- // Enable various compression support for 3D Tiles tileset:
- // - `KHR_draco_mesh_compression` mesh compression extension
- // - `KHR_texture_basisu` texture compresion extension
- itowns.enableDracoLoader('./libs/draco/');
- itowns.enableKtx2Loader('./lib/basis/', view.renderer);
+ // Add two elevation layers: world terrain and a more precise terrain for france
+ // These will deform iTowns globe geometry to represent terrain elevation.
+ function addElevationLayerFromConfig(config) {
+ config.source = new itowns.WMTSSource(config.source);
+ 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);
+
+ // ---------- 3D Tiles loading
+
+ function readURL() {
+ const url = document.getElementById('url').value;
+
+ if (url) {
+ setUrl(url);
+ }
+ }
+
+ function setUrl(url) {
+ if (!url) return;
+
+ const input_url = document.getElementById('url');
+ if (!input_url) return;
+
+ uri.searchParams.set('copc', url);
+ history.replaceState(null, null, `?${uri.searchParams.toString()}`);
+
+ input_url.value = url;
+ load(url);
+ }
+
+
+ function load(url) {
+ const source = new OGC3DTilesSource({ url });
- if (state.tileset) {
- const source = new OGC3DTilesSource({ url: state.tileset });
- const layer = new OGC3DTilesLayer('3DTiles', {
+ if (window.layer) {
+ gui.removeFolder('Layer 3DTiles');
+ view.removeLayer('3DTiles');
+ view.notifyChange();
+ window.layer.delete();
+ }
+
+ window.layer = new OGC3DTilesLayer('3DTiles', {
source,
+ pntsSizeMode: PNTS_SIZE_MODE.ATTENUATED,
});
// Add an event for picking the 3D Tiles layer and displaying
@@ -131,20 +175,37 @@
const pickingArgs = {
htmlDiv: document.getElementById('featureInfo'),
view,
- layer,
+ layer: window.layer,
};
// Add the layer to our view
- view.addLayer(layer).then((layer) => {
+ view.addLayer(window.layer).then((layer) => {
zoomToLayer(view, layer);
window.addEventListener('click',
(event) => fillHTMLWithPickingInfo(event, pickingArgs), false);
});
- debug.createOGC3DTilesDebugUI(menuGlobe.gui, view, layer);
+ window.layer.whenReady
+ .then(() => debug.createOGC3DTilesDebugUI(gui, view, window.layer));
+ }
+
+ function loadLyon() {
+ setUrl("https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/refs/heads/master/3DTiles/lyon1-4978/tileset.json");
+ }
+
+ function loadSete() {
+ setUrl("https://raw.githubusercontent.com/iTowns/iTowns2-sample-data/master/pointclouds/pnts-sete-2021-0756_6256/tileset.json");
}
- window.setURL = setURL;
+ function loadLille() {
+ setUrl("https://webimaging.lillemetropole.fr/externe/maillage/2020_mel_5cm/tileset.json");
+ }
+
+ window.readURL = readURL;
+ window.loadLyon = loadLyon;
+ window.loadSete = loadSete;
+ window.loadLille = loadLille;
+